Avoid hard-dep on bleeding-edge GLib
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Jun 2013 01:10:44 +0000 (21:10 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 8 Jun 2013 01:10:44 +0000 (21:10 -0400)
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
tests/testboundaries.c
tests/testboundaries_ucd.c

index f8fec40..bcd60ae 100644 (file)
@@ -8,6 +8,7 @@ CLEANFILES = pangorc
 DISTCLEANFILES = all-unicode.txt
 
 AM_CPPFLAGS =                                  \
+       -DSRCDIR=\"$(srcdir)\"                  \
        -I$(top_srcdir)                         \
        $(PANGO_DEBUG_FLAGS)                    \
        $(GLIB_CFLAGS)                          \
index 241e685..feef19c 100644 (file)
@@ -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))
index d9019c6..5a78406 100644 (file)
@@ -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;