[glade] tests/toplevel-order: User GResource for test UI files to make sure it will work in distcheck
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] tests/toplevel-order: User GResource for test UI files to make sure it will work in distcheck
- Date: Wed, 18 Dec 2013 21:30:58 +0000 (UTC)
commit 47a3c5da670f7af56f44fe51f8b7a72b21c89709
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Wed Dec 18 17:50:05 2013 -0300
tests/toplevel-order: User GResource for test UI files to make sure
it will work in distcheck
tests/Makefile.am | 31 ++++++++++++++++++++++++-------
tests/toplevel-order.c | 26 ++++++++++++++++++--------
2 files changed, 42 insertions(+), 15 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4d829ab..f82125e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,6 +11,7 @@ progs_cppflags = \
$(common_defines) \
-I$(top_srcdir) \
-I$(top_builddir) \
+ -DDATADIR=\"$(top_srcdir)/tests/\" \
$(GTK_CFLAGS) \
$(GTK_MAC_BUNDLE_FLAG) \
$(GTK_MAC_CFLAGS) \
@@ -40,21 +41,37 @@ add_child_LDFLAGS = $(progs_libs)
add_child_LDADD = $(progs_ldadd)
add_child_SOURCES = add-child.c
-# Test toplevel order in xml output
-toplevel_order_CPPFLAGS = $(progs_cppflags)
-toplevel_order_CFLAGS = $(progs_cflags)
-toplevel_order_LDFLAGS = $(progs_libs)
-toplevel_order_LDADD = $(progs_ldadd)
-toplevel_order_SOURCES = toplevel-order.c
TOPLEVEL_ORDER_FILES = \
+ toplevel-order-resources.gresource.xml \
+ toplevel_order_test.glade \
toplevel_order_test.glade \
- toplevel_order_test1.glade \
toplevel_order_test2.glade \
toplevel_order_test3.glade \
toplevel_order_test4.glade \
toplevel_order_test5.glade \
toplevel_order_test6.glade
+BUILT_SOURCES = toplevel-order-resources.c toplevel-order-resources.h
+# Generate resources
+toplevel-order-resources.h: $(TOPLEVEL_ORDER_FILES)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/toplevel-order-resources.gresource.xml \
+ --target=$@ --sourcedir=$(srcdir) --c-name _glade --generate-header
+toplevel-order-resources.c: $(TOPLEVEL_ORDER_FILES)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/toplevel-order-resources.gresource.xml \
+ --target=$@ --sourcedir=$(srcdir) --c-name _glade --generate-source
+
+# Test toplevel order in xml output
+toplevel_order_CPPFLAGS = $(progs_cppflags)
+toplevel_order_CFLAGS = $(progs_cflags)
+toplevel_order_LDFLAGS = $(progs_libs)
+toplevel_order_LDADD = $(progs_ldadd)
+toplevel_order_SOURCES = \
+ toplevel-order.c \
+ toplevel-order-resources.c
+
+noinst_HEADERS = \
+ toplevel-order-resources.h
+
EXTRA_DIST = $(TOPLEVEL_ORDER_FILES)
TESTS = $(TEST_PROGS)
diff --git a/tests/toplevel-order.c b/tests/toplevel-order.c
index 9011c01..2007845 100644
--- a/tests/toplevel-order.c
+++ b/tests/toplevel-order.c
@@ -68,10 +68,20 @@ test_toplevel_order (gconstpointer userdata)
GladeProject *project;
GList *toplevels, *l;
gchar *temp_path;
+ const gchar *xml_data;
+ gsize xml_size;
+ GBytes *xml;
g_assert (g_close (g_file_open_tmp ("glade-toplevel-order-XXXXXX.glade", &temp_path, NULL), NULL));
+
+ /* Dump contents to a temp file */
+ g_assert ((xml = g_resources_lookup_data (project_path, 0, NULL)));
+ xml_data = g_bytes_get_data (xml, &xml_size);
+ g_assert (g_file_set_contents (temp_path, xml_data, xml_size, NULL));
+ g_bytes_unref (xml);
+
/* Load project */
- g_assert ((project = glade_project_load (project_path)));
+ g_assert ((project = glade_project_load (temp_path)));
/* And save it, order should be the same */
g_assert (glade_project_save (project, temp_path, NULL));
@@ -101,7 +111,7 @@ test_toplevel_order (gconstpointer userdata)
}
#define add_project_test(data) g_test_add_data_func_full ("/ToplevelOrder/"#data, data, test_toplevel_order,
NULL);
-
+#define RESOURCE_PATH "/org/gnome/glade/tests/toplevel-order"
/* _glade_tsort() test cases */
/* the array must be properly ordered, since it will be used to test order */
@@ -110,25 +120,25 @@ static gchar *tsort_test[] = {"bbb", "ccc", "aaa", NULL };
static gchar *tsort_test_edges[][2] = { {"ccc","aaa"}, { NULL, NULL} };
/* GladeProject toplevel order test */
-static gchar *order_test[] = {"toplevel_order_test.glade",
+static gchar *order_test[] = {RESOURCE_PATH"/toplevel_order_test.glade",
"bbb", "ccc", "aaa", NULL};
-static gchar *order_test2[] = {"toplevel_order_test2.glade",
+static gchar *order_test2[] = {RESOURCE_PATH"/toplevel_order_test2.glade",
"aa", "bbb", "ccc", "aaa", "ddd", NULL };
-static gchar *order_test3[] = {"toplevel_order_test3.glade",
+static gchar *order_test3[] = {RESOURCE_PATH"/toplevel_order_test3.glade",
"aaa", "ccc", "bbb", NULL };
/* toplevels with circular dependencies get ordered alphabetically at the end */
-static gchar *order_test4[] = {"toplevel_order_test4.glade",
+static gchar *order_test4[] = {RESOURCE_PATH"/toplevel_order_test4.glade",
"aa", "bbb", "cc", "ddd", "aaa", "ccc", NULL };
/* children dependency */
-static gchar *order_test5[] = {"toplevel_order_test5.glade",
+static gchar *order_test5[] = {RESOURCE_PATH"/toplevel_order_test5.glade",
"xaction", "awindow", NULL };
/* Commonly used widgets with dependencies */
-static gchar *order_test6[] = {"toplevel_order_test6.glade",
+static gchar *order_test6[] = {RESOURCE_PATH"/toplevel_order_test6.glade",
"ziconfactory", "label_a", "label_b", "asizegroup", "label_c", "xaction",
"xactiongroup", "anotherwindow", "xentrybuffer", "xliststore", "treeview",
"zaccelgroup", "awindow", NULL };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]