aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-11-06 20:59:43 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-11-06 20:59:43 -0600
commitd2c974f31f0441cc4e9745fe571f3d94fa5fa273 (patch)
treeea26d11a80bed957149d41fb147a49e692d7cd03 /tests
parent3e84f25e58f554719c333326c767b503b5ce673c (diff)
downloadayatana-ido-d2c974f31f0441cc4e9745fe571f3d94fa5fa273.tar.gz
ayatana-ido-d2c974f31f0441cc4e9745fe571f3d94fa5fa273.tar.bz2
ayatana-ido-d2c974f31f0441cc4e9745fe571f3d94fa5fa273.zip
extract-method: TestMenuItems::PutInMenu()
Diffstat (limited to 'tests')
-rw-r--r--tests/gtest-menuitems.cpp64
1 files changed, 20 insertions, 44 deletions
diff --git a/tests/gtest-menuitems.cpp b/tests/gtest-menuitems.cpp
index 269d360..901c7bc 100644
--- a/tests/gtest-menuitems.cpp
+++ b/tests/gtest-menuitems.cpp
@@ -15,6 +15,22 @@ public:
gtk_init(&argc, (gchar ***)&argv);
return;
}
+
+protected:
+ void PutInMenu (GtkWidget * item)
+ {
+ GtkWidget * menu = gtk_menu_new();
+ gtk_widget_show(menu);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ gtk_widget_show(item);
+ gtk_widget_realize(item);
+
+ EXPECT_TRUE(gtk_widget_get_realized(item));
+
+ g_object_ref_sink(menu);
+ g_object_unref(menu);
+ }
};
TEST_F(TestMenuitems, BuildCalendar) {
@@ -24,17 +40,7 @@ TEST_F(TestMenuitems, BuildCalendar) {
EXPECT_TRUE(IDO_IS_CALENDAR_MENU_ITEM(cal));
EXPECT_TRUE(GTK_IS_MENU_ITEM(cal));
- GtkWidget * menu = gtk_menu_new();
- gtk_widget_show(menu);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), cal);
-
- gtk_widget_show(cal);
- gtk_widget_realize(cal);
-
- EXPECT_TRUE(gtk_widget_get_realized(cal));
-
- g_object_ref_sink(menu);
- g_object_unref(menu);
+ PutInMenu (cal);
return;
}
@@ -45,17 +51,7 @@ TEST_F(TestMenuitems, BuildEntry) {
EXPECT_TRUE(IDO_IS_ENTRY_MENU_ITEM(entry));
EXPECT_TRUE(GTK_IS_MENU_ITEM(entry));
- GtkWidget * menu = gtk_menu_new();
- gtk_widget_show(menu);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
-
- gtk_widget_show(entry);
- gtk_widget_realize(entry);
-
- EXPECT_TRUE(gtk_widget_get_realized(entry));
-
- g_object_ref_sink(menu);
- g_object_unref(menu);
+ PutInMenu (entry);
return;
}
@@ -66,17 +62,7 @@ TEST_F(TestMenuitems, BuildScaleDefault) {
EXPECT_TRUE(IDO_IS_SCALE_MENU_ITEM(scale));
EXPECT_TRUE(GTK_IS_MENU_ITEM(scale));
- GtkWidget * menu = gtk_menu_new();
- gtk_widget_show(menu);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), scale);
-
- gtk_widget_show(scale);
- gtk_widget_realize(scale);
-
- EXPECT_TRUE(gtk_widget_get_realized(scale));
-
- g_object_ref_sink(menu);
- g_object_unref(menu);
+ PutInMenu (scale);
return;
}
@@ -87,16 +73,6 @@ TEST_F(TestMenuitems, BuildScaleSmall) {
EXPECT_TRUE(IDO_IS_SCALE_MENU_ITEM(scale));
EXPECT_TRUE(GTK_IS_MENU_ITEM(scale));
- GtkWidget * menu = gtk_menu_new();
- gtk_widget_show(menu);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), scale);
-
- gtk_widget_show(scale);
- gtk_widget_realize(scale);
-
- EXPECT_TRUE(gtk_widget_get_realized(scale));
-
- g_object_ref_sink(menu);
- g_object_unref(menu);
+ PutInMenu (scale);
return;
}