From 961659bc66f666453a78cf3d79f546187ba9b47d Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 23 Dec 2015 21:36:38 -0500 Subject: [PATCH] gui/builder: Add a test UI file This file creates a button that calls the test_builder_activated() function when clicked. Signed-off-by: Anna Schumaker --- gui/builder.c | 1 + tests/gui/Sconscript | 2 ++ tests/gui/builder.c | 9 ++++++++- tests/gui/builder.ui | 17 +++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/gui/builder.ui diff --git a/gui/builder.c b/gui/builder.c index 9dc44652..a0c7f2f5 100644 --- a/gui/builder.c +++ b/gui/builder.c @@ -8,6 +8,7 @@ static GtkBuilder *gui_builder = NULL; void gui_builder_init(const char *file) { gui_builder = gtk_builder_new_from_file(file); + gtk_builder_connect_signals(gui_builder, NULL); } void gui_builder_deinit() diff --git a/tests/gui/Sconscript b/tests/gui/Sconscript index 2c47f080..dcd0aa62 100644 --- a/tests/gui/Sconscript +++ b/tests/gui/Sconscript @@ -24,6 +24,8 @@ def GuiTest(name): res += [ GuiTest("settings") ] + +env.UsePackage("gmodule-export-2.0") res += [ GuiTest("builder") ] ignore.close() diff --git a/tests/gui/builder.c b/tests/gui/builder.c index 80fca11b..5099abf3 100644 --- a/tests/gui/builder.c +++ b/tests/gui/builder.c @@ -4,6 +4,13 @@ #include #include +static unsigned int gui_clicked = 0; + +void test_builder_clicked() +{ + gui_clicked++; +} + static void test_builder() { int argc = 0; @@ -11,7 +18,7 @@ static void test_builder() test_equal((void *)test_get_gui_builder(), NULL); gtk_init(&argc, NULL); - gui_builder_init("share/ocarina/ocarina6.glade"); + gui_builder_init("tests/gui/builder.ui"); test_not_equal((void *)test_get_gui_builder(), NULL); gui_builder_deinit(); diff --git a/tests/gui/builder.ui b/tests/gui/builder.ui new file mode 100644 index 00000000..520e0756 --- /dev/null +++ b/tests/gui/builder.ui @@ -0,0 +1,17 @@ + + + + + + False + + + button + True + True + True + + + + +