Module: wine Branch: master Commit: 292c99e3290736a3fe75e50a11105f929e30915b URL: http://source.winehq.org/git/wine.git/?a=commit;h=292c99e3290736a3fe75e50a11...
Author: Jeff Latimer lats@yless4u.com.au Date: Tue Oct 17 19:11:25 2006 +1000
usp10: Fix dead code in ScriptItemize.
---
dlls/usp10/tests/usp10.c | 13 ++++++++++++- dlls/usp10/usp10.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index 378bf68..31df9c7 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -46,7 +46,8 @@ static void test_ScriptItemIzeShapePlace WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; WCHAR TestItem2[] = {'T', 'e', 's', 't', 'b', 0}; WCHAR TestItem3[] = {'T', 'e', 's', 't', 'c',' ','1','2','3',' ',' ','e','n','d',0}; - WCHAR TestItem4[] = {'T', 'e', 's', 't', 'c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0}; + WCHAR TestItem4[] = {'T', 'e', 's', 't', 'c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0}; + WCHAR TestItem5[] = {0x0684,'T','e','s','t','c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0};
SCRIPT_CACHE psc; int cChars; @@ -243,6 +244,16 @@ static void test_ScriptItemIzeShapePlace hr = ScriptFreeCache( &psc); ok (!psc, "psc is not null after ScriptFreeCache\n"); } + + /* + * This test is for when the first unicode character requires bidi support + */ + cInChars = (sizeof(TestItem5)-1)/sizeof(WCHAR); + hr = ScriptItemize(TestItem5, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); + ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr); + ok (pcItems == 4, "There should have been 4 items, found %d\n", pcItems); + ok (pItem[0].a.s.uBidiLevel == 1, "The first character should have been bidi=1 not %d\n", + pItem[0].a.s.uBidiLevel); }
void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 6a52933..9fd6c1e 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -326,7 +326,7 @@ #define Script_Numeric 5 pItems[index].a.fLogicalOrder = 0; pItems[index].a.fNoGlyphIndex = 0; /* set the SCRIPT_STATE */ - if (New_Script == Script_Arabic) + if (pItems[index].a.eScript == Script_Arabic) pItems[index].a.s.uBidiLevel = 1; else pItems[index].a.s.uBidiLevel = 0;