summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-06-07 21:10:44 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-06-07 21:10:44 -0400
commit8ac9fc7faeff8908448e9da09a43873e2e0fe376 (patch)
treed606ebdd62c150ebe7fa25e909ac1b24a567f0be
parentd489ad061d70526fc5f5cdae2273e9deabea6a17 (diff)
downloadpango-8ac9fc7faeff8908448e9da09a43873e2e0fe376.tar.gz
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.
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/testboundaries.c5
-rw-r--r--tests/testboundaries_ucd.c16
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f8fec40b..bcd60ae5 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 241e6859..feef19ce 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 d9019c63..5a78406f 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;