diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index 378bf6892c6..31df9c73382 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -46,7 +46,8 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 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(HDC hdc, unsigned short pwOutGlyphs[256 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 6a52933cce8..9fd6c1e6177 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -326,7 +326,7 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem 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;