[pango] Avoid hard-dep on bleeding-edge GLib



commit 8ac9fc7faeff8908448e9da09a43873e2e0fe376
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 7 21:10:44 2013 -0400

    Avoid hard-dep on bleeding-edge GLib
    
    If new test api is not available, do without it. In this
    case, the tests won't work installed, but they should still
    work uninstalled and in distcheck.

 tests/Makefile.am          |    1 +
 tests/testboundaries.c     |    5 +++++
 tests/testboundaries_ucd.c |   16 ++++++++++++++++
 3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f8fec40..bcd60ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,6 +8,7 @@ CLEANFILES = pangorc
 DISTCLEANFILES = all-unicode.txt
 
 AM_CPPFLAGS =                                  \
+       -DSRCDIR=\"$(srcdir)\"                  \
        -I$(top_srcdir)                         \
        $(PANGO_DEBUG_FLAGS)                    \
        $(GLIB_CFLAGS)                          \
diff --git a/tests/testboundaries.c b/tests/testboundaries.c
index 241e685..feef19c 100644
--- a/tests/testboundaries.c
+++ b/tests/testboundaries.c
@@ -317,7 +317,12 @@ test_boundaries (void)
 {
   gchar *text;
   const gchar *filename;
+#if GLIB_CHECK_VERSION(2, 37, 2)
   filename = g_test_get_filename (G_TEST_DIST, "boundaries.utf8", NULL);
+#else
+  filename = SRCDIR "/boundaries.utf8";
+#endif
+
   g_print ("sample file: %s\n", filename);
 
   if (!g_file_get_contents (filename, &text, NULL, NULL))
diff --git a/tests/testboundaries_ucd.c b/tests/testboundaries_ucd.c
index d9019c6..5a78406 100644
--- a/tests/testboundaries_ucd.c
+++ b/tests/testboundaries_ucd.c
@@ -332,7 +332,11 @@ test_grapheme_break (void)
   const gchar *filename;
   AttrBits bits;
 
+#if GLIB_CHECK_VERSION(2, 37, 2)
   filename = g_test_get_filename (G_TEST_DIST, "GraphemeBreakTest.txt", NULL);
+#else
+  filename = SRCDIR "/GraphemeBreakTest.txt";
+#endif
   bits.bits = 0;
   bits.attr.is_cursor_position = 1;
   do_test (filename, bits, FALSE);
@@ -344,7 +348,11 @@ test_word_break (void)
   const gchar *filename;
   AttrBits bits;
 
+#if GLIB_CHECK_VERSION(2, 37, 2)
   filename = g_test_get_filename (G_TEST_DIST, "WordBreakTest.txt", NULL);
+#else
+  filename = SRCDIR "/WordBreakTest.txt";
+#endif
   bits.bits = 0;
   bits.attr.is_word_boundary = 1;
   do_test (filename, bits, FALSE);
@@ -356,7 +364,11 @@ test_sentence_break (void)
   const gchar *filename;
   AttrBits bits;
 
+#if GLIB_CHECK_VERSION(2, 37, 2)
   filename = g_test_get_filename (G_TEST_DIST, "SentenceBreakTest.txt", NULL);
+#else
+  filename = SRCDIR "/SentenceBreakTest.txt";
+#endif
   bits.bits = 0;
   bits.attr.is_sentence_boundary = 1;
   do_test (filename, bits, FALSE);
@@ -368,7 +380,11 @@ test_line_break (void)
   const gchar *filename;
   AttrBits bits;
 
+#if GLIB_CHECK_VERSION(2, 37, 2)
   filename = g_test_get_filename (G_TEST_DIST, "LineBreakTest.txt", NULL);
+#else
+  filename = SRCDIR "/LineBreakTest.txt";
+#endif
   bits.bits = 0;
   bits.attr.is_line_break = 1;
   bits.attr.is_mandatory_break = 1;


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