[USP10_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Aug 2016 10:48:39 +0000 (10:48 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Aug 2016 10:48:39 +0000 (10:48 +0000)
svn path=/trunk/; revision=72312

rostests/winetests/usp10/usp10.c

index 0a99a13..3ea4639 100644 (file)
@@ -89,7 +89,8 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString,
         return;
     }
     todo_wine_if (nItemsToDo)
-        winetest_ok(outnItems == nItems, "Wrong number of items\n");
+        winetest_ok(outnItems == nItems, "Wrong number of items (%u)\n", outnItems);
+    outnItems = min(outnItems, nItems);
     for (x = 0; x <= outnItems; x++)
     {
         if (items[x].isBroken && broken(outpItems[x].iCharPos == items[x].broken_value[0]))
@@ -571,6 +572,29 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     static const itemTest t561[] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
     static const itemTest t562[] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
 
+    /* Persian numerals and punctuation. */
+    static const WCHAR test57[] = {0x06f1, 0x06f2, 0x066c, 0x06f3, 0x06f4, 0x06f5, 0x066c,  /* ۱۲٬۳۴۵٬ */
+                                   0x06f6, 0x06f7, 0x06f8, 0x066b, 0x06f9, 0x06f0};         /* ۶۷۸٫۹۰ */
+    static const itemTest t571[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0}, 2,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 3,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0}, 6,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 7,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0},10,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0},11,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
+    static const itemTest t572[] = {{{0,0,0,0,0,0}, 0,0,0,2,0,arab_tag,FALSE},{{0,0,1,0,0,0}, 2,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 3,0,0,2,0,arab_tag,FALSE},{{0,0,1,0,0,0}, 6,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 7,0,0,2,0,arab_tag,FALSE},{{0,0,1,0,0,0},10,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0},11,0,0,2,0,arab_tag,FALSE},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
+    static const itemTest t573[] = {{{0,0,0,0,0,0}, 0,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0}, 2,0,0,0,1,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 3,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0}, 6,0,0,0,1,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 7,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},10,0,0,0,1,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0},11,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
+    /* Arabic numerals and punctuation. */
+    static const WCHAR test58[] = {0x0661, 0x0662, 0x066c, 0x0663, 0x0664, 0x0665, 0x066c,  /* ١٢٬٣٤٥٬ */
+                                   0x0666, 0x0667, 0x0668, 0x066b, 0x0669, 0x0660};         /* ٦٧٨٫٩٠ */
+    static const itemTest t581[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
+    static const itemTest t582[] = {{{0,0,1,1,0,1}, 0,0,0,0,1,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
+
     SCRIPT_ITEM items[15];
     SCRIPT_CONTROL  Control;
     SCRIPT_STATE    State;
@@ -652,6 +676,8 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test46,16,NULL,NULL,1,t461,FALSE,0);
     test_items_ok(test47,26,NULL,NULL,1,t471,FALSE,0);
     test_items_ok(test56,6,NULL,NULL,1,t561,FALSE,0);
+    test_items_ok(test57,13,NULL,NULL,7,t571,FALSE,0);
+    test_items_ok(test58,13,NULL,NULL,1,t581,FALSE,0);
 
     State.uBidiLevel = 0;
     test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
@@ -715,6 +741,8 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test54,7,&Control,&State,2,t541,FALSE,0);
     test_items_ok(test55,8,&Control,&State,2,t551,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
+    test_items_ok(test57,13,&Control,&State,7,t572,FALSE,0);
+    test_items_ok(test58,13,&Control,&State,1,t581,FALSE,0);
 
     State.uBidiLevel = 1;
     test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
@@ -770,6 +798,8 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
     test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
+    test_items_ok(test57,13,&Control,&State,7,t571,FALSE,0);
+    test_items_ok(test58,13,&Control,&State,1,t581,FALSE,0);
 
     State.uBidiLevel = 1;
     Control.fMergeNeutralItems = TRUE;
@@ -826,6 +856,8 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
     test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
+    test_items_ok(test57,13,&Control,&State,7,t571,FALSE,0);
+    test_items_ok(test58,13,&Control,&State,1,t581,FALSE,0);
 
     State.uBidiLevel = 0;
     Control.fMergeNeutralItems = FALSE;
@@ -891,6 +923,8 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test54,7,&Control,&State,2,t542,FALSE,0);
     test_items_ok(test55,8,&Control,&State,2,t552,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t562,FALSE,0);
+    test_items_ok(test57,13,&Control,&State,7,t573,FALSE,0);
+    test_items_ok(test58,13,&Control,&State,1,t582,FALSE,0);
 }
 
 static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
