test-unicode.c 30.1 KB
Newer Older
1
/*
2 3
 * Copyright © 2011  Codethink Limited
 * Copyright © 2011  Google, Inc.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 *  This is part of HarfBuzz, a text shaping library.
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 *
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Codethink Author(s): Ryan Lortie
26
 * Google Author(s): Behdad Esfahbod
27 28 29 30
 */

#include "hb-test.h"

31
/* Unit tests for hb-unicode.h */
32 33
/* Unit tests for hb-glib.h */
/* Unit tests for hb-icu.h */
34

35

36 37 38 39 40 41 42 43
#ifdef HAVE_GLIB
#include <hb-glib.h>
#endif
#ifdef HAVE_ICU
#include <hb-icu.h>
#endif


44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
/* Some useful stuff */

#define MAGIC0 0x12345678
#define MAGIC1 0x76543210

typedef struct {
  int value;
  gboolean freed;
} data_t;

static void free_up (void *p)
{
  data_t *data = (data_t *) p;

  g_assert (data->value == MAGIC0 || data->value == MAGIC1);
B
Behdad Esfahbod 已提交
59
  g_assert (!data->freed);
60 61 62 63 64 65 66 67 68 69
  data->freed = TRUE;
}

static hb_script_t
simple_get_script (hb_unicode_funcs_t *ufuncs,
                   hb_codepoint_t      codepoint,
                   void               *user_data)
{
  data_t *data = (data_t *) user_data;

70
  g_assert (hb_unicode_funcs_get_parent (ufuncs) != NULL);
B
Behdad Esfahbod 已提交
71 72
  g_assert_cmphex (data->value, ==, MAGIC0);
  g_assert (!data->freed);
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

  if ('a' <= codepoint && codepoint <= 'z')
    return HB_SCRIPT_LATIN;
  else
    return HB_SCRIPT_UNKNOWN;
}

static hb_script_t
a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs,
                            hb_codepoint_t      codepoint,
                            void               *user_data)
{
  data_t *data = (data_t *) user_data;

  g_assert (hb_unicode_funcs_get_parent (ufuncs) != NULL);
B
Behdad Esfahbod 已提交
88 89
  g_assert_cmphex (data->value, ==, MAGIC1);
  g_assert (!data->freed);
90 91 92 93 94 95

  if (codepoint == 'a') {
    return HB_SCRIPT_ARABIC;
  } else {
    hb_unicode_funcs_t *parent = hb_unicode_funcs_get_parent (ufuncs);

96
    return hb_unicode_script (parent, codepoint);
97 98 99 100 101
  }
}



102 103 104 105 106 107 108 109 110 111 112
/* Check all properties */

/* Some of the following tables where adapted from glib/glib/tests/utf8-misc.c.
 * The license is compatible. */

typedef struct {
  hb_codepoint_t unicode;
  unsigned int   value;
} test_pair_t;

static const test_pair_t combining_class_tests[] =
113
{
B
Minor  
Behdad Esfahbod 已提交
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
  {   0x0020, 0 },
  {   0x0334, 1 },
  {   0x093C, 7 },
  {   0x3099, 8 },
  {   0x094D, 9 },
  {   0x05B0, 10 },
  {   0x05B1, 11 },
  {   0x05B2, 12 },
  {   0x05B3, 13 },
  {   0x05B4, 14 },
  {   0x05B5, 15 },
  {   0x05B6, 16 },
  {   0x05B7, 17 },
  {   0x05B8, 18 },
  {   0x05B9, 19 },
  {   0x05BB, 20 },
  {   0x05BC, 21 },
  {   0x05BD, 22 },
  {   0x05BF, 23 },
  {   0x05C1, 24 },
  {   0x05C2, 25 },
  {   0xFB1E, 26 },
  {   0x064B, 27 },
  {   0x064C, 28 },
  {   0x064D, 29 },
139
  /* ... */
B
Minor  
Behdad Esfahbod 已提交
140 141 142 143 144 145 146 147
  {   0x05AE, 228 },
  {   0x0300, 230 },
  {   0x302C, 232 },
  {   0x0362, 233 },
  {   0x0360, 234 },
  {   0x0345, 240 },

  { 0x111111, 0 }
148 149 150
};
static const test_pair_t combining_class_tests_more[] =
{
B
Minor  
Behdad Esfahbod 已提交
151 152 153
  /* Unicode-5.1 character additions */
  {   0x1DCD, 234 },

154
  /* Unicode-5.2 character additions */
B
Minor  
Behdad Esfahbod 已提交
155
  {   0xA8E0, 230 },
156

157
  /* Unicode-6.0 character additions */
B
Minor  
Behdad Esfahbod 已提交
158 159
  {   0x135D, 230 },

160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
  /* Unicode-6.1 character additions */
  {   0xA674, 230 },

  /* Unicode-7.0 character additions */
  {   0x1AB0, 230 },

  /* Unicode-8.0 character additions */
  {   0xA69E, 230 },

  /* Unicode-9.0 character additions */
  {  0x1E000, 230 },

  /* Unicode-10.0 character additions */
  {   0x1DF6, 232 },

  /* Unicode-11.0 character additions */
  {   0x07FD, 220 },

  /* Unicode-12.0 character additions */
  {   0x0EBA,   9 },

B
Minor  
Behdad Esfahbod 已提交
181
  { 0x111111, 0 }
182
};
183

184 185 186

