aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-03-09 14:20:14 -0500
committerTed Gould <ted@gould.cx>2015-03-09 14:20:14 -0500
commit9c16722dc9a6799d600a86fea48f3a3c71da895f (patch)
tree9621a4d3ef3ad824552d51d2318e92e9dd7c1072 /tests
parent414740248af49364c7fce1d0dcf4baa65dca7608 (diff)
downloadayatana-indicator-messages-9c16722dc9a6799d600a86fea48f3a3c71da895f.tar.gz
ayatana-indicator-messages-9c16722dc9a6799d600a86fea48f3a3c71da895f.tar.bz2
ayatana-indicator-messages-9c16722dc9a6799d600a86fea48f3a3c71da895f.zip
Add enabled testing
Diffstat (limited to 'tests')
-rw-r--r--tests/indicator-fixture.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h
index a1ca3e2..273d8ed 100644
--- a/tests/indicator-fixture.h
+++ b/tests/indicator-fixture.h
@@ -294,6 +294,30 @@ class IndicatorFixture : public ::testing::Test
return expectEventually(func);
}
+ testing::AssertionResult expectActionEnabled (const char * nameStr, const char * typeStr, const std::string& name, bool enabled) {
+ auto aenabled = g_action_group_get_action_enabled(run->_actions.get(), name.c_str());
+
+ if (enabled != aenabled) {
+ auto result = testing::AssertionFailure();
+ result <<
+ " Action: " << nameStr << std::endl <<
+ " Expected: " << enabled << std::endl <<
+ " Actual: " << aenabled << std::endl;
+
+ return result;
+ }
+
+ auto result = testing::AssertionSuccess();
+ return result;
+ }
+
+ template <typename... Args> testing::AssertionResult expectEventuallyActionEnabled (Args&& ... args) {
+ std::function<testing::AssertionResult(void)> func = [&]() {
+ return expectActionEnabled(std::forward<Args>(args)...);
+ };
+ return expectEventually(func);
+ }
+
testing::AssertionResult expectActionStateType (const char * nameStr, const char * typeStr, const std::string& name, const GVariantType * type) {
auto atype = g_action_group_get_action_state_type(run->_actions.get(), name.c_str());
bool same = false;
@@ -565,6 +589,16 @@ class IndicatorFixture : public ::testing::Test
#define EXPECT_EVENTUALLY_ACTION_EXISTS(action) \
EXPECT_PRED_FORMAT1(IndicatorFixture::expectEventuallyActionExists, action)
+/* Action Enabled */
+#define ASSERT_ACTION_ENABLED(action, state) \
+ ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionEnabled, action, state)
+
+#define EXPECT_ACTION_ENABLED(action, state) \
+ EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionEnabled, action, state)
+
+#define EXPECT_EVENTUALLY_ACTION_ENABLED(action, state) \
+ EXPECT_PRED_FORMAT2(IndicatorFixture::expectEventuallyActionEnabled, action, state)
+
/* Action State */
#define ASSERT_ACTION_STATE(action, value) \
ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionStateIs, action, value)