[pango/test-coverage: 15/15] Add missing bidi types




commit 6f4574670f987454f92e4c7c22982a2e9cec767c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 27 11:52:34 2021 -0400

    Add missing bidi types
    
    The api is deprecated, but it is very ugly to randomly
    miss a few values here. Just add them.

 pango/pango-bidi-type.c |  7 ++++---
 pango/pango-bidi-type.h | 12 +++++++++++-
 tests/testmisc.c        |  7 +++++--
 3 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
index 8700836b..a5a13a9a 100644
--- a/pango/pango-bidi-type.c
+++ b/pango/pango-bidi-type.c
@@ -79,10 +79,11 @@ pango_bidi_type_for_unichar (gunichar ch)
     case FRIBIDI_TYPE_SS:   return PANGO_BIDI_TYPE_S;
     case FRIBIDI_TYPE_WS:   return PANGO_BIDI_TYPE_WS;
     case FRIBIDI_TYPE_ON:   return PANGO_BIDI_TYPE_ON;
+    case FRIBIDI_TYPE_LRI:  return PANGO_BIDI_TYPE_LRI;
+    case FRIBIDI_TYPE_RLI:  return PANGO_BIDI_TYPE_RLI;
+    case FRIBIDI_TYPE_FSI:  return PANGO_BIDI_TYPE_FSI;
+    case FRIBIDI_TYPE_PDI:  return PANGO_BIDI_TYPE_PDI;
     default:
-      /* TODO
-       * This function has not been updated for latest FriBidi.
-       * Should add new types and / or deprecate this function. */
       return PANGO_BIDI_TYPE_ON;
     }
 }
diff --git a/pango/pango-bidi-type.h b/pango/pango-bidi-type.h
index 2f1dfd1d..a1fd0c69 100644
--- a/pango/pango-bidi-type.h
+++ b/pango/pango-bidi-type.h
@@ -51,6 +51,10 @@ G_BEGIN_DECLS
  * @PANGO_BIDI_TYPE_S: Segment Separator
  * @PANGO_BIDI_TYPE_WS: Whitespace
  * @PANGO_BIDI_TYPE_ON: Other Neutrals
+ * @PANGO_BIDI_TYPE_LRI: Left-to-Right isolate. Since 1.48.6
+ * @PANGO_BIDI_TYPE_RLI: Right-to-Left isolate. Since 1.48.6
+ * @PANGO_BIDI_TYPE_FSI: First strong isolate. Since 1.48.6
+ * @PANGO_BIDI_TYPE_PDI: Pop directional isolate. Since 1.48.6
  *
  * `PangoBidiType` represents the bidirectional character
  * type of a Unicode character as specified by the
@@ -83,7 +87,13 @@ typedef enum {
   PANGO_BIDI_TYPE_B,
   PANGO_BIDI_TYPE_S,
   PANGO_BIDI_TYPE_WS,
-  PANGO_BIDI_TYPE_ON
+  PANGO_BIDI_TYPE_ON,
+
+  /* Explicit formatting */
+  PANGO_BIDI_TYPE_LRI,
+  PANGO_BIDI_TYPE_RLI,
+  PANGO_BIDI_TYPE_FSI,
+  PANGO_BIDI_TYPE_PDI
 } PangoBidiType;
 
 PANGO_DEPRECATED_IN_1_44
diff --git a/tests/testmisc.c b/tests/testmisc.c
index eb5c16e7..a095cbf1 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -258,8 +258,11 @@ test_bidi_type_for_unichar (void)
   g_assert_true (pango_bidi_type_for_unichar (0x000b) == PANGO_BIDI_TYPE_S);
   g_assert_true (pango_bidi_type_for_unichar (' ') == PANGO_BIDI_TYPE_WS);
   g_assert_true (pango_bidi_type_for_unichar ('!') == PANGO_BIDI_TYPE_ON);
-  /* this should be FSI */
-  g_assert_true (pango_bidi_type_for_unichar (0x2026) == PANGO_BIDI_TYPE_ON);
+  /* these are new */
+  g_assert_true (pango_bidi_type_for_unichar (0x2066) == PANGO_BIDI_TYPE_LRI);
+  g_assert_true (pango_bidi_type_for_unichar (0x2067) == PANGO_BIDI_TYPE_RLI);
+  g_assert_true (pango_bidi_type_for_unichar (0x2068) == PANGO_BIDI_TYPE_FSI);
+  g_assert_true (pango_bidi_type_for_unichar (0x2069) == PANGO_BIDI_TYPE_PDI);
 }
 
 static void


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