static const test_pair_t general_category_tests[] =
{
B
Minor  
Behdad Esfahbod 已提交
187 188 189 190 191 192 193 194 195 196
  {   0x000D, HB_UNICODE_GENERAL_CATEGORY_CONTROL },
  {   0x200E, HB_UNICODE_GENERAL_CATEGORY_FORMAT },
  {   0x0378, HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED },
  {   0xE000, HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE },
  {   0xD800, HB_UNICODE_GENERAL_CATEGORY_SURROGATE },
  {   0x0061, HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER },
  {   0x02B0, HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER },
  {   0x3400, HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER },
  {   0x01C5, HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER },
  {   0xFF21, HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER },
197
  {   0x0903, HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK },
B
Minor  
Behdad Esfahbod 已提交
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
  {   0x20DD, HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK },
  {   0xA806, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK },
  {   0xFF10, HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER },
  {   0x16EE, HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER },
  {   0x17F0, HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER },
  {   0x005F, HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION },
  {   0x058A, HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION },
  {   0x0F3B, HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION },
  {   0x2019, HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION },
  {   0x2018, HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION },
  {   0x2016, HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION },
  {   0x0F3A, HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION },
  {   0x20A0, HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL },
  {   0x309B, HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL },
  {   0xFB29, HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL },
  {   0x00A6, HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL },
  {   0x2028, HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR },
  {   0x2029, HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR },
  {   0x202F, HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR },

  { 0x111111, HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED }
219 220 221 222
};
static const test_pair_t general_category_tests_more[] =
{
  /* Unicode-5.2 character additions */
B
Minor  
Behdad Esfahbod 已提交
223
  {  0x1F131, HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL },
224

225
  /* Unicode-6.0 character additions */
B
Minor  
Behdad Esfahbod 已提交
226 227
  {   0x0620, HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER },

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
  /* Unicode-6.1 character additions */
  {   0x058F, HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL },

  /* Unicode-6.2 character additions */
  {   0x20BA, HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL },

  /* Unicode-6.3 character additions */
  {   0x061C, HB_UNICODE_GENERAL_CATEGORY_FORMAT },

  /* Unicode-7.0 character additions */
  {   0x058D, HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL },

  /* Unicode-8.0 character additions */
  {   0x08E3, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK },

  /* Unicode-9.0 character additions */
  {   0x08D4, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK },

  /* Unicode-10.0 character additions */
  {   0x09FD, HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION },

  /* Unicode-11.0 character additions */
  {   0x0560, HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER },

  /* Unicode-12.0 character additions */
  {   0x0C77, HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION },

  /* Unicode-12.1 character additions */
  {   0x32FF, HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL },

B
Minor  
Behdad Esfahbod 已提交
258
  { 0x111111, HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED }
259 260 261 262 263
};

static const test_pair_t mirroring_tests[] =
{
  /* Some characters that do NOT mirror */
B
Minor  
Behdad Esfahbod 已提交
264 265 266 267 268 269 270
  {   0x0020, 0x0020 },
  {   0x0041, 0x0041 },
  {   0x00F0, 0x00F0 },
  {   0x27CC, 0x27CC },
  {  0xE01EF, 0xE01EF },
  {  0x1D7C3, 0x1D7C3 },
  { 0x100000, 0x100000 },
271 272

  /* Some characters that do mirror */
B
Minor  
Behdad Esfahbod 已提交
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
  {   0x0029, 0x0028 },
  {   0x0028, 0x0029 },
  {   0x003E, 0x003C },
  {   0x003C, 0x003E },
  {   0x005D, 0x005B },
  {   0x005B, 0x005D },
  {   0x007D, 0x007B },
  {   0x007B, 0x007D },
  {   0x00BB, 0x00AB },
  {   0x00AB, 0x00BB },
  {   0x226B, 0x226A },
  {   0x226A, 0x226B },
  {   0x22F1, 0x22F0 },
  {   0x22F0, 0x22F1 },
  {   0xFF60, 0xFF5F },
  {   0xFF5F, 0xFF60 },
  {   0xFF63, 0xFF62 },
  {   0xFF62, 0xFF63 },

  { 0x111111, 0x111111 },
293 294 295
};
static const test_pair_t mirroring_tests_more[] =
{
296 297 298 299 300 301
  /* Unicode-6.1 character additions */
  {   0x27CB, 0x27CD },

  /* Unicode-11.0 character additions */
  {   0x2BFE, 0x221F },

B
Minor  
Behdad Esfahbod 已提交
302
  { 0x111111, 0x111111 }
303 304 305 306
};

