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 <Anna@OcarinaProject.net>
This commit is contained in:
parent
3bc5b1db9e
commit
961659bc66
|
@ -8,6 +8,7 @@ static GtkBuilder *gui_builder = NULL;
|
||||||
void gui_builder_init(const char *file)
|
void gui_builder_init(const char *file)
|
||||||
{
|
{
|
||||||
gui_builder = gtk_builder_new_from_file(file);
|
gui_builder = gtk_builder_new_from_file(file);
|
||||||
|
gtk_builder_connect_signals(gui_builder, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_builder_deinit()
|
void gui_builder_deinit()
|
||||||
|
|
|
@ -24,6 +24,8 @@ def GuiTest(name):
|
||||||
|
|
||||||
|
|
||||||
res += [ GuiTest("settings") ]
|
res += [ GuiTest("settings") ]
|
||||||
|
|
||||||
|
env.UsePackage("gmodule-export-2.0")
|
||||||
res += [ GuiTest("builder") ]
|
res += [ GuiTest("builder") ]
|
||||||
|
|
||||||
ignore.close()
|
ignore.close()
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <tests/test.h>
|
#include <tests/test.h>
|
||||||
|
|
||||||
|
static unsigned int gui_clicked = 0;
|
||||||
|
|
||||||
|
void test_builder_clicked()
|
||||||
|
{
|
||||||
|
gui_clicked++;
|
||||||
|
}
|
||||||
|
|
||||||
static void test_builder()
|
static void test_builder()
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -11,7 +18,7 @@ static void test_builder()
|
||||||
test_equal((void *)test_get_gui_builder(), NULL);
|
test_equal((void *)test_get_gui_builder(), NULL);
|
||||||
|
|
||||||
gtk_init(&argc, 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);
|
test_not_equal((void *)test_get_gui_builder(), NULL);
|
||||||
|
|
||||||
gui_builder_deinit();
|
gui_builder_deinit();
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.19.0 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.16"/>
|
||||||
|
<object class="GtkWindow" id="window1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button1">
|
||||||
|
<property name="label" translatable="yes">button</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<signal name="clicked" handler="test_builder_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
Loading…
Reference in New Issue