mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-6249 Add test cases; use direction of first logical run as direction for test case text.
X-SVN-Rev: 24101
This commit is contained in:
parent
534b14f417
commit
340fa39fd6
4 changed files with 64 additions and 7 deletions
|
@ -420,15 +420,19 @@ static le_font *openFont(const char *fontName, const char *checksum, const char
|
|||
|
||||
static le_bool getRTL(const LEUnicode *text, le_int32 charCount)
|
||||
{
|
||||
UBiDiLevel paraLevel;
|
||||
UBiDiLevel level;
|
||||
le_int32 limit = -1;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UBiDi *ubidi = ubidi_openSized(charCount, 0, &status);
|
||||
|
||||
ubidi_setPara(ubidi, text, charCount, UBIDI_DEFAULT_LTR, NULL, &status);
|
||||
paraLevel = ubidi_getParaLevel(ubidi);
|
||||
|
||||
/* TODO: Should check that there's only a single logical run... */
|
||||
ubidi_getLogicalRun(ubidi, 0, &limit, &level);
|
||||
|
||||
ubidi_close(ubidi);
|
||||
|
||||
return paraLevel & 1;
|
||||
return level & 1;
|
||||
}
|
||||
|
||||
static void doTestCase (const char *testID,
|
||||
|
|
|
@ -128,4 +128,14 @@
|
|||
<test-font name="lklug.hj.ttf"/>
|
||||
<test-text>ක්රෙ ක්යෙ ක්ෂෙ ක්ෂ්යෙ ක්ෂෙ කර්මෙ ස්ට්රේ ස්සෙ ස්ස</test-text>
|
||||
</test-case>
|
||||
|
||||
<test-case id="Arabic Presentation Forms LRO Test" script="arab">
|
||||
<test-font name="trado.ttf"/>
|
||||
<test-text>ﻲﺑﺮﻌﻟﺎﺑ</test-text>
|
||||
</test-case>
|
||||
|
||||
<test-case id="Arabic Presentation Forms No LRO Test" script="arab">
|
||||
<test-font name="trado.ttf"/>
|
||||
<test-text>ﻲﺑﺮﻌﻟﺎﺑ</test-text>
|
||||
</test-case>
|
||||
</layout-tests>
|
|
@ -78,16 +78,20 @@ void freeCString(char *cString)
|
|||
|
||||
le_bool getRTL(const UnicodeString &text)
|
||||
{
|
||||
UBiDiLevel paraLevel;
|
||||
UBiDiLevel level = 0;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
le_int32 charCount = text.length();
|
||||
le_int32 limit = -1;
|
||||
UBiDi *ubidi = ubidi_openSized(charCount, 0, &status);
|
||||
|
||||
ubidi_setPara(ubidi, text.getBuffer(), charCount, UBIDI_DEFAULT_LTR, NULL, &status);
|
||||
paraLevel = ubidi_getParaLevel(ubidi);
|
||||
|
||||
// TODO: Should check that there's only a single logical run...
|
||||
ubidi_getLogicalRun(ubidi, 0, &limit, &level);
|
||||
|
||||
ubidi_close(ubidi);
|
||||
|
||||
return paraLevel & 1;
|
||||
return level & 1;
|
||||
}
|
||||
|
||||
le_int32 getLanguageCode(const char *lang)
|
||||
|
|
41
icu4c/source/test/testdata/letest.xml
vendored
41
icu4c/source/test/testdata/letest.xml
vendored
|
@ -8,7 +8,7 @@
|
|||
UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.
|
||||
|
||||
file name: letest.xml
|
||||
generated on: 05/27/2008 03:13:34 PM Hawaiian Standard Time
|
||||
generated on: 06/03/2008 12:55:35 PM Hawaiian Standard Time
|
||||
generated by: gendata.cpp
|
||||
-->
|
||||
|
||||
|
@ -1452,4 +1452,43 @@
|
|||
</result-positions>
|
||||
</test-case>
|
||||
|
||||
<test-case id="Arabic Presentation Forms LRO Test" script="arab">
|
||||
<test-font name="trado.ttf" version="Version 1.01" checksum="0x7B68B462"/>
|
||||
|
||||
<test-text>ﻲﺑﺮﻌﻟﺎﺑ</test-text>
|
||||
|
||||
<result-glyphs>
|
||||
0x0000FFFF, 0x00000206, 0x000001A5, 0x000001C2, 0x000001E0, 0x000001F3, 0x000001A2, 0x000001A5
|
||||
</result-glyphs>
|
||||
|
||||
<result-indices>
|
||||
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007
|
||||
</result-indices>
|
||||
|
||||
<result-positions>
|
||||
0.000000, 0.000000, 0.000000, 0.000000, 5.759766, 0.000000, 7.980469, 0.000000,
|
||||
11.748047, 0.000000, 15.298828, 0.000000, 17.302734, 0.000000, 19.763672, 0.000000,
|
||||
21.984375, 0.000000
|
||||
</result-positions>
|
||||
</test-case>
|
||||
|
||||
<test-case id="Arabic Presentation Forms No LRO Test" script="arab">
|
||||
<test-font name="trado.ttf" version="Version 1.01" checksum="0x7B68B462"/>
|
||||
|
||||
<test-text>ﻲﺑﺮﻌﻟﺎﺑ</test-text>
|
||||
|
||||
<result-glyphs>
|
||||
0x000001A5, 0x000001A2, 0x000001F3, 0x000001E0, 0x000001C2, 0x000001A5, 0x00000206
|
||||
</result-glyphs>
|
||||
|
||||
<result-indices>
|
||||
0x00000006, 0x00000005, 0x00000004, 0x00000003, 0x00000002, 0x00000001, 0x00000000
|
||||
</result-indices>
|
||||
|
||||
<result-positions>
|
||||
0.000000, 0.000000, 2.220703, 0.000000, 4.681641, 0.000000, 6.685547, 0.000000,
|
||||
10.236328, 0.000000, 14.003906, 0.000000, 16.224609, 0.000000, 21.984375, 0.000000
|
||||
</result-positions>
|
||||
</test-case>
|
||||
|
||||
</layout-tests>
|
||||
|
|
Loading…
Add table
Reference in a new issue