static const test_pair_t script_tests[] =
{
B
Minor  
Behdad Esfahbod 已提交
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
  {   0x002A, HB_SCRIPT_COMMON },
  {   0x0670, HB_SCRIPT_INHERITED },
  {   0x060D, HB_SCRIPT_ARABIC },
  {   0x0559, HB_SCRIPT_ARMENIAN },
  {   0x09CD, HB_SCRIPT_BENGALI },
  {   0x31B6, HB_SCRIPT_BOPOMOFO },
  {   0x13A2, HB_SCRIPT_CHEROKEE },
  {   0x2CFD, HB_SCRIPT_COPTIC },
  {   0x0482, HB_SCRIPT_CYRILLIC },
  {  0x10401, HB_SCRIPT_DESERET },
  {   0x094D, HB_SCRIPT_DEVANAGARI },
  {   0x1258, HB_SCRIPT_ETHIOPIC },
  {   0x10FC, HB_SCRIPT_GEORGIAN },
  {  0x10341, HB_SCRIPT_GOTHIC },
  {   0x0375, HB_SCRIPT_GREEK },
  {   0x0A83, HB_SCRIPT_GUJARATI },
  {   0x0A3C, HB_SCRIPT_GURMUKHI },
  {   0x3005, HB_SCRIPT_HAN },
  {   0x1100, HB_SCRIPT_HANGUL },
  {   0x05BF, HB_SCRIPT_HEBREW },
  {   0x309F, HB_SCRIPT_HIRAGANA },
  {   0x0CBC, HB_SCRIPT_KANNADA },
  {   0x30FF, HB_SCRIPT_KATAKANA },
  {   0x17DD, HB_SCRIPT_KHMER },
  {   0x0EDD, HB_SCRIPT_LAO },
  {   0x0061, HB_SCRIPT_LATIN },
  {   0x0D3D, HB_SCRIPT_MALAYALAM },
  {   0x1843, HB_SCRIPT_MONGOLIAN },
  {   0x1031, HB_SCRIPT_MYANMAR },
  {   0x169C, HB_SCRIPT_OGHAM },
  {  0x10322, HB_SCRIPT_OLD_ITALIC },
  {   0x0B3C, HB_SCRIPT_ORIYA },
  {   0x16EF, HB_SCRIPT_RUNIC },
  {   0x0DBD, HB_SCRIPT_SINHALA },
  {   0x0711, HB_SCRIPT_SYRIAC },
  {   0x0B82, HB_SCRIPT_TAMIL },
  {   0x0C03, HB_SCRIPT_TELUGU },
  {   0x07B1, HB_SCRIPT_THAANA },
  {   0x0E31, HB_SCRIPT_THAI },
  {   0x0FD4, HB_SCRIPT_TIBETAN },
347
  {   0x1401, HB_SCRIPT_CANADIAN_SYLLABICS },
B
Minor  
Behdad Esfahbod 已提交
348 349 350 351 352
  {   0xA015, HB_SCRIPT_YI },
  {   0x1700, HB_SCRIPT_TAGALOG },
  {   0x1720, HB_SCRIPT_HANUNOO },
  {   0x1740, HB_SCRIPT_BUHID },
  {   0x1760, HB_SCRIPT_TAGBANWA },
353 354

  /* Unicode-4.0 additions */
B
Minor  
Behdad Esfahbod 已提交
355 356 357 358 359 360 361 362
  {   0x2800, HB_SCRIPT_BRAILLE },
  {  0x10808, HB_SCRIPT_CYPRIOT },
  {   0x1932, HB_SCRIPT_LIMBU },
  {  0x10480, HB_SCRIPT_OSMANYA },
  {  0x10450, HB_SCRIPT_SHAVIAN },
  {  0x10000, HB_SCRIPT_LINEAR_B },
  {   0x1950, HB_SCRIPT_TAI_LE },
  {  0x1039F, HB_SCRIPT_UGARITIC },
363 364

  /* Unicode-4.1 additions */
B
Minor  
Behdad Esfahbod 已提交
365 366 367 368 369 370 371
  {   0x1980, HB_SCRIPT_NEW_TAI_LUE },
  {   0x1A1F, HB_SCRIPT_BUGINESE },
  {   0x2C00, HB_SCRIPT_GLAGOLITIC },
  {   0x2D6F, HB_SCRIPT_TIFINAGH },
  {   0xA800, HB_SCRIPT_SYLOTI_NAGRI },
  {  0x103D0, HB_SCRIPT_OLD_PERSIAN },
  {  0x10A3F, HB_SCRIPT_KHAROSHTHI },
372 373

  /* Unicode-5.0 additions */
B
Minor  
Behdad Esfahbod 已提交
374 375 376 377 378 379
  {   0x0378, HB_SCRIPT_UNKNOWN },
  {   0x1B04, HB_SCRIPT_BALINESE },
  {  0x12000, HB_SCRIPT_CUNEIFORM },
  {  0x10900, HB_SCRIPT_PHOENICIAN },
  {   0xA840, HB_SCRIPT_PHAGS_PA },
  {   0x07C0, HB_SCRIPT_NKO },
380 381

  /* Unicode-5.1 additions */
B
Minor  
Behdad Esfahbod 已提交
382 383 384 385 386 387 388 389 390 391 392 393 394
  {   0xA900, HB_SCRIPT_KAYAH_LI },
  {   0x1C00, HB_SCRIPT_LEPCHA },
  {   0xA930, HB_SCRIPT_REJANG },
  {   0x1B80, HB_SCRIPT_SUNDANESE },
  {   0xA880, HB_SCRIPT_SAURASHTRA },
  {   0xAA00, HB_SCRIPT_CHAM },
  {   0x1C50, HB_SCRIPT_OL_CHIKI },
  {   0xA500, HB_SCRIPT_VAI },
  {  0x102A0, HB_SCRIPT_CARIAN },
  {  0x10280, HB_SCRIPT_LYCIAN },
  {  0x1093F, HB_SCRIPT_LYDIAN },

  { 0x111111, HB_SCRIPT_UNKNOWN }
395 396 397 398
};
static const test_pair_t script_tests_more[] =
{
  /* Unicode-5.2 additions */
B
Minor  
Behdad Esfahbod 已提交
399 400
  {  0x10B00, HB_SCRIPT_AVESTAN },
  {   0xA6A0, HB_SCRIPT_BAMUM },
401
  {   0x1400, HB_SCRIPT_CANADIAN_ABORIGINAL },
B
Minor  
Behdad Esfahbod 已提交
402 403
  {  0x13000, HB_SCRIPT_EGYPTIAN_HIEROGLYPHS },
  {  0x10840, HB_SCRIPT_IMPERIAL_ARAMAIC },
404
  {   0x1CED, HB_SCRIPT_INHERITED },
B
Minor  
Behdad Esfahbod 已提交
405 406 407 408 409 410 411 412 413 414 415
  {  0x10B60, HB_SCRIPT_INSCRIPTIONAL_PAHLAVI },
  {  0x10B40, HB_SCRIPT_INSCRIPTIONAL_PARTHIAN },
  {   0xA980, HB_SCRIPT_JAVANESE },
  {  0x11082, HB_SCRIPT_KAITHI },
  {   0xA4D0, HB_SCRIPT_LISU },
  {   0xABE5, HB_SCRIPT_MEETEI_MAYEK },
  {  0x10A60, HB_SCRIPT_OLD_SOUTH_ARABIAN },
  {  0x10C00, HB_SCRIPT_OLD_TURKIC },
  {   0x0800, HB_SCRIPT_SAMARITAN },
  {   0x1A20, HB_SCRIPT_TAI_THAM },
  {   0xAA80, HB_SCRIPT_TAI_VIET },
416 417

  /* Unicode-6.0 additions */
B
Minor  
Behdad Esfahbod 已提交
418 419 420
  {   0x1BC0, HB_SCRIPT_BATAK },
  {  0x11000, HB_SCRIPT_BRAHMI },
  {   0x0840, HB_SCRIPT_MANDAIC },
421

422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
  /* Unicode-6.1 additions */
  {  0x10980, HB_SCRIPT_MEROITIC_HIEROGLYPHS },
  {  0x109A0, HB_SCRIPT_MEROITIC_CURSIVE },
  {  0x110D0, HB_SCRIPT_SORA_SOMPENG },
  {  0x11100, HB_SCRIPT_CHAKMA },
  {  0x11180, HB_SCRIPT_SHARADA },
  {  0x11680, HB_SCRIPT_TAKRI },
  {  0x16F00, HB_SCRIPT_MIAO },

  /* Unicode-6.2 additions */
  {   0x20BA, HB_SCRIPT_COMMON },

  /* Unicode-6.3 additions */
  {   0x2066, HB_SCRIPT_COMMON },

  /* Unicode-7.0 additions */
  {   0x10350, HB_SCRIPT_OLD_PERMIC },
  {   0x10500, HB_SCRIPT_ELBASAN },
  {   0x10530, HB_SCRIPT_CAUCASIAN_ALBANIAN },
  {   0x10600, HB_SCRIPT_LINEAR_A },
  {   0x10860, HB_SCRIPT_PALMYRENE },
  {   0x10880, HB_SCRIPT_NABATAEAN },
  {   0x10A80, HB_SCRIPT_OLD_NORTH_ARABIAN },
  {   0x10AC0, HB_SCRIPT_MANICHAEAN },
  {   0x10B80, HB_SCRIPT_PSALTER_PAHLAVI },
  {   0x11150, HB_SCRIPT_MAHAJANI },
  {   0x11200, HB_SCRIPT_KHOJKI },
  {   0x112B0, HB_SCRIPT_KHUDAWADI },
  {   0x11300, HB_SCRIPT_GRANTHA },
  {   0x11480, HB_SCRIPT_TIRHUTA },
  {   0x11580, HB_SCRIPT_SIDDHAM },
  {   0x11600, HB_SCRIPT_MODI },
  {   0x118A0, HB_SCRIPT_WARANG_CITI },
  {   0x11AC0, HB_SCRIPT_PAU_CIN_HAU },
  {   0x16A40, HB_SCRIPT_MRO },
  {   0x16AD0, HB_SCRIPT_BASSA_VAH },
  {   0x16B00, HB_SCRIPT_PAHAWH_HMONG },
  {   0x1BC00, HB_SCRIPT_DUPLOYAN },
  {   0x1E800, HB_SCRIPT_MENDE_KIKAKUI },

  /* Unicode-8.0 additions */
  {   0x108E0, HB_SCRIPT_HATRAN },
  {   0x10C80, HB_SCRIPT_OLD_HUNGARIAN },
  {   0x11280, HB_SCRIPT_MULTANI },
  {   0x11700, HB_SCRIPT_AHOM },
  {   0x14400, HB_SCRIPT_ANATOLIAN_HIEROGLYPHS },
  {   0x1D800, HB_SCRIPT_SIGNWRITING },

  /* Unicode-9.0 additions */
  {   0x104B0, HB_SCRIPT_OSAGE },
  {   0x11400, HB_SCRIPT_NEWA },
  {   0x11C00, HB_SCRIPT_BHAIKSUKI },
  {   0x11C70, HB_SCRIPT_MARCHEN },
  {   0x17000, HB_SCRIPT_TANGUT },
  {   0x1E900, HB_SCRIPT_ADLAM },

  /* Unicode-10.0 additions */
  {   0x11A00, HB_SCRIPT_ZANABAZAR_SQUARE },
  {   0x11A50, HB_SCRIPT_SOYOMBO },
  {   0x11D00, HB_SCRIPT_MASARAM_GONDI },
  {   0x1B170, HB_SCRIPT_NUSHU },

  /* Unicode-11.0 additions */
  {   0x10D00, HB_SCRIPT_HANIFI_ROHINGYA },
  {   0x10F00, HB_SCRIPT_OLD_SOGDIAN },
  {   0x10F30, HB_SCRIPT_SOGDIAN },
  {   0x11800, HB_SCRIPT_DOGRA },
  {   0x11D60, HB_SCRIPT_GUNJALA_GONDI },
  {   0x11EE0, HB_SCRIPT_MAKASAR },
  {   0x16E40, HB_SCRIPT_MEDEFAIDRIN },

  /* Unicode-12.0 additions */
  {   0x10FE0, HB_SCRIPT_ELYMAIC },
  {   0x119A0, HB_SCRIPT_NANDINAGARI },
  {   0x1E100, HB_SCRIPT_NYIAKENG_PUACHUE_HMONG },
  {   0x1E2C0, HB_SCRIPT_WANCHO },

  /* Unicode-12.1 additions */
  {   0x32FF, HB_SCRIPT_COMMON },
B
Minor  
Behdad Esfahbod 已提交
501 502

  { 0x111111, HB_SCRIPT_UNKNOWN }
503 504 505 506 507 508 509
};


