mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-9095 fix for reorder rules mixed with other rules
X-SVN-Rev: 31311
This commit is contained in:
parent
c0431190d6
commit
bbe524b849
2 changed files with 29 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2011, International Business Machines
|
||||
* Copyright (C) 1996-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* file name: ucol_res.cpp
|
||||
|
@ -434,7 +434,8 @@ ucol_openRulesForImport( const UChar *rules,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if(src.resultLen > 0 || src.removeSet != NULL) { /* we have a set of rules, let's make something of it */
|
||||
/* if we have a set of rules, let's make something of it */
|
||||
if(src.resultLen > 0 || src.removeSet != NULL || src.reorderCodesLength > 0) {
|
||||
/* also, if we wanted to remove some contractions, we should make a tailoring */
|
||||
table = ucol_assembleTailoringTable(&src, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
|
@ -450,6 +451,7 @@ ucol_openRulesForImport( const UChar *rules,
|
|||
if (U_FAILURE(*status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
ucol_setReorderCodesFromParser(result, &src, status);
|
||||
result->hasRealData = TRUE;
|
||||
result->freeImageOnClose = TRUE;
|
||||
}
|
||||
|
@ -470,7 +472,6 @@ ucol_openRulesForImport( const UChar *rules,
|
|||
}
|
||||
uprv_memcpy(opts, src.opts, sizeof(UColOptionSet));
|
||||
ucol_setOptionsFromHeader(result, opts, status);
|
||||
ucol_setReorderCodesFromParser(result, &src, status);
|
||||
result->freeOptionsOnClose = TRUE;
|
||||
result->hasRealData = FALSE;
|
||||
result->freeImageOnClose = FALSE;
|
||||
|
|
|
@ -6489,6 +6489,30 @@ static void TestHaniReorder(void)
|
|||
doTestOneReorderingAPITestCase(privateUseCharacterStrings, LEN(privateUseCharacterStrings), apiRules, LEN(apiRules));
|
||||
}
|
||||
|
||||
static void TestHaniReorderWithOtherRules(void)
|
||||
{
|
||||
const char* strRules[] = {
|
||||
"[reorder Hani] &b<a"
|
||||
};
|
||||
const int32_t apiRules[] = {
|
||||
USCRIPT_HAN
|
||||
};
|
||||
|
||||
const static OneTestCase privateUseCharacterStrings[] = {
|
||||
{ {0x4e00}, {0x0041}, UCOL_LESS },
|
||||
{ {0x4e00}, {0x0060}, UCOL_GREATER },
|
||||
{ {0xD86D, 0xDF40}, {0x0041}, UCOL_LESS },
|
||||
{ {0xD86D, 0xDF40}, {0x0060}, UCOL_GREATER },
|
||||
{ {0x4e00}, {0xD86D, 0xDF40}, UCOL_LESS },
|
||||
{ {0xfa27}, {0x0041}, UCOL_LESS },
|
||||
{ {0xD869, 0xDF00}, {0x0041}, UCOL_LESS },
|
||||
{ {0x0062}, {0x0061}, UCOL_LESS },
|
||||
};
|
||||
|
||||
/* Test rules creation */
|
||||
doTestOneTestCase(privateUseCharacterStrings, LEN(privateUseCharacterStrings), strRules, LEN(strRules));
|
||||
}
|
||||
|
||||
static void TestMultipleReorder(void)
|
||||
{
|
||||
const char* strRules[] = {
|
||||
|
@ -7131,6 +7155,7 @@ void addMiscCollTest(TestNode** root)
|
|||
TEST(TestGreekLastReorder);
|
||||
TEST(TestNonScriptReorder);
|
||||
TEST(TestHaniReorder);
|
||||
TEST(TestHaniReorderWithOtherRules);
|
||||
TEST(TestMultipleReorder);
|
||||
TEST(TestReorderingAcrossCloning);
|
||||
/* test for ticket 8814 - disabled until resolved */
|
||||
|
|
Loading…
Add table
Reference in a new issue