From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- tests/unigbrk/test-uc-is-grapheme-break.c | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'tests/unigbrk/test-uc-is-grapheme-break.c') diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c index 55defb3d..70bd5197 100644 --- a/tests/unigbrk/test-uc-is-grapheme-break.c +++ b/tests/unigbrk/test-uc-is-grapheme-break.c @@ -1,5 +1,5 @@ /* Grapheme cluster break function test. - Copyright (C) 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2010-2022 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -21,10 +21,13 @@ /* Specification. */ #include +#include #include #include #include +#include "unictype.h" + const char * graphemebreakproperty_to_string (int gbp) { @@ -86,7 +89,9 @@ main (int argc, char *argv[]) char *comment; const char *p; ucs4_t prev; - int last_compchar_prop; + int last_char_prop; + bool emoji_modifier_sequence; + bool emoji_modifier_sequence_before_last_char; size_t ri_count; lineno++; @@ -97,7 +102,9 @@ main (int argc, char *argv[]) if (line[strspn (line, " \t\r\n")] == '\0') continue; - last_compchar_prop = -1; + last_char_prop = -1; + emoji_modifier_sequence = false; + emoji_modifier_sequence_before_last_char = false; ri_count = 0; prev = 0; p = line; @@ -144,13 +151,14 @@ main (int argc, char *argv[]) next = next_int; } - if ((last_compchar_prop == GBP_EB - || last_compchar_prop == GBP_EBG) - && uc_graphemeclusterbreak_property (next) == GBP_EM) + /* Skip unsupported rules involving 3 or more characters. */ + if (last_char_prop == GBP_ZWJ + && emoji_modifier_sequence_before_last_char + && uc_is_property_extended_pictographic (next)) { int prev_gbp = uc_graphemeclusterbreak_property (prev); int next_gbp = uc_graphemeclusterbreak_property (next); - fprintf (stderr, "%s:%d: skipping GB10: should join U+%04X (%s) " + fprintf (stderr, "%s:%d: skipping GB11: should join U+%04X (%s) " "and U+%04X (%s)\n", filename, lineno, prev, graphemebreakproperty_to_string (prev_gbp), @@ -183,10 +191,13 @@ main (int argc, char *argv[]) p += strspn (p, " \t\r\n"); prev = next; - if (!(uc_graphemeclusterbreak_property (next) == GBP_EXTEND - && (last_compchar_prop == GBP_EB - || last_compchar_prop == GBP_EBG))) - last_compchar_prop = uc_graphemeclusterbreak_property (next); + emoji_modifier_sequence_before_last_char = emoji_modifier_sequence; + emoji_modifier_sequence = + (emoji_modifier_sequence + && uc_graphemeclusterbreak_property (next) == GBP_EXTEND) + || uc_is_property_extended_pictographic (next); + + last_char_prop = uc_graphemeclusterbreak_property (next); if (uc_graphemeclusterbreak_property (next) == GBP_RI) ri_count++; -- cgit v1.2.3