typedef unsigned int (*get_func_t)         (hb_unicode_funcs_t *ufuncs,
					    hb_codepoint_t      unicode,
					    void               *user_data);
typedef unsigned int (*func_setter_func_t) (hb_unicode_funcs_t *ufuncs,
510
					    get_func_t          func,
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
					    void               *user_data,
					    hb_destroy_func_t   destroy);
typedef unsigned int (*getter_func_t)      (hb_unicode_funcs_t *ufuncs,
					    hb_codepoint_t      unicode);

typedef struct {
  const char         *name;
  func_setter_func_t  func_setter;
  getter_func_t       getter;
  const test_pair_t  *tests;
  unsigned int        num_tests;
  const test_pair_t  *tests_more;
  unsigned int        num_tests_more;
  unsigned int        default_value;
} property_t;

#define RETURNS_UNICODE_ITSELF ((unsigned int) -1)

#define PROPERTY(name, DEFAULT) \
  { \
    #name, \
    (func_setter_func_t) hb_unicode_funcs_set_##name##_func, \
533
    (getter_func_t) hb_unicode_##name, \
534 535 536 537 538 539 540 541 542 543 544
    name##_tests, \
    G_N_ELEMENTS (name##_tests), \
    name##_tests_more, \
    G_N_ELEMENTS (name##_tests_more), \
    DEFAULT \
  }
static const property_t properties[] =
{
  PROPERTY (combining_class, 0),
  PROPERTY (general_category, (unsigned int) HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER),
  PROPERTY (mirroring, RETURNS_UNICODE_ITSELF),
B
Behdad Esfahbod 已提交
545
  PROPERTY (script, (unsigned int) HB_SCRIPT_UNKNOWN)
546 547
};
#undef PROPERTY
548 549

static void
550
test_unicode_properties (gconstpointer user_data, hb_bool_t lenient)
551
{
552 553
  hb_unicode_funcs_t *uf = (hb_unicode_funcs_t *) user_data;
  unsigned int i, j;
554
  gboolean failed = TRUE;
555

556
  g_assert (hb_unicode_funcs_is_immutable (uf));
557
  g_assert (hb_unicode_funcs_get_parent (uf));
558

559 560 561 562
  for (i = 0; i < G_N_ELEMENTS (properties); i++) {
    const property_t *p = &properties[i];
    const test_pair_t *tests;

563
    g_test_message ("Testing property %s", p->name);
564
    tests = p->tests;
565 566 567 568
    for (j = 0; j < p->num_tests; j++) {
      g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode);
      g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, tests[j].value);
    }
569 570 571 572 573
    /* These tests are from Unicode 5.2 onward and older glib/ICU
     * don't get them right.  Just warn instead of assert. */
    tests = p->tests_more;
    for (j = 0; j < p->num_tests_more; j++) {
      g_test_message ("Test %s more #%d: U+%04X", p->name, j, tests[j].unicode);
574 575 576 577 578
      if (lenient) {
	if (p->getter (uf, tests[j].unicode) != tests[j].value) {
	  g_test_message ("Soft fail: Received %x, expected %x", p->getter (uf, tests[j].unicode), tests[j].value);
	  failed = TRUE;
	}
579
      }
580 581
      else
	g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, tests[j].value);
582
    }
583
  }
