Commit 258f83de authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

usp10/tests: Build without -DWINE_NO_LONG_TYPES.

parent f1ea8a4a
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = usp10.dll TESTDLL = usp10.dll
IMPORTS = usp10 user32 gdi32 IMPORTS = usp10 user32 gdi32
......
...@@ -82,7 +82,7 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString, ...@@ -82,7 +82,7 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString,
else else
hr = ScriptItemize(string, cchString, 15, Control, State, outpItems, &outnItems); hr = ScriptItemize(string, cchString, 15, Control, State, outpItems, &outnItems);
winetest_ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (nItemsBroken && (broken(nItemsBroken[0] == outnItems) || broken(nItemsBroken[1] == outnItems))) if (nItemsBroken && (broken(nItemsBroken[0] == outnItems) || broken(nItemsBroken[1] == outnItems)))
{ {
winetest_win_skip("This test broken on this platform: nitems %d\n", outnItems); winetest_win_skip("This test broken on this platform: nitems %d\n", outnItems);
...@@ -123,9 +123,9 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString, ...@@ -123,9 +123,9 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString,
if (pScriptItemizeOpenType) if (pScriptItemizeOpenType)
{ {
if (items[x].isBroken && broken(tags[x] == items[x].broken_value[5])) if (items[x].isBroken && broken(tags[x] == items[x].broken_value[5]))
winetest_win_skip("This test broken on this platform: item %d Script Tag %x\n", x, tags[x]); winetest_win_skip("This test broken on this platform: item %d Script Tag %lx\n", x, tags[x]);
else todo_wine_if (items[x].todo_flag[5]) else todo_wine_if (items[x].todo_flag[5])
winetest_ok(tags[x] == items[x].scriptTag,"%i:Incorrect Script Tag %x != %x\n",x,tags[x],items[x].scriptTag); winetest_ok(tags[x] == items[x].scriptTag,"%i:Incorrect Script Tag %lx != %lx\n",x,tags[x],items[x].scriptTag);
} }
} }
...@@ -950,7 +950,7 @@ static void test_ScriptItemize_surrogates(void) ...@@ -950,7 +950,7 @@ static void test_ScriptItemize_surrogates(void)
/* Find Script_Surrogates */ /* Find Script_Surrogates */
surrogate[0] = 0xd800; surrogate[0] = 0xd800;
hr = ScriptItemize( surrogate, 1, 2, NULL, NULL, items, &num ); hr = ScriptItemize( surrogate, 1, 2, NULL, NULL, items, &num );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "Unexpected hr %#lx.\n", hr );
ok( num == 1, "got %d\n", num ); ok( num == 1, "got %d\n", num );
ok( items[0].a.eScript != SCRIPT_UNDEFINED, "got script %x\n", items[0].a.eScript ); ok( items[0].a.eScript != SCRIPT_UNDEFINED, "got script %x\n", items[0].a.eScript );
Script_Surrogates = items[0].a.eScript; Script_Surrogates = items[0].a.eScript;
...@@ -958,7 +958,7 @@ static void test_ScriptItemize_surrogates(void) ...@@ -958,7 +958,7 @@ static void test_ScriptItemize_surrogates(void)
/* Show that an invalid character has script Script_Surrogates */ /* Show that an invalid character has script Script_Surrogates */
make_surrogate( 0x01ffff, surrogate ); make_surrogate( 0x01ffff, surrogate );
hr = ScriptItemize( surrogate, 2, 2, NULL, NULL, items, &num ); hr = ScriptItemize( surrogate, 2, 2, NULL, NULL, items, &num );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "Unexpected hr %#lx.\n", hr );
ok( num == 1, "got %d\n", num ); ok( num == 1, "got %d\n", num );
ok( items[0].a.eScript == Script_Surrogates, "got script %x\n", items[0].a.eScript ); ok( items[0].a.eScript == Script_Surrogates, "got script %x\n", items[0].a.eScript );
} }
...@@ -985,13 +985,13 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, ...@@ -985,13 +985,13 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
ULONG tags[15]; ULONG tags[15];
hr = ScriptGetProperties(&script_properties, &script_count); hr = ScriptGetProperties(&script_properties, &script_count);
winetest_ok(SUCCEEDED(hr), "Failed to get script properties, hr %#x.\n", hr); winetest_ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
hr = pScriptItemizeOpenType(string, cchString, 15, Control, State, outpItems, tags, &outnItems); hr = pScriptItemizeOpenType(string, cchString, 15, Control, State, outpItems, tags, &outnItems);
if (valid > 0) if (valid > 0)
winetest_ok(hr == S_OK, "ScriptItemizeOpenType should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
else if (hr != S_OK) else if (hr != S_OK)
winetest_trace("ScriptItemizeOpenType should return S_OK not %08x\n", hr); winetest_trace("ScriptItemizeOpenType returned %#lx.\n", hr);
if (outnItems <= item) if (outnItems <= item)
{ {
...@@ -1025,9 +1025,9 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, ...@@ -1025,9 +1025,9 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
outpItems[item].a.fLogicalOrder); outpItems[item].a.fLogicalOrder);
hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, string, cchString, maxGlyphs, logclust, charProp, glyphs, glyphProp, &outnGlyphs); hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, string, cchString, maxGlyphs, logclust, charProp, glyphs, glyphProp, &outnGlyphs);
if (valid > 0) if (valid > 0)
winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n",hr);
else if (hr != S_OK) else if (hr != S_OK)
winetest_trace("ScriptShapeOpenType failed (%x)\n",hr); winetest_trace("ScriptShapeOpenType failed hr %#lx.\n",hr);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
...@@ -1097,7 +1097,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, ...@@ -1097,7 +1097,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
outpItems[item].a.fLogicalOrder = 1; outpItems[item].a.fLogicalOrder = 1;
hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
string, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2); string, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n",hr);
/* Cluster maps are hard. */ /* Cluster maps are hard. */
if (tags[item] != thaa_tag && tags[item] != syrc_tag) if (tags[item] != thaa_tag && tags[item] != syrc_tag)
{ {
...@@ -1150,7 +1150,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, ...@@ -1150,7 +1150,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
outpItems[item].a.fRTL = !outpItems[item].a.fRTL; outpItems[item].a.fRTL = !outpItems[item].a.fRTL;
hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2); string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n",hr);
for (x = 0; x < cchString; ++x) for (x = 0; x < cchString; ++x)
{ {
unsigned int compare_idx = cchString - x - 1; unsigned int compare_idx = cchString - x - 1;
...@@ -1182,7 +1182,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, ...@@ -1182,7 +1182,7 @@ static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
outpItems[item].a.fLogicalOrder = 1; outpItems[item].a.fLogicalOrder = 1;
hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2); string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n",hr);
for (x = 0; x < cchString; ++x) for (x = 0; x < cchString; ++x)
{ {
unsigned int compare_idx = outpItems[item].a.fRTL ? x : cchString - x - 1; unsigned int compare_idx = outpItems[item].a.fRTL ? x : cchString - x - 1;
...@@ -1649,23 +1649,22 @@ static void test_ScriptShapeOpenType(HDC hdc) ...@@ -1649,23 +1649,22 @@ static void test_ScriptShapeOpenType(HDC hdc)
memset(&State, 0 , sizeof(State)); memset(&State, 0 , sizeof(State));
hr = pScriptItemizeOpenType(test1, 4, 2, &Control, &State, items, tags, &outnItems); hr = pScriptItemizeOpenType(test1, 4, 2, &Control, &State, items, tags, &outnItems);
ok(hr == S_OK, "ScriptItemizeOpenType should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, NULL, &nb); hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, NULL, &nb);
ok(hr == E_INVALIDARG, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, NULL); hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, NULL);
ok(hr == E_INVALIDARG, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = pScriptShapeOpenType(NULL, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, &nb); hr = pScriptShapeOpenType(NULL, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, &nb);
ok(hr == E_INVALIDARG, "ScriptShapeOpenType should return E_PENDING not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, &nb); hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, NULL, NULL, glyphs, glyphProp, &nb);
ok( hr == E_INVALIDARG, ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
"ScriptShapeOpenType should return E_FAIL or E_INVALIDARG, not %08x\n", hr);
hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, logclust, NULL, glyphs, glyphProp, &nb); hr = pScriptShapeOpenType(hdc, &sc, &items[0].a, tags[0], 0x00000000, NULL, NULL, 0, test1, 4, 4, logclust, NULL, glyphs, glyphProp, &nb);
ok(hr == E_INVALIDARG, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ScriptFreeCache(&sc); ScriptFreeCache(&sc);
...@@ -1842,31 +1841,31 @@ static void test_ScriptShape(HDC hdc) ...@@ -1842,31 +1841,31 @@ static void test_ScriptShape(HDC hdc)
int nb, i, j; int nb, i, j;
hr = ScriptItemize(test1, 4, 2, NULL, NULL, items, NULL); hr = ScriptItemize(test1, 4, 2, NULL, NULL, items, NULL);
ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, NULL, &nb); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, NULL, &nb);
ok(hr == E_INVALIDARG, "ScriptShape should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, NULL); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, NULL);
ok(hr == E_INVALIDARG, "ScriptShape should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptShape(NULL, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, &nb); hr = ScriptShape(NULL, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, &nb);
ok(hr == E_PENDING, "ScriptShape should return E_PENDING not %08x\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, &nb); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, &nb);
ok(broken(hr == S_OK) || ok(broken(hr == S_OK) ||
hr == E_INVALIDARG || /* Vista, W2K8 */ hr == E_INVALIDARG || /* Vista, W2K8 */
hr == E_FAIL, /* WIN7 */ hr == E_FAIL, /* WIN7 */
"ScriptShape should return E_FAIL or E_INVALIDARG, not %08x\n", hr); "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptShape(hdc, &sc2, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc2, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 == sc, "caches %p, %p not identical\n", sc, sc2); ok(sc2 == sc, "caches %p, %p not identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
...@@ -1874,7 +1873,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -1874,7 +1873,7 @@ static void test_ScriptShape(HDC hdc)
memset(logclust,-1,sizeof(logclust)); memset(logclust,-1,sizeof(logclust));
memset(attrs,-1,sizeof(attrs)); memset(attrs,-1,sizeof(attrs));
hr = ScriptShape(NULL, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(NULL, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nb == 4, "Wrong number of items\n"); ok(nb == 4, "Wrong number of items\n");
ok(logclust[0] == 0, "clusters out of order\n"); ok(logclust[0] == 0, "clusters out of order\n");
ok(logclust[1] == 1, "clusters out of order\n"); ok(logclust[1] == 1, "clusters out of order\n");
...@@ -1908,7 +1907,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -1908,7 +1907,7 @@ static void test_ScriptShape(HDC hdc)
GetGlyphIndicesW(hdc, test2, 4, glyphs3, 0); GetGlyphIndicesW(hdc, test2, 4, glyphs3, 0);
hr = ScriptShape(hdc, &sc, test2, 4, 4, &items[0].a, glyphs2, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, test2, 4, 4, &items[0].a, glyphs2, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nb == 4, "Wrong number of items\n"); ok(nb == 4, "Wrong number of items\n");
ok(glyphs2[0] == glyphs3[0], "Incorrect glyph for 0x202B\n"); ok(glyphs2[0] == glyphs3[0], "Incorrect glyph for 0x202B\n");
ok(glyphs2[3] == glyphs3[3], "Incorrect glyph for 0x202C\n"); ok(glyphs2[3] == glyphs3[3], "Incorrect glyph for 0x202C\n");
...@@ -1939,7 +1938,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -1939,7 +1938,7 @@ static void test_ScriptShape(HDC hdc)
memset(logclust,-1,sizeof(logclust)); memset(logclust,-1,sizeof(logclust));
memset(attrs,-1,sizeof(attrs)); memset(attrs,-1,sizeof(attrs));
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs2, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs2, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nb == 4, "Wrong number of items\n"); ok(nb == 4, "Wrong number of items\n");
ok(glyphs2[0] == glyphs[3], "Glyphs not reordered properly\n"); ok(glyphs2[0] == glyphs[3], "Glyphs not reordered properly\n");
ok(glyphs2[1] == glyphs[2], "Glyphs not reordered properly\n"); ok(glyphs2[1] == glyphs[2], "Glyphs not reordered properly\n");
...@@ -2011,10 +2010,10 @@ static void test_ScriptShape(HDC hdc) ...@@ -2011,10 +2010,10 @@ static void test_ScriptShape(HDC hdc)
} }
hr = ScriptItemize(space, 1, 2, NULL, NULL, items, NULL); hr = ScriptItemize(space, 1, 2, NULL, NULL, items, NULL);
ok(hr == S_OK, "%s: expected S_OK, got %08x\n", lf.lfFaceName, hr); ok(hr == S_OK, "%s: unexpected hr %#lx.\n", lf.lfFaceName, hr);
hr = ScriptShape(hdc, &sc, space, 1, 1, &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, space, 1, 1, &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "%s: expected S_OK, got %08x\n", lf.lfFaceName, hr); ok(hr == S_OK, "%s: unexpected hr %#lx.\n", lf.lfFaceName, hr);
ok(nb == 1, "%s: expected 1, got %d\n", lf.lfFaceName, nb); ok(nb == 1, "%s: expected 1, got %d\n", lf.lfFaceName, nb);
chars[0] = 'A'; chars[0] = 'A';
...@@ -2026,7 +2025,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -2026,7 +2025,7 @@ static void test_ScriptShape(HDC hdc)
chars[1] = c; chars[1] = c;
hr = ScriptItemize(chars, 3, 4, NULL, NULL, items, &nb); hr = ScriptItemize(chars, 3, 4, NULL, NULL, items, &nb);
ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, c, hr); ok(hr == S_OK, "%s: [%02x] unexpected hr %#lx.\n", lf.lfFaceName, c, hr);
ok(nb == test_data[j].item_count, "%s: [%02x] Got unexpected item count %d.\n", ok(nb == test_data[j].item_count, "%s: [%02x] Got unexpected item count %d.\n",
lf.lfFaceName, c, nb); lf.lfFaceName, c, nb);
item = &items[test_data[j].item]; item = &items[test_data[j].item];
...@@ -2034,7 +2033,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -2034,7 +2033,7 @@ static void test_ScriptShape(HDC hdc)
ok(!item->a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n", ok(!item->a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
lf.lfFaceName, c, item->a.fNoGlyphIndex); lf.lfFaceName, c, item->a.fNoGlyphIndex);
hr = ScriptShape(hdc, &sc, chars, 3, 3, &item->a, glyphs2, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, chars, 3, 3, &item->a, glyphs2, logclust, attrs, &nb);
ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, c, hr); ok(hr == S_OK, "%s: [%02x] unexpected hr %#lx.\n", lf.lfFaceName, c, hr);
ok(nb == 3, "%s: [%02x] expected 3, got %d\n", lf.lfFaceName, c, nb); ok(nb == 3, "%s: [%02x] expected 3, got %d\n", lf.lfFaceName, c, nb);
ok(!item->a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n", ok(!item->a.fNoGlyphIndex, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
lf.lfFaceName, c, item->a.fNoGlyphIndex); lf.lfFaceName, c, item->a.fNoGlyphIndex);
...@@ -2047,7 +2046,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -2047,7 +2046,7 @@ static void test_ScriptShape(HDC hdc)
item->a.fNoGlyphIndex = 1; item->a.fNoGlyphIndex = 1;
hr = ScriptShape(hdc, &sc, chars, 3, 3, &item->a, glyphs2, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, chars, 3, 3, &item->a, glyphs2, logclust, attrs, &nb);
ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, c, hr); ok(hr == S_OK, "%s: [%02x] unexpected hr %#lx.\n", lf.lfFaceName, c, hr);
ok(nb == 3, "%s: [%02x] expected 1, got %d\n", lf.lfFaceName, c, nb); ok(nb == 3, "%s: [%02x] expected 1, got %d\n", lf.lfFaceName, c, nb);
if (c == 0x200b || c == 0x200c || c == 0x200d) if (c == 0x200b || c == 0x200c || c == 0x200d)
...@@ -2074,7 +2073,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -2074,7 +2073,7 @@ static void test_ScriptShape(HDC hdc)
memset(items, 0, sizeof(items)); memset(items, 0, sizeof(items));
nb = 0; nb = 0;
hr = ScriptItemize(test3, ARRAY_SIZE(test3), ARRAY_SIZE(items), NULL, NULL, items, &nb); hr = ScriptItemize(test3, ARRAY_SIZE(test3), ARRAY_SIZE(items), NULL, NULL, items, &nb);
ok(hr == S_OK, "ScriptItemize failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.eScript > 0, "Expected script id.\n"); ok(items[0].a.eScript > 0, "Expected script id.\n");
ok(nb == 1, "Unexpected number of items.\n"); ok(nb == 1, "Unexpected number of items.\n");
...@@ -2082,7 +2081,7 @@ static void test_ScriptShape(HDC hdc) ...@@ -2082,7 +2081,7 @@ static void test_ScriptShape(HDC hdc)
nb = 0; nb = 0;
hr = ScriptShape(hdc, &sc, test3, ARRAY_SIZE(test3), ARRAY_SIZE(glyphs), hr = ScriptShape(hdc, &sc, test3, ARRAY_SIZE(test3), ARRAY_SIZE(glyphs),
&items[0].a, glyphs, logclust, attrs, &nb); &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nb == 1, "Unexpected glyph count %u\n", nb); ok(nb == 1, "Unexpected glyph count %u\n", nb);
ok(glyphs[0] == 0, "Unexpected glyph id\n"); ok(glyphs[0] == 0, "Unexpected glyph id\n");
ScriptFreeCache(&sc); ScriptFreeCache(&sc);
...@@ -2107,37 +2106,37 @@ static void test_ScriptPlace(HDC hdc) ...@@ -2107,37 +2106,37 @@ static void test_ScriptPlace(HDC hdc)
TEXTMETRICW tm; TEXTMETRICW tm;
hr = ScriptItemize(test1, 4, 2, NULL, NULL, items, NULL); hr = ScriptItemize(test1, 4, 2, NULL, NULL, items, NULL);
ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptPlace(hdc, &sc, glyphs, 4, NULL, &items[0].a, widths, NULL, NULL); hr = ScriptPlace(hdc, &sc, glyphs, 4, NULL, &items[0].a, widths, NULL, NULL);
ok(hr == E_INVALIDARG, "ScriptPlace should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, NULL); hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, NULL);
ok(broken(hr == E_PENDING) || ok(broken(hr == E_PENDING) ||
hr == E_INVALIDARG || /* Vista, W2K8 */ hr == E_INVALIDARG || /* Vista, W2K8 */
hr == E_FAIL, /* WIN7 */ hr == E_FAIL, /* WIN7 */
"ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr); "Unexpected hr %#lx.\n", hr);
hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL); hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
ok(hr == E_PENDING, "ScriptPlace should return E_PENDING not %08x\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, abc); hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, abc);
ok(broken(hr == E_PENDING) || ok(broken(hr == E_PENDING) ||
hr == E_INVALIDARG || /* Vista, W2K8 */ hr == E_INVALIDARG || /* Vista, W2K8 */
hr == E_FAIL, /* WIN7 */ hr == E_FAIL, /* WIN7 */
"ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr); "Unexpected hr %#lx.\n", hr);
hr = ScriptPlace(hdc, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL); hr = ScriptPlace(hdc, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
hr = ScriptPlace(hdc, &sc2, glyphs, 4, attrs, &items[0].a, widths, offset, NULL); hr = ScriptPlace(hdc, &sc2, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 == sc, "caches %p, %p not identical\n", sc, sc2); ok(sc2 == sc, "caches %p, %p not identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
...@@ -2147,7 +2146,7 @@ static void test_ScriptPlace(HDC hdc) ...@@ -2147,7 +2146,7 @@ static void test_ScriptPlace(HDC hdc)
attrs[0].fZeroWidth = 1; attrs[0].fZeroWidth = 1;
hr = ScriptPlace(hdc, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL); hr = ScriptPlace(hdc, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(widths[0] == 0, "got width %d\n", widths[0]); ok(widths[0] == 0, "got width %d\n", widths[0]);
widths[0] = old_width; widths[0] = old_width;
} }
...@@ -2182,28 +2181,28 @@ static void test_ScriptPlace(HDC hdc) ...@@ -2182,28 +2181,28 @@ static void test_ScriptPlace(HDC hdc)
if (sz.cx > len * tm.tmAveCharWidth) if (sz.cx > len * tm.tmAveCharWidth)
{ {
hr = ScriptItemize(test2, len, 2, NULL, NULL, items, NULL); hr = ScriptItemize(test2, len, 2, NULL, NULL, items, NULL);
ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
items[0].a.fNoGlyphIndex = TRUE; items[0].a.fNoGlyphIndex = TRUE;
memset(glyphs, 'a', sizeof(glyphs)); memset(glyphs, 'a', sizeof(glyphs));
hr = ScriptShape(hdc, &sc, test2, len, ARRAY_SIZE(glyphs), &items[0].a, glyphs, logclust, attrs, &nb); hr = ScriptShape(hdc, &sc, test2, len, ARRAY_SIZE(glyphs), &items[0].a, glyphs, logclust, attrs, &nb);
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
memset(offset, 'a', sizeof(offset)); memset(offset, 'a', sizeof(offset));
memset(widths, 'a', sizeof(widths)); memset(widths, 'a', sizeof(widths));
hr = ScriptPlace(hdc, &sc, glyphs, ARRAY_SIZE(widths), attrs, &items[0].a, widths, offset, NULL); hr = ScriptPlace(hdc, &sc, glyphs, ARRAY_SIZE(widths), attrs, &items[0].a, widths, offset, NULL);
ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (total = 0, i = 0; i < nb; i++) for (total = 0, i = 0; i < nb; i++)
{ {
ok(offset[i].du == 0, "[%d] expected 0, got %d\n", i, offset[i].du); ok(offset[i].du == 0, "[%ld] expected 0, got %ld\n", i, offset[i].du);
ok(offset[i].dv == 0, "[%d] expected 0, got %d\n", i, offset[i].dv); ok(offset[i].dv == 0, "[%ld] expected 0, got %ld\n", i, offset[i].dv);
ok(widths[i] > tm.tmAveCharWidth, "[%d] expected greater than %d, got %d\n", ok(widths[i] > tm.tmAveCharWidth, "[%ld] expected greater than %ld, got %d\n",
i, tm.tmAveCharWidth, widths[i]); i, tm.tmAveCharWidth, widths[i]);
total += widths[i]; total += widths[i];
} }
ok(total == sz.cx, "expected %d, got %d\n", sz.cx, total); ok(total == sz.cx, "expected %ld, got %ld\n", sz.cx, total);
} }
else else
skip("Associated font is unavailable\n"); skip("Associated font is unavailable\n");
...@@ -2244,7 +2243,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2244,7 +2243,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
/* Verify we get a valid pointer from ScriptGetProperties(). */ /* Verify we get a valid pointer from ScriptGetProperties(). */
hr = ScriptGetProperties(&ppSp, &iMaxProps); hr = ScriptGetProperties(&ppSp, &iMaxProps);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
trace("number of script properties %d\n", iMaxProps); trace("number of script properties %d\n", iMaxProps);
ok(iMaxProps > 0, "Got unexpected script count %d.\n", iMaxProps); ok(iMaxProps > 0, "Got unexpected script count %d.\n", iMaxProps);
ok(ppSp[0]->langid == 0, "Got unexpected langid %#x.\n", ppSp[0]->langid); ok(ppSp[0]->langid == 0, "Got unexpected langid %#x.\n", ppSp[0]->langid);
...@@ -2252,7 +2251,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2252,7 +2251,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
/* This is a valid test that will cause parsing to take place. */ /* This is a valid test that will cause parsing to take place. */
cInChars = lstrlenW(TestItem1); cInChars = lstrlenW(TestItem1);
hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test is for the interim operation of ScriptItemize() where only /* This test is for the interim operation of ScriptItemize() where only
* one SCRIPT_ITEM is returned. */ * one SCRIPT_ITEM is returned. */
ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
...@@ -2263,15 +2262,15 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2263,15 +2262,15 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
psc = NULL; psc = NULL;
hr = ScriptShape(NULL, &psc, TestItem1, cInChars, cInChars, hr = ScriptShape(NULL, &psc, TestItem1, cInChars, cInChars,
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
hr = ScriptShape(hdc, &psc, TestItem1, cInChars, cInChars - 1, hr = ScriptShape(hdc, &psc, TestItem1, cInChars, cInChars - 1,
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); ok(hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
...@@ -2280,16 +2279,16 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2280,16 +2279,16 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test verifies that SCRIPT_CACHE is reused and that no translation /* This test verifies that SCRIPT_CACHE is reused and that no translation
* takes place if fNoGlyphIndex is set. */ * takes place if fNoGlyphIndex is set. */
cInChars = lstrlenW(TestItem2); cInChars = lstrlenW(TestItem2);
hr = ScriptItemize(TestItem2, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem2, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test is for the interim operation of ScriptItemize() where only /* This test is for the interim operation of ScriptItemize() where only
* one SCRIPT_ITEM is returned. */ * one SCRIPT_ITEM is returned. */
ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
...@@ -2300,7 +2299,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2300,7 +2299,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
pItem[0].a.fNoGlyphIndex = 1; /* No translation. */ pItem[0].a.fNoGlyphIndex = 1; /* No translation. */
hr = ScriptShape(NULL, &psc, TestItem2, cInChars, ARRAY_SIZE(pwOutGlyphs1), hr = ScriptShape(NULL, &psc, TestItem2, cInChars, ARRAY_SIZE(pwOutGlyphs1),
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
...@@ -2313,7 +2312,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2313,7 +2312,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
...@@ -2321,7 +2320,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2321,7 +2320,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
* script_items. */ * script_items. */
cInChars = lstrlenW(TestItem3); cInChars = lstrlenW(TestItem3);
hr = ScriptItemize(TestItem3, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem3, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(pcItems == 3, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 3, "Got unexpected item count %d.\n", pcItems);
ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
ok(pItem[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos); ok(pItem[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos);
...@@ -2333,7 +2332,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2333,7 +2332,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
* script_items. */ * script_items. */
cInChars = lstrlenW(TestItem4); cInChars = lstrlenW(TestItem4);
hr = ScriptItemize(TestItem4, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem4, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(pcItems == 5, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 5, "Got unexpected item count %d.\n", pcItems);
ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
...@@ -2352,7 +2351,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2352,7 +2351,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
/* This test is for when the first Unicode character requires BiDi support. */ /* This test is for when the first Unicode character requires BiDi support. */
hr = ScriptItemize(TestItem5, lstrlenW(TestItem5), ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem5, lstrlenW(TestItem5), ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(pcItems == 4, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 4, "Got unexpected item count %d.\n", pcItems);
ok(pItem[0].a.s.uBidiLevel == 1, "Got unexpected bidi level %u.\n", pItem[0].a.s.uBidiLevel); ok(pItem[0].a.s.uBidiLevel == 1, "Got unexpected bidi level %u.\n", pItem[0].a.s.uBidiLevel);
...@@ -2361,7 +2360,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 ...@@ -2361,7 +2360,7 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256
* often needs a greater number of SCRIPT_ITEMS to process a string than * often needs a greater number of SCRIPT_ITEMS to process a string than
* is returned in pcItems. */ * is returned in pcItems. */
hr = ScriptItemize(TestItem6, lstrlenW(TestItem6), 4, NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem6, lstrlenW(TestItem6), 4, NULL, NULL, pItem, &pcItems);
ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); ok(hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
} }
static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
...@@ -2386,36 +2385,32 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) ...@@ -2386,36 +2385,32 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
/* Some sanity checks for ScriptGetCMap */ /* Some sanity checks for ScriptGetCMap */
hr = ScriptGetCMap(NULL, NULL, NULL, 0, 0, NULL); hr = ScriptGetCMap(NULL, NULL, NULL, 0, 0, NULL);
ok( hr == E_INVALIDARG, "(NULL,NULL,NULL,0,0,NULL), " ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
"expected E_INVALIDARG, got %08x\n", hr);
hr = ScriptGetCMap(NULL, NULL, TestItem1, cInChars, dwFlags, pwOutGlyphs3); hr = ScriptGetCMap(NULL, NULL, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), " ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
"expected E_INVALIDARG, got %08x\n", hr);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */ /* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, 0, pwOutGlyphs3); hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
ok( hr == E_PENDING, "(NULL,&psc,NULL,0,0,NULL), expected E_PENDING, " ok( hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
"got %08x\n", hr);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
/* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */ /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, 0, pwOutGlyphs3); hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
ok( hr == S_OK, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, " ok (hr == S_OK, "Unexpected hr %#lx.\n", hr);
"got %08x\n", hr);
ok( psc != NULL, "ScriptGetCMap expected psc to be not NULL\n"); ok( psc != NULL, "ScriptGetCMap expected psc to be not NULL\n");
ScriptFreeCache( &psc); ScriptFreeCache( &psc);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */ /* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3); hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
ok( hr == E_PENDING, "(NULL,&psc,), expected E_PENDING, got %08x\n", hr); ok( hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
/* Check to see if the results are the same as those returned by ScriptShape */ /* Check to see if the results are the same as those returned by ScriptShape */
hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3); hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr); ok (hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {} for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {}
ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n", ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n",
...@@ -2430,9 +2425,9 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) ...@@ -2430,9 +2425,9 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
hr = ScriptGetCMap(hdc, &psc, TestItem2, cInChars, dwFlags, pwOutGlyphs3); hr = ScriptGetCMap(hdc, &psc, TestItem2, cInChars, dwFlags, pwOutGlyphs3);
if (pwOutGlyphs3[0] == 0 || pwOutGlyphs3[3] == 0) if (pwOutGlyphs3[0] == 0 || pwOutGlyphs3[3] == 0)
ok(hr == S_FALSE, "ScriptGetCMap should return S_FALSE not (%08x)\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
else else
ok(hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); ok(psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "expected glyph %d, got %d\n", pwOutGlyphs2[0], pwOutGlyphs3[0]); ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "expected glyph %d, got %d\n", pwOutGlyphs2[0], pwOutGlyphs3[0]);
...@@ -2440,14 +2435,14 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) ...@@ -2440,14 +2435,14 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
cInChars = cChars = 9; cInChars = cChars = 9;
hr = ScriptGetCMap(hdc, &psc, TestItem3b, cInChars, dwFlags, pwOutGlyphs2); hr = ScriptGetCMap(hdc, &psc, TestItem3b, cInChars, dwFlags, pwOutGlyphs2);
ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); ok(psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
cInChars = cChars = 9; cInChars = cChars = 9;
dwFlags = SGCM_RTL; dwFlags = SGCM_RTL;
hr = ScriptGetCMap(hdc, &psc, TestItem3, cInChars, dwFlags, pwOutGlyphs3); hr = ScriptGetCMap(hdc, &psc, TestItem3, cInChars, dwFlags, pwOutGlyphs3);
ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); ok(psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "glyph incorrectly altered\n"); ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "glyph incorrectly altered\n");
ok(pwOutGlyphs3[1] == pwOutGlyphs2[1], "glyph incorrectly altered\n"); ok(pwOutGlyphs3[1] == pwOutGlyphs2[1], "glyph incorrectly altered\n");
ok(pwOutGlyphs3[2] == pwOutGlyphs2[2], "glyph incorrectly altered\n"); ok(pwOutGlyphs3[2] == pwOutGlyphs2[2], "glyph incorrectly altered\n");
...@@ -2524,40 +2519,40 @@ static void test_ScriptGetFontProperties(HDC hdc) ...@@ -2524,40 +2519,40 @@ static void test_ScriptGetFontProperties(HDC hdc)
/* Some sanity checks for ScriptGetFontProperties */ /* Some sanity checks for ScriptGetFontProperties */
hr = ScriptGetFontProperties(NULL,NULL,NULL); hr = ScriptGetFontProperties(NULL,NULL,NULL);
ok( hr == E_INVALIDARG, "(NULL,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetFontProperties(NULL,NULL,&sfp); hr = ScriptGetFontProperties(NULL,NULL,&sfp);
ok( hr == E_INVALIDARG, "(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */ /* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(NULL,&psc,NULL); hr = ScriptGetFontProperties(NULL,&psc,NULL);
ok( hr == E_INVALIDARG, "(NULL,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */ /* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(NULL,&psc,&sfp); hr = ScriptGetFontProperties(NULL,&psc,&sfp);
ok( hr == E_PENDING, "(NULL,&psc,&sfp), expected E_PENDING, got %08x\n", hr); ok( hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
hr = ScriptGetFontProperties(hdc,NULL,NULL); hr = ScriptGetFontProperties(hdc,NULL,NULL);
ok( hr == E_INVALIDARG, "(hdc,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetFontProperties(hdc,NULL,&sfp); hr = ScriptGetFontProperties(hdc,NULL,&sfp);
ok( hr == E_INVALIDARG, "(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */ /* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(hdc,&psc,NULL); hr = ScriptGetFontProperties(hdc,&psc,NULL);
ok( hr == E_INVALIDARG, "(hdc,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
/* Pass an invalid sfp */ /* Pass an invalid sfp */
psc = NULL; psc = NULL;
sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES) - 1; sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES) - 1;
hr = ScriptGetFontProperties(hdc,&psc,&sfp); hr = ScriptGetFontProperties(hdc,&psc,&sfp);
ok( hr == E_INVALIDARG, "(hdc,&psc,&sfp) invalid, expected E_INVALIDARG, got %08x\n", hr); ok( hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok( psc != NULL, "Expected a pointer in psc, got NULL\n"); ok( psc != NULL, "Expected a pointer in psc, got NULL\n");
ok( sfp.cBytes == sizeof(SCRIPT_FONTPROPERTIES) - 1, "Unexpected cBytes.\n"); ok( sfp.cBytes == sizeof(SCRIPT_FONTPROPERTIES) - 1, "Unexpected cBytes.\n");
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
...@@ -2567,14 +2562,14 @@ static void test_ScriptGetFontProperties(HDC hdc) ...@@ -2567,14 +2562,14 @@ static void test_ScriptGetFontProperties(HDC hdc)
sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES); sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(hdc,&psc,&sfp); hr = ScriptGetFontProperties(hdc,&psc,&sfp);
ok( hr == S_OK, "(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x\n", hr); ok( hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok( psc != NULL, "Expected a pointer in psc, got NULL\n"); ok( psc != NULL, "Expected a pointer in psc, got NULL\n");
/* Save the psc pointer */ /* Save the psc pointer */
old_psc = psc; old_psc = psc;
/* Now a NULL hdc again */ /* Now a NULL hdc again */
hr = ScriptGetFontProperties(NULL,&psc,&sfp); hr = ScriptGetFontProperties(NULL,&psc,&sfp);
ok( hr == S_OK, "(NULL,&psc,&sfp), expected S_OK, got %08x\n", hr); ok( hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok( psc == old_psc, "Expected psc not to be changed, was %p is now %p\n", old_psc, psc); ok( psc == old_psc, "Expected psc not to be changed, was %p is now %p\n", old_psc, psc);
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
...@@ -2598,7 +2593,7 @@ static void test_ScriptGetFontProperties(HDC hdc) ...@@ -2598,7 +2593,7 @@ static void test_ScriptGetFontProperties(HDC hdc)
sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES); sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(hdc, &psc, &sfp); hr = ScriptGetFontProperties(hdc, &psc, &sfp);
ok(hr == S_OK, "ScriptGetFontProperties expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (winetest_interactive) if (winetest_interactive)
{ {
trace("bitmap font %s\n", lf.lfFaceName); trace("bitmap font %s\n", lf.lfFaceName);
...@@ -2646,7 +2641,7 @@ static void test_ScriptGetFontProperties(HDC hdc) ...@@ -2646,7 +2641,7 @@ static void test_ScriptGetFontProperties(HDC hdc)
sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES); sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
psc = NULL; psc = NULL;
hr = ScriptGetFontProperties(hdc, &psc, &sfp); hr = ScriptGetFontProperties(hdc, &psc, &sfp);
ok(hr == S_OK, "ScriptGetFontProperties expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (winetest_interactive) if (winetest_interactive)
{ {
trace("truetype font %s\n", lf.lfFaceName); trace("truetype font %s\n", lf.lfFaceName);
...@@ -2713,7 +2708,7 @@ static void test_ScriptTextOut(HDC hdc) ...@@ -2713,7 +2708,7 @@ static void test_ScriptTextOut(HDC hdc)
/* This is a valid test that will cause parsing to take place. */ /* This is a valid test that will cause parsing to take place. */
cInChars = lstrlenW(TestItem1); cInChars = lstrlenW(TestItem1);
hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test is for the interim operation of ScriptItemize() where only /* This test is for the interim operation of ScriptItemize() where only
* one SCRIPT_ITEM is returned. */ * one SCRIPT_ITEM is returned. */
ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
...@@ -2725,49 +2720,49 @@ static void test_ScriptTextOut(HDC hdc) ...@@ -2725,49 +2720,49 @@ static void test_ScriptTextOut(HDC hdc)
cInChars = 5; cInChars = 5;
hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
/* Note hdc is needed as glyph info is not yet in psc. */ /* Note hdc is needed as glyph info is not yet in psc. */
hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Get rid of psc for next test set. */ /* Get rid of psc for next test set. */
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL); hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL); hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
/* hdc is required. */ /* hdc is required. */
hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Test Rect Rgn is acceptable. */ /* Test Rect Rgn is acceptable. */
SetRect(&rect, 10, 10, 40, 20); SetRect(&rect, 10, 10, 40, 20);
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptCPtoX(1, FALSE, cInChars, pcGlyphs, pwLogClust, psva, piAdvance, &pItem[0].a, &piX); hr = ScriptCPtoX(1, FALSE, cInChars, pcGlyphs, pwLogClust, psva, piAdvance, &pItem[0].a, &piX);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptBreak(TestItem1, cInChars, &pItem[0].a, sla); hr = ScriptBreak(TestItem1, cInChars, &pItem[0].a, sla);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
...@@ -2804,7 +2799,7 @@ static void test_ScriptTextOut2(HDC hdc) ...@@ -2804,7 +2799,7 @@ static void test_ScriptTextOut2(HDC hdc)
/* This is a valid test that will cause parsing to take place. */ /* This is a valid test that will cause parsing to take place. */
cInChars = lstrlenW(TestItem1); cInChars = lstrlenW(TestItem1);
hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test is for the interim operation of ScriptItemize() where only /* This test is for the interim operation of ScriptItemize() where only
* one SCRIPT_ITEM is returned. */ * one SCRIPT_ITEM is returned. */
ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
...@@ -2815,14 +2810,14 @@ static void test_ScriptTextOut2(HDC hdc) ...@@ -2815,14 +2810,14 @@ static void test_ScriptTextOut2(HDC hdc)
psc = NULL; psc = NULL;
hr = ScriptShape(hdc2, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), hr = ScriptShape(hdc2, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
/* Note hdc is needed as glyph info is not yet in psc. */ /* Note hdc is needed as glyph info is not yet in psc. */
hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Key part! Cached DC is being deleted. */ /* Key part! Cached DC is being deleted. */
ret = DeleteDC(hdc2); ret = DeleteDC(hdc2);
...@@ -2833,7 +2828,7 @@ static void test_ScriptTextOut2(HDC hdc) ...@@ -2833,7 +2828,7 @@ static void test_ScriptTextOut2(HDC hdc)
* that DC. */ * that DC. */
hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
DeleteDC(hdc1); DeleteDC(hdc1);
...@@ -2865,7 +2860,7 @@ static void test_ScriptTextOut3(HDC hdc) ...@@ -2865,7 +2860,7 @@ static void test_ScriptTextOut3(HDC hdc)
* glyph number. */ * glyph number. */
cInChars = lstrlenW(TestItem1); cInChars = lstrlenW(TestItem1);
hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* This test is for the interim operation of ScriptItemize() where only /* This test is for the interim operation of ScriptItemize() where only
* one SCRIPT_ITEM is returned. */ * one SCRIPT_ITEM is returned. */
ok(pcItems == 2, "Got unexpected item count %d.\n", pcItems); ok(pcItems == 2, "Got unexpected item count %d.\n", pcItems);
...@@ -2877,20 +2872,20 @@ static void test_ScriptTextOut3(HDC hdc) ...@@ -2877,20 +2872,20 @@ static void test_ScriptTextOut3(HDC hdc)
psc = NULL; psc = NULL;
hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
&pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc); ok(!!psc, "Got unexpected psc %p.\n", psc);
ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
/* Note hdc is needed as glyph info is not yet in psc. */ /* Note hdc is needed as glyph info is not yet in psc. */
hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
psva, &pItem[0].a, piAdvance, pGoffset, pABC); psva, &pItem[0].a, piAdvance, pGoffset, pABC);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Test Rect Rgn is acceptable. */ /* Test Rect Rgn is acceptable. */
SetRect(&rect, 10, 10, 40, 20); SetRect(&rect, 10, 10, 40, 20);
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ScriptFreeCache(&psc); ScriptFreeCache(&psc);
ok(!psc, "Got unexpected psc %p.\n", psc); ok(!psc, "Got unexpected psc %p.\n", psc);
...@@ -2918,7 +2913,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, ...@@ -2918,7 +2913,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
winetest_ok(hr == S_OK, "ScriptXtoCP: should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
winetest_ok(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); winetest_ok(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
winetest_ok(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing); winetest_ok(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
} }
...@@ -2929,7 +2924,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, ...@@ -2929,7 +2924,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
winetest_ok(hr == S_OK, "ScriptXtoCP leading: should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
winetest_ok(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); winetest_ok(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
winetest_ok(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing); winetest_ok(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
} }
...@@ -2940,7 +2935,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, ...@@ -2940,7 +2935,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
winetest_ok(hr == S_OK, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
winetest_ok(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); winetest_ok(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
winetest_ok(piTrailing == 1, "ScriptXtoCP trailing: iX=%d should return piTrailing=1 not %d\n", iX, piTrailing); winetest_ok(piTrailing == 1, "ScriptXtoCP trailing: iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);
} }
...@@ -2951,7 +2946,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, ...@@ -2951,7 +2946,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX); hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX);
winetest_ok(hr == S_OK, "ScriptCPtoX: should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
winetest_ok(piX == offsets[iCP], winetest_ok(piX == offsets[iCP],
"ScriptCPtoX: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP], piX); "ScriptCPtoX: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP], piX);
} }
...@@ -2962,7 +2957,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, ...@@ -2962,7 +2957,7 @@ static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX); hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX);
winetest_ok(hr == S_OK, "ScriptCPtoX trailing: should return S_OK not %08x\n", hr); winetest_ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
winetest_ok(piX == offsets[iCP+1], winetest_ok(piX == offsets[iCP+1],
"ScriptCPtoX trailing: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP+1], piX); "ScriptCPtoX trailing: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP+1], piX);
} }
...@@ -2994,7 +2989,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh ...@@ -2994,7 +2989,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP: should return S_OK not %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing); ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
} }
...@@ -3009,7 +3004,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh ...@@ -3009,7 +3004,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP leading: should return S_OK not %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing); ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
} }
...@@ -3023,7 +3018,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh ...@@ -3023,7 +3018,7 @@ static void _test_caret_item_ScriptXtoCP(int line, SCRIPT_ANALYSIS *psa, int cCh
icChars = cChars; icChars = cChars;
icGlyphs = cGlyphs; icGlyphs = cGlyphs;
hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP); ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
ok_(__FILE__,line)(piTrailing == clusterSize, "ScriptXtoCP trailing: iX=%d should return piTrailing=%d not %d\n", iX, clusterSize, piTrailing); ok_(__FILE__,line)(piTrailing == clusterSize, "ScriptXtoCP trailing: iX=%d should return piTrailing=%d not %d\n", iX, clusterSize, piTrailing);
iCP = i+1; iCP = i+1;
...@@ -3068,7 +3063,7 @@ static void test_ScriptXtoX(void) ...@@ -3068,7 +3063,7 @@ static void test_ScriptXtoX(void)
sa.fRTL = FALSE; sa.fRTL = FALSE;
hr = ScriptXtoCP(-1, 10, 10, pwLogClust, psva, piAdvance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(-1, 10, 10, pwLogClust, psva, piAdvance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (piTrailing) if (piTrailing)
ok(piCP == -1, "Negative iX should return piCP=-1 not %d\n", piCP); ok(piCP == -1, "Negative iX should return piCP=-1 not %d\n", piCP);
else /* win2k3 */ else /* win2k3 */
...@@ -3079,7 +3074,7 @@ static void test_ScriptXtoX(void) ...@@ -3079,7 +3074,7 @@ static void test_ScriptXtoX(void)
WORD clust = 0; WORD clust = 0;
INT advance = 16; INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX, piCP,piTrailing); ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX, piCP,piTrailing);
} }
for (iX = 8; iX < 16; iX++) for (iX = 8; iX < 16; iX++)
...@@ -3087,13 +3082,13 @@ static void test_ScriptXtoX(void) ...@@ -3087,13 +3082,13 @@ static void test_ScriptXtoX(void)
WORD clust = 0; WORD clust = 0;
INT advance = 16; INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX, piCP,piTrailing); ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX, piCP,piTrailing);
} }
sa.fRTL = TRUE; sa.fRTL = TRUE;
hr = ScriptXtoCP(-1, 10, 10, pwLogClust_RTL, psva, piAdvance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(-1, 10, 10, pwLogClust_RTL, psva, piAdvance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (piTrailing) if (piTrailing)
ok(piCP == -1, "Negative iX should return piCP=-1 not %d\n", piCP); ok(piCP == -1, "Negative iX should return piCP=-1 not %d\n", piCP);
else /* win2k3 */ else /* win2k3 */
...@@ -3101,7 +3096,7 @@ static void test_ScriptXtoX(void) ...@@ -3101,7 +3096,7 @@ static void test_ScriptXtoX(void)
iX = 1954; iX = 1954;
hr = ScriptXtoCP(1954, 10, 10, pwLogClust_RTL, psva, piAdvance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(1954, 10, 10, pwLogClust_RTL, psva, piAdvance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP == -1, "iX=%d should return piCP=-1 not %d\n", iX, piCP); ok(piCP == -1, "iX=%d should return piCP=-1 not %d\n", iX, piCP);
ok(piTrailing == 1, "iX=%d should return piTrailing=1 not %d\n", iX, piTrailing); ok(piTrailing == 1, "iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);
...@@ -3110,7 +3105,7 @@ static void test_ScriptXtoX(void) ...@@ -3110,7 +3105,7 @@ static void test_ScriptXtoX(void)
WORD clust = 0; WORD clust = 0;
INT advance = 16; INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP() failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX,piCP,piTrailing); ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX,piCP,piTrailing);
} }
for (iX = 9; iX < 16; iX++) for (iX = 9; iX < 16; iX++)
...@@ -3118,7 +3113,7 @@ static void test_ScriptXtoX(void) ...@@ -3118,7 +3113,7 @@ static void test_ScriptXtoX(void)
WORD clust = 0; WORD clust = 0;
INT advance = 16; INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP() failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX,piCP,piTrailing); ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX,piCP,piTrailing);
} }
...@@ -3130,7 +3125,7 @@ static void test_ScriptXtoX(void) ...@@ -3130,7 +3125,7 @@ static void test_ScriptXtoX(void)
/* Get thai eScript, This will do LTR and fNeedsCaretInfo */ /* Get thai eScript, This will do LTR and fNeedsCaretInfo */
hr = ScriptItemize(thaiW, 1, 2, NULL, NULL, items, &i); hr = ScriptItemize(thaiW, 1, 2, NULL, NULL, items, &i);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(i == 1, "got %d\n", i); ok(i == 1, "got %d\n", i);
sa = items[0].a; sa = items[0].a;
...@@ -3138,7 +3133,7 @@ static void test_ScriptXtoX(void) ...@@ -3138,7 +3133,7 @@ static void test_ScriptXtoX(void)
/* Get hebrew eScript, This will do RTL and fNeedsCaretInfo */ /* Get hebrew eScript, This will do RTL and fNeedsCaretInfo */
hr = ScriptItemize(hebrW, 1, 2, NULL, NULL, items, &i); hr = ScriptItemize(hebrW, 1, 2, NULL, NULL, items, &i);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(i == 1, "got %d\n", i); ok(i == 1, "got %d\n", i);
sa = items[0].a; sa = items[0].a;
...@@ -3149,7 +3144,7 @@ static void test_ScriptXtoX(void) ...@@ -3149,7 +3144,7 @@ static void test_ScriptXtoX(void)
{ {
test_caret_item_ScriptXtoCP(&sa, 17, 15, offsets_3_RTL, pwLogClust_3_RTL, piAdvance_3); test_caret_item_ScriptXtoCP(&sa, 17, 15, offsets_3_RTL, pwLogClust_3_RTL, piAdvance_3);
hr = ScriptXtoCP(0, 17, 15, pwLogClust_3_RTL, psva, piAdvance_3, &sa, &piCP, &piTrailing); hr = ScriptXtoCP(0, 17, 15, pwLogClust_3_RTL, psva, piAdvance_3, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP: should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(piCP == 16, "ScriptXtoCP: iX=0 should return piCP=16 not %d\n", piCP); ok(piCP == 16, "ScriptXtoCP: iX=0 should return piCP=16 not %d\n", piCP);
ok(piTrailing == 1, "ScriptXtoCP: iX=0 should return piTrailing=1 not %d\n", piTrailing); ok(piTrailing == 1, "ScriptXtoCP: iX=0 should return piTrailing=1 not %d\n", piTrailing);
} }
...@@ -3190,34 +3185,34 @@ static void test_ScriptString(HDC hdc) ...@@ -3190,34 +3185,34 @@ static void test_ScriptString(HDC hdc)
/* Test without hdc to get E_PENDING. */ /* Test without hdc to get E_PENDING. */
hr = ScriptStringAnalyse(NULL, teststr, len, Glyphs, -1, hr = ScriptStringAnalyse(NULL, teststr, len, Glyphs, -1,
Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
/* Test that 0 length string returns E_INVALIDARG. */ /* Test that 0 length string returns E_INVALIDARG. */
hr = ScriptStringAnalyse(hdc, teststr, 0, Glyphs, -1, hr = ScriptStringAnalyse(hdc, teststr, 0, Glyphs, -1,
Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Test with hdc, this should be a valid test. */ /* Test with hdc, this should be a valid test. */
hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1, hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1,
Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ScriptStringFree(&ssa); ScriptStringFree(&ssa);
/* Test makes sure that a call with a valid pssa still works. */ /* Test makes sure that a call with a valid pssa still works. */
hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1, hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1,
Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!ssa, "Got unexpected ssa %p.\n", ssa); ok(!!ssa, "Got unexpected ssa %p.\n", ssa);
hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled); hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
clip_len = ScriptString_pcOutChars(ssa); clip_len = ScriptString_pcOutChars(ssa);
ok(*clip_len == len, "Got unexpected *clip_len %d, expected %d.\n", *clip_len, len); ok(*clip_len == len, "Got unexpected *clip_len %d, expected %d.\n", *clip_len, len);
order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(*order)); order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(*order));
hr = ScriptStringGetOrder(ssa, order); hr = ScriptStringGetOrder(ssa, order);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < *clip_len; ++i) for (i = 0; i < *clip_len; ++i)
{ {
...@@ -3226,7 +3221,7 @@ static void test_ScriptString(HDC hdc) ...@@ -3226,7 +3221,7 @@ static void test_ScriptString(HDC hdc)
HeapFree(GetProcessHeap(), 0, order); HeapFree(GetProcessHeap(), 0, order);
hr = ScriptStringFree(&ssa); hr = ScriptStringFree(&ssa);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
/* Test ScriptStringXtoCP() and ScriptStringCPtoX(). Since fonts may differ /* Test ScriptStringXtoCP() and ScriptStringCPtoX(). Since fonts may differ
...@@ -3254,7 +3249,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3254,7 +3249,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1, hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1,
SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa); SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa);
ok(hr == S_OK || broken(hr == E_INVALIDARG) /* NT */, ok(hr == S_OK || broken(hr == E_INVALIDARG) /* NT */,
"Got unexpected hr %08x.\n", hr); "Got unexpected hr %#lx.\n", hr);
if (hr != S_OK) if (hr != S_OK)
return; return;
ok(!!ssa, "Got unexpected ssa %p.\n", ssa); ok(!!ssa, "Got unexpected ssa %p.\n", ssa);
...@@ -3270,9 +3265,9 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3270,9 +3265,9 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
* character and iTrailing is FALSE. So for this loop iTrailing will * character and iTrailing is FALSE. So for this loop iTrailing will
* be FALSE in both cases. */ * be FALSE in both cases. */
hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail); hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead); hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(rtl[Cp] ? lead > trail : lead < trail, ok(rtl[Cp] ? lead > trail : lead < trail,
"Got unexpected lead %d, trail %d, for rtl[%u] %u.\n", "Got unexpected lead %d, trail %d, for rtl[%u] %u.\n",
lead, trail, Cp, rtl[Cp]); lead, trail, Cp, rtl[Cp]);
...@@ -3284,14 +3279,14 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3284,14 +3279,14 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
/* Inside the leading edge. */ /* Inside the leading edge. */
X = rtl[Cp] ? lead - 1 : lead + 1; X = rtl[Cp] ? lead - 1 : lead + 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp); ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp);
ok(!iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X); ok(!iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X);
/* Inside the trailing edge. */ /* Inside the trailing edge. */
X = rtl[Cp] ? trail + 1 : trail - 1; X = rtl[Cp] ? trail + 1 : trail - 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp); ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp);
ok(iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X); ok(iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X);
...@@ -3300,7 +3295,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3300,7 +3295,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
{ {
X = rtl[Cp] ? lead + 1 : trail + 1; X = rtl[Cp] ? lead + 1 : trail + 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == Cp + 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp + 1); ok(Ch == Cp + 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp + 1);
ok(iTrailing == !!rtl[Cp + 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n", ok(iTrailing == !!rtl[Cp + 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n",
iTrailing, X, !!rtl[Cp + 1]); iTrailing, X, !!rtl[Cp + 1]);
...@@ -3311,7 +3306,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3311,7 +3306,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
{ {
X = rtl[Cp] ? trail - 1 : lead - 1; X = rtl[Cp] ? trail - 1 : lead - 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == Cp - 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp - 1); ok(Ch == Cp - 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp - 1);
ok(iTrailing == !rtl[Cp - 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n", ok(iTrailing == !rtl[Cp - 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n",
iTrailing, X, !rtl[Cp - 1]); iTrailing, X, !rtl[Cp - 1]);
...@@ -3324,20 +3319,20 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3324,20 +3319,20 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
/* Having a leading RTL character seems to confuse usp. This looks to /* Having a leading RTL character seems to confuse usp. This looks to
* be a Windows bug we should emulate. */ * be a Windows bug we should emulate. */
hr = ScriptStringCPtoX(ssa, 0, TRUE, &X); hr = ScriptStringCPtoX(ssa, 0, TRUE, &X);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
--X; --X;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == 1, "Got unexpected Ch %d.\n", Ch); ok(Ch == 1, "Got unexpected Ch %d.\n", Ch);
ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
} }
else else
{ {
hr = ScriptStringCPtoX(ssa, 0, FALSE, &X); hr = ScriptStringCPtoX(ssa, 0, FALSE, &X);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
--X; --X;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == -1, "Got unexpected Ch %d.\n", Ch); ok(Ch == -1, "Got unexpected Ch %d.\n", Ch);
ok(iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); ok(iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
} }
...@@ -3346,34 +3341,34 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) ...@@ -3346,34 +3341,34 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
if (rtl[String_len - 1]) if (rtl[String_len - 1])
{ {
hr = ScriptStringCPtoX(ssa, String_len - 1, FALSE, &X); hr = ScriptStringCPtoX(ssa, String_len - 1, FALSE, &X);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
else else
{ {
hr = ScriptStringCPtoX(ssa, String_len - 1, TRUE, &X); hr = ScriptStringCPtoX(ssa, String_len - 1, TRUE, &X);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
++X; ++X;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Ch == String_len, "Got unexpected Ch %d, expected %d.\n", Ch, String_len); ok(Ch == String_len, "Got unexpected Ch %d, expected %d.\n", Ch, String_len);
ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
/* Cleanup the SSA for the next round of tests. */ /* Cleanup the SSA for the next round of tests. */
hr = ScriptStringFree(&ssa); hr = ScriptStringFree(&ssa);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Test to see that exceeding the number of characters returns /* Test to see that exceeding the number of characters returns
* E_INVALIDARG. First generate an SSA for the subsequent tests. */ * E_INVALIDARG. First generate an SSA for the subsequent tests. */
hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1, hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1,
SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa); SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* When ScriptStringCPtoX() is called with a character position that /* When ScriptStringCPtoX() is called with a character position that
* exceeds the string length, return E_INVALIDARG. This also invalidates * exceeds the string length, return E_INVALIDARG. This also invalidates
* the ssa so a ScriptStringFree() should also fail. */ * the ssa so a ScriptStringFree() should also fail. */
hr = ScriptStringCPtoX(ssa, String_len + 1, FALSE, &X); hr = ScriptStringCPtoX(ssa, String_len + 1, FALSE, &X);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ScriptStringFree(&ssa); ScriptStringFree(&ssa);
} }
...@@ -3401,33 +3396,33 @@ static void test_ScriptCacheGetHeight(HDC hdc) ...@@ -3401,33 +3396,33 @@ static void test_ScriptCacheGetHeight(HDC hdc)
HDC hdc2; HDC hdc2;
hr = ScriptCacheGetHeight(NULL, NULL, NULL); hr = ScriptCacheGetHeight(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptCacheGetHeight(NULL, &sc, NULL); hr = ScriptCacheGetHeight(NULL, &sc, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptCacheGetHeight(NULL, &sc, &height); hr = ScriptCacheGetHeight(NULL, &sc, &height);
ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
height = 123; height = 123;
hr = ScriptCacheGetHeight(hdc, NULL, &height); hr = ScriptCacheGetHeight(hdc, NULL, &height);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(height == 123, "Unexpected height.\n"); ok(height == 123, "Unexpected height.\n");
memset(&tm, 0, sizeof(tm)); memset(&tm, 0, sizeof(tm));
GetTextMetricsW(hdc, &tm); GetTextMetricsW(hdc, &tm);
ok(tm.tmHeight > 0, "Unexpected tmHeight %u.\n", tm.tmHeight); ok(tm.tmHeight > 0, "Unexpected tmHeight %lu.\n", tm.tmHeight);
height = 0; height = 0;
hr = ScriptCacheGetHeight(hdc, &sc, &height); hr = ScriptCacheGetHeight(hdc, &sc, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(height == tm.tmHeight, "expected height > 0\n"); ok(height == tm.tmHeight, "expected height > 0\n");
/* Try again with NULL dc. */ /* Try again with NULL dc. */
height2 = 0; height2 = 0;
hr = ScriptCacheGetHeight(NULL, &sc, &height2); hr = ScriptCacheGetHeight(NULL, &sc, &height2);
ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(height2 == height, "Unexpected height %u.\n", height2); ok(height2 == height, "Unexpected height %lu.\n", height2);
hwnd = create_test_window(); hwnd = create_test_window();
...@@ -3445,11 +3440,11 @@ static void test_ScriptCacheGetHeight(HDC hdc) ...@@ -3445,11 +3440,11 @@ static void test_ScriptCacheGetHeight(HDC hdc)
memset(&tm, 0, sizeof(tm)); memset(&tm, 0, sizeof(tm));
GetTextMetricsW(hdc2, &tm); GetTextMetricsW(hdc2, &tm);
ok(tm.tmHeight > height, "Unexpected tmHeight %u.\n", tm.tmHeight); ok(tm.tmHeight > height, "Unexpected tmHeight %lu.\n", tm.tmHeight);
height2 = 0; height2 = 0;
hr = ScriptCacheGetHeight(hdc2, &sc, &height2); hr = ScriptCacheGetHeight(hdc2, &sc, &height2);
ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(height2 == height, "Unexpected height.\n"); ok(height2 == height, "Unexpected height.\n");
SelectObject(hdc2, prev_hfont); SelectObject(hdc2, prev_hfont);
...@@ -3479,23 +3474,23 @@ static void test_ScriptGetGlyphABCWidth(HDC hdc) ...@@ -3479,23 +3474,23 @@ static void test_ScriptGetGlyphABCWidth(HDC hdc)
ok(glyph != 0, "Unexpected glyph index.\n"); ok(glyph != 0, "Unexpected glyph index.\n");
hr = ScriptGetGlyphABCWidth(NULL, NULL, glyph, NULL); hr = ScriptGetGlyphABCWidth(NULL, NULL, glyph, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, NULL); hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, NULL);
ok(broken(hr == E_PENDING) || ok(broken(hr == E_PENDING) ||
hr == E_INVALIDARG, /* WIN7 */ hr == E_INVALIDARG, /* WIN7 */
"expected E_INVALIDARG, got 0x%08x\n", hr); "Unexpected hr %#lx.\n", hr);
hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, &abc); hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, &abc);
ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
if (0) { /* crashes on WinXP */ if (0) { /* crashes on WinXP */
hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, NULL); hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
} }
hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc); hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(abc.abcB != 0, "Unexpected width.\n"); ok(abc.abcB != 0, "Unexpected width.\n");
ret = GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc2); ret = GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc2);
...@@ -3524,7 +3519,7 @@ static void test_ScriptGetGlyphABCWidth(HDC hdc) ...@@ -3524,7 +3519,7 @@ static void test_ScriptGetGlyphABCWidth(HDC hdc)
sc = NULL; sc = NULL;
hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc); hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
ok(hr == S_OK, "Failed to get glyph width, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(abc.abcB != 0, "Unexpected width.\n"); ok(abc.abcB != 0, "Unexpected width.\n");
ret = GetCharWidthI(hdc, glyph, 1, NULL, &width); ret = GetCharWidthI(hdc, glyph, 1, NULL, &width);
...@@ -3609,15 +3604,15 @@ static void test_ScriptLayout(void) ...@@ -3609,15 +3604,15 @@ static void test_ScriptLayout(void)
int i, j, vistolog[sizeof(levels[0])], logtovis[sizeof(levels[0])]; int i, j, vistolog[sizeof(levels[0])], logtovis[sizeof(levels[0])];
hr = ScriptLayout(sizeof(levels[0]), NULL, vistolog, logtovis); hr = ScriptLayout(sizeof(levels[0]), NULL, vistolog, logtovis);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptLayout(sizeof(levels[0]), levels[0], NULL, NULL); hr = ScriptLayout(sizeof(levels[0]), levels[0], NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(levels); ++i) for (i = 0; i < ARRAY_SIZE(levels); ++i)
{ {
hr = ScriptLayout(sizeof(levels[0]), levels[i], vistolog, logtovis); hr = ScriptLayout(sizeof(levels[0]), levels[i], vistolog, logtovis);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (j = 0; j < sizeof(levels[i]); j++) for (j = 0; j < sizeof(levels[i]); j++)
{ {
...@@ -3653,10 +3648,10 @@ static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR l ...@@ -3653,10 +3648,10 @@ static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR l
if (!SetThreadLocale(lcid)) return TRUE; if (!SetThreadLocale(lcid)) return TRUE;
hr = ScriptRecordDigitSubstitution(lcid, &sds); hr = ScriptRecordDigitSubstitution(lcid, &sds);
ok(hr == S_OK, "ScriptRecordDigitSubstitution failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss); hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);
ok(hr == S_OK, "ScriptApplyDigitSubstitution failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SetThreadLocale(lcid_old); SetThreadLocale(lcid_old);
return TRUE; return TRUE;
...@@ -3690,7 +3685,7 @@ static void test_digit_substitution(void) ...@@ -3690,7 +3685,7 @@ static void test_digit_substitution(void)
for (i = 0; i < ARRAY_SIZE(groups); ++i) for (i = 0; i < ARRAY_SIZE(groups); ++i)
{ {
ret = EnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0); ret = EnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0);
ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError()); ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %lu\n", GetLastError());
} }
} }
...@@ -3701,16 +3696,16 @@ static void test_ScriptGetProperties(void) ...@@ -3701,16 +3696,16 @@ static void test_ScriptGetProperties(void)
int num; int num;
hr = ScriptGetProperties(NULL, NULL); hr = ScriptGetProperties(NULL, NULL);
ok(hr == E_INVALIDARG, "ScriptGetProperties succeeded\n"); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetProperties(NULL, &num); hr = ScriptGetProperties(NULL, &num);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetProperties(&props, NULL); hr = ScriptGetProperties(&props, NULL);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptGetProperties(&props, &num); hr = ScriptGetProperties(&props, &num);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
static void test_ScriptBreak(void) static void test_ScriptBreak(void)
...@@ -3721,7 +3716,7 @@ static void test_ScriptBreak(void) ...@@ -3721,7 +3716,7 @@ static void test_ScriptBreak(void)
HRESULT hr; HRESULT hr;
hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL); hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL);
ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* /*
* This Test crashes pre Vista. * This Test crashes pre Vista.
...@@ -3731,14 +3726,14 @@ static void test_ScriptBreak(void) ...@@ -3731,14 +3726,14 @@ static void test_ScriptBreak(void)
*/ */
hr = ScriptBreak(test, 0, &items[0].a, &la); hr = ScriptBreak(test, 0, &items[0].a, &la);
ok(hr == E_FAIL || broken(hr == S_OK), "ScriptBreak should return E_FAIL not %08x\n", hr); ok(hr == E_FAIL || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr);
hr = ScriptBreak(test, -1, &items[0].a, &la); hr = ScriptBreak(test, -1, &items[0].a, &la);
ok(hr == E_INVALIDARG || broken(hr == S_OK), "ScriptBreak should return E_INVALIDARG not %08x\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr);
memset(&la, 0, sizeof(la)); memset(&la, 0, sizeof(la));
hr = ScriptBreak(test, 1, &items[0].a, &la); hr = ScriptBreak(test, 1, &items[0].a, &la);
ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!la.fSoftBreak, "fSoftBreak set\n"); ok(!la.fSoftBreak, "fSoftBreak set\n");
ok(la.fWhiteSpace, "fWhiteSpace not set\n"); ok(la.fWhiteSpace, "fWhiteSpace not set\n");
...@@ -3749,7 +3744,7 @@ static void test_ScriptBreak(void) ...@@ -3749,7 +3744,7 @@ static void test_ScriptBreak(void)
memset(&la, 0, sizeof(la)); memset(&la, 0, sizeof(la));
hr = ScriptBreak(test + 1, 1, &items[1].a, &la); hr = ScriptBreak(test + 1, 1, &items[1].a, &la);
ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!la.fSoftBreak, "fSoftBreak set\n"); ok(!la.fSoftBreak, "fSoftBreak set\n");
ok(!la.fWhiteSpace, "fWhiteSpace set\n"); ok(!la.fWhiteSpace, "fWhiteSpace set\n");
...@@ -3760,7 +3755,7 @@ static void test_ScriptBreak(void) ...@@ -3760,7 +3755,7 @@ static void test_ScriptBreak(void)
memset(&la, 0, sizeof(la)); memset(&la, 0, sizeof(la));
hr = ScriptBreak(test + 2, 1, &items[2].a, &la); hr = ScriptBreak(test + 2, 1, &items[2].a, &la);
ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!la.fSoftBreak, "fSoftBreak set\n"); ok(!la.fSoftBreak, "fSoftBreak set\n");
ok(!la.fWhiteSpace, "fWhiteSpace set\n"); ok(!la.fWhiteSpace, "fWhiteSpace set\n");
...@@ -3783,27 +3778,27 @@ static void test_newlines(void) ...@@ -3783,27 +3778,27 @@ static void test_newlines(void)
count = 0; count = 0;
hr = ScriptItemize(test1, lstrlenW(test1), 5, NULL, NULL, items, &count); hr = ScriptItemize(test1, lstrlenW(test1), 5, NULL, NULL, items, &count);
ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 3, "got %d expected 3\n", count); ok(count == 3, "got %d expected 3\n", count);
count = 0; count = 0;
hr = ScriptItemize(test2, lstrlenW(test2), 5, NULL, NULL, items, &count); hr = ScriptItemize(test2, lstrlenW(test2), 5, NULL, NULL, items, &count);
ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 3, "got %d expected 3\n", count); ok(count == 3, "got %d expected 3\n", count);
count = 0; count = 0;
hr = ScriptItemize(test3, lstrlenW(test3), 5, NULL, NULL, items, &count); hr = ScriptItemize(test3, lstrlenW(test3), 5, NULL, NULL, items, &count);
ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 4, "got %d expected 4\n", count); ok(count == 4, "got %d expected 4\n", count);
count = 0; count = 0;
hr = ScriptItemize(test4, lstrlenW(test4), 5, NULL, NULL, items, &count); hr = ScriptItemize(test4, lstrlenW(test4), 5, NULL, NULL, items, &count);
ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 4, "got %d expected 4\n", count); ok(count == 4, "got %d expected 4\n", count);
count = 0; count = 0;
hr = ScriptItemize(test5, lstrlenW(test5), 5, NULL, NULL, items, &count); hr = ScriptItemize(test5, lstrlenW(test5), 5, NULL, NULL, items, &count);
ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 4, "got %d expected 4\n", count); ok(count == 4, "got %d expected 4\n", count);
} }
...@@ -3827,22 +3822,22 @@ static void test_ScriptGetFontFunctions(HDC hdc) ...@@ -3827,22 +3822,22 @@ static void test_ScriptGetFontFunctions(HDC hdc)
} }
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL); hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count); hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, NULL); hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count); hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontScriptTags(NULL, &sc, NULL, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontScriptTags(NULL, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK || hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
if (hr == S_OK) if (hr == S_OK)
ok(count <= 5, "Got unexpected count %d.\n", count); ok(count <= 5, "Got unexpected count %d.\n", count);
else else
...@@ -3853,22 +3848,22 @@ static void test_ScriptGetFontFunctions(HDC hdc) ...@@ -3853,22 +3848,22 @@ static void test_ScriptGetFontFunctions(HDC hdc)
sc = NULL; sc = NULL;
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, NULL); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count);
ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count);
ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK || hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
if (hr == S_OK) if (hr == S_OK)
ok(count <= 5, "Got unexpected count %d.\n", count); ok(count <= 5, "Got unexpected count %d.\n", count);
else else
...@@ -3878,22 +3873,22 @@ static void test_ScriptGetFontFunctions(HDC hdc) ...@@ -3878,22 +3873,22 @@ static void test_ScriptGetFontFunctions(HDC hdc)
sc = NULL; sc = NULL;
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, NULL); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(!sc, "Got unexpected script cache %p.\n", sc); ok(!sc, "Got unexpected script cache %p.\n", sc);
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK || hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
if (hr == S_OK) if (hr == S_OK)
ok(count <= 5, "Got unexpected count %d.\n", count); ok(count <= 5, "Got unexpected count %d.\n", count);
else else
...@@ -3904,20 +3899,20 @@ static void test_ScriptGetFontFunctions(HDC hdc) ...@@ -3904,20 +3899,20 @@ static void test_ScriptGetFontFunctions(HDC hdc)
hr = ScriptItemize(test_phagspa, ARRAY_SIZE(test_phagspa), ARRAY_SIZE(items), hr = ScriptItemize(test_phagspa, ARRAY_SIZE(test_phagspa), ARRAY_SIZE(items),
&control, &state, items, &count); &control, &state, items, &count);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
memset(tags, 0, sizeof(tags)); memset(tags, 0, sizeof(tags));
hr = pScriptGetFontScriptTags(hdc, &sc, &items[0].a, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontScriptTags(hdc, &sc, &items[0].a, ARRAY_SIZE(tags), tags, &count);
ok(hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); ok(hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr);
hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, ARRAY_SIZE(tags), tags, &count);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pScriptGetFontLanguageTags(hdc, &sc, &items[0].a, dsrt_tag, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontLanguageTags(hdc, &sc, &items[0].a, dsrt_tag, ARRAY_SIZE(tags), tags, &count);
ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr);
hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pScriptGetFontFeatureTags(hdc, &sc, &items[0].a, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count); hr = pScriptGetFontFeatureTags(hdc, &sc, &items[0].a, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr);
ScriptFreeCache(&sc); ScriptFreeCache(&sc);
} }
...@@ -3967,7 +3962,7 @@ static void test_ScriptGetLogicalWidths(void) ...@@ -3967,7 +3962,7 @@ static void test_ScriptGetLogicalWidths(void)
} }
hr = ScriptGetLogicalWidths(&sa, ptr->char_count, ptr->glyph_count, ptr->advances, ptr->map, attrs, widths); hr = ScriptGetLogicalWidths(&sa, ptr->char_count, ptr->glyph_count, ptr->advances, ptr->map, attrs, widths);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine_if(ptr->todo) todo_wine_if(ptr->todo)
ok(!memcmp(ptr->widths, widths, sizeof(widths)), "test %u: got wrong widths\n", i); ok(!memcmp(ptr->widths, widths, sizeof(widths)), "test %u: got wrong widths\n", i);
...@@ -3998,42 +3993,42 @@ static void test_ScriptIsComplex(void) ...@@ -3998,42 +3993,42 @@ static void test_ScriptIsComplex(void)
HRESULT hr; HRESULT hr;
hr = ScriptIsComplex(NULL, 0, 0); hr = ScriptIsComplex(NULL, 0, 0);
ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "Unexpected hr %#lx.\n", hr);
if (hr == E_INVALIDARG) if (hr == E_INVALIDARG)
{ {
hr = ScriptIsComplex(NULL, 1, 0); hr = ScriptIsComplex(NULL, 1, 0);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
} }
hr = ScriptIsComplex(test2W, -1, SIC_ASCIIDIGIT); hr = ScriptIsComplex(test2W, -1, SIC_ASCIIDIGIT);
ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "Unexpected hr %#lx.\n", hr);
hr = ScriptIsComplex(test2W, 0, SIC_ASCIIDIGIT); hr = ScriptIsComplex(test2W, 0, SIC_ASCIIDIGIT);
ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(complex_tests); ++i) for (i = 0; i < ARRAY_SIZE(complex_tests); ++i)
{ {
hr = ScriptIsComplex(complex_tests[i].text, lstrlenW(complex_tests[i].text), complex_tests[i].flags); hr = ScriptIsComplex(complex_tests[i].text, lstrlenW(complex_tests[i].text), complex_tests[i].flags);
todo_wine_if(complex_tests[i].todo) todo_wine_if(complex_tests[i].todo)
ok(hr == complex_tests[i].hr, "%u: got %#x, expected %#x, flags %#x\n", i, hr, complex_tests[i].hr, ok(hr == complex_tests[i].hr, "%u: got %#lx, expected %#lx, flags %#lx.\n", i, hr, complex_tests[i].hr,
complex_tests[i].flags); complex_tests[i].flags);
} }
hr = ScriptIsComplex(test2W, 1, ~0u); hr = ScriptIsComplex(test2W, 1, ~0u);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptIsComplex(testW, 3, 0); hr = ScriptIsComplex(testW, 3, 0);
ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = ScriptIsComplex(testW, 3, SIC_NEUTRAL | SIC_COMPLEX); hr = ScriptIsComplex(testW, 3, SIC_NEUTRAL | SIC_COMPLEX);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptIsComplex(testW, 3, SIC_COMPLEX); hr = ScriptIsComplex(testW, 3, SIC_COMPLEX);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptIsComplex(test2W, 1, SIC_COMPLEX); hr = ScriptIsComplex(test2W, 1, SIC_COMPLEX);
ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
} }
static void test_ScriptString_pSize(HDC hdc) static void test_ScriptString_pSize(HDC hdc)
...@@ -4046,7 +4041,7 @@ static void test_ScriptString_pSize(HDC hdc) ...@@ -4046,7 +4041,7 @@ static void test_ScriptString_pSize(HDC hdc)
ABC abc; ABC abc;
hr = ScriptStringAnalyse(hdc, textW, 1, 16, -1, SSA_GLYPHS, 0, NULL, NULL, NULL, NULL, NULL, &ssa); hr = ScriptStringAnalyse(hdc, textW, 1, 16, -1, SSA_GLYPHS, 0, NULL, NULL, NULL, NULL, NULL, &ssa);
ok(hr == S_OK, "ScriptStringAnalyse failed, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
size = ScriptString_pSize(NULL); size = ScriptString_pSize(NULL);
ok(size == NULL || broken(size != NULL) /* <win7 */, "Unexpected size pointer.\n"); ok(size == NULL || broken(size != NULL) /* <win7 */, "Unexpected size pointer.\n");
...@@ -4059,11 +4054,11 @@ static void test_ScriptString_pSize(HDC hdc) ...@@ -4059,11 +4054,11 @@ static void test_ScriptString_pSize(HDC hdc)
size = ScriptString_pSize(ssa); size = ScriptString_pSize(ssa);
ok(size != NULL, "Unexpected size pointer.\n"); ok(size != NULL, "Unexpected size pointer.\n");
ok(size->cx == abc.abcA + abc.abcB + abc.abcC, "Unexpected cx size %d.\n", size->cx); ok(size->cx == abc.abcA + abc.abcB + abc.abcC, "Unexpected cx size %ld.\n", size->cx);
ok(size->cy == tm.tmHeight, "Unexpected cy size %d.\n", size->cy); ok(size->cy == tm.tmHeight, "Unexpected cy size %ld.\n", size->cy);
hr = ScriptStringFree(&ssa); hr = ScriptStringFree(&ssa);
ok(hr == S_OK, "Failed to free ssa, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
static void test_script_cache_reuse(void) static void test_script_cache_reuse(void)
...@@ -4102,13 +4097,13 @@ static void test_script_cache_reuse(void) ...@@ -4102,13 +4097,13 @@ static void test_script_cache_reuse(void)
/* Get a script cache */ /* Get a script cache */
hr = ScriptCacheGetHeight(hdc1, &sc, &height); hr = ScriptCacheGetHeight(hdc1, &sc, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc != NULL, "Script cache is NULL\n"); ok(sc != NULL, "Script cache is NULL\n");
/* Same font, same DC -> same SCRIPT_CACHE */ /* Same font, same DC -> same SCRIPT_CACHE */
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc1, &sc2, &height); hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2); ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
...@@ -4116,7 +4111,7 @@ static void test_script_cache_reuse(void) ...@@ -4116,7 +4111,7 @@ static void test_script_cache_reuse(void)
/* Same font in different DC -> same SCRIPT_CACHE */ /* Same font in different DC -> same SCRIPT_CACHE */
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc2, &sc2, &height); hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2); ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
...@@ -4127,14 +4122,14 @@ static void test_script_cache_reuse(void) ...@@ -4127,14 +4122,14 @@ static void test_script_cache_reuse(void)
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc1, &sc2, &height); hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2); ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc2, &sc2, &height); hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2); ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
...@@ -4151,14 +4146,14 @@ static void test_script_cache_reuse(void) ...@@ -4151,14 +4146,14 @@ static void test_script_cache_reuse(void)
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc1, &sc2, &height); hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2); ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
sc2 = NULL; sc2 = NULL;
hr = ScriptCacheGetHeight(hdc2, &sc2, &height); hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(sc2 != NULL, "Script cache is NULL\n"); ok(sc2 != NULL, "Script cache is NULL\n");
ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2); ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
ScriptFreeCache(&sc2); ScriptFreeCache(&sc2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment