aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-03-09 17:06:43 -0500
committerTed Gould <ted@gould.cx>2015-03-09 17:06:43 -0500
commit56801d13e16f29542f620c1e0e7f249d52705b09 (patch)
tree20315ee50378da48bc3299d45e8674d077c4a744 /tests
parentace149bd9c1218a5533d1f68d0ed760381552a47 (diff)
downloadayatana-indicator-messages-56801d13e16f29542f620c1e0e7f249d52705b09.tar.gz
ayatana-indicator-messages-56801d13e16f29542f620c1e0e7f249d52705b09.tar.bz2
ayatana-indicator-messages-56801d13e16f29542f620c1e0e7f249d52705b09.zip
Adding a test to ensure an action doesn't exist
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 2455107..75a49cd 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 expectActionDoesNotExist (const gchar * nameStr, const std::string& name) {
+ bool hasit = g_action_group_has_action(run->_actions.get(), name.c_str());
+
+ if (hasit) {
+ auto result = testing::AssertionFailure();
+ result <<
+ " Action: " << nameStr << std::endl <<
+ " Expected: " << "No action found" << std::endl <<
+ " Actual: " << "Exists" << std::endl;
+
+ return result;
+ }
+
+ auto result = testing::AssertionSuccess();
+ return result;
+ }
+
+ template <typename... Args> testing::AssertionResult expectEventuallyActionDoesNotExist (Args&& ... args) {
+ std::function<testing::AssertionResult(void)> func = [&]() {
+ return expectActionDoesNotExist(std::forward<Args>(args)...);
+ };
+ 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());
@@ -593,6 +617,16 @@ class IndicatorFixture : public ::testing::Test
#define EXPECT_EVENTUALLY_ACTION_EXISTS(action) \
EXPECT_PRED_FORMAT1(IndicatorFixture::expectEventuallyActionExists, action)
+/* Action Does Not Exist */
+#define ASSERT_ACTION_DOES_NOT_EXIST(action) \
+ ASSERT_PRED_FORMAT1(IndicatorFixture::expectActionDoesNotExist, action)
+
+#define EXPECT_ACTION_DOES_NOT_EXIST(action) \
+ EXPECT_PRED_FORMAT1(IndicatorFixture::expectActionDoesNotExist, action)
+
+#define EXPECT_EVENTUALLY_ACTION_DOES_NOT_EXIST(action) \
+ EXPECT_PRED_FORMAT1(IndicatorFixture::expectEventuallyActionDoesNotExist, action)
+
/* Action Enabled */
#define ASSERT_ACTION_ENABLED(action, state) \
ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionEnabled, action, state)