584 585

  if (failed)
586
    g_test_message ("Some property tests failed.  You probably have an old version of one of the libraries used.");
587
}
588 589 590 591 592 593 594 595 596 597
static void
test_unicode_properties_lenient (gconstpointer user_data)
{
  test_unicode_properties (user_data, TRUE);
}
static void
test_unicode_properties_strict (gconstpointer user_data)
{
  test_unicode_properties (user_data, FALSE);
}
598 599

static hb_codepoint_t
B
Behdad Esfahbod 已提交
600
default_value (hb_codepoint_t _default_value, hb_codepoint_t unicode)
601
{
B
Behdad Esfahbod 已提交
602
  return _default_value == RETURNS_UNICODE_ITSELF ?  unicode : _default_value;
603 604
}

605
static void
606
_test_unicode_properties_nil (hb_unicode_funcs_t *uf)
607
{
608
  unsigned int i, j;
609

610 611 612
  for (i = 0; i < G_N_ELEMENTS (properties); i++) {
    const property_t *p = &properties[i];
    const test_pair_t *tests;
613

B
Minor  
Behdad Esfahbod 已提交
614
    g_test_message ("Testing property %s", p->name);
615
    tests = p->tests;
B
Minor  
Behdad Esfahbod 已提交
616 617
    for (j = 0; j < p->num_tests; j++) {
      g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode);
618
      g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode));
