summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-1-07
-rw-r--r--ChangeLog.pre-1-107
-rw-r--r--ChangeLog.pre-1-27
-rw-r--r--ChangeLog.pre-1-47
-rw-r--r--ChangeLog.pre-1-67
-rw-r--r--ChangeLog.pre-1-87
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/dump-boundaries.c130
-rw-r--r--tests/testboundaries.c7
10 files changed, 189 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7fe1083b..34833da7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 7fe1083b..34833da7 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,5 +1,12 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
+ * tests/dump-boundaries.c: new program to dump logical attrs to stdout
+
+ * tests/testboundaries.c (check_invariants): oops, fix for
+ pango_get_log_attrs() change
+
+2001-10-03 Havoc Pennington <hp@redhat.com>
+
* pango/break.c (pango_break)
(pango_default_break) (pango_get_log_attrs): require one more
log attr in the buffer passed in, to account for the end position
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 084453a5..a5fdeb3b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,13 +4,19 @@ INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS)
TESTS=runtests.sh
+noinst_PROGRAMS = dump-boundaries
+
check_PROGRAMS = testboundaries
testboundaries_SOURCES = testboundaries.c
+dump_boundaries_SOURCES = dump-boundaries.c
+
## pangox should not actually be required, this is broken
testboundaries_LDADD = ../pango/libpango.la ../pango/libpangox.la $(X_LIBS)
+dump_boundaries_LDADD = ../pango/libpango.la ../pango/libpangox.la $(X_LIBS)
+
EXTRA_DIST = \
all-unicode.txt \
boundaries.utf8 \
diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c
new file mode 100644
index 00000000..8ea4383e
--- /dev/null
+++ b/tests/dump-boundaries.c
@@ -0,0 +1,130 @@
+/* Pango
+ * dump-boundaries.c: Dump text boundaries for a file
+ *
+ * Copyright (C) 1999-2000 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <pango/pango.h>
+
+#define CHFORMAT "%0#6x"
+
+static void
+fail (const char *format,
+ ...)
+{
+ char *str;
+ char *line_text;
+
+ va_list args;
+
+ va_start (args, format);
+ str = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ fprintf (stderr, "Error: %s\n", format);
+
+ exit (1);
+}
+
+static void
+dump_text (const char *text)
+{
+ int len;
+ PangoLogAttr *attrs;
+ int i;
+ gunichar *ucs4;
+
+ if (!g_utf8_validate (text, -1, NULL))
+ fail ("Invalid UTF-8 in file");
+
+ len = g_utf8_strlen (text, -1);
+ attrs = g_new0 (PangoLogAttr, len + 1);
+
+ pango_get_log_attrs (text,
+ -1,
+ 0,
+ pango_language_from_string ("C"),
+ attrs,
+ len + 1);
+
+ ucs4 = g_utf8_to_ucs4 (text, -1, NULL, NULL, NULL);
+
+ i = 0;
+ while (i <= len)
+ {
+ char buf[7] = { '\0', };
+ char *loc;
+
+ g_unichar_to_utf8 (ucs4[i], buf);
+
+ if (*buf == '\n')
+ loc = g_strdup ("\\n");
+ else if (*buf == '\r')
+ loc = g_strdup ("\\r");
+ else
+ loc = g_locale_from_utf8 (buf, -1, NULL, NULL, NULL);
+
+ g_print (CHFORMAT " (%s):\t line_break = %d mandatory_break = %d char_break = %d\n"
+ " \t\t white = %d cursor_position = %d\n"
+ " \t\t word_start = %d word_end = %d\n"
+ " \t\t sentence_boundary = %d sentence_start = %d sentence_end = %d\n",
+ ucs4[i], loc ? loc : "?",
+ attrs[i].is_line_break,
+ attrs[i].is_mandatory_break,
+ attrs[i].is_char_break,
+ attrs[i].is_white,
+ attrs[i].is_cursor_position,
+ attrs[i].is_word_start,
+ attrs[i].is_word_end,
+ attrs[i].is_sentence_boundary,
+ attrs[i].is_sentence_start,
+ attrs[i].is_sentence_end);
+
+ g_free (loc);
+
+ ++i;
+ }
+
+ g_free (ucs4);
+ g_free (attrs);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ gchar *text;
+
+ if (argc < 2)
+ fail ("must give a filename on the command line");
+
+ if (!g_file_get_contents (argv[1], &text, NULL, NULL))
+ fail ("Couldn't open sample text file");
+
+ dump_text (text);
+
+ g_free (text);
+
+ return 0;
+}
+
diff --git a/tests/testboundaries.c b/tests/testboundaries.c
index a405bd04..fb45c4d3 100644
--- a/tests/testboundaries.c
+++ b/tests/testboundaries.c
@@ -316,13 +316,14 @@ check_invariants (const char *text)
fail ("Invalid UTF-8 in test text");
len = g_utf8_strlen (text, -1);
- attrs = g_new0 (PangoLogAttr, len);
+ attrs = g_new0 (PangoLogAttr, len + 1);
pango_get_log_attrs (text,
-1,
0,
- "C",
- attrs);
+ pango_language_from_string ("C"),
+ attrs,
+ len + 1);
check_line_invariants (text, attrs);
check_sentence_invariants (text, attrs);