aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-03-09 11:21:24 -0500
committerTed Gould <ted@gould.cx>2015-03-09 11:21:24 -0500
commitf6776a30db54d274d1918df5f5bacf41e1945530 (patch)
tree3abf9266d2883a7b208e3f9a7f0ac41c52e3b73e /tests
parente4b55aa627bba56186b8df30cbd9f27177cfe1ad (diff)
downloadayatana-indicator-messages-f6776a30db54d274d1918df5f5bacf41e1945530.tar.gz
ayatana-indicator-messages-f6776a30db54d274d1918df5f5bacf41e1945530.tar.bz2
ayatana-indicator-messages-f6776a30db54d274d1918df5f5bacf41e1945530.zip
Add checking for the activation parameter type
Diffstat (limited to 'tests')
-rw-r--r--tests/indicator-fixture.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h
index aa191ae..0747842 100644
--- a/tests/indicator-fixture.h
+++ b/tests/indicator-fixture.h
@@ -292,7 +292,7 @@ class IndicatorFixture : public ::testing::Test
result <<
" Action: " << nameStr << std::endl <<
" Expected: " << typeStr << std::endl <<
- " Actual: " << g_variant_type_peek_string(atype) << std::endl;
+ " Actual: " << (atype == nullptr ? "(null)" : g_variant_type_peek_string(atype)) << std::endl;
return result;
}
@@ -308,6 +308,35 @@ class IndicatorFixture : public ::testing::Test
return expectEventually(func);
}
+ testing::AssertionResult expectActionActivationType (const char * nameStr, const char * typeStr, const std::string& name, const GVariantType * type) {
+ auto atype = g_action_group_get_action_parameter_type(run->_actions.get(), name.c_str());
+ bool same = false;
+
+ if (atype != nullptr) {
+ same = g_variant_type_equal(atype, type);
+ }
+
+ if (!same) {
+ auto result = testing::AssertionFailure();
+ result <<
+ " Action: " << nameStr << std::endl <<
+ " Expected: " << typeStr << std::endl <<
+ " Actual: " << (atype == nullptr ? "(null)" : g_variant_type_peek_string(atype)) << std::endl;
+
+ return result;
+ }
+
+ auto result = testing::AssertionSuccess();
+ return result;
+ }
+
+ template <typename... Args> testing::AssertionResult expectEventuallyActionActivationType (Args&& ... args) {
+ std::function<testing::AssertionResult(void)> func = [&]() {
+ return expectActionActivationType(std::forward<Args>(args)...);
+ };
+ return expectEventually(func);
+ }
+
testing::AssertionResult expectActionStateIs (const char * nameStr, const char * valueStr, const std::string& name, GVariant * value) {
auto varref = std::shared_ptr<GVariant>(g_variant_ref_sink(value), [](GVariant * varptr) {
if (varptr != nullptr)
@@ -522,3 +551,14 @@ class IndicatorFixture : public ::testing::Test
#define EXPECT_EVENTUALLY_ACTION_STATE_TYPE(action, type) \
EXPECT_PRED_FORMAT2(IndicatorFixture::expectEventuallyActionStateType, action, type)
+
+/* Action Activation Type */
+#define ASSERT_ACTION_ACTIVATION_TYPE(action, type) \
+ ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionActivationType, action, type)
+
+#define EXPECT_ACTION_ACTIVATION_TYPE(action, type) \
+ EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionActivationType, action, type)
+
+#define EXPECT_EVENTUALLY_ACTION_ACTIVATION_TYPE(action, type) \
+ EXPECT_PRED_FORMAT2(IndicatorFixture::expectEventuallyActionActivationType, action, type)
+