B
Minor  
Behdad Esfahbod 已提交
619
    }
620 621 622 623 624
    tests = p->tests_more;
    for (j = 0; j < p->num_tests_more; j++) {
      g_test_message ("Test %s more #%d: U+%04X", p->name, j, tests[j].unicode);
      g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode));
    }
625
  }
626 627 628 629 630 631 632 633 634 635 636 637 638
}

static void
test_unicode_properties_nil (void)
{
  hb_unicode_funcs_t *uf = hb_unicode_funcs_create (NULL);

  g_assert (!hb_unicode_funcs_is_immutable (uf));
  _test_unicode_properties_nil (uf);

  hb_unicode_funcs_destroy (uf);
}

639 640 641 642 643
static void
test_unicode_properties_empty (void)
{
  hb_unicode_funcs_t *uf = hb_unicode_funcs_get_empty ();

644
  g_assert (uf);
645 646 647 648
  g_assert (hb_unicode_funcs_is_immutable (uf));
  _test_unicode_properties_nil (uf);
}

649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665

static void
test_unicode_chainup (void)
{
  hb_unicode_funcs_t *uf, *uf2;

  /* Chain-up to nil */

  uf = hb_unicode_funcs_create (NULL);
  g_assert (!hb_unicode_funcs_is_immutable (uf));

  uf2 = hb_unicode_funcs_create (uf);
  g_assert (hb_unicode_funcs_is_immutable (uf));
  hb_unicode_funcs_destroy (uf);

  g_assert (!hb_unicode_funcs_is_immutable (uf2));
  _test_unicode_properties_nil (uf2);
666

667 668 669 670 671 672 673 674 675
  hb_unicode_funcs_destroy (uf2);

  /* Chain-up to default */

  uf = hb_unicode_funcs_create (hb_unicode_funcs_get_default ());
  g_assert (!hb_unicode_funcs_is_immutable (uf));

  uf2 = hb_unicode_funcs_create (uf);
  g_assert (hb_unicode_funcs_is_immutable (uf));
676
  hb_unicode_funcs_destroy (uf);
677 678 679

  g_assert (!hb_unicode_funcs_is_immutable (uf2));
  hb_unicode_funcs_make_immutable (uf2);
680
  test_unicode_properties_strict (uf2);
681 682 683

  hb_unicode_funcs_destroy (uf2);

684
}
685 686

static void
687
test_unicode_setters (void)
688
{
689 690
  hb_unicode_funcs_t *uf;
  unsigned int i;
691

692 693
  /* This is cruel: we use script-returning functions to test all properties,
   * but it works. */
694

695 696 697
  for (i = 0; i < G_N_ELEMENTS (properties); i++) {
    const property_t *p = &properties[i];
    data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
698

699
    g_test_message ("Testing property %s", p->name);
700

701 702
    uf = hb_unicode_funcs_create (NULL);
    g_assert (!hb_unicode_funcs_is_immutable (uf));
703

704
    p->func_setter (uf, (get_func_t) simple_get_script, &data[0], free_up);
705

706 707
    g_assert_cmphex (p->getter (uf, 'a'), ==, HB_SCRIPT_LATIN);
    g_assert_cmphex (p->getter (uf, '0'), ==, HB_SCRIPT_UNKNOWN);
708

709 710 711
    p->func_setter (uf, (get_func_t) NULL, NULL, NULL);
    g_assert (data[0].freed && !data[1].freed);

712 713 714
    g_assert (!hb_unicode_funcs_is_immutable (uf));
    hb_unicode_funcs_make_immutable (uf);
    g_assert (hb_unicode_funcs_is_immutable (uf));
715

716 717
    /* Since uf is immutable now, the following setter should do nothing. */
    p->func_setter (uf, (get_func_t) a_is_for_arabic_get_script, &data[1], free_up);
718

719
    g_assert (data[0].freed && !data[1].freed);
720 721
    hb_unicode_funcs_destroy (uf);
    g_assert (data[0].freed && !data[1].freed);
722 723 724
  }
}

725 726


727 728 729
typedef struct {
  data_t data[2];
} data_fixture_t;
730

731
static void
732
data_fixture_init (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
733 734 735 736 737
{
  f->data[0].value = MAGIC0;
  f->data[1].value = MAGIC1;
}
static void
738
data_fixture_finish (data_fixture_t *f HB_UNUSED, gconstpointer user_data HB_UNUSED)
739
{
740 741
}

742
static void
743
test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
744
{
745 746 747 748 749 750
  hb_unicode_funcs_t *uf, *aa;

  uf = hb_unicode_funcs_create (NULL);

  aa = hb_unicode_funcs_create (uf);

751 752 753
  hb_unicode_funcs_destroy (uf);

  hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
754
                                    &f->data[1], free_up);
755

756 757
  g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
  g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_UNKNOWN);
758

759
  g_assert (!f->data[0].freed && !f->data[1].freed);
760
  hb_unicode_funcs_destroy (aa);
