aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-10-28 21:46:59 -0500
committerTed Gould <ted@gould.cx>2014-10-28 21:46:59 -0500
commit5b7a608243729d4f9133fe092b5093ed041ba9ff (patch)
tree7e0ab71f3c261c4d20e8dbcbbd8bd91fb8229cc5
parentb62d0b2dd397ed513565c764a83018507e259790 (diff)
downloadayatana-indicator-sound-5b7a608243729d4f9133fe092b5093ed041ba9ff.tar.gz
ayatana-indicator-sound-5b7a608243729d4f9133fe092b5093ed041ba9ff.tar.bz2
ayatana-indicator-sound-5b7a608243729d4f9133fe092b5093ed041ba9ff.zip
Enforce type and get the right one from our functions
-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)