aboutsummaryrefslogtreecommitdiff
path: root/tests/indicator-fixture.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/indicator-fixture.h')
-rw-r--r--tests/indicator-fixture.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h
index eae70b9..7ae3dde 100644
--- a/tests/indicator-fixture.h
+++ b/tests/indicator-fixture.h
@@ -138,9 +138,12 @@ class IndicatorFixture : public ::testing::Test
if (location >= g_menu_model_get_n_items(menu))
return;
- auto menuval = g_menu_model_get_item_attribute_value(menu, location, attribute.c_str(), NULL);
- EXPECT_TRUE(g_variant_equal(value, menuval));
- g_variant_unref(menuval);
+ auto menuval = g_menu_model_get_item_attribute_value(menu, location, attribute.c_str(), g_variant_get_type(value));
+ EXPECT_NE(nullptr, menuval);
+ if (menuval != nullptr) {
+ EXPECT_TRUE(g_variant_equal(value, menuval));
+ g_variant_unref(menuval);
+ }
}
void expectMenuAttributeRecurse (const std::vector<int> menuLocation, const std::string& attribute, GVariant * value, unsigned int index, GMenuModel * menu) {
@@ -174,6 +177,11 @@ class IndicatorFixture : public ::testing::Test
expectMenuAttribute(menuLocation, attribute, var);
}
+ void expectMenuAttribute (const std::vector<int> menuLocation, const std::string& attribute, const char * value) {
+ GVariant * var = g_variant_new_string(value);
+ expectMenuAttribute(menuLocation, attribute, var);
+ }
+
};
#define EXPECT_MENU_ATTRIB(menu, attrib, value) expectMenuAttribute(menu, attrib, value)