761
  g_assert (!f->data[0].freed && f->data[1].freed);
762 763 764
}

static void
765
test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
766
{
767 768
  hb_unicode_funcs_t *uf, *aa;

769
  uf = hb_unicode_funcs_get_default ();
770
  aa = hb_unicode_funcs_create (uf);
771 772

  hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
773
                                    &f->data[1], free_up);
774

775 776
  g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
  g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN);
777

778
  g_assert (!f->data[0].freed && !f->data[1].freed);
779
  hb_unicode_funcs_destroy (aa);
780
  g_assert (!f->data[0].freed && f->data[1].freed);
781 782 783
}

static void
784
test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
785
{
786 787 788
  hb_unicode_funcs_t *uf, *aa;

  uf = hb_unicode_funcs_create (NULL);
789 790

  hb_unicode_funcs_set_script_func (uf, simple_get_script,
791
                                    &f->data[0], free_up);
792

793
  aa = hb_unicode_funcs_create (uf);
794 795 796 797

  hb_unicode_funcs_destroy (uf);

  /* make sure the 'uf' didn't get freed, since 'aa' holds a ref */
798
  g_assert (!f->data[0].freed);
799 800

  hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
801
                                    &f->data[1], free_up);
802

803 804 805
  g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
  g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN);
  g_assert_cmphex (hb_unicode_script (aa, '0'), ==, HB_SCRIPT_UNKNOWN);
806

807
  g_assert (!f->data[0].freed && !f->data[1].freed);
808
  hb_unicode_funcs_destroy (aa);
809
  g_assert (f->data[0].freed && f->data[1].freed);
810 811
}

812

813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867
static hb_script_t
script_roundtrip_default (hb_script_t script)
{
  return hb_script_from_iso15924_tag (hb_script_to_iso15924_tag (script));
}

#ifdef HAVE_GLIB
static hb_script_t
script_roundtrip_glib (hb_script_t script)
{
  return hb_glib_script_to_script (hb_glib_script_from_script (script));
}
#endif

#ifdef HAVE_ICU
static hb_script_t
script_roundtrip_icu (hb_script_t script)
{
  return hb_icu_script_to_script (hb_icu_script_from_script (script));
}
#endif

static void
test_unicode_script_roundtrip (gconstpointer user_data)
{
  typedef hb_script_t (*roundtrip_func_t) (hb_script_t);
  roundtrip_func_t roundtrip_func = (roundtrip_func_t) user_data;
  unsigned int i;
  gboolean failed = FALSE;

  for (i = 0; i < G_N_ELEMENTS (script_tests); i++) {
    const test_pair_t *test = &script_tests[i];
    hb_script_t script = test->value;

    g_test_message ("Test script roundtrip #%d: %x", i, script);
    g_assert_cmphex (script, ==, roundtrip_func (script));
  }
  for (i = 0; i < G_N_ELEMENTS (script_tests_more); i++) {
    const test_pair_t *test = &script_tests_more[i];
    hb_script_t script = test->value;

    g_test_message ("Test script roundtrip more #%d: %x", i, script);
    if (script != roundtrip_func (script)) {
      g_test_message ("Soft fail: Received %x, expected %x", roundtrip_func (script), script);
      failed = TRUE;
    }
  }

  g_assert_cmphex (HB_SCRIPT_INVALID, ==, roundtrip_func (HB_SCRIPT_INVALID));

  if (failed)
    g_test_message ("Some script roundtrip tests failed.  You probably have an old version of one of the libraries used.");
}


