usp10: ScriptTextOut updated to reflect that it must have a hdc passed to it.
This commit is contained in:
parent
d5d441d790
commit
8bdeffa4ef
|
@ -363,13 +363,13 @@ void test_ScriptTextOut(void)
|
||||||
int cMaxItems;
|
int cMaxItems;
|
||||||
SCRIPT_ITEM pItem[255];
|
SCRIPT_ITEM pItem[255];
|
||||||
int pcItems;
|
int pcItems;
|
||||||
WCHAR TestItem1[6] = {'T', 'e', 's', 't', 0x0166, 0};
|
WCHAR TestItem1[6] = {'T', 'e', 's', 't', 'a', 0};
|
||||||
|
|
||||||
SCRIPT_CACHE psc;
|
SCRIPT_CACHE psc;
|
||||||
int cChars;
|
int cChars;
|
||||||
int cMaxGlyphs;
|
int cMaxGlyphs;
|
||||||
unsigned short pwOutGlyphs1[256];
|
unsigned short pwOutGlyphs1[256];
|
||||||
unsigned short pwLogClust[256];
|
WORD pwLogClust[256];
|
||||||
SCRIPT_VISATTR psva[256];
|
SCRIPT_VISATTR psva[256];
|
||||||
int pcGlyphs;
|
int pcGlyphs;
|
||||||
int piAdvance[256];
|
int piAdvance[256];
|
||||||
|
@ -422,7 +422,8 @@ void test_ScriptTextOut(void)
|
||||||
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 (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
|
ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
|
||||||
if (hr ==0) {
|
if (hr ==0) {
|
||||||
hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance,
|
/* 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);
|
pGoffset, pABC);
|
||||||
ok (hr == 0, "Should return 0 not (%08x)\n", (unsigned int) hr);
|
ok (hr == 0, "Should return 0 not (%08x)\n", (unsigned int) hr);
|
||||||
ScriptFreeCache(&psc); /* Get rid of psc for next test set */
|
ScriptFreeCache(&psc); /* Get rid of psc for next test set */
|
||||||
|
@ -444,25 +445,26 @@ void test_ScriptTextOut(void)
|
||||||
"got %08x\n", (unsigned int)hr);
|
"got %08x\n", (unsigned int)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
|
||||||
|
* hdc is required for this one rather than the usual optional */
|
||||||
psc = NULL;
|
psc = NULL;
|
||||||
hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
||||||
piAdvance, NULL, pGoffset);
|
piAdvance, NULL, pGoffset);
|
||||||
ok( hr == E_PENDING, "(NULL,&psc,), expected E_PENDING, got %08x\n", (unsigned int)hr);
|
ok( hr == E_INVALIDARG, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", (unsigned int)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);
|
||||||
|
|
||||||
/* Se that is gets a psc and that returns 0 status */
|
/* Set that is gets a psc and that returns 0 status */
|
||||||
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
||||||
piAdvance, NULL, pGoffset);
|
piAdvance, NULL, pGoffset);
|
||||||
ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", (unsigned int) hr);
|
ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", (unsigned int) 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");
|
||||||
|
|
||||||
/* Test Rect Rgn is acceptable and that it works without hdc */
|
/* Test Rect Rgn is acceptable */
|
||||||
rect.top = 10;
|
rect.top = 10;
|
||||||
rect.bottom = 20;
|
rect.bottom = 20;
|
||||||
rect.left = 10;
|
rect.left = 10;
|
||||||
rect.right = 40;
|
rect.right = 40;
|
||||||
hr = ScriptTextOut(NULL, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs,
|
||||||
piAdvance, NULL, pGoffset);
|
piAdvance, NULL, pGoffset);
|
||||||
ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", (unsigned int) hr);
|
ok (hr == 0, "ScriptTextOut should return 0 not (%08x)\n", (unsigned int) 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");
|
||||||
|
|
|
@ -604,23 +604,18 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
|
||||||
hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs,
|
hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs,
|
||||||
piAdvance, piJustify, pGoffset);
|
piAdvance, piJustify, pGoffset);
|
||||||
|
|
||||||
if (!psc || !piAdvance || !psa || !pwGlyphs)
|
if (!hdc || !psc || !piAdvance || !psa || !pwGlyphs) /* hdc is mandatory */
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if (!hdc && !*psc) {
|
if (!*psc) {
|
||||||
TRACE("No Script_Cache (psc) and no hdc. Ask for one. Hdc=%p, psc=%p\n", hdc, *psc);
|
pScriptcache = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Scriptcache) );
|
||||||
return E_PENDING;
|
pScriptcache->hdc = hdc;
|
||||||
} else
|
phdc = hdc;
|
||||||
if (hdc && !*psc) {
|
*psc = pScriptcache;
|
||||||
pScriptcache = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Scriptcache) );
|
} else {
|
||||||
pScriptcache->hdc = hdc;
|
pScriptcache = *psc;
|
||||||
phdc = hdc;
|
phdc = pScriptcache->hdc;
|
||||||
*psc = pScriptcache;
|
}
|
||||||
} else
|
|
||||||
if (*psc) {
|
|
||||||
pScriptcache = *psc;
|
|
||||||
phdc = pScriptcache->hdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuOptions &= ETO_CLIPPED + ETO_OPAQUE;
|
fuOptions &= ETO_CLIPPED + ETO_OPAQUE;
|
||||||
if (!psa->fNoGlyphIndex) /* Have Glyphs? */
|
if (!psa->fNoGlyphIndex) /* Have Glyphs? */
|
||||||
|
|
Loading…
Reference in New Issue