#include <stdio.h>
#include <wine/test.h>
-#include <winnls.h>
-#include <wingdi.h>
-#include <winuser.h>
-//#include <windows.h>
+#include <windows.h>
#include <usp10.h>
typedef struct _itemTest {
SCRIPT_GLYPHPROP GlyphProp;
} shapeTest_glyph;
+typedef struct _font_fingerprint {
+ WCHAR check[10];
+ WORD result[10];
+} font_fingerprint;
+
/* Uniscribe 1.6 calls */
static HRESULT (WINAPI *pScriptItemizeOpenType)( const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, ULONG *pScriptTags, int *pcItems);
static HRESULT (WINAPI *pScriptShapeOpenType)( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, WORD *pwOutGlyphs, SCRIPT_GLYPHPROP *pOutGlyphProps, int *pcGlyphs);
-static DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
-
static HRESULT (WINAPI *pScriptGetFontScriptTags)( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags);
static HRESULT (WINAPI *pScriptGetFontLanguageTags)( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags);
static HRESULT (WINAPI *pScriptGetFontFeatureTags)( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags);
SCRIPT_CONTROL Control;
SCRIPT_STATE State;
HRESULT hr;
- HMODULE usp10;
int nItems;
- usp10 = LoadLibraryA("usp10.dll");
- ok (usp10 != 0,"Unable to LoadLibrary on usp10.dll\n");
- pScriptItemizeOpenType = (void*)GetProcAddress(usp10, "ScriptItemizeOpenType");
- pScriptShapeOpenType = (void*)GetProcAddress(usp10, "ScriptShapeOpenType");
- pGetGlyphIndicesW = (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
-
memset(&Control, 0, sizeof(Control));
memset(&State, 0, sizeof(State));
winetest_ok(SUCCEEDED(hr), "Failed to get script properties, hr %#x.\n", hr);
hr = pScriptItemizeOpenType(string, cchString, 15, Control, State, outpItems, tags, &outnItems);
- if (hr == USP_E_SCRIPT_NOT_IN_FONT)
- {
- if (valid > 0)
- winetest_win_skip("Select font does not support script\n");
- else
- winetest_trace("Select font does not support script\n");
- return;
- }
if (valid > 0)
winetest_ok(hr == S_OK, "ScriptItemizeOpenType should return S_OK not %08x\n", hr);
else if (hr != S_OK)
return 1;
}
-static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, const WCHAR check, HFONT *hfont, HFONT *origFont)
+static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, const WCHAR check, HFONT *hfont, HFONT *origFont, const font_fingerprint *fingerprint)
{
int rc = 0;
fontEnumParam lParam;
if (*hfont)
{
winetest_trace("using font %s\n",lParam.lf.lfFaceName);
- rc = 1;
+ if (fingerprint)
+ {
+ WORD output[10];
+ int i;
+
+ *origFont = SelectObject(hdc,*hfont);
+ if (GetGlyphIndicesW(hdc, fingerprint->check, 10, output, 0) != GDI_ERROR)
+ {
+ for (i=0; i < 10; i++)
+ if (output[i] != fingerprint->result[i])
+ {
+ winetest_trace("found font does not match fingerprint\n");
+ SelectObject(hdc,*origFont);
+ DeleteObject(*hfont);
+ *hfont = NULL;
+ break;
+ }
+ if (i == 10) rc = 1;
+ }
+ SelectObject(hdc, *origFont);
+ }
+ else rc = 1;
}
}
if (!rc)
WORD glyph = 0;
*origFont = SelectObject(hdc,*hfont);
- if (pGetGlyphIndicesW && (pGetGlyphIndicesW(hdc, &check, 1, &glyph, 0) == GDI_ERROR || glyph ==0))
+ if (GetGlyphIndicesW(hdc, &check, 1, &glyph, 0) == GDI_ERROR || glyph == 0)
{
winetest_trace(" Font fails to contain required glyphs\n");
SelectObject(hdc,*origFont);
return rc;
}
-#define find_font_for_range(a,b,c,d,e,f) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _find_font_for_range(a,b,c,d,e,f)
+#define find_font_for_range(a,b,c,d,e,f,g) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _find_font_for_range(a,b,c,d,e,f,g)
static void test_ScriptShapeOpenType(HDC hdc)
{
{1,{{SCRIPT_JUSTIFY_NONE,1,0,0,0,0},0}},
{1,{{SCRIPT_JUSTIFY_NONE,0,0,0,0,0},0}} };
+ static const font_fingerprint fingerprint_estrangelo = {
+ {'A','a','B','b','C','c','D','d',0,0},
+ {284,310,285,311,286,312,287,313,0,0}};
+
+
if (!pScriptItemizeOpenType || !pScriptShapeOpenType)
{
win_skip("ScriptShapeOpenType not available on this platform\n");
test_shape_ok(hdc, test2, 4, &Control, &State, 1, 4, t2_c, glyph_test);
- test_valid = find_font_for_range(hdc, "Calibri", 0, test3[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Calibri", 0, test3[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test3, 6, &Control, &State, 0, 2, t3_c, t3_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 11, test_hebrew[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 11, test_hebrew[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_hebrew, 4, &Control, &State, 0, 4, hebrew_c, hebrew_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 13, test_arabic[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 13, test_arabic[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_arabic, 4, &Control, &State, 0, 3, arabic_c, arabic_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 24, test_thai[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Microsoft Sans Serif", 24, test_thai[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_thai, 10, &Control, &State, 0, 10, thai_c, thai_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Estrangelo Edessa", 71, test_syriac[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Estrangelo Edessa", 71, test_syriac[0], &hfont, &hfont_orig, &fingerprint_estrangelo);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_syriac, 8, &Control, &State, 0, 7, syriac_c, syriac_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "MV Boli", 72, test_thaana[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "MV Boli", 72, test_thaana[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_thaana, 13, &Control, &State, 0, 13, thaana_c, thaana_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Microsoft PhagsPa", 53, test_phagspa[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Microsoft PhagsPa", 53, test_phagspa[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid_props2(test_valid, hdc, test_phagspa, 11, &Control, &State, 0, 11,
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "DokChampa", 25, test_lao[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "DokChampa", 25, test_lao[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_lao, 9, &Control, &State, 0, 9, lao_c, lao_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Microsoft Himalaya", 70, test_tibetan[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Microsoft Himalaya", 70, test_tibetan[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid_props2(test_valid, hdc, test_tibetan, 17, &Control, &State, 0, 17,
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Mangal", 15, test_devanagari[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Mangal", 15, test_devanagari[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_devanagari, 8, &Control, &State, 0, 8, devanagari_c, devanagari_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Vrinda", 16, test_bengali[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Vrinda", 16, test_bengali[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_bengali, 5, &Control, &State, 0, 5, bengali_c, bengali_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Raavi", 17, test_gurmukhi[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Raavi", 17, test_gurmukhi[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_gurmukhi, 7, &Control, &State, 0, 7, gurmukhi_c, gurmukhi_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Shruti", 18, test_gujarati[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Shruti", 18, test_gujarati[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_gujarati, 7, &Control, &State, 0, 7, gujarati_c, gujarati_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Kalinga", 19, test_oriya[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Kalinga", 19, test_oriya[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_oriya, 5, &Control, &State, 0, 4, oriya_c, oriya_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Latha", 20, test_tamil[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Latha", 20, test_tamil[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_tamil, 5, &Control, &State, 0, 4, tamil_c, tamil_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Gautami", 21, test_telugu[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Gautami", 21, test_telugu[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_telugu, 6, &Control, &State, 0, 6, telugu_c, telugu_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Kartika", 23, test_malayalam[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Kartika", 23, test_malayalam[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_malayalam, 6, &Control, &State, 0, 6, malayalam_c, malayalam_g);
DeleteObject(hfont);
}
- test_valid = find_font_for_range(hdc, "Tunga", 22, test_kannada[0], &hfont, &hfont_orig);
+ test_valid = find_font_for_range(hdc, "Tunga", 22, test_kannada[0], &hfont, &hfont_orig, NULL);
if (hfont != NULL)
{
test_shape_ok_valid(test_valid, hdc, test_kannada, 5, &Control, &State, 0, 4, kannada_c, kannada_g);
{
static const WCHAR test1[] = {'w', 'i', 'n', 'e',0};
static const WCHAR test2[] = {0x202B, 'i', 'n', 0x202C,0};
+ static const WCHAR test3[] = {0x30b7};
HRESULT hr;
SCRIPT_CACHE sc = NULL;
+ SCRIPT_CACHE sc2 = NULL;
WORD glyphs[4], glyphs2[4], logclust[4], glyphs3[4];
SCRIPT_VISATTR attrs[4];
SCRIPT_ITEM items[4];
ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
+ 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(sc2 == sc, "caches %p, %p not identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
memset(glyphs,-1,sizeof(glyphs));
memset(logclust,-1,sizeof(logclust));
chars[0] = 'A';
chars[2] = 'A';
- for (j = 0; j < sizeof(test_data) / sizeof(*test_data); ++j)
+ for (j = 0; j < ARRAY_SIZE(test_data); ++j)
{
WCHAR c = test_data[j].c;
SCRIPT_ITEM *item;
DeleteObject(SelectObject(hdc, oldfont));
ScriptFreeCache(&sc);
}
+
+ /* Text does not support this range. */
+ memset(items, 0, sizeof(items));
+ nb = 0;
+ hr = ScriptItemize(test3, ARRAY_SIZE(test3), ARRAY_SIZE(items), NULL, NULL, items, &nb);
+ ok(hr == S_OK, "ScriptItemize failed, hr %#x.\n", hr);
+ ok(items[0].a.eScript > 0, "Expected script id.\n");
+ ok(nb == 1, "Unexpected number of items.\n");
+
+ memset(glyphs, 0xff, sizeof(glyphs));
+ nb = 0;
+ hr = ScriptShape(hdc, &sc, test3, ARRAY_SIZE(test3), ARRAY_SIZE(glyphs),
+ &items[0].a, glyphs, logclust, attrs, &nb);
+ ok(hr == S_OK, "ScriptShape failed, hr %#x.\n", hr);
+ ok(nb == 1, "Unexpected glyph count %u\n", nb);
+ ok(glyphs[0] == 0, "Unexpected glyph id\n");
+ ScriptFreeCache(&sc);
}
static void test_ScriptPlace(HDC hdc)
BOOL ret;
HRESULT hr;
SCRIPT_CACHE sc = NULL;
+ SCRIPT_CACHE sc2 = NULL;
WORD glyphs[4], logclust[4];
SCRIPT_VISATTR attrs[4];
SCRIPT_ITEM items[2];
ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr);
ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
+ 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(sc2 == sc, "caches %p, %p not identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
if (widths[0] != 0)
{
int old_width = widths[0];
const SCRIPT_PROPERTIES **ppSp;
int cInChars;
- int cMaxItems;
SCRIPT_ITEM pItem[255];
int pcItems;
WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
WCHAR TestItem6[] = {'T', 'e', 's', 't', 'f',' ',' ',' ','\r','\n','e','n','d',0};
SCRIPT_CACHE psc;
- int cChars;
- int cMaxGlyphs;
unsigned short pwOutGlyphs1[256];
- unsigned short pwOutGlyphs2[256];
unsigned short pwLogClust[256];
SCRIPT_VISATTR psva[256];
int pcGlyphs;
int piAdvance[256];
GOFFSET pGoffset[256];
ABC pABC[256];
- int cnt;
+ unsigned int i;
- /* Start testing usp10 functions */
- /* This test determines that the pointer returned by ScriptGetProperties is valid
- * by checking a known value in the table */
+ /* Verify we get a valid pointer from ScriptGetProperties(). */
hr = ScriptGetProperties(&ppSp, &iMaxProps);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
trace("number of script properties %d\n", iMaxProps);
- ok (iMaxProps > 0, "Number of scripts returned should not be 0\n");
- if (iMaxProps > 0)
- ok( ppSp[0]->langid == 0, "Langid[0] not = to 0\n"); /* Check a known value to ensure */
- /* ptrs work */
-
- /* This is a valid test that will cause parsing to take place */
- cInChars = 5;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
- * returned. */
- ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
- if (pcItems > 0)
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
- "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
- pItem[0].iCharPos, cInChars, pItem[1].iCharPos);
-
- /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
- * ie. ScriptItemize has succeeded and that pItem has been set */
- cInChars = 5;
- if (hr == S_OK) {
- psc = NULL; /* must be null on first call */
- cChars = cInChars;
- cMaxGlyphs = cInChars;
- hr = ScriptShape(NULL, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == E_PENDING, "If psc is NULL (%08x) the E_PENDING should be returned\n", hr);
- cMaxGlyphs = 4;
- hr = ScriptShape(hdc, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == E_OUTOFMEMORY, "If not enough output area cChars (%d) is > than CMaxGlyphs "
- "(%d) but not E_OUTOFMEMORY\n",
- cChars, cMaxGlyphs);
- cMaxGlyphs = 256;
- hr = ScriptShape(hdc, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
- ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
- if (hr ==0) {
- hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr);
- hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr);
- for (cnt=0; cnt < pcGlyphs; cnt++)
- pwOutGlyphs[cnt] = pwOutGlyphs1[cnt]; /* Send to next function */
- }
-
- /* This test will check to make sure that SCRIPT_CACHE is reused and that not translation *
- * takes place if fNoGlyphIndex is set. */
-
- cInChars = 5;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem2, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
- * returned. */
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
- "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
- pItem[0].iCharPos, cInChars, pItem[1].iCharPos);
- /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue */
- if (hr == S_OK) {
- cChars = cInChars;
- cMaxGlyphs = 256;
- pItem[0].a.fNoGlyphIndex = 1; /* say no translate */
- hr = ScriptShape(NULL, &psc, TestItem2, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs2, pwLogClust, psva, &pcGlyphs);
- ok (hr != E_PENDING, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n", hr);
- ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
- ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
- for (cnt=0; cnt < cChars && TestItem2[cnt] == pwOutGlyphs2[cnt]; cnt++) {}
- ok (cnt == cChars, "Translation to place when told not to. WCHAR %d - %04x != %04x\n",
- cnt, TestItem2[cnt], pwOutGlyphs2[cnt]);
- if (hr == S_OK) {
- hr = ScriptPlace(hdc, &psc, pwOutGlyphs2, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr);
- }
- }
- ScriptFreeCache( &psc);
- ok (!psc, "psc is not null after ScriptFreeCache\n");
-
- }
-
- /* This is a valid test that will cause parsing to take place and create 3 script_items */
- cInChars = (sizeof(TestItem3)/2)-1;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem3, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- if (hr == S_OK)
- {
- ok (pcItems == 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems);
- if (pcItems > 2)
- {
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6,
- "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
- pItem[0].iCharPos, pItem[1].iCharPos);
- ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11,
- "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
- pItem[1].iCharPos, pItem[2].iCharPos);
- ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == cInChars,
- "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n",
- pItem[2].iCharPos, pItem[3].iCharPos, cInChars);
- }
- }
+ ok(iMaxProps > 0, "Got unexpected script count %d.\n", iMaxProps);
+ ok(ppSp[0]->langid == 0, "Got unexpected langid %#x.\n", ppSp[0]->langid);
+
+ /* This is a valid test that will cause parsing to take place. */
+ cInChars = lstrlenW(TestItem1);
+ hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* This test is for the interim operation of ScriptItemize() where only
+ * one SCRIPT_ITEM is returned. */
+ ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
+ ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[1].iCharPos, cInChars);
- /* This is a valid test that will cause parsing to take place and create 5 script_items */
- cInChars = (sizeof(TestItem4)/2)-1;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem4, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- if (hr == S_OK)
- {
- ok (pcItems == 5, "The number of SCRIPT_ITEMS should be 5 not %d\n", pcItems);
- if (pcItems > 4)
- {
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6,
- "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
- pItem[0].iCharPos, pItem[1].iCharPos);
- ok (pItem[0].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n",
- pItem[0].a.s.uBidiLevel);
- ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11,
- "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
- pItem[1].iCharPos, pItem[2].iCharPos);
- ok (pItem[1].a.s.uBidiLevel == 1, "Should have been bidi=1 not %d\n",
- pItem[1].a.s.uBidiLevel);
- ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == 12,
- "Start pos [2] not = 11 (%d) or end [3] pos not = 12 (%d)\n",
- pItem[2].iCharPos, pItem[3].iCharPos);
- ok (pItem[2].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n",
- pItem[2].a.s.uBidiLevel);
- ok (pItem[3].iCharPos == 12 && pItem[4].iCharPos == 13,
- "Start pos [3] not = 12 (%d) or end [4] pos not = 13 (%d)\n",
- pItem[3].iCharPos, pItem[4].iCharPos);
- ok (pItem[3].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n",
- pItem[3].a.s.uBidiLevel);
- ok (pItem[4].iCharPos == 13 && pItem[5].iCharPos == cInChars,
- "Start pos [4] not = 13 (%d) or end [5] pos not = 16 (%d), cInChars = %d\n",
- pItem[4].iCharPos, pItem[5].iCharPos, cInChars);
- }
+ psc = NULL;
+ hr = ScriptShape(NULL, &psc, TestItem1, cInChars, cInChars,
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
+
+ hr = ScriptShape(hdc, &psc, TestItem1, cInChars, cInChars - 1,
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
+
+ hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+ ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
+
+ /* Send to next test. */
+ memcpy(pwOutGlyphs, pwOutGlyphs1, pcGlyphs * sizeof(*pwOutGlyphs));
+
+ hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* This test verifies that SCRIPT_CACHE is reused and that no translation
+ * takes place if fNoGlyphIndex is set. */
+ cInChars = lstrlenW(TestItem2);
+ hr = ScriptItemize(TestItem2, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* This test is for the interim operation of ScriptItemize() where only
+ * one SCRIPT_ITEM is returned. */
+ ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
+ ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[1].iCharPos, cInChars);
+
+ pItem[0].a.fNoGlyphIndex = 1; /* No translation. */
+ hr = ScriptShape(NULL, &psc, TestItem2, cInChars, ARRAY_SIZE(pwOutGlyphs1),
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+ ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars);
+
+ for (i = 0; i < cInChars; ++i)
+ {
+ ok(pwOutGlyphs1[i] == TestItem2[i],
+ "Got unexpected pwOutGlyphs1[%u] %#x, expected %#x.\n",
+ i, pwOutGlyphs1[i], TestItem2[i]);
}
- /*
- * This test is for when the first unicode character requires bidi support
- */
- cInChars = (sizeof(TestItem5)-1)/sizeof(WCHAR);
- hr = ScriptItemize(TestItem5, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- ok (pcItems == 4, "There should have been 4 items, found %d\n", pcItems);
- ok (pItem[0].a.s.uBidiLevel == 1, "The first character should have been bidi=1 not %d\n",
- pItem[0].a.s.uBidiLevel);
-
- /* This test checks to make sure that the test to see if there are sufficient buffers to store *
- * the pointer to the last char works. Note that windows often needs a greater number of *
- * SCRIPT_ITEMS to process a string than is returned in pcItems. */
- cInChars = (sizeof(TestItem6)/2)-1;
- cMaxItems = 4;
- hr = ScriptItemize(TestItem6, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == E_OUTOFMEMORY, "ScriptItemize should return E_OUTOFMEMORY, returned %08x\n", hr);
-
+ hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ScriptFreeCache(&psc);
+ ok(!psc, "Got unexpected psc %p.\n", psc);
+
+ /* This is a valid test that will cause parsing to take place and create 3
+ * script_items. */
+ cInChars = lstrlenW(TestItem3);
+ hr = ScriptItemize(TestItem3, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos);
+ ok(pItem[2].iCharPos == 11, "Got unexpected character position %d.\n", pItem[2].iCharPos);
+ ok(pItem[3].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[3].iCharPos, cInChars);
+
+ /* This is a valid test that will cause parsing to take place and create 5
+ * script_items. */
+ cInChars = lstrlenW(TestItem4);
+ hr = ScriptItemize(TestItem4, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos);
+ ok(pItem[2].iCharPos == 11, "Got unexpected character position %d.\n", pItem[2].iCharPos);
+ ok(pItem[3].iCharPos == 12, "Got unexpected character position %d.\n", pItem[3].iCharPos);
+ ok(pItem[4].iCharPos == 13, "Got unexpected character position %d.\n", pItem[4].iCharPos);
+ ok(pItem[5].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[5].iCharPos, cInChars);
+
+ ok(pItem[0].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[0].a.s.uBidiLevel);
+ ok(pItem[1].a.s.uBidiLevel == 1, "Got unexpected bidi level %u.\n", pItem[1].a.s.uBidiLevel);
+ ok(pItem[2].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[2].a.s.uBidiLevel);
+ ok(pItem[3].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[3].a.s.uBidiLevel);
+ ok(pItem[4].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[3].a.s.uBidiLevel);
+
+ /* This test is for when the first Unicode character requires BiDi support. */
+ hr = ScriptItemize(TestItem5, lstrlenW(TestItem5), ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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);
+
+ /* This test verifies that the test to see if there are sufficient buffers
+ * to store the pointer to the last character works. Note that Windows
+ * often needs a greater number of SCRIPT_ITEMS to process a string than
+ * is returned in pcItems. */
+ hr = ScriptItemize(TestItem6, lstrlenW(TestItem6), 4, NULL, NULL, pItem, &pcItems);
+ ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
}
static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
hr = ScriptGetFontProperties(hdc,&psc,&sfp);
ok( hr == E_INVALIDARG, "(hdc,&psc,&sfp) invalid, expected E_INVALIDARG, got %08x\n", hr);
ok( psc != NULL, "Expected a pointer in psc, got NULL\n");
+ ok( sfp.cBytes == sizeof(SCRIPT_FONTPROPERTIES) - 1, "Unexpected cBytes.\n");
ScriptFreeCache(&psc);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
ScriptFreeCache(&psc);
ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
- pGetGlyphIndicesW = (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
- if (!pGetGlyphIndicesW)
- {
- win_skip("Skip on WINNT4\n");
- return;
- }
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = DEFAULT_CHARSET;
efnd.total = 0;
ret = GetTextMetricsA(hdc, &tmA);
ok(ret != 0, "GetTextMetricsA failed!\n");
- ret = pGetGlyphIndicesW(hdc, invalids, 1, gi, GGI_MARK_NONEXISTING_GLYPHS);
+ ret = GetGlyphIndicesW(hdc, invalids, 1, gi, GGI_MARK_NONEXISTING_GLYPHS);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
ok(sfp.wgBlank == tmA.tmBreakChar || sfp.wgBlank == gi[0], "bitmap font %s wgBlank %04x tmBreakChar %04x Space %04x\n", lf.lfFaceName, sfp.wgBlank, tmA.tmBreakChar, gi[0]);
}
str[0] = 0x0020; /* U+0020: numeric space */
- ret = pGetGlyphIndicesW(hdc, str, 1, gi, 0);
+ ret = GetGlyphIndicesW(hdc, str, 1, gi, 0);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
ok(sfp.wgBlank == gi[0], "truetype font %s wgBlank %04x gi[0] %04x\n", lf.lfFaceName, sfp.wgBlank, gi[0]);
ok(sfp.wgDefault == 0 || broken(is_arabic), "truetype font %s wgDefault %04x\n", lf.lfFaceName, sfp.wgDefault);
- ret = pGetGlyphIndicesW(hdc, invalids, 3, gi, GGI_MARK_NONEXISTING_GLYPHS);
+ ret = GetGlyphIndicesW(hdc, invalids, 3, gi, GGI_MARK_NONEXISTING_GLYPHS);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
if (gi[2] != 0xFFFF) /* index of default non exist char */
ok(sfp.wgInvalid == gi[2], "truetype font %s wgInvalid %04x gi[2] %04x\n", lf.lfFaceName, sfp.wgInvalid, gi[2]);
ok(sfp.wgInvalid == 0, "truetype font %s wgInvalid %04x expect 0\n", lf.lfFaceName, sfp.wgInvalid);
str[0] = 0x0640; /* U+0640: kashida */
- ret = pGetGlyphIndicesW(hdc, str, 1, gi, GGI_MARK_NONEXISTING_GLYPHS);
+ ret = GetGlyphIndicesW(hdc, str, 1, gi, GGI_MARK_NONEXISTING_GLYPHS);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
is_arial = !lstrcmpA(lf.lfFaceName, "Arial");
is_times_new_roman= !lstrcmpA(lf.lfFaceName, "Times New Roman");
HRESULT hr;
int cInChars;
- int cMaxItems;
SCRIPT_ITEM pItem[255];
int pcItems;
WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
SCRIPT_CACHE psc;
- int cChars;
- int cMaxGlyphs;
unsigned short pwOutGlyphs1[256];
WORD pwLogClust[256];
SCRIPT_VISATTR psva[256];
ABC pABC[256];
RECT rect;
int piX;
- int iCP = 1;
- BOOL fTrailing = FALSE;
- SCRIPT_LOGATTR *psla;
SCRIPT_LOGATTR sla[256];
- /* This is a valid test that will cause parsing to take place */
- cInChars = 5;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
- * returned. */
- ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
- if (pcItems > 0)
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
- "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
- pItem[0].iCharPos, cInChars, pItem[1].iCharPos);
-
- /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
- * ie. ScriptItemize has succeeded and that pItem has been set */
+ /* This is a valid test that will cause parsing to take place. */
+ cInChars = lstrlenW(TestItem1);
+ hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* This test is for the interim operation of ScriptItemize() where only
+ * one SCRIPT_ITEM is returned. */
+ ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
+ ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[1].iCharPos, cInChars);
+
+ psc = NULL;
cInChars = 5;
- if (hr == S_OK) {
- psc = NULL; /* must be null on first call */
- cChars = cInChars;
- cMaxGlyphs = 256;
- hr = ScriptShape(hdc, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
- ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
- if (hr == S_OK) {
- /* Note hdc is needed as glyph info is not yet in psc */
- hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr);
- ScriptFreeCache(&psc); /* Get rid of psc for next test set */
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
-
- hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
- ok (hr == E_INVALIDARG, "Should return 0 not (%08x)\n", hr);
-
- hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
- "expected E_INVALIDARG, got %08x\n", hr);
-
- /* Set psc to NULL, to be able to check if a pointer is returned in psc */
- psc = NULL;
- hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0,
- NULL, NULL, NULL);
- ok( hr == E_INVALIDARG, "(NULL,&psc,NULL,0,0,0,NULL,), expected E_INVALIDARG, "
- "got %08x\n", hr);
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
-
- /* hdc is required for this one rather than the usual optional */
- psc = NULL;
- hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok( hr == E_INVALIDARG, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", hr);
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
-
- /* Set that it returns 0 status */
- hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
-
- /* Test Rect Rgn is acceptable */
- SetRect(&rect, 10, 10, 40, 20);
- hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
-
- iCP = 1;
- hr = ScriptCPtoX(iCP, fTrailing, cChars, pcGlyphs, (const WORD *) &pwLogClust,
- (const SCRIPT_VISATTR *) &psva, (const int *)&piAdvance, &pItem[0].a, &piX);
- ok(hr == S_OK, "ScriptCPtoX Stub should return S_OK not %08x\n", hr);
-
- psla = (SCRIPT_LOGATTR *)&sla;
- hr = ScriptBreak(TestItem1, cChars, &pItem[0].a, psla);
- ok(hr == S_OK, "ScriptBreak Stub should return S_OK not %08x\n", hr);
-
- /* Clean up and go */
- ScriptFreeCache(&psc);
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
- }
- }
+ hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+ 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. */
+ hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* Get rid of psc for next test set. */
+ ScriptFreeCache(&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);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ 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(!psc, "Got unexpected psc %p.\n", psc);
+
+ /* hdc is required. */
+ hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!psc, "Got unexpected psc %p.\n", psc);
+ hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* Test Rect Rgn is acceptable. */
+ SetRect(&rect, 10, 10, 40, 20);
+ hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ hr = ScriptCPtoX(1, FALSE, cInChars, pcGlyphs, pwLogClust, psva, piAdvance, &pItem[0].a, &piX);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ hr = ScriptBreak(TestItem1, cInChars, &pItem[0].a, sla);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ScriptFreeCache(&psc);
+ ok(!psc, "Got unexpected psc %p.\n", psc);
}
+/* The intent is to validate that the DC passed into ScriptTextOut() is used
+ * instead of the (possibly) invalid cached one. */
static void test_ScriptTextOut2(HDC hdc)
{
-/* Intent is to validate that the HDC passed into ScriptTextOut is
- * used instead of the (possibly) invalid cached one
- */
HRESULT hr;
HDC hdc1, hdc2;
int cInChars;
- int cMaxItems;
SCRIPT_ITEM pItem[255];
int pcItems;
WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
SCRIPT_CACHE psc;
- int cChars;
- int cMaxGlyphs;
unsigned short pwOutGlyphs1[256];
WORD pwLogClust[256];
SCRIPT_VISATTR psva[256];
int piAdvance[256];
GOFFSET pGoffset[256];
ABC pABC[256];
+ BOOL ret;
- /* Create an extra DC that will be used until the ScriptTextOut */
+ /* Create an extra DC that will be used until the ScriptTextOut() call. */
hdc1 = CreateCompatibleDC(hdc);
- ok (hdc1 != 0, "CreateCompatibleDC failed to create a DC\n");
+ ok(!!hdc1, "Failed to create a DC.\n");
hdc2 = CreateCompatibleDC(hdc);
- ok (hdc2 != 0, "CreateCompatibleDC failed to create a DC\n");
+ ok(!!hdc2, "Failed to create a DC.\n");
+
+ /* This is a valid test that will cause parsing to take place. */
+ cInChars = lstrlenW(TestItem1);
+ hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* This test is for the interim operation of ScriptItemize() where only
+ * one SCRIPT_ITEM is returned. */
+ ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems);
+ ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[1].iCharPos, cInChars);
- /* This is a valid test that will cause parsing to take place */
- cInChars = 5;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
- * returned. */
- ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
- if (pcItems > 0)
- ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
- "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
- pItem[0].iCharPos, cInChars, pItem[1].iCharPos);
-
- /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
- * ie. ScriptItemize has succeeded and that pItem has been set */
- cInChars = 5;
- if (hr == S_OK) {
- psc = NULL; /* must be null on first call */
- cChars = cInChars;
- cMaxGlyphs = 256;
- hr = ScriptShape(hdc2, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
- ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
- if (hr == S_OK) {
- BOOL ret;
-
- /* Note hdc is needed as glyph info is not yet in psc */
- hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr);
-
- /* key part!!! cached dc is being deleted */
- ret = DeleteDC(hdc2);
- ok(ret, "DeleteDC should return 1 not %d\n", ret);
-
- /* At this point the cached hdc (hdc2) has been destroyed,
- * however, we are passing in a *real* hdc (the original hdc).
- * The text should be written to that DC
- */
- hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
-
- DeleteDC(hdc1);
-
- /* Clean up and go */
- ScriptFreeCache(&psc);
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
- }
- }
+ psc = NULL;
+ hr = ScriptShape(hdc2, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+ 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. */
+ hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* Key part! Cached DC is being deleted. */
+ ret = DeleteDC(hdc2);
+ ok(ret, "Got unexpected ret %#x.\n", ret);
+
+ /* At this point the cached DC (hdc2) has been destroyed. However, we are
+ * passing in a *real* DC (the original DC). The text should be written to
+ * that DC. */
+ hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+
+ DeleteDC(hdc1);
+
+ ScriptFreeCache(&psc);
+ ok(!psc, "Got unexpected psc %p.\n", psc);
}
static void test_ScriptTextOut3(HDC hdc)
HRESULT hr;
int cInChars;
- int cMaxItems;
SCRIPT_ITEM pItem[255];
int pcItems;
WCHAR TestItem1[] = {' ','\r', 0};
SCRIPT_CACHE psc;
- int cChars;
- int cMaxGlyphs;
unsigned short pwOutGlyphs1[256];
WORD pwLogClust[256];
SCRIPT_VISATTR psva[256];
ABC pABC[256];
RECT rect;
- /* This is to ensure that nonexistent glyphs are translated into a valid glyph number */
- cInChars = 2;
- cMaxItems = 255;
- hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
- ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr);
- /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
- * returned. */
- ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
- if (pcItems > 0)
- ok (pItem[0].iCharPos == 0 && pItem[2].iCharPos == cInChars,
- "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
- pItem[0].iCharPos, cInChars, pItem[2].iCharPos);
-
- /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
- * ie. ScriptItemize has succeeded and that pItem has been set */
- cInChars = 2;
- if (hr == S_OK) {
- psc = NULL; /* must be null on first call */
- cChars = cInChars;
- cMaxGlyphs = 256;
- hr = ScriptShape(hdc, &psc, TestItem1, cChars,
- cMaxGlyphs, &pItem[0].a,
- pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
- ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr);
- ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
- ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
- if (hr ==0) {
- /* Note hdc is needed as glyph info is not yet in psc */
- hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
- pGoffset, pABC);
- ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr);
-
- /* Test Rect Rgn is acceptable */
- SetRect(&rect, 10, 10, 40, 20);
- hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
- piAdvance, NULL, pGoffset);
- ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr);
- }
- /* Clean up and go */
- ScriptFreeCache(&psc);
- ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
- }
+ /* This is to ensure that non-existent glyphs are translated into a valid
+ * glyph number. */
+ cInChars = lstrlenW(TestItem1);
+ hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* This test is for the interim operation of ScriptItemize() where only
+ * one SCRIPT_ITEM is returned. */
+ ok(pcItems == 2, "Got unexpected item count %d.\n", pcItems);
+ ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[1].iCharPos == 1, "Got unexpected character position %d.\n", pItem[0].iCharPos);
+ ok(pItem[2].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n",
+ pItem[2].iCharPos, cInChars);
+
+ psc = NULL;
+ hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1),
+ &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!psc, "Got unexpected psc %p.\n", psc);
+ 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. */
+ hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs,
+ psva, &pItem[0].a, piAdvance, pGoffset, pABC);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* Test Rect Rgn is acceptable. */
+ SetRect(&rect, 10, 10, 40, 20);
+ hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0,
+ pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ScriptFreeCache(&psc);
+ ok(!psc, "Got unexpected psc %p.\n", psc);
}
#define test_item_ScriptXtoX(a,b,c,d,e,f) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_item_ScriptXtoX(a,b,c,d,e,f)
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
+ ok(hr == S_OK, "ScriptXtoCP() failed, hr %#x.\n", hr);
ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX,piCP,piTrailing);
}
for (iX = 9; iX < 16; iX++)
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
+ ok(hr == S_OK, "ScriptXtoCP() failed, hr %#x.\n", hr);
ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX,piCP,piTrailing);
}
win_skip("Uniscribe version too old to test Hebrew clusters\n");
}
+/* This set of tests is for the string functions of Uniscribe. The
+ * ScriptStringAnalyse() function allocates memory pointed to by the
+ * SCRIPT_STRING_ANALYSIS ssa pointer. This memory is freed by
+ * ScriptStringFree(). There needs to be a valid hdc for this as
+ * ScriptStringAnalyse() calls ScriptItemize(), ScriptShape() and
+ * ScriptPlace() which require it. */
static void test_ScriptString(HDC hdc)
{
-/*******************************************************************************************
- *
- * This set of tests are for the string functions of uniscribe. The ScriptStringAnalyse
- * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer. This
- * memory is freed by ScriptStringFree. There needs to be a valid hdc for this as
- * ScriptStringAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.
- *
- */
HRESULT hr;
WCHAR teststr[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'};
- int len = (sizeof(teststr) / sizeof(WCHAR)) - 1;
+ int len = ARRAY_SIZE(teststr) - 1;
int Glyphs = len * 2 + 16;
- int Charset;
DWORD Flags = SSA_GLYPHS;
int ReqWidth = 100;
- static const int Dx[(sizeof(teststr) / sizeof(WCHAR)) - 1];
- static const BYTE InClass[(sizeof(teststr) / sizeof(WCHAR)) - 1];
+ static const int Dx[ARRAY_SIZE(teststr) - 1];
+ static const BYTE InClass[ARRAY_SIZE(teststr) - 1];
SCRIPT_STRING_ANALYSIS ssa = NULL;
int X = 10;
int MaxSel = 0;
BOOL Disabled = FALSE;
const int *clip_len;
- int i;
UINT *order;
+ unsigned int i;
+ /* Test without hdc to get E_PENDING. */
+ hr = ScriptStringAnalyse(NULL, teststr, len, Glyphs, -1,
+ Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
+ ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
- Charset = -1; /* this flag indicates unicode input */
- /* Test without hdc to get E_PENDING */
- hr = ScriptStringAnalyse( NULL, teststr, len, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, Dx, NULL,
- InClass, &ssa);
- ok(hr == E_PENDING, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr);
-
- /* Test that 0 length string returns E_INVALIDARG */
- hr = ScriptStringAnalyse( hdc, teststr, 0, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, Dx, NULL,
- InClass, &ssa);
- ok(hr == E_INVALIDARG, "ScriptStringAnalyse should return E_INVALIDARG not %08x\n", hr);
-
- /* test with hdc, this should be a valid test */
- hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, Dx, NULL,
- InClass, &ssa);
- ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);
+ /* Test that 0 length string returns E_INVALIDARG. */
+ hr = ScriptStringAnalyse(hdc, teststr, 0, Glyphs, -1,
+ Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ /* Test with hdc, this should be a valid test. */
+ hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1,
+ Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ScriptStringFree(&ssa);
- /* test makes sure that a call with a valid pssa still works */
- hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, Dx, NULL,
- InClass, &ssa);
- ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);
- ok(ssa != NULL, "ScriptStringAnalyse pssa should not be NULL\n");
+ /* Test makes sure that a call with a valid pssa still works. */
+ hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1,
+ Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!!ssa, "Got unexpected ssa %p.\n", ssa);
- if (hr == S_OK)
- {
- hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled);
- ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr);
- }
+ hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- clip_len = ScriptString_pcOutChars(ssa);
- ok(*clip_len == len, "ScriptString_pcOutChars failed, got %d, expected %d\n", *clip_len, len);
+ clip_len = ScriptString_pcOutChars(ssa);
+ ok(*clip_len == len, "Got unexpected *clip_len %d, expected %d.\n", *clip_len, len);
- order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(UINT));
- hr = ScriptStringGetOrder(ssa, order);
- ok(hr == S_OK, "ScriptStringGetOrder failed, got %08x, expected S_OK\n", hr);
+ order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(*order));
+ hr = ScriptStringGetOrder(ssa, order);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- for (i = 0; i < *clip_len; i++) ok(order[i] == i, "%d: got %d expected %d\n", i, order[i], i);
- HeapFree(GetProcessHeap(), 0, order);
+ for (i = 0; i < *clip_len; ++i)
+ {
+ ok(order[i] == i, "Got unexpected order[%u] %u.\n", i, order[i]);
+ }
+ HeapFree(GetProcessHeap(), 0, order);
- hr = ScriptStringFree(&ssa);
- ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);
+ hr = ScriptStringFree(&ssa);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
}
+/* Test ScriptStringXtoCP() and ScriptStringCPtoX(). Since fonts may differ
+ * between Windows and Wine, the test generates values using one function, and
+ * then verifies the output is consistent with the output of the other. */
static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
{
-/*****************************************************************************************
- *
- * This test is for the ScriptStringXtoCP and ScriptStringXtoCP functions. Due to the
- * nature of the fonts between Windows and Wine, the test is implemented by generating
- * values using one one function then checking the output of the second. In this way
- * the validity of the functions is established using Windows as a base and confirming
- * similar behaviour in wine.
- */
-
HRESULT hr;
static const WCHAR teststr1[] = {0x05e9, 'i', 0x05dc, 'n', 0x05d5, 'e', 0x05dd, '.',0};
static const BOOL rtl[] = {1, 0, 1, 0, 1, 0, 1, 0};
- void *String = (WCHAR *) &teststr1; /* ScriptStringAnalysis needs void */
- int String_len = (sizeof(teststr1)/sizeof(WCHAR))-1;
+ unsigned int String_len = ARRAY_SIZE(teststr1) - 1;
int Glyphs = String_len * 2 + 16; /* size of buffer as recommended */
- int Charset = -1; /* unicode */
- DWORD Flags = SSA_GLYPHS;
- int ReqWidth = 100;
- static const BYTE InClass[(sizeof(teststr1)/sizeof(WCHAR))-1];
+ static const BYTE InClass[ARRAY_SIZE(teststr1) - 1];
SCRIPT_STRING_ANALYSIS ssa = NULL;
int Ch; /* Character position in string */
int Cp; /* Character position in string */
int X;
int trail,lead;
- BOOL fTrailing;
-
- /* Test with hdc, this should be a valid test
- * Here we generate an SCRIPT_STRING_ANALYSIS that will be used as input to the
- * following character positions to X and X to character position functions.
- */
- hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, NULL, NULL,
- InClass, &ssa);
- ok(hr == S_OK ||
- hr == E_INVALIDARG, /* NT */
- "ScriptStringAnalyse should return S_OK or E_INVALIDARG not %08x\n", hr);
+ /* Test with hdc, this should be a valid test. Here we generate a
+ * SCRIPT_STRING_ANALYSIS that will be used as input to the following
+ * character-positions-to-X and X-to-character-position functions. */
+ hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1,
+ SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa);
+ ok(hr == S_OK || broken(hr == E_INVALIDARG) /* NT */,
+ "Got unexpected hr %08x.\n", hr);
+ if (hr != S_OK)
+ return;
+ ok(!!ssa, "Got unexpected ssa %p.\n", ssa);
- if (hr == S_OK)
+ /* Loop to generate character positions to provide starting positions for
+ * the ScriptStringCPtoX() and ScriptStringXtoCP() functions. */
+ for (Cp = 0; Cp < String_len; ++Cp)
{
- ok(ssa != NULL, "ScriptStringAnalyse ssa should not be NULL\n");
-
- /*
- * Loop to generate character positions to provide starting positions for the
- * ScriptStringCPtoX and ScriptStringXtoCP functions
- */
- for (Cp = 0; Cp < String_len; Cp++)
- {
- /* The fTrailing flag is used to indicate whether the X being returned is at
- * the beginning or the end of the character. What happens here is that if
- * fTrailing indicates the end of the character, ie. FALSE, then ScriptStringXtoCP
- * returns the beginning of the next character and iTrailing is FALSE. So for this
- * loop iTrailing will be FALSE in both cases.
- */
- hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- if (rtl[Cp])
- ok(lead > trail, "Leading values should be after trailing for rtl characters(%i)\n",Cp);
- else
- ok(lead < trail, "Trailing values should be after leading for ltr characters(%i)\n",Cp);
-
- /* move by 1 pixel so that we are not between 2 characters. That could result in being the lead of a rtl and
- at the same time the trail of an ltr */
-
- /* inside the leading edge */
- X = lead;
- if (rtl[Cp]) X--; else X++;
- hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail);
- ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
- iTrailing, X);
-
- /* inside the trailing edge */
- X = trail;
- if (rtl[Cp]) X++; else X--;
- hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail);
- ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
- iTrailing, X);
-
- /* outside the "trailing" edge */
- if (Cp < String_len-1)
- {
- if (rtl[Cp]) X = lead; else X = trail;
- X++;
- hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Cp + 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp + 1, Ch, trail);
- if (rtl[Cp+1])
- ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
- iTrailing, X);
- else
- ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
- iTrailing, X);
- }
+ /* The fTrailing flag is used to indicate whether the X being returned
+ * is at the beginning or the end of the character. What happens here
+ * is that if fTrailing indicates the end of the character, i.e. FALSE,
+ * then ScriptStringXtoCP() returns the beginning of the next
+ * character and iTrailing is FALSE. So for this loop iTrailing will
+ * be FALSE in both cases. */
+ hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(rtl[Cp] ? lead > trail : lead < trail,
+ "Got unexpected lead %d, trail %d, for rtl[%u] %u.\n",
+ lead, trail, Cp, rtl[Cp]);
+
+ /* Move by 1 pixel so that we are not between 2 characters. That could
+ * result in being the lead of a RTL and at the same time the trail of
+ * an LTR. */
+
+ /* Inside the leading edge. */
+ X = rtl[Cp] ? lead - 1 : lead + 1;
+ hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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);
- /* outside the "leading" edge */
- if (Cp != 0)
- {
- if (rtl[Cp]) X = trail; else X = lead;
- X--;
- hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Cp - 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp - 1, Ch, trail);
- if (Cp != 0 && rtl[Cp-1])
- ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
- iTrailing, X);
- else
- ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
- iTrailing, X);
- }
- }
+ /* Inside the trailing edge. */
+ X = rtl[Cp] ? trail + 1 : trail - 1;
+ hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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);
- /* Check beyond the leading boundary of the whole string */
- if (rtl[0])
+ /* Outside the trailing edge. */
+ if (Cp < String_len - 1)
{
- /* having a leading rtl character seems to confuse usp */
- /* this looks to be a windows bug we should emulate */
- hr = ScriptStringCPtoX(ssa, 0, TRUE, &X);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- X--;
+ X = rtl[Cp] ? lead + 1 : trail + 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Ch == 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch);
- ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n",
- iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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",
+ iTrailing, X, !!rtl[Cp + 1]);
}
- else
+
+ /* Outside the leading edge. */
+ if (Cp)
{
- hr = ScriptStringCPtoX(ssa, 0, FALSE, &X);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- X--;
+ X = rtl[Cp] ? trail - 1 : lead - 1;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Ch == -1, "ScriptStringXtoCP should return Ch = -1 not %d for X outside leading edge\n", Ch);
- ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = outside leading edge\n",
- iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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",
+ iTrailing, X, !rtl[Cp - 1]);
}
+ }
- /* Check beyond the end boundary of the whole string */
- if (rtl[String_len-1])
- {
- hr = ScriptStringCPtoX(ssa, String_len-1, FALSE, &X);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- }
- else
- {
- hr = ScriptStringCPtoX(ssa, String_len-1, TRUE, &X);
- ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
- }
- X++;
+ /* Check beyond the leading boundary of the whole string. */
+ if (rtl[0])
+ {
+ /* Having a leading RTL character seems to confuse usp. This looks to
+ * be a Windows bug we should emulate. */
+ hr = ScriptStringCPtoX(ssa, 0, TRUE, &X);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ --X;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
- ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- ok(Ch == String_len, "ScriptStringXtoCP should return Ch = %i not %d for X outside trailing edge\n", String_len, Ch);
- ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside trailing edge\n",
- iTrailing);
-
- /*
- * Cleanup the SSA for the next round of tests
- */
- hr = ScriptStringFree(&ssa);
- ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);
-
- /*
- * Test to see that exceeding the number of chars returns E_INVALIDARG. First
- * generate an SSA for the subsequent tests.
- */
- hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags,
- ReqWidth, NULL, NULL, NULL, NULL,
- InClass, &ssa);
- ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);
-
- /*
- * When ScriptStringCPtoX is called with a character position Cp that exceeds the
- * string length, return E_INVALIDARG. This also invalidates the ssa so a
- * ScriptStringFree should also fail.
- */
- fTrailing = FALSE;
- Cp = String_len + 1;
- hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X);
- ok(hr == E_INVALIDARG, "ScriptStringCPtoX should return E_INVALIDARG not %08x\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(Ch == 1, "Got unexpected Ch %d.\n", Ch);
+ ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
+ }
+ else
+ {
+ hr = ScriptStringCPtoX(ssa, 0, FALSE, &X);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ --X;
+ hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(Ch == -1, "Got unexpected Ch %d.\n", Ch);
+ ok(iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
+ }
- ScriptStringFree(&ssa);
+ /* Check beyond the end boundary of the whole string. */
+ if (rtl[String_len - 1])
+ {
+ hr = ScriptStringCPtoX(ssa, String_len - 1, FALSE, &X);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
}
+ else
+ {
+ hr = ScriptStringCPtoX(ssa, String_len - 1, TRUE, &X);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ }
+ ++X;
+ hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(Ch == String_len, "Got unexpected Ch %d, expected %d.\n", Ch, String_len);
+ ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing);
+
+ /* Cleanup the SSA for the next round of tests. */
+ hr = ScriptStringFree(&ssa);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* Test to see that exceeding the number of characters returns
+ * E_INVALIDARG. First generate an SSA for the subsequent tests. */
+ hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1,
+ SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ /* When ScriptStringCPtoX() is called with a character position that
+ * exceeds the string length, return E_INVALIDARG. This also invalidates
+ * the ssa so a ScriptStringFree() should also fail. */
+ hr = ScriptStringCPtoX(ssa, String_len + 1, FALSE, &X);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ ScriptStringFree(&ssa);
+}
+
+static HWND create_test_window(void)
+{
+ HWND hwnd = CreateWindowExA(0, "Static", "", WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
+ ok(hwnd != NULL, "Failed to create test window.\n");
+
+ ShowWindow(hwnd, SW_SHOW);
+ UpdateWindow(hwnd);
+
+ return hwnd;
}
static void test_ScriptCacheGetHeight(HDC hdc)
{
- HRESULT hr;
+ HFONT hfont, prev_hfont;
SCRIPT_CACHE sc = NULL;
- LONG height;
+ LONG height, height2;
+ TEXTMETRICW tm;
+ LOGFONTA lf;
+ HRESULT hr;
+ HWND hwnd;
+ HDC hdc2;
hr = ScriptCacheGetHeight(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
hr = ScriptCacheGetHeight(NULL, &sc, &height);
ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);
- height = 0;
+ height = 123;
+ hr = ScriptCacheGetHeight(hdc, NULL, &height);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ ok(height == 123, "Unexpected height.\n");
+
+ memset(&tm, 0, sizeof(tm));
+ GetTextMetricsW(hdc, &tm);
+ ok(tm.tmHeight > 0, "Unexpected tmHeight %u.\n", tm.tmHeight);
+ height = 0;
hr = ScriptCacheGetHeight(hdc, &sc, &height);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
- ok(height > 0, "expected height > 0\n");
+ ok(height == tm.tmHeight, "expected height > 0\n");
+
+ /* Try again with NULL dc. */
+ height2 = 0;
+ hr = ScriptCacheGetHeight(NULL, &sc, &height2);
+ ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr);
+ ok(height2 == height, "Unexpected height %u.\n", height2);
+
+ hwnd = create_test_window();
+
+ hdc2 = GetDC(hwnd);
+ ok(hdc2 != NULL, "Failed to get window dc.\n");
+
+ memset(&lf, 0, sizeof(LOGFONTA));
+ lstrcpyA(lf.lfFaceName, "Tahoma");
+ lf.lfHeight = -32;
+
+ hfont = CreateFontIndirectA(&lf);
+ ok(hfont != NULL, "Failed to create font.\n");
+
+ prev_hfont = SelectObject(hdc2, hfont);
+
+ memset(&tm, 0, sizeof(tm));
+ GetTextMetricsW(hdc2, &tm);
+ ok(tm.tmHeight > height, "Unexpected tmHeight %u.\n", tm.tmHeight);
+
+ height2 = 0;
+ hr = ScriptCacheGetHeight(hdc2, &sc, &height2);
+ ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr);
+ ok(height2 == height, "Unexpected height.\n");
+
+ SelectObject(hdc2, prev_hfont);
+ DeleteObject(hfont);
+
+ ReleaseDC(hwnd, hdc2);
+ DestroyWindow(hwnd);
ScriptFreeCache(&sc);
}
{
HRESULT hr;
SCRIPT_CACHE sc = NULL;
- ABC abc;
+ HFONT hfont, prev_hfont;
+ TEXTMETRICA tm;
+ ABC abc, abc2;
+ LOGFONTA lf;
+ WORD glyph;
+ INT width;
+ DWORD ret;
+
+ glyph = 0;
+ ret = GetGlyphIndicesA(hdc, "a", 1, &glyph, 0);
+ ok(ret == 1, "Failed to get glyph index.\n");
+ ok(glyph != 0, "Unexpected glyph index.\n");
- hr = ScriptGetGlyphABCWidth(NULL, NULL, 'a', NULL);
+ hr = ScriptGetGlyphABCWidth(NULL, NULL, glyph, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
- hr = ScriptGetGlyphABCWidth(NULL, &sc, 'a', NULL);
+ hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, NULL);
ok(broken(hr == E_PENDING) ||
hr == E_INVALIDARG, /* WIN7 */
"expected E_INVALIDARG, got 0x%08x\n", hr);
- hr = ScriptGetGlyphABCWidth(NULL, &sc, 'a', &abc);
+ hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, &abc);
ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);
if (0) { /* crashes on WinXP */
- hr = ScriptGetGlyphABCWidth(hdc, &sc, 'a', NULL);
+ hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
}
- hr = ScriptGetGlyphABCWidth(hdc, &sc, 'a', &abc);
+ hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(abc.abcB != 0, "Unexpected width.\n");
+
+ ret = GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc2);
+ ok(ret, "Failed to get char width.\n");
+ ok(!memcmp(&abc, &abc2, sizeof(abc)), "Unexpected width.\n");
+
+ ScriptFreeCache(&sc);
+
+ /* Bitmap font */
+ memset(&lf, 0, sizeof(lf));
+ strcpy(lf.lfFaceName, "System");
+ lf.lfHeight = 20;
+
+ hfont = CreateFontIndirectA(&lf);
+ prev_hfont = SelectObject(hdc, hfont);
+
+ ret = GetTextMetricsA(hdc, &tm);
+ ok(ret, "Failed to get text metrics.\n");
+ ok(!(tm.tmPitchAndFamily & TMPF_TRUETYPE), "Unexpected TrueType font.\n");
+ ok(tm.tmPitchAndFamily & TMPF_FIXED_PITCH, "Unexpected fixed pitch font.\n");
+
+ glyph = 0;
+ ret = GetGlyphIndicesA(hdc, "i", 1, &glyph, 0);
+ ok(ret == 1, "Failed to get glyph index.\n");
+ ok(glyph != 0, "Unexpected glyph index.\n");
+
+ sc = NULL;
+ hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
+ ok(hr == S_OK, "Failed to get glyph width, hr %#x.\n", hr);
+ ok(abc.abcB != 0, "Unexpected width.\n");
+
+ ret = GetCharWidthI(hdc, glyph, 1, NULL, &width);
+ ok(ret, "Failed to get char width.\n");
+ abc2.abcA = abc2.abcC = 0;
+ abc2.abcB = width;
+ ok(!memcmp(&abc, &abc2, sizeof(abc)), "Unexpected width.\n");
+
+ SelectObject(hdc, prev_hfont);
+ DeleteObject(hfont);
ScriptFreeCache(&sc);
}
hr = ScriptLayout(sizeof(levels[0]), levels[0], NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
- for (i = 0; i < sizeof(levels)/sizeof(levels[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(levels); ++i)
{
hr = ScriptLayout(sizeof(levels[0]), levels[i], vistolog, logtovis);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
LGRPID_GEORGIAN,
LGRPID_ARMENIAN
};
- HMODULE hKernel32;
- static BOOL (WINAPI * pEnumLanguageGroupLocalesA)(LANGGROUPLOCALE_ENUMPROCA,LGRPID,DWORD,LONG_PTR);
- hKernel32 = GetModuleHandleA("kernel32.dll");
- pEnumLanguageGroupLocalesA = (void*)GetProcAddress(hKernel32, "EnumLanguageGroupLocalesA");
-
- if (!pEnumLanguageGroupLocalesA)
+ for (i = 0; i < ARRAY_SIZE(groups); ++i)
{
- win_skip("EnumLanguageGroupLocalesA not available on this platform\n");
- return;
- }
-
- for (i = 0; i < sizeof(groups)/sizeof(groups[0]); i++)
- {
- ret = pEnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0);
- if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- {
- win_skip("EnumLanguageGroupLocalesA not implemented on this platform\n");
- break;
- }
-
+ ret = EnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0);
ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError());
}
}
static void test_ScriptGetFontFunctions(HDC hdc)
{
+ static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859,
+ 0x0020, 0xa850, 0xa85c, 0xa85e};
+ SCRIPT_CONTROL control;
+ SCRIPT_CACHE sc = NULL;
+ SCRIPT_ITEM items[15];
+ OPENTYPE_TAG tags[5];
+ SCRIPT_STATE state;
+ int count = 0;
HRESULT hr;
- pScriptGetFontScriptTags = (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontScriptTags");
- pScriptGetFontLanguageTags = (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontLanguageTags");
- pScriptGetFontFeatureTags = (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontFeatureTags");
+
if (!pScriptGetFontScriptTags || !pScriptGetFontLanguageTags || !pScriptGetFontFeatureTags)
{
- win_skip("ScriptGetFontScriptTags,ScriptGetFontLanguageTags or ScriptGetFontFeatureTags not available on this platform\n");
+ win_skip("ScriptGetFontScriptTags, ScriptGetFontLanguageTags or "
+ "ScriptGetFontFeatureTags not available on this platform.\n");
+ return;
}
+
+ hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontScriptTags(NULL, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
+ if (hr == S_OK)
+ ok(count <= 5, "Got unexpected count %d.\n", count);
else
- {
- SCRIPT_CACHE sc = NULL;
- OPENTYPE_TAG tags[5];
- int count = 0;
- int outnItems=0;
- SCRIPT_ITEM outpItems[15];
- SCRIPT_CONTROL Control;
- SCRIPT_STATE State;
- static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
-
- hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 5, tags, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontScriptTags(NULL, &sc, NULL, 5, tags, &count);
- ok(hr == E_PENDING,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 5, tags, &count);
- ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n");
- if (hr == S_OK)
- ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n");
- else if (hr == E_OUTOFMEMORY)
- ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
- ok(sc != NULL, "ScriptCache should be initialized\n");
+ ok(!count, "Got unexpected count %d.\n", count);
+ ok(!!sc, "Got unexpected script cache %p.\n", sc);
- ScriptFreeCache(&sc);
- sc = NULL;
-
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 5, tags, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, 5, tags, &count);
- ok(hr == E_PENDING,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 5, tags, &count);
- ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n");
- if (hr == S_OK)
- ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n");
- else if (hr == E_OUTOFMEMORY)
- ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
+ ScriptFreeCache(&sc);
+ sc = NULL;
- ScriptFreeCache(&sc);
- sc = NULL;
-
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 5, tags, NULL);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count);
- ok(hr == E_INVALIDARG,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, 5, tags, &count);
- ok(hr == E_PENDING,"Incorrect return code\n");
- ok(sc == NULL, "ScriptCache should remain uninitialized\n");
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 5, tags, &count);
- ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n");
- if (hr == S_OK)
- ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n");
- else if (hr == E_OUTOFMEMORY)
- ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
-
- memset(&Control, 0, sizeof(Control));
- memset(&State, 0, sizeof(State));
-
- hr = ScriptItemize(test_phagspa, 10, 15, &Control, &State, outpItems, &outnItems);
- ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
- memset(tags,0,sizeof(tags));
- hr = pScriptGetFontScriptTags(hdc, &sc, &outpItems[0].a, 5, tags, &count);
- ok( hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "wrong return code\n");
-
- hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, 5, tags, &count);
- ok( hr == S_OK, "wrong return code\n");
- hr = pScriptGetFontLanguageTags(hdc, &sc, &outpItems[0].a, dsrt_tag, 5, tags, &count);
- ok( hr == E_INVALIDARG || broken(hr == S_OK), "wrong return code\n");
-
- hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, 5, tags, &count);
- ok( hr == S_OK, "wrong return code\n");
- hr = pScriptGetFontFeatureTags(hdc, &sc, &outpItems[0].a, dsrt_tag, 0x0, 5, tags, &count);
- ok( hr == E_INVALIDARG || broken(hr == S_OK), "wrong return code\n");
+ hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ 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);
+ if (hr == S_OK)
+ ok(count <= 5, "Got unexpected count %d.\n", count);
+ else
+ ok(!count, "Got unexpected count %d.\n", count);
- ScriptFreeCache(&sc);
- }
+ ScriptFreeCache(&sc);
+ sc = NULL;
+
+ hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
+ ok(!sc, "Got unexpected script cache %p.\n", sc);
+ 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);
+ if (hr == S_OK)
+ ok(count <= 5, "Got unexpected count %d.\n", count);
+ else
+ ok(!count, "Got unexpected count %d.\n", count);
+
+ memset(&control, 0, sizeof(control));
+ memset(&state, 0, sizeof(state));
+
+ hr = ScriptItemize(test_phagspa, ARRAY_SIZE(test_phagspa), ARRAY_SIZE(items),
+ &control, &state, items, &count);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ memset(tags, 0, sizeof(tags));
+ 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);
+
+ hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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);
+
+ hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ 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);
+
+ ScriptFreeCache(&sc);
}
struct logical_width_test
SCRIPT_ANALYSIS sa = { 0 };
unsigned int i, j;
- for (i = 0; i < sizeof(logical_width_tests)/sizeof(logical_width_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(logical_width_tests); ++i)
{
const struct logical_width_test *ptr = logical_width_tests + i;
SCRIPT_VISATTR attrs[3];
hr = ScriptIsComplex(test2W, 0, SIC_ASCIIDIGIT);
ok(hr == S_FALSE, "got 0x%08x\n", hr);
- for (i = 0; i < sizeof(complex_tests)/sizeof(complex_tests[0]); 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);
todo_wine_if(complex_tests[i].todo)
ok(hr == S_FALSE, "got 0x%08x\n", hr);
}
+static void test_ScriptString_pSize(HDC hdc)
+{
+ static const WCHAR textW[] = {'A',0};
+ SCRIPT_STRING_ANALYSIS ssa;
+ const SIZE *size;
+ TEXTMETRICW tm;
+ HRESULT hr;
+ ABC abc;
+
+ 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);
+
+ size = ScriptString_pSize(NULL);
+ ok(size == NULL || broken(size != NULL) /* <win7 */, "Unexpected size pointer.\n");
+
+ GetCharABCWidthsW(hdc, textW[0], textW[0], &abc);
+
+ memset(&tm, 0, sizeof(tm));
+ GetTextMetricsW(hdc, &tm);
+ ok(tm.tmHeight > 0, "Unexpected tmHeight.\n");
+
+ size = ScriptString_pSize(ssa);
+ 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->cy == tm.tmHeight, "Unexpected cy size %d.\n", size->cy);
+
+ hr = ScriptStringFree(&ssa);
+ ok(hr == S_OK, "Failed to free ssa, hr %#x.\n", hr);
+}
+
+static void test_script_cache_reuse(void)
+{
+ HRESULT hr;
+ HWND hwnd1, hwnd2;
+ HDC hdc1, hdc2;
+ LOGFONTA lf;
+ HFONT hfont1, hfont2;
+ HFONT prev_hfont1, prev_hfont2;
+ SCRIPT_CACHE sc = NULL;
+ SCRIPT_CACHE sc2;
+ LONG height;
+
+ hwnd1 = create_test_window();
+ hwnd2 = create_test_window();
+
+ hdc1 = GetDC(hwnd1);
+ hdc2 = GetDC(hwnd2);
+ ok(hdc1 != NULL && hdc2 != NULL, "Failed to get window dc.\n");
+
+ memset(&lf, 0, sizeof(LOGFONTA));
+ lstrcpyA(lf.lfFaceName, "Tahoma");
+
+ lf.lfHeight = 10;
+ hfont1 = CreateFontIndirectA(&lf);
+ ok(hfont1 != NULL, "CreateFontIndirectA failed\n");
+ hfont2 = CreateFontIndirectA(&lf);
+ ok(hfont2 != NULL, "CreateFontIndirectA failed\n");
+ ok(hfont1 != hfont2, "Expected fonts %p and %p to differ\n", hfont1, hfont2);
+
+ prev_hfont1 = SelectObject(hdc1, hfont1);
+ ok(prev_hfont1 != NULL, "SelectObject failed: %p\n", prev_hfont1);
+ prev_hfont2 = SelectObject(hdc2, hfont1);
+ ok(prev_hfont2 != NULL, "SelectObject failed: %p\n", prev_hfont2);
+
+ /* Get a script cache */
+ hr = ScriptCacheGetHeight(hdc1, &sc, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc != NULL, "Script cache is NULL\n");
+
+ /* Same font, same DC -> same SCRIPT_CACHE */
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ /* Same font in different DC -> same SCRIPT_CACHE */
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ /* Same font face & size, but different font handle */
+ ok(SelectObject(hdc1, hfont2) != NULL, "SelectObject failed\n");
+ ok(SelectObject(hdc2, hfont2) != NULL, "SelectObject failed\n");
+
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ /* Different font size -- now we get a different SCRIPT_CACHE */
+ SelectObject(hdc1, prev_hfont1);
+ SelectObject(hdc2, prev_hfont2);
+ DeleteObject(hfont2);
+ lf.lfHeight = 20;
+ hfont2 = CreateFontIndirectA(&lf);
+ ok(hfont2 != NULL, "CreateFontIndirectA failed\n");
+ ok(SelectObject(hdc1, hfont2) != NULL, "SelectObject failed\n");
+ ok(SelectObject(hdc2, hfont2) != NULL, "SelectObject failed\n");
+
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ sc2 = NULL;
+ hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
+ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+ ok(sc2 != NULL, "Script cache is NULL\n");
+ ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
+ ScriptFreeCache(&sc2);
+
+ ScriptFreeCache(&sc);
+ SelectObject(hdc1, prev_hfont1);
+ SelectObject(hdc2, prev_hfont2);
+ DeleteObject(hfont1);
+ DeleteObject(hfont2);
+ DestroyWindow(hwnd1);
+ DestroyWindow(hwnd2);
+}
+
+static void init_tests(void)
+{
+ HMODULE module = GetModuleHandleA("usp10.dll");
+
+ ok(module != 0, "Expected usp10.dll to be loaded.\n");
+
+ pScriptItemizeOpenType = (void *)GetProcAddress(module, "ScriptItemizeOpenType");
+ pScriptShapeOpenType = (void *)GetProcAddress(module, "ScriptShapeOpenType");
+ pScriptGetFontScriptTags = (void *)GetProcAddress(module, "ScriptGetFontScriptTags");
+ pScriptGetFontLanguageTags = (void *)GetProcAddress(module, "ScriptGetFontLanguageTags");
+ pScriptGetFontFeatureTags = (void *)GetProcAddress(module, "ScriptGetFontFeatureTags");
+}
+
START_TEST(usp10)
{
HWND hwnd;
hfont = SelectObject(hdc, CreateFontIndirectA(&lf));
ok(hfont != NULL, "SelectObject failed: %p\n", hfont);
+ init_tests();
+
test_ScriptItemize();
test_ScriptItemize_surrogates();
test_ScriptItemIzeShapePlace(hdc,pwOutGlyphs);
test_ScriptXtoX();
test_ScriptString(hdc);
test_ScriptStringXtoCP_CPtoX(hdc);
+ test_ScriptString_pSize(hdc);
test_ScriptLayout();
test_digit_substitution();
test_ScriptGetLogicalWidths();
test_ScriptIsComplex();
+ test_script_cache_reuse();
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);