868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
static void
test_unicode_normalization (gconstpointer user_data)
{
  hb_unicode_funcs_t *uf = (hb_unicode_funcs_t *) user_data;
  gunichar a, b, ab;


  /* Test compose() */

  /* Not composable */
  g_assert (!hb_unicode_compose (uf, 0x0041, 0x0042, &ab) && ab == 0);
  g_assert (!hb_unicode_compose (uf, 0x0041, 0, &ab) && ab == 0);
  g_assert (!hb_unicode_compose (uf, 0x0066, 0x0069, &ab) && ab == 0);

  /* Singletons should not compose */
  g_assert (!hb_unicode_compose (uf, 0x212B, 0, &ab) && ab == 0);
  g_assert (!hb_unicode_compose (uf, 0x00C5, 0, &ab) && ab == 0);
  g_assert (!hb_unicode_compose (uf, 0x2126, 0, &ab) && ab == 0);
  g_assert (!hb_unicode_compose (uf, 0x03A9, 0, &ab) && ab == 0);

888 889 890 891
  /* Non-starter pairs should not compose */
  g_assert (!hb_unicode_compose (uf, 0x0308, 0x0301, &ab) && ab == 0); /* !0x0344 */
  g_assert (!hb_unicode_compose (uf, 0x0F71, 0x0F72, &ab) && ab == 0); /* !0x0F73 */

892 893 894 895 896 897 898 899 900 901 902 903 904 905
  /* Pairs */
  g_assert (hb_unicode_compose (uf, 0x0041, 0x030A, &ab) && ab == 0x00C5);
  g_assert (hb_unicode_compose (uf, 0x006F, 0x0302, &ab) && ab == 0x00F4);
  g_assert (hb_unicode_compose (uf, 0x1E63, 0x0307, &ab) && ab == 0x1E69);
  g_assert (hb_unicode_compose (uf, 0x0073, 0x0323, &ab) && ab == 0x1E63);
  g_assert (hb_unicode_compose (uf, 0x0064, 0x0307, &ab) && ab == 0x1E0B);
  g_assert (hb_unicode_compose (uf, 0x0064, 0x0323, &ab) && ab == 0x1E0D);

  /* Hangul */
  g_assert (hb_unicode_compose (uf, 0xD4CC, 0x11B6, &ab) && ab == 0xD4DB);
  g_assert (hb_unicode_compose (uf, 0x1111, 0x1171, &ab) && ab == 0xD4CC);
  g_assert (hb_unicode_compose (uf, 0xCE20, 0x11B8, &ab) && ab == 0xCE31);
  g_assert (hb_unicode_compose (uf, 0x110E, 0x1173, &ab) && ab == 0xCE20);

B
Behdad Esfahbod 已提交
906 907 908 909
  g_assert (!hb_unicode_compose (uf, 0xAC00, 0x11A7, &ab));
  g_assert (hb_unicode_compose (uf, 0xAC00, 0x11A8, &ab) && ab == 0xAC01);
  g_assert (!hb_unicode_compose (uf, 0xAC01, 0x11A8, &ab));

910 911 912 913 914 915

  /* Test decompose() */

  /* Not decomposable */
  g_assert (!hb_unicode_decompose (uf, 0x0041, &a, &b) && a == 0x0041 && b == 0);
  g_assert (!hb_unicode_decompose (uf, 0xFB01, &a, &b) && a == 0xFB01 && b == 0);
916
  g_assert (!hb_unicode_decompose (uf, 0x1F1EF, &a, &b) && a == 0x1F1EF && b == 0);
917 918 919 920 921

  /* Singletons */
  g_assert (hb_unicode_decompose (uf, 0x212B, &a, &b) && a == 0x00C5 && b == 0);
  g_assert (hb_unicode_decompose (uf, 0x2126, &a, &b) && a == 0x03A9 && b == 0);

922 923 924 925
  /* Non-starter pairs decompose, but not compose */
  g_assert (hb_unicode_decompose (uf, 0x0344, &a, &b) && a == 0x0308 && b == 0x0301);
  g_assert (hb_unicode_decompose (uf, 0x0F73, &a, &b) && a == 0x0F71 && b == 0x0F72);

926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
  /* Pairs */
  g_assert (hb_unicode_decompose (uf, 0x00C5, &a, &b) && a == 0x0041 && b == 0x030A);
  g_assert (hb_unicode_decompose (uf, 0x00F4, &a, &b) && a == 0x006F && b == 0x0302);
  g_assert (hb_unicode_decompose (uf, 0x1E69, &a, &b) && a == 0x1E63 && b == 0x0307);
  g_assert (hb_unicode_decompose (uf, 0x1E63, &a, &b) && a == 0x0073 && b == 0x0323);
  g_assert (hb_unicode_decompose (uf, 0x1E0B, &a, &b) && a == 0x0064 && b == 0x0307);
  g_assert (hb_unicode_decompose (uf, 0x1E0D, &a, &b) && a == 0x0064 && b == 0x0323);

  /* Hangul */
  g_assert (hb_unicode_decompose (uf, 0xD4DB, &a, &b) && a == 0xD4CC && b == 0x11B6);
  g_assert (hb_unicode_decompose (uf, 0xD4CC, &a, &b) && a == 0x1111 && b == 0x1171);
  g_assert (hb_unicode_decompose (uf, 0xCE31, &a, &b) && a == 0xCE20 && b == 0x11B8);
  g_assert (hb_unicode_decompose (uf, 0xCE20, &a, &b) && a == 0x110E && b == 0x1173);
}

941 942


943 944 945
int
main (int argc, char **argv)
{
B
Behdad Esfahbod 已提交
946
  hb_test_init (&argc, &argv);
947

948
  hb_test_add (test_unicode_properties_nil);
949
  hb_test_add (test_unicode_properties_empty);
950

951
  hb_test_add_data_flavor (hb_unicode_funcs_get_default (),          "default", test_unicode_properties_strict);
952
  hb_test_add_data_flavor (hb_unicode_funcs_get_default (),          "default", test_unicode_normalization);
953
  hb_test_add_data_flavor ((gconstpointer) script_roundtrip_default, "default", test_unicode_script_roundtrip);
954
#ifdef HAVE_GLIB
955
  hb_test_add_data_flavor (hb_glib_get_unicode_funcs (),             "glib",    test_unicode_properties_lenient);
956
  hb_test_add_data_flavor (hb_glib_get_unicode_funcs (),             "glib",    test_unicode_normalization);
957
  hb_test_add_data_flavor ((gconstpointer) script_roundtrip_glib,    "glib",    test_unicode_script_roundtrip);
958 959
#endif
#ifdef HAVE_ICU
960
  hb_test_add_data_flavor (hb_icu_get_unicode_funcs (),              "icu",     test_unicode_properties_lenient);
961
  hb_test_add_data_flavor (hb_icu_get_unicode_funcs (),              "icu",     test_unicode_normalization);
962
  hb_test_add_data_flavor ((gconstpointer) script_roundtrip_icu,     "icu",     test_unicode_script_roundtrip);
963
#endif
964

965 966
  hb_test_add (test_unicode_chainup);

967 968
  hb_test_add (test_unicode_setters);

969 970 971
  hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_nil);
  hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_default);
  hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_deep);
972

B
Behdad Esfahbod 已提交
973
  return hb_test_run ();
974
}