aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-03-03 11:11:32 -0600
committerTed Gould <ted@gould.cx>2014-03-03 11:11:32 -0600
commitcc8600927594dcdfcba74813788d90c999156468 (patch)
tree6883553012005d380deb43f899d3cc0214b1aad5
parent248a67022dcfb0cc2540720007ee122fbc3eb6ea (diff)
downloadayatana-indicator-sound-cc8600927594dcdfcba74813788d90c999156468.tar.gz
ayatana-indicator-sound-cc8600927594dcdfcba74813788d90c999156468.tar.bz2
ayatana-indicator-sound-cc8600927594dcdfcba74813788d90c999156468.zip
Test the number of entries in the menu
-rw-r--r--src/sound-menu.vala4
-rw-r--r--tests/sound-menu-test.cc7
2 files changed, 7 insertions, 4 deletions
diff --git a/src/sound-menu.vala b/src/sound-menu.vala
index 74da887..8c087bc 100644
--- a/src/sound-menu.vala
+++ b/src/sound-menu.vala
@@ -123,8 +123,8 @@ public class SoundMenu: Object
this.notify_handlers.remove (player);
}
- Menu root;
- Menu menu;
+ public Menu root;
+ public Menu menu;
Menu volume_section;
bool mic_volume_shown;
bool settings_shown = false;
diff --git a/tests/sound-menu-test.cc b/tests/sound-menu-test.cc
index 4d28c4a..5d18d08 100644
--- a/tests/sound-menu-test.cc
+++ b/tests/sound-menu-test.cc
@@ -44,6 +44,8 @@ class SoundMenuTest : public ::testing::Test
TEST_F(SoundMenuTest, BasicObject) {
SoundMenu * menu = sound_menu_new (nullptr, SOUND_MENU_DISPLAY_FLAGS_NONE);
+ ASSERT_NE(nullptr, menu);
+
g_clear_object(&menu);
return;
}
@@ -67,11 +69,12 @@ TEST_F(SoundMenuTest, AddRemovePlayer) {
sound_menu_add_player(menu, MEDIA_PLAYER(media));
- /* TODO: Verify */
+ ASSERT_NE(nullptr, menu->menu);
+ EXPECT_EQ(2, g_menu_model_get_n_items(G_MENU_MODEL(menu->menu)));
sound_menu_remove_player(menu, MEDIA_PLAYER(media));
- /* TODO: Verify */
+ EXPECT_EQ(1, g_menu_model_get_n_items(G_MENU_MODEL(menu->menu)));
g_clear_object(&media);
g_clear_object(&menu);