Move and reshuffle reactos/regtetsts into rostests. 2/2
[reactos.git] / reactos / regtests / winetests / usp10 / usp10.c
diff --git a/reactos/regtests/winetests/usp10/usp10.c b/reactos/regtests/winetests/usp10/usp10.c
deleted file mode 100644 (file)
index 01a0bb9..0000000
+++ /dev/null
@@ -1,1252 +0,0 @@
-/*\r
- * Tests for usp10 dll\r
- *\r
- * Copyright 2006 Jeff Latimer\r
- * Copyright 2006 Hans Leidekker\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA\r
- *\r
- * Notes:\r
- * Uniscribe allows for processing of complex scripts such as joining\r
- * and filtering characters and bi-directional text with custom line breaks.\r
- */\r
-\r
-//#include <assert.h>\r
-//#include <stdio.h>\r
-//#include <windows.h>\r
-//#include <wine/test.h>\r
-//#include <winbase.h>\r
-//#include <wingdi.h>\r
-//#include <winuser.h>\r
-//#include <winerror.h>\r
-//#include <winnls.h>\r
-//#include <usp10.h>\r
-\r
-#include <stdio.h>\r
-#include <windows.h>\r
-#include "usp10.h"\r
-#include "wine/test.h"\r
-#include "wine/windef.h"\r
-\r
-BOOL WINAPI ShowWindow(HWND,int);\r
-\r
-static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256])\r
-{\r
-    HRESULT         hr;\r
-    int             iMaxProps;\r
-    const SCRIPT_PROPERTIES **ppSp;\r
-\r
-    int             cInChars;\r
-    int             cMaxItems;\r
-    SCRIPT_ITEM     pItem[255];\r
-    int             pcItems;\r
-    WCHAR           TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; \r
-    WCHAR           TestItem2[] = {'T', 'e', 's', 't', 'b', 0}; \r
-    WCHAR           TestItem3[] = {'T', 'e', 's', 't', 'c',' ','1','2','3',' ',' ','e','n','d',0}; \r
-    WCHAR           TestItem4[] = {'T', 'e', 's', 't', 'c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0};\r
-    WCHAR           TestItem5[] = {0x0684,'T','e','s','t','c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0}; \r
-\r
-    SCRIPT_CACHE    psc;\r
-    int             cChars;\r
-    int             cMaxGlyphs;\r
-    unsigned short  pwOutGlyphs1[256];\r
-    unsigned short  pwOutGlyphs2[256];\r
-    unsigned short  pwLogClust[256];\r
-    SCRIPT_VISATTR  psva[256];\r
-    int             pcGlyphs;\r
-    int             piAdvance[256];\r
-    GOFFSET         pGoffset[256];\r
-    ABC             pABC[256];\r
-    int             cnt;\r
-\r
-    /* Start testing usp10 functions                                                         */\r
-    /* This test determines that the pointer returned by ScriptGetProperties is valid\r
-     * by checking a known value in the table                                                */\r
-    hr = ScriptGetProperties(&ppSp, &iMaxProps);\r
-    trace("number of script properties %d\n", iMaxProps);\r
-    ok (iMaxProps > 0, "Number of scripts returned should not be 0\n"); \r
-    if  (iMaxProps > 0)\r
-         ok( ppSp[5]->langid == 9, "Langid[5] not = to 9\n"); /* Check a known value to ensure   */\r
-                                                              /* ptrs work                       */\r
-\r
-\r
-    /* This set of tests are to check that the various edits in ScriptIemize work           */\r
-    cInChars = 5;                                        /* Length of test without NULL     */\r
-    cMaxItems = 1;                                       /* Check threshold value           */\r
-    hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == E_INVALIDARG, "ScriptItemize should return E_INVALIDARG if cMaxItems < 2.  Was %d\n",\r
-        cMaxItems);\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(NULL, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == E_INVALIDARG, "ScriptItemize should return E_INVALIDARG if pwcInChars is NULL\n");\r
-\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem1, 0, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == E_INVALIDARG, "ScriptItemize should return E_INVALIDARG if cInChars is 0\n");\r
-\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, NULL, &pcItems);\r
-    ok (hr == E_INVALIDARG, "ScriptItemize should return E_INVALIDARG if pItems is NULL\n");\r
-\r
-    /* This is a valid test that will cause parsing to take place                             */\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-    /*  This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *\r
-     *  returned.                                                                             */\r
-    ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");\r
-    if (pcItems > 0)\r
-        ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,\r
-            "Start pos not = 0 (%d) or end pos not = %d (%d)\n",\r
-            pItem[0].iCharPos, cInChars, pItem[1].iCharPos);\r
-\r
-    /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue\r
-     * ie. ScriptItemize has succeeded and that pItem has been set                            */\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    if (hr == 0) {\r
-        psc = NULL;                                   /* must be null on first call           */\r
-        cChars = cInChars;\r
-        cMaxGlyphs = cInChars;\r
-        hr = ScriptShape(NULL, &psc, TestItem1, cChars,\r
-                         cMaxGlyphs, &pItem[0].a,\r
-                         pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);\r
-        ok (hr == E_PENDING, "If psc is NULL (%08x) the E_PENDING should be returned\n", hr);\r
-        cMaxGlyphs = 4;\r
-        hr = ScriptShape(hdc, &psc, TestItem1, cChars,\r
-                         cMaxGlyphs, &pItem[0].a,\r
-                         pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);\r
-        ok (hr == E_OUTOFMEMORY, "If not enough output area cChars (%d) is > than CMaxGlyphs "\r
-                                 "(%d) but not E_OUTOFMEMORY\n",\r
-                                 cChars, cMaxGlyphs);\r
-        cMaxGlyphs = 256;\r
-        hr = ScriptShape(hdc, &psc, TestItem1, cChars,\r
-                         cMaxGlyphs, &pItem[0].a,\r
-                         pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);\r
-        ok (hr == 0, "ScriptShape should return 0 not (%08x)\n", hr);\r
-        ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-        ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);\r
-        if (hr ==0) {\r
-            hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,\r
-                             pGoffset, pABC);\r
-            ok (hr == 0, "ScriptPlace should return 0 not (%08x)\n", hr);\r
-            hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,\r
-                             pGoffset, pABC);\r
-            ok (hr == 0, "ScriptPlace should return 0 not (%08x)\n", hr);\r
-            for (cnt=0; cnt < pcGlyphs; cnt++)\r
-                pwOutGlyphs[cnt] = pwOutGlyphs1[cnt];                 /* Send to next function */\r
-        }\r
-\r
-        /* This test will check to make sure that SCRIPT_CACHE is reused and that not translation   *\r
-         * takes place if fNoGlyphIndex is set.                                                     */\r
-\r
-        cInChars = 5;\r
-        cMaxItems = 255;\r
-        hr = ScriptItemize(TestItem2, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-        ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-        /*  This test is for the intertrim operation of ScriptItemize where only one SCRIPT_ITEM is *\r
-         *  returned.                                                                               */\r
-        ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,\r
-                            "Start pos not = 0 (%d) or end pos not = %d (%d)\n",\r
-                             pItem[0].iCharPos, cInChars, pItem[1].iCharPos);\r
-        /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue                    */\r
-        if (hr == 0) {\r
-             cChars = cInChars;\r
-             cMaxGlyphs = 256;\r
-             pItem[0].a.fNoGlyphIndex = 1;                /* say no translate                     */\r
-             hr = ScriptShape(NULL, &psc, TestItem2, cChars,\r
-                              cMaxGlyphs, &pItem[0].a,\r
-                              pwOutGlyphs2, pwLogClust, psva, &pcGlyphs);\r
-             ok (hr != E_PENDING, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n", hr);\r
-             ok (hr == 0, "ScriptShape should return 0 not (%08x)\n", hr);\r
-             ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-             ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);\r
-             for (cnt=0; cnt < cChars && TestItem2[cnt] == pwOutGlyphs2[cnt]; cnt++) {}\r
-             ok (cnt == cChars, "Translation to place when told not to. WCHAR %d - %04x != %04x\n",\r
-                           cnt, TestItem2[cnt], pwOutGlyphs2[cnt]);\r
-             if (hr ==0) {\r
-                 hr = ScriptPlace(hdc, &psc, pwOutGlyphs2, pcGlyphs, psva, &pItem[0].a, piAdvance,\r
-                                  pGoffset, pABC);\r
-                 ok (hr == 0, "ScriptPlace should return 0 not (%08x)\n", hr);\r
-             }\r
-        }\r
-        hr = ScriptFreeCache( &psc);\r
-        ok (!psc, "psc is not null after ScriptFreeCache\n");\r
-\r
-    }\r
-\r
-    /* This is a valid test that will cause parsing to take place and create 3 script_items   */\r
-    cInChars = (sizeof(TestItem3)/2)-1;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem3, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-    if  (hr == 0)\r
-       {\r
-        ok (pcItems == 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems);\r
-        if (pcItems > 2)\r
-        {\r
-            ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6,\r
-                "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",\r
-                pItem[0].iCharPos, pItem[1].iCharPos);\r
-            ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11,\r
-                "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",\r
-                pItem[1].iCharPos, pItem[2].iCharPos);\r
-            ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == cInChars,\r
-                "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n",\r
-                pItem[2].iCharPos, pItem[3].iCharPos, cInChars);\r
-        }\r
-        hr = ScriptFreeCache( &psc);\r
-        ok (!psc, "psc is not null after ScriptFreeCache\n");\r
-    }\r
-\r
-    /* This is a valid test that will cause parsing to take place and create 3 script_items   */\r
-    cInChars = (sizeof(TestItem4)/2)-1;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem4, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-    if  (hr == 0)\r
-       {\r
-        ok (pcItems == 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems);\r
-        if (pcItems > 2)\r
-        {\r
-            ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6,\r
-                "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",\r
-                pItem[0].iCharPos, pItem[1].iCharPos);\r
-            ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11,\r
-                "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",\r
-                pItem[1].iCharPos, pItem[2].iCharPos);\r
-            ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == cInChars,\r
-                "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n",\r
-                pItem[2].iCharPos, pItem[3].iCharPos, cInChars);\r
-        }\r
-        hr = ScriptFreeCache( &psc);\r
-        ok (!psc, "psc is not null after ScriptFreeCache\n");\r
-    }\r
-\r
-    /*\r
-     * This test is for when the first unicode character requires bidi support\r
-     */ \r
-    cInChars = (sizeof(TestItem5)-1)/sizeof(WCHAR);\r
-    hr = ScriptItemize(TestItem5, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-    ok (pcItems == 4, "There should have been 4 items, found %d\n", pcItems);\r
-    ok (pItem[0].a.s.uBidiLevel == 1, "The first character should have been bidi=1 not %d\n", \r
-                                       pItem[0].a.s.uBidiLevel);\r
-}\r
-\r
-static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])\r
-{\r
-    HRESULT         hr;\r
-    SCRIPT_CACHE    psc = NULL;\r
-    int             cInChars;\r
-    int             cChars;\r
-    unsigned short  pwOutGlyphs3[256];\r
-    WCHAR           TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; \r
-    DWORD           dwFlags;\r
-    int             cnt;\r
-\r
-    /*  Check to make sure that SCRIPT_CACHE gets allocated ok                     */\r
-    dwFlags = 0;\r
-    cInChars = cChars = 5;\r
-    /* Some sanity checks for ScriptGetCMap */\r
-\r
-    hr = ScriptGetCMap(NULL, NULL, NULL, 0, 0, NULL);\r
-    ok( hr == E_INVALIDARG, "(NULL,NULL,NULL,0,0,NULL), "\r
-                            "expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    hr = ScriptGetCMap(NULL, NULL, TestItem1, cInChars, dwFlags, pwOutGlyphs3);\r
-    ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "\r
-                            "expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetCMap(NULL, &psc, NULL, 0, 0, NULL);\r
-    ok( hr == E_PENDING, "(NULL,&psc,NULL,0,0NULL), expected E_PENDING, "\r
-                         "got %08x\n", hr);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-    /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetCMap(hdc, &psc, NULL, 0, 0, NULL);\r
-    ok( hr == S_OK, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, "\r
-                    "got %08x\n", hr);\r
-    ok( psc != NULL, "ScritpGetCMap expected psc to be not NULL\n");\r
-\r
-    /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);\r
-    ok( hr == E_PENDING, "(NULL,&psc,), expected E_PENDING, got %08x\n", hr);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-    /*  Check to see if the results are the same as those returned by ScriptShape  */\r
-    hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);\r
-    ok (hr == 0, "ScriptGetCMap should return 0 not (%08x)\n", hr);\r
-    ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-    for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {}\r
-    ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n",\r
-                         cnt, pwOutGlyphs[cnt], pwOutGlyphs3[cnt]);\r
-        \r
-    hr = ScriptFreeCache( &psc);\r
-    ok (!psc, "psc is not null after ScriptFreeCache\n");\r
-\r
-}\r
-\r
-static void test_ScriptGetFontProperties(HDC hdc)\r
-{\r
-    HRESULT         hr;\r
-    SCRIPT_CACHE    psc,old_psc;\r
-    SCRIPT_FONTPROPERTIES sfp;\r
-\r
-    /* Some sanity checks for ScriptGetFontProperties */\r
-\r
-    hr = ScriptGetFontProperties(NULL,NULL,NULL);\r
-    ok( hr == E_INVALIDARG, "(NULL,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    hr = ScriptGetFontProperties(NULL,NULL,&sfp);\r
-    ok( hr == E_INVALIDARG, "(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetFontProperties(NULL,&psc,NULL);\r
-    ok( hr == E_INVALIDARG, "(NULL,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-    /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetFontProperties(NULL,&psc,&sfp);\r
-    ok( hr == E_PENDING, "(NULL,&psc,&sfp), expected E_PENDING, got %08x\n", hr);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-    hr = ScriptGetFontProperties(hdc,NULL,NULL);\r
-    ok( hr == E_INVALIDARG, "(hdc,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    hr = ScriptGetFontProperties(hdc,NULL,&sfp);\r
-    ok( hr == E_INVALIDARG, "(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-    /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-    psc = NULL;\r
-    hr = ScriptGetFontProperties(hdc,&psc,NULL);\r
-    ok( hr == E_INVALIDARG, "(hdc,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-    /* Pass an uninitialized sfp */\r
-    psc = NULL;\r
-    hr = ScriptGetFontProperties(hdc,&psc,&sfp);\r
-    ok( hr == E_INVALIDARG, "(hdc,&psc,&sfp) partly uninitialized, expected E_INVALIDARG, got %08x\n", hr);\r
-    ok( psc != NULL, "Expected a pointer in psc, got NULL\n");\r
-    ScriptFreeCache(&psc);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-    /* Give it the correct cBytes, we don't care about what's coming back */\r
-    sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);\r
-    psc = NULL;\r
-    hr = ScriptGetFontProperties(hdc,&psc,&sfp);\r
-    ok( hr == S_OK, "(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x\n", hr);\r
-    ok( psc != NULL, "Expected a pointer in psc, got NULL\n");\r
-\r
-    /* Save the psc pointer */\r
-    old_psc = psc;\r
-    /* Now a NULL hdc again */\r
-    hr = ScriptGetFontProperties(NULL,&psc,&sfp);\r
-    ok( hr == S_OK, "(NULL,&psc,&sfp), expected S_OK, got %08x\n", hr);\r
-    ok( psc == old_psc, "Expected psc not to be changed, was %p is now %p\n", old_psc, psc);\r
-    ScriptFreeCache(&psc);\r
-    ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-}\r
-\r
-static void test_ScriptTextOut(HDC hdc)\r
-{\r
-    HRESULT         hr;\r
-\r
-    int             cInChars;\r
-    int             cMaxItems;\r
-    SCRIPT_ITEM     pItem[255];\r
-    int             pcItems;\r
-    WCHAR           TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; \r
-\r
-    SCRIPT_CACHE    psc;\r
-    int             cChars;\r
-    int             cMaxGlyphs;\r
-    unsigned short  pwOutGlyphs1[256];\r
-    WORD            pwLogClust[256];\r
-    SCRIPT_VISATTR  psva[256];\r
-    int             pcGlyphs;\r
-    int             piAdvance[256];\r
-    GOFFSET         pGoffset[256];\r
-    ABC             pABC[256];\r
-    RECT            rect;\r
-    int             piX;\r
-    int             iCP = 1;\r
-    BOOL            fTrailing = FALSE;\r
-    SCRIPT_LOGATTR  *psla;\r
-    SCRIPT_LOGATTR  sla[256];\r
-\r
-    /* This is a valid test that will cause parsing to take place                             */\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);\r
-    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);\r
-    /*  This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *\r
-     *  returned.                                                                             */\r
-    ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");\r
-    if (pcItems > 0)\r
-        ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,\r
-            "Start pos not = 0 (%d) or end pos not = %d (%d)\n",\r
-            pItem[0].iCharPos, cInChars, pItem[1].iCharPos);\r
-\r
-    /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue\r
-     * ie. ScriptItemize has succeeded and that pItem has been set                            */\r
-    cInChars = 5;\r
-    cMaxItems = 255;\r
-    if (hr == 0) {\r
-        psc = NULL;                                   /* must be null on first call           */\r
-        cChars = cInChars;\r
-        cMaxGlyphs = cInChars;\r
-        cMaxGlyphs = 256;\r
-        hr = ScriptShape(hdc, &psc, TestItem1, cChars,\r
-                         cMaxGlyphs, &pItem[0].a,\r
-                         pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);\r
-        ok (hr == 0, "ScriptShape should return 0 not (%08x)\n", hr);\r
-        ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-        ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);\r
-        if (hr ==0) {\r
-            /* Note hdc is needed as glyph info is not yet in psc                  */\r
-            hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,\r
-                             pGoffset, pABC);\r
-            ok (hr == 0, "Should return 0 not (%08x)\n", hr);\r
-            ScriptFreeCache(&psc);              /* Get rid of psc for next test set */\r
-            ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-            hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);\r
-            ok (hr == E_INVALIDARG, "Should return 0 not (%08x)\n", hr);\r
-\r
-            hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,\r
-                               piAdvance, NULL, pGoffset);\r
-            ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "\r
-                                    "expected E_INVALIDARG, got %08x\n", hr);\r
-\r
-            /* Set psc to NULL, to be able to check if a pointer is returned in psc */\r
-            psc = NULL;\r
-            hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0,\r
-                               NULL, NULL, NULL);\r
-            ok( hr == E_INVALIDARG, "(NULL,&psc,NULL,0,0,0,NULL,), expected E_INVALIDARG, "\r
-                                    "got %08x\n", hr);\r
-            ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-            /* Set psc to NULL, to be able to check if a pointer is returned in psc\r
-             * hdc is required for this one rather than the usual optional          */\r
-            psc = NULL;\r
-            hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,\r
-                               piAdvance, NULL, pGoffset);\r
-            ok( hr == E_INVALIDARG, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", hr);\r
-            ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-\r
-            /* Set that is gets a psc and that returns 0 status */\r
-            hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,\r
-                               piAdvance, NULL, pGoffset);\r
-            ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", hr);\r
-            ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-\r
-            /* Test Rect Rgn is acceptable */\r
-            rect.top = 10;\r
-            rect.bottom = 20;\r
-            rect.left = 10;\r
-            rect.right = 40;\r
-            hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,\r
-                               piAdvance, NULL, pGoffset);\r
-            ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", hr);\r
-            ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");\r
-\r
-            iCP = 1;\r
-            hr = ScriptCPtoX(iCP, fTrailing, cChars, pcGlyphs, (const WORD *) &pwLogClust,\r
-                            (const SCRIPT_VISATTR *) &psva, (const int *)&piAdvance, &pItem[0].a, &piX);\r
-            ok(hr == S_OK, "ScriptCPtoX Stub should return S_OK not %08x\n", hr);\r
-\r
-            psla = (SCRIPT_LOGATTR *)&sla;\r
-            hr = ScriptBreak(TestItem1, cChars, &pItem[0].a, psla);\r
-            ok(hr == S_OK, "ScriptBreak Stub should return S_OK not %08x\n", hr);\r
-\r
-            /* Clean up and go   */\r
-            ScriptFreeCache(&psc);\r
-            ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);\r
-        }\r
-    }\r
-}\r
-\r
-static void test_ScriptXtoX(void)\r
-/****************************************************************************************\r
- *  This routine tests the ScriptXtoCP and ScriptCPtoX functions using static variables *\r
- ****************************************************************************************/\r
-{\r
-    int iX, iCP;\r
-    int cChars;\r
-    int cGlyphs;\r
-    WORD pwLogClust[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
-    SCRIPT_VISATTR psva[10];\r
-    int piAdvance[10] = {200, 190, 210, 180, 170, 204, 189, 195, 212, 203};\r
-    SCRIPT_ANALYSIS psa;\r
-    int piCP, piX;\r
-    int piTrailing;\r
-    BOOL fTrailing;\r
-    HRESULT hr;\r
-\r
-    iX = -1;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == -1, "Negative iX should return piCP=-1 not %d\n", piCP);\r
-    ok(piTrailing == TRUE, "Negative iX should return piTrailing=TRUE not %d\n", piTrailing);\r
-    iX = 1954;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 10, "Excessive iX should return piCP=10 not %d\n", piCP);\r
-    ok(piTrailing == FALSE, "Excessive iX should return piTrailing=FALSE not %d\n", piTrailing);\r
-    iX = 779;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 3, "iX=%d should return piCP=3 not %d\n", iX, piCP);\r
-    ok(piTrailing == 1, "iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);\r
-    iX = 780;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 3, "iX=%d should return piCP=3 not %d\n", iX, piCP);\r
-    ok(piTrailing == 1, "iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);\r
-    iX = 868;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 4, "iX=%d should return piCP=4 not %d\n", iX, piCP);\r
-\r
-    iX = 0;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 0, "iX=%d should return piCP=0 not %d\n", iX, piCP);\r
-    iX = 195;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 0, "iX=%d should return piCP=0 not %d\n", iX, piCP);\r
-    iX = 196;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);\r
-    ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);\r
-    ok(piCP == 1, "iX=%d should return piCP=1 not %d\n", iX, piCP);\r
-\r
-    iCP=5;\r
-    fTrailing = FALSE;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptCPtoX(iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piX);\r
-    ok(hr == S_OK, "ScriptCPtoX should return S_OK not %08x\n", hr);\r
-    ok(piX == 976, "iCP=%d should return piX=976 not %d\n", iCP, piX);\r
-    iCP=5;\r
-    fTrailing = TRUE;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptCPtoX(iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piX);\r
-    ok(hr == S_OK, "ScriptCPtoX should return S_OK not %08x\n", hr);\r
-    ok(piX == 1171, "iCP=%d should return piX=1171 not %d\n", iCP, piX);   \r
-    iCP=6;\r
-    fTrailing = FALSE;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptCPtoX(iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piX);\r
-    ok(hr == S_OK, "ScriptCPtoX should return S_OK not %08x\n", hr);\r
-    ok(piX == 1171, "iCP=%d should return piX=1171 not %d\n", iCP, piX);\r
-    iCP=11;\r
-    fTrailing = FALSE;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptCPtoX(iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piX);\r
-    ok(hr == S_OK, "ScriptCPtoX should return S_OK not %08x\n", hr);\r
-    ok(piX == 1953, "iCP=%d should return piX=1953 not %d\n", iCP, piX);\r
-    iCP=11;\r
-    fTrailing = TRUE;\r
-    cChars = 10;\r
-    cGlyphs = 10;\r
-    hr = ScriptCPtoX(iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piX);\r
-    ok(hr == S_OK, "ScriptCPtoX should return S_OK not %08x\n", hr);\r
-    ok(piX == 1953, "iCP=%d should return piX=1953 not %d\n", iCP, piX); \r
-\r
-}\r
-\r
-static void test_ScriptString(HDC hdc)\r
-{\r
-/*******************************************************************************************\r
- *\r
- * This set of tests are for the string functions of uniscribe.  The ScriptStringAnalyse\r
- * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer.  This\r
- * memory if freed by ScriptStringFree.  There needs to be a valid hdc for this as\r
- * ScriptStringAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.\r
- *\r
- */\r
-\r
-    HRESULT         hr;\r
-    WCHAR           teststr[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'};\r
-    int             len = (sizeof(teststr) / sizeof(WCHAR)) - 1;\r
-    int             Glyphs = len * 2 + 16;\r
-    int             Charset;\r
-    DWORD           Flags = SSA_GLYPHS;\r
-    int             ReqWidth = 100;\r
-    SCRIPT_CONTROL  Control;\r
-    SCRIPT_STATE    State;\r
-    const int       Dx[5] = {10, 10, 10, 10, 10};\r
-    SCRIPT_TABDEF   Tabdef;\r
-    const BYTE      InClass = 0;\r
-    SCRIPT_STRING_ANALYSIS ssa = NULL;\r
-\r
-    int             X = 10; \r
-    int             Y = 100;\r
-    UINT            Options = 0; \r
-    const RECT      rc = {0, 50, 100, 100}; \r
-    int             MinSel = 0;\r
-    int             MaxSel = 0;\r
-    BOOL            Disabled = FALSE;\r
-    const int      *clip_len;\r
-    UINT           *order, i;\r
-\r
-\r
-    Charset = -1;     /* this flag indicates unicode input */\r
-    /* Test without hdc to get E_PENDING */\r
-    hr = ScriptStringAnalyse( NULL, teststr, len, Glyphs, Charset, Flags,\r
-                             ReqWidth, &Control, &State, Dx, &Tabdef,\r
-                             &InClass, &ssa);\r
-    ok(hr == E_PENDING, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr);\r
-\r
-    /* test with hdc, this should be a valid test  */\r
-    hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags,\r
-                              ReqWidth, &Control, &State, Dx, &Tabdef,\r
-                              &InClass, &ssa);\r
-    ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);\r
-\r
-    /* test makes sure that a call with a valid pssa still works */\r
-    hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags,\r
-                              ReqWidth, &Control, &State, Dx, &Tabdef,\r
-                              &InClass, &ssa);\r
-    ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);\r
-    ok(ssa != NULL, "ScriptStringAnalyse pssa should not be NULL\n");\r
-\r
-    if (hr == S_OK)\r
-    {\r
-        hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled);\r
-        ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr);\r
-    }\r
-\r
-     clip_len = ScriptString_pcOutChars(ssa);\r
-     ok(*clip_len == len, "ScriptString_pcOutChars failed, got %d, expected %d\n", *clip_len, len);\r
-\r
-     order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(UINT));\r
-     hr = ScriptStringGetOrder(ssa, order);\r
-     ok(hr == S_OK, "ScriptStringGetOrder failed, got %08x, expected S_OK\n", hr);\r
-\r
-     for (i = 0; i < *clip_len; i++) ok(order[i] == i, "%d: got %d expected %d\n", i, order[i], i);\r
-     HeapFree(GetProcessHeap(), 0, order);\r
-\r
-     hr = ScriptStringFree(&ssa);\r
-     ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);\r
-}\r
-\r
-static void test_ScriptStringXtoCP_CPtoX(HDC hdc)\r
-{\r
-/*****************************************************************************************\r
- *\r
- * This test is for the ScriptStringXtoCP and ScriptStringXtoCP functions.  Due to the\r
- * nature of the fonts between Windows and Wine, the test is implemented by generating\r
- * values using one one function then checking the output of the second.  In this way\r
- * the validity of the functions is established using Windows as a base and confirming\r
- * similar behaviour in wine.\r
- */\r
-\r
-    HRESULT         hr;\r
-    WCHAR           teststr1[] = {'T', 'e', 's', 't', 'e', '1', '2', ' ', 'a', '\0'};\r
-    void            *String = (WCHAR *) &teststr1;      /* ScriptStringAnalysis needs void */\r
-    int             String_len = (sizeof(teststr1)/sizeof(WCHAR))-1;\r
-    int             Glyphs = String_len * 2 + 16;       /* size of buffer as recommended  */\r
-    int             Charset = -1;                       /* unicode                        */\r
-    DWORD           Flags = SSA_GLYPHS;\r
-    int             ReqWidth = 100;\r
-    SCRIPT_CONTROL  Control;\r
-    SCRIPT_STATE    State;\r
-    SCRIPT_TABDEF   Tabdef;\r
-    const BYTE      InClass = 0;\r
-    SCRIPT_STRING_ANALYSIS ssa = NULL;\r
-\r
-    int             Ch;                                  /* Character position in string */\r
-    int             iTrailing;\r
-    int             Cp;                                  /* Character position in string */\r
-    int             X;\r
-    BOOL            fTrailing;\r
-\r
-    /* Test with hdc, this should be a valid test\r
-     * Here we generrate an SCRIPT_STRING_ANALYSIS that will be used as input to the\r
-     * following character positions to X and X to character position functions.\r
-     */\r
-    hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags,\r
-                              ReqWidth, &Control, &State, NULL, &Tabdef,\r
-                              &InClass, &ssa);\r
-    ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);\r
-    ok(ssa != NULL, "ScriptStringAnalyse ssa should not be NULL\n");\r
-    if  (hr == 0)\r
-    {\r
-        /*\r
-         * Loop to generate character positions to provide starting positions for the\r
-         * ScriptStringCPtoX and ScriptStringXtoCP functions\r
-         */\r
-        for (Cp = 0; Cp < String_len; Cp++)\r
-        {\r
-            /* The fTrailing flag is used to indicate whether the X being returned is at\r
-             * the beginning or the end of the character. What happens here is that if\r
-             * fTrailing indicates the end of the character, ie. FALSE, then ScriptStringXtoCP\r
-             * returns the beginning of the next character and iTrailing is FALSE.  So for this\r
-             * loop iTrailing will be FALSE in both cases.\r
-             */\r
-            fTrailing = FALSE;\r
-            hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-            ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);\r
-            hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);\r
-            ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);\r
-            ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, X);\r
-            ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", \r
-                                  iTrailing, X);\r
-            fTrailing = TRUE;\r
-            hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-            ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);\r
-            hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);\r
-            ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);\r
-\r
-            /*\r
-             * Check that character position returned by ScriptStringXtoCP in Ch matches the\r
-             * one input to ScriptStringCPtoX.  This means that the Cp to X position and back\r
-             * again works\r
-             */\r
-            ok(Cp + 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp + 1, Ch, X);\r
-            ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", \r
-                                   iTrailing, X);\r
-        }\r
-        /*\r
-         * This test is to check that if the X position is just inside the trailing edge of the\r
-         * character then iTrailing will indicate the trailing edge, ie. TRUE\r
-         */\r
-        fTrailing = TRUE;\r
-        Cp = 3;\r
-        hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-        ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);\r
-        X--;                                /* put X just inside the trailing edge */\r
-        hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);\r
-        ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);\r
-        ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, X);\r
-        ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n", \r
-                                  iTrailing, X);\r
-\r
-        /*\r
-         * This test is to check that if the X position is just outside the trailing edge of the\r
-         * character then iTrailing will indicate the leading edge, ie. FALSE, and Ch will indicate\r
-         * the next character, ie. Cp + 1 \r
-         */\r
-        fTrailing = TRUE;\r
-        Cp = 3;\r
-        hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-        ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);\r
-        X++;                                /* put X just outside the trailing edge */\r
-        hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);\r
-        ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);\r
-        ok(Cp + 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp + 1, Ch, X);\r
-        ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", \r
-                                  iTrailing, X);\r
-\r
-        /*\r
-         * This test is to check that if the X position is just outside the leading edge of the\r
-         * character then iTrailing will indicate the trailing edge, ie. TRUE, and Ch will indicate\r
-         * the next character down , ie. Cp - 1 \r
-         */\r
-        fTrailing = FALSE;\r
-        Cp = 3;\r
-        hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-        ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);\r
-        X--;                                /* put X just outside the leading edge */\r
-        hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);\r
-        ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);\r
-        ok(Cp - 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp - 1, Ch, X);\r
-        ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n", \r
-                                  iTrailing, X);\r
-\r
-        /*\r
-         * Cleanup the the SSA for the next round of tests\r
-         */\r
-        hr = ScriptStringFree(&ssa);\r
-        ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);\r
-\r
-        /*\r
-         * Test to see that exceeding the number of chars returns E_INVALIDARG.  First\r
-         * generate an SSA for the subsequent tests.\r
-         */\r
-        hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags,\r
-                                  ReqWidth, &Control, &State, NULL, &Tabdef,\r
-                                  &InClass, &ssa);\r
-        ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);\r
-\r
-        /*\r
-         * When ScriptStringCPtoX is called with a character position Cp that exceeds the\r
-         * string length, return E_INVALIDARG.  This also invalidates the ssa so a \r
-         * ScriptStringFree should also fail.\r
-         */\r
-        fTrailing = FALSE;\r
-        Cp = String_len + 1; \r
-        hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);\r
-        ok(hr == E_INVALIDARG, "ScriptStringCPtoX should return E_INVALIDARG not %08x\n", hr);\r
-\r
-        hr = ScriptStringFree(&ssa);\r
-        /*\r
-         * ScriptStringCPtoX should free ssa, hence ScriptStringFree should fail\r
-         */\r
-        ok(hr == E_INVALIDARG, "ScriptStringFree should return E_INVALIDARG not %08x\n", hr);\r
-    }\r
-}\r
-\r
-static void test_ScriptCacheGetHeight(HDC hdc)\r
-{\r
-    HRESULT hr;\r
-    SCRIPT_CACHE sc = NULL;\r
-    LONG height;\r
-\r
-    hr = ScriptCacheGetHeight(NULL, NULL, NULL);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-\r
-    hr = ScriptCacheGetHeight(NULL, &sc, NULL);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-\r
-    hr = ScriptCacheGetHeight(NULL, &sc, &height);\r
-    ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);\r
-\r
-    height = 0;\r
-\r
-    hr = ScriptCacheGetHeight(hdc, &sc, &height);\r
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);\r
-\r
-    ok(height > 0, "expected height > 0\n");\r
-}\r
-\r
-static void test_ScriptGetGlyphABCWidth(HDC hdc)\r
-{\r
-    HRESULT hr;\r
-    SCRIPT_CACHE sc = NULL;\r
-    ABC abc;\r
-\r
-    hr = ScriptGetGlyphABCWidth(NULL, NULL, 'a', NULL);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-\r
-    hr = ScriptGetGlyphABCWidth(NULL, &sc, 'a', NULL);\r
-    ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);\r
-\r
-    if (0) {    /* crashes on WinXP */\r
-    hr = ScriptGetGlyphABCWidth(hdc, &sc, 'a', NULL);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-    }\r
-\r
-    hr = ScriptGetGlyphABCWidth(hdc, &sc, 'a', &abc);\r
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);\r
-}\r
-\r
-static void test_ScriptLayout(void)\r
-{\r
-    HRESULT hr;\r
-    static const BYTE levels[][5] =\r
-    {\r
-        { 0, 0, 0, 0, 0 },\r
-        { 1, 1, 1, 1, 1 },\r
-        { 2, 2, 2, 2, 2 },\r
-        { 3, 3, 3, 3, 3 },\r
-    };\r
-    static const int expect[][5] =\r
-    {\r
-        { 0, 1, 2, 3, 4 },\r
-        { 4, 3, 2, 1, 0 },\r
-        { 0, 1, 2, 3, 4 },\r
-        { 4, 3, 2, 1, 0 }\r
-    };\r
-    int i, j, vistolog[sizeof(levels[0])], logtovis[sizeof(levels[0])];\r
-\r
-    hr = ScriptLayout(sizeof(levels[0]), NULL, vistolog, logtovis);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-\r
-    hr = ScriptLayout(sizeof(levels[0]), levels[0], NULL, NULL);\r
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);\r
-\r
-    for (i = 0; i < sizeof(levels)/sizeof(levels[0]); i++)\r
-    {\r
-        hr = ScriptLayout(sizeof(levels[0]), levels[i], vistolog, logtovis);\r
-        ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);\r
-\r
-        for (j = 0; j < sizeof(levels[i]); j++)\r
-        {\r
-            ok(expect[i][j] == vistolog[j],\r
-               "failure: levels[%d][%d] = %d, vistolog[%d] = %d\n",\r
-               i, j, levels[i][j], j, vistolog[j] );\r
-        }\r
-\r
-        for (j = 0; j < sizeof(levels[i]); j++)\r
-        {\r
-            ok(expect[i][j] == logtovis[j],\r
-               "failure: levels[%d][%d] = %d, logtovis[%d] = %d\n",\r
-               i, j, levels[i][j], j, logtovis[j] );\r
-        }\r
-    }\r
-}\r
-\r
-static const struct\r
-{\r
-    LGRPID group;\r
-    LCID lcid;\r
-    SCRIPT_DIGITSUBSTITUTE sds;\r
-    DWORD uDefaultLanguage;\r
-    DWORD fContextDigits;\r
-    WORD fDigitSubstitute;\r
-}\r
-subst_data[] =\r
-{\r
-    { 0x01, 0x00403, { 9, 3, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00406, { 9, 6, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00407, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00409, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0040a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0040b, { 9, 11, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0040c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0040f, { 9, 15, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00410, { 9, 16, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00413, { 9, 19, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00414, { 9, 20, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00416, { 9, 22, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0041d, { 9, 29, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00421, { 9, 33, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0042d, { 9, 45, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00432, { 9, 50, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00434, { 9, 52, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00435, { 9, 53, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00436, { 9, 54, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00438, { 9, 56, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0043a, { 9, 58, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0043b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0043e, { 9, 62, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00441, { 9, 65, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00452, { 9, 82, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00456, { 9, 86, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0046b, { 9, 107, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0046c, { 9, 108, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00481, { 9, 129, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00807, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00809, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0080a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0080c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00810, { 9, 16, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00813, { 9, 19, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00814, { 9, 20, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00816, { 9, 22, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0081d, { 9, 29, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0083b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0083e, { 9, 62, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0086b, { 9, 107, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c07, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c09, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c0a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c0c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c3b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x00c6b, { 9, 107, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01007, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01009, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0100a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0100c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0103b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01407, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01409, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0140a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0140c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0143b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01809, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0180a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0180c, { 9, 12, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0183b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01c09, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01c0a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x01c3b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x02009, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0200a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0203b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x02409, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0240a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0243b, { 9, 59, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x02809, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0280a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x02c09, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x02c0a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x03009, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0300a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x03409, { 9, 9, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0340a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0380a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x03c0a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0400a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0440a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0480a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x04c0a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x0500a, { 9, 10, 1, 0 }, 9, 0, 0 },\r
-    { 0x01, 0x10407, { 9, 7, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x00405, { 9, 5, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0040e, { 9, 14, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x00415, { 9, 21, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x00418, { 9, 24, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0041a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0041b, { 9, 27, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0041c, { 9, 28, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x00424, { 9, 36, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0081a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0101a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0141a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x0181a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x02, 0x1040e, { 9, 14, 1, 0 }, 9, 0, 0 },\r
-    { 0x03, 0x00425, { 9, 37, 1, 0 }, 9, 0, 0 },\r
-    { 0x03, 0x00426, { 9, 38, 1, 0 }, 9, 0, 0 },\r
-    { 0x03, 0x00427, { 9, 39, 1, 0 }, 9, 0, 0 },\r
-    { 0x04, 0x00408, { 9, 8, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00402, { 9, 2, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00419, { 9, 25, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00422, { 9, 34, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00423, { 9, 35, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x0042f, { 9, 47, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x0043f, { 9, 63, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00440, { 9, 64, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00444, { 9, 68, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00450, { 9, 80, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x0082c, { 9, 44, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00843, { 9, 67, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x00c1a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x05, 0x01c1a, { 9, 26, 1, 0 }, 9, 0, 0 },\r
-    { 0x06, 0x0041f, { 9, 31, 1, 0 }, 9, 0, 0 },\r
-    { 0x06, 0x0042c, { 9, 44, 1, 0 }, 9, 0, 0 },\r
-    { 0x06, 0x00443, { 9, 67, 1, 0 }, 9, 0, 0 },\r
-    { 0x07, 0x00411, { 9, 17, 1, 0 }, 9, 0, 0 },\r
-    { 0x08, 0x00412, { 9, 18, 1, 0 }, 9, 0, 0 },\r
-    { 0x09, 0x00404, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x09, 0x00c04, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x09, 0x01404, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x09, 0x21404, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x09, 0x30404, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x0a, 0x00804, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x0a, 0x01004, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x0a, 0x20804, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x0a, 0x21004, { 9, 4, 1, 0 }, 9, 0, 0 },\r
-    { 0x0b, 0x0041e, { 9, 30, 1, 0 }, 9, 0, 0 },\r
-    { 0x0c, 0x0040d, { 9, 13, 1, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00401, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00420, { 9, 32, 1, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00429, { 41, 41, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x0045a, { 9, 90, 1, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00465, { 9, 101, 1, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00801, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x00c01, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x01001, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x01401, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x01801, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x01c01, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x02001, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x02401, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x02801, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x02c01, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x03001, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x03401, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x03801, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x03c01, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0d, 0x04001, { 1, 1, 0, 0 }, 9, 0, 0 },\r
-    { 0x0e, 0x0042a, { 9, 42, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x00439, { 9, 57, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x00446, { 9, 70, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x00447, { 9, 71, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x00449, { 9, 73, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x0044a, { 9, 74, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x0044b, { 9, 75, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x0044e, { 9, 78, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x0044f, { 9, 79, 1, 0 }, 9, 0, 0 },\r
-    { 0x0f, 0x00457, { 9, 87, 1, 0 }, 9, 0, 0 },\r
-    { 0x10, 0x00437, { 9, 55, 1, 0 }, 9, 0, 0 },\r
-    { 0x10, 0x10437, { 9, 55, 1, 0 }, 9, 0, 0 },\r
-    { 0x11, 0x0042b, { 9, 43, 1, 0 }, 9, 0, 0 }\r
-};\r
-\r
-static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR lparam)\r
-{\r
-    HRESULT hr;\r
-    SCRIPT_DIGITSUBSTITUTE sds;\r
-    SCRIPT_CONTROL sc;\r
-    SCRIPT_STATE ss;\r
-    LCID lcid_old;\r
-    unsigned int i;\r
-\r
-    if (!IsValidLocale(lcid, LCID_INSTALLED)) return TRUE;\r
-\r
-    memset(&sds, 0, sizeof(sds));\r
-    memset(&sc, 0, sizeof(sc));\r
-    memset(&ss, 0, sizeof(ss));\r
-\r
-    lcid_old = GetThreadLocale();\r
-    if (!SetThreadLocale(lcid)) return TRUE;\r
-\r
-    hr = ScriptRecordDigitSubstitution(lcid, &sds);\r
-    ok(hr == S_OK, "ScriptRecordDigitSubstitution failed: 0x%08x\n", hr);\r
-\r
-    hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);\r
-    ok(hr == S_OK, "ScriptApplyDigitSubstitution failed: 0x%08x\n", hr);\r
-\r
-    for (i = 0; i < sizeof(subst_data)/sizeof(subst_data[0]); i++)\r
-    {\r
-        if (group == subst_data[i].group && lcid == subst_data[i].lcid)\r
-        {\r
-            ok(!memcmp(&sds, &subst_data[i].sds, sizeof(sds)),\r
-               "substitution data does not match\n");\r
-\r
-            ok(sc.uDefaultLanguage == subst_data[i].uDefaultLanguage,\r
-               "sc.uDefaultLanguage does not match\n");\r
-            ok(sc.fContextDigits == subst_data[i].fContextDigits,\r
-               "sc.fContextDigits does not match\n");\r
-            ok(ss.fDigitSubstitute == subst_data[i].fDigitSubstitute,\r
-               "ss.fDigitSubstitute does not match\n");\r
-        }\r
-    }\r
-    SetThreadLocale(lcid_old);\r
-    return TRUE;\r
-}\r
-\r
-static void test_digit_substitution(void)\r
-{\r
-    BOOL ret;\r
-    unsigned int i;\r
-    static const LGRPID groups[] =\r
-    {\r
-        LGRPID_WESTERN_EUROPE,\r
-        LGRPID_CENTRAL_EUROPE,\r
-        LGRPID_BALTIC,\r
-        LGRPID_GREEK,\r
-        LGRPID_CYRILLIC,\r
-        LGRPID_TURKISH,\r
-        LGRPID_JAPANESE,\r
-        LGRPID_KOREAN,\r
-        LGRPID_TRADITIONAL_CHINESE,\r
-        LGRPID_SIMPLIFIED_CHINESE,\r
-        LGRPID_THAI,\r
-        LGRPID_HEBREW,\r
-        LGRPID_ARABIC,\r
-        LGRPID_VIETNAMESE,\r
-        LGRPID_INDIC,\r
-        LGRPID_GEORGIAN,\r
-        LGRPID_ARMENIAN\r
-    };\r
-    HMODULE hKernel32;\r
-    static BOOL (WINAPI * pEnumLanguageGroupLocalesA)(LANGGROUPLOCALE_ENUMPROC,LGRPID,DWORD,LONG_PTR);\r
-\r
-    hKernel32 = GetModuleHandleA("kernel32.dll");\r
-    pEnumLanguageGroupLocalesA = (void*)GetProcAddress(hKernel32, "EnumLanguageGroupLocalesA");\r
-\r
-    if (!pEnumLanguageGroupLocalesA)\r
-    {\r
-        trace("EnumLanguageGroupLocalesA not available on this platform\n");\r
-        return;\r
-    }\r
-\r
-    for (i = 0; i < sizeof(groups)/sizeof(groups[0]); i++)\r
-    {\r
-        ret = pEnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0);\r
-        ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError());\r
-    }\r
-}\r
-\r
-static void test_ScriptGetProperties(void)\r
-{\r
-    const SCRIPT_PROPERTIES **props;\r
-    HRESULT hr;\r
-    int num;\r
-\r
-    hr = ScriptGetProperties(NULL, NULL);\r
-    ok(hr == E_INVALIDARG, "ScriptGetProperties succeeded\n");\r
-\r
-    hr = ScriptGetProperties(NULL, &num);\r
-    ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);\r
-\r
-    hr = ScriptGetProperties(&props, NULL);\r
-    ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);\r
-\r
-    hr = ScriptGetProperties(&props, &num);\r
-    ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);\r
-}\r
-\r
-START_TEST(usp10)\r
-{\r
-    HWND            hwnd;\r
-    HDC             hdc;\r
-    LOGFONTA        lf;\r
-    HFONT           hfont;\r
-\r
-    unsigned short  pwOutGlyphs[256];\r
-\r
-    /* We need a valid HDC to drive a lot of Script functions which requires the following    *\r
-     * to set up for the tests.                                                               */\r
-    hwnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,\r
-                           0, 0, 0, NULL);\r
-    // FIXME do wine assert\r
-    //assert(hwnd != 0);\r
-    ShowWindow(hwnd, SW_SHOW);\r
-    UpdateWindow(hwnd);\r
-\r
-    hdc = GetDC(hwnd);                                      /* We now have a hdc             */\r
-    ok( hdc != NULL, "HDC failed to be created %p\n", hdc);\r
-\r
-    memset(&lf, 0, sizeof(HFONT));\r
-    lstrcpyA(lf.lfFaceName, "Symbol");\r
-    lf.lfHeight = 10;\r
-    lf.lfWeight = 3;\r
-    lf.lfWidth = 10;\r
-\r
-    hfont = SelectObject(hdc, CreateFontIndirectA(&lf));\r
-\r
-    test_ScriptItemIzeShapePlace(hdc,pwOutGlyphs);\r
-    test_ScriptGetCMap(hdc, pwOutGlyphs);\r
-    test_ScriptCacheGetHeight(hdc);\r
-    test_ScriptGetGlyphABCWidth(hdc);\r
-\r
-    test_ScriptGetFontProperties(hdc);\r
-    test_ScriptTextOut(hdc);\r
-    test_ScriptXtoX();\r
-    test_ScriptString(hdc);\r
-    test_ScriptStringXtoCP_CPtoX(hdc);\r
-\r
-    test_ScriptLayout();\r
-    test_digit_substitution();\r
-    test_ScriptGetProperties();\r
-\r
-    ReleaseDC(hwnd, hdc);\r
-    DestroyWindow(hwnd);\r
-}\r