From cc8600927594dcdfcba74813788d90c999156468 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 3 Mar 2014 11:11:32 -0600 Subject: Test the number of entries in the menu --- src/sound-menu.vala | 4 ++-- tests/sound-menu-test.cc | 7 +++++-- 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); -- cgit v1.2.3