[latexila] Fix unit tests



commit 71eb1974e5c57a0e970c94716b1b69bc348803ff
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Oct 26 21:45:06 2014 +0100

    Fix unit tests

 tests/Makefile.am               |   12 ++++++++++--
 tests/build-tools.gresource.xml |    7 +++++++
 tests/test-build-tools.c        |    8 +++-----
 3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a4b850e..6dc0ba9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,13 +4,18 @@ AM_CPPFLAGS =                                 \
        -I$(top_srcdir)                         \
        -I$(top_srcdir)/src/liblatexila         \
        -I$(top_builddir)/src/liblatexila       \
-       -DSRCDIR=\""$(ABS_SRCDIR)"\"            \
        $(WARN_CFLAGS)
 
 LDADD = $(top_builddir)/src/liblatexila/liblatexila.la
 
+build-tools-resources.c: build-tools.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/build-tools.gresource.xml)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source 
$(srcdir)/build-tools.gresource.xml
+
+BUILT_SOURCES = build-tools-resources.c
+
 UNIT_TEST_PROGS = test-build-tools
 test_build_tools_SOURCES = test-build-tools.c
+nodist_test_build_tools_SOURCES = build-tools-resources.c
 
 UNIT_TEST_PROGS += test-utils
 test_utils_SOURCES = test-utils.c
@@ -18,7 +23,10 @@ test_utils_SOURCES = test-utils.c
 noinst_PROGRAMS = $(UNIT_TEST_PROGS)
 TESTS = $(UNIT_TEST_PROGS)
 
-EXTRA_DIST =   \
+EXTRA_DIST =                           \
+       build-tools.gresource.xml       \
        build_tools_test.xml
 
+CLEANFILES = $(BUILT_SOURCES)
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/build-tools.gresource.xml b/tests/build-tools.gresource.xml
new file mode 100644
index 0000000..59861ce
--- /dev/null
+++ b/tests/build-tools.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<gresources>
+  <gresource prefix="/org/gnome/latexila">
+    <file>build_tools_test.xml</file>
+  </gresource>
+</gresources>
diff --git a/tests/test-build-tools.c b/tests/test-build-tools.c
index fa73efd..9326fc4 100644
--- a/tests/test-build-tools.c
+++ b/tests/test-build-tools.c
@@ -187,13 +187,8 @@ static void
 test_load (void)
 {
   LatexilaBuildTools *build_tools;
-  gchar *path;
   GFile *xml_file;
 
-  path = g_build_filename (SRCDIR, "build_tools_test.xml", NULL);
-  xml_file = g_file_new_for_path (path);
-  g_free (path);
-
   build_tools = g_object_new (LATEXILA_TYPE_BUILD_TOOLS, NULL);
 
   g_signal_connect (build_tools,
@@ -201,6 +196,9 @@ test_load (void)
                     G_CALLBACK (loaded_cb),
                     NULL);
 
+  xml_file = g_file_new_for_uri ("resource:///org/gnome/latexila/build_tools_test.xml");
+  g_assert (g_file_query_exists (xml_file, NULL));
+
   latexila_build_tools_load (build_tools, xml_file);
   g_object_unref (xml_file);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]