@@ -1665,7 +1699,9 @@ static void test_ScriptShape(HDC hdc)
     for (i = 0; i < 2; i++)
     {
         static const WCHAR space[]  = {' ', 0};
-        static const WCHAR blanks[] = {'\t', '\r', '\n', 0x001C, 0x001D, 0x001E, 0x001F,0};
+        static const WCHAR blanks[] = {'\t', '\r', '\n', 0x001c, 0x001d, 0x001e, 0x001f,
+                                       0x200b, 0x200c, 0x200d, 0x200e, 0x200f,          /* ZWSP, ZWNJ, ZWJ, LRM, RLM */
+                                       0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0};      /* LRE, RLE, PDF, LRO, RLO */
         HFONT font, oldfont = NULL;
         LOGFONTA lf;
 
@@ -1689,13 +1725,39 @@ static void test_ScriptShape(HDC hdc)
             hr = ScriptItemize(&blanks[j], 1, 2, NULL, NULL, items, NULL);
             ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, blanks[j], hr);
 
+            ok(!items[0].a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
+               lf.lfFaceName, blanks[j], items[0].a.fNoGlyphIndex);
             hr = ScriptShape(hdc, &sc, &blanks[j], 1, 1, &items[0].a, glyphs2, logclust, attrs, &nb);
             ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, blanks[j], hr);
             ok(nb == 1, "%s: [%02x] expected 1, got %d\n", lf.lfFaceName, blanks[j], nb);
+            ok(!items[0].a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
+               lf.lfFaceName, blanks[j], items[0].a.fNoGlyphIndex);
 
             ok(glyphs[0] == glyphs2[0] ||
                broken(glyphs2[0] == blanks[j] && (blanks[j] < 0x10)),
                "%s: [%02x] expected %04x, got %04x\n", lf.lfFaceName, blanks[j], glyphs[0], glyphs2[0]);
+            ok(attrs[0].fZeroWidth || broken(!attrs[0].fZeroWidth && (blanks[j] < 0x10) /* Vista */),
+               "%s: [%02x] got unexpected fZeroWidth %#x.\n", lf.lfFaceName, blanks[j], attrs[0].fZeroWidth);
+
+            items[0].a.fNoGlyphIndex = 1;
+            hr = ScriptShape(hdc, &sc, &blanks[j], 1, 1, &items[0].a, glyphs2, logclust, attrs, &nb);
+            ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, blanks[j], hr);
+            ok(nb == 1, "%s: [%02x] expected 1, got %d\n", lf.lfFaceName, blanks[j], nb);
+
+            if (blanks[j] == 0x200b || blanks[j] == 0x200c || blanks[j] == 0x200d)
+            {
+                ok(glyphs2[0] == 0x0020,
+                   "%s: [%02x] got unexpected %04x.\n", lf.lfFaceName, blanks[j], glyphs2[0]);
+                ok(attrs[0].fZeroWidth, "%s: [%02x] got unexpected fZeroWidth %#x.\n",
+                   lf.lfFaceName, blanks[j], attrs[0].fZeroWidth);
+            }
+            else
+            {
+                ok(glyphs2[0] == blanks[j],
+                   "%s: [%02x] got unexpected %04x.\n", lf.lfFaceName, blanks[j], glyphs2[0]);
+                ok(!attrs[0].fZeroWidth, "%s: [%02x] got unexpected fZeroWidth %#x.\n",
+                   lf.lfFaceName, blanks[j], attrs[0].fZeroWidth);
+            }
         }
         if (oldfont)
             DeleteObject(SelectObject(hdc, oldfont));
@@ -2391,10 +2453,7 @@ static void test_ScriptTextOut(HDC hdc)
             ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
 
             /* Test Rect Rgn is acceptable */
-            rect.top = 10;
-            rect.bottom = 20;
-            rect.left = 10;
-            rect.right = 40;
+            SetRect(&rect, 10, 10, 40, 20);
             hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
                                piAdvance, NULL, pGoffset);
             ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
@@ -2557,10 +2616,7 @@ static void test_ScriptTextOut3(HDC hdc)
             ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr);
 
             /* Test Rect Rgn is acceptable */
-            rect.top = 10;
-            rect.bottom = 20;
-            rect.left = 10;
-            rect.right = 40;
+            SetRect(&rect, 10, 10, 40, 20);
             hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
                                piAdvance, NULL, pGoffset);
             ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);