Commit 37e7de12 authored by Jeff Latimer's avatar Jeff Latimer Committed by Alexandre Julliard

usp10: Add tests for ScriptStringAnalyse and ScriptStringFree.

parent 9fe46733
...@@ -614,30 +614,38 @@ static void test_ScriptXtoX(void) ...@@ -614,30 +614,38 @@ static void test_ScriptXtoX(void)
static void test_ScriptString(void) static void test_ScriptString(void)
{ {
/*******************************************************************************************
*
* 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 if freed by ScriptStringFree. There needs to be a valid hdc for this this as
* ScriptStrinAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.
*
*/
HRESULT hr; HRESULT hr;
HWND hwnd; HWND hwnd;
HDC hdc = 0; HDC hdc = 0;
WCHAR teststr[] = {'T', 'e', 's', 't', 'a', '\0'}; WCHAR teststr[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'};
void *pString = (WCHAR *) &teststr; int String = (sizeof(teststr)/sizeof(WCHAR))-1;
int cString = 5; int Glyphs = String * 2 + 16;
int cGlyphs = cString * 2 + 16; int Charset;
int iCharset = -1; DWORD Flags = SSA_GLYPHS;
DWORD dwFlags = SSA_GLYPHS; int ReqWidth = 100;
int iReqWidth = 100; SCRIPT_CONTROL Control;
SCRIPT_CONTROL psControl; SCRIPT_STATE State;
SCRIPT_STATE psState; const int Dx[5] = {10, 10, 10, 10, 10};
const int piDx[5] = {10, 10, 10, 10, 10}; SCRIPT_TABDEF Tabdef;
SCRIPT_TABDEF pTabdef; const BYTE InClass = 0;
const BYTE pbInClass = 0; SCRIPT_STRING_ANALYSIS ssa = NULL;
SCRIPT_STRING_ANALYSIS pssa = NULL;
int X = 10;
int iX = 10; int Y = 100;
int iY = 100; UINT Options = 0;
UINT uOptions = 0; const RECT rc = {0, 50, 100, 100};
const RECT prc = {0, 50, 100, 100}; int MinSel = 0;
int iMinSel = 0; int MaxSel = 0;
int iMaxSel = 0; BOOL Disabled = FALSE;
BOOL fDisabled = FALSE;
LOGFONTA lf; LOGFONTA lf;
HFONT zfont; HFONT zfont;
...@@ -658,31 +666,37 @@ static void test_ScriptString(void) ...@@ -658,31 +666,37 @@ static void test_ScriptString(void)
lf.lfOrientation = 0; lf.lfOrientation = 0;
lf.lfUnderline = 0; lf.lfUnderline = 0;
lf.lfStrikeOut = 0; lf.lfStrikeOut = 0;
lf.lfWeight = 3; lf.lfWeight = 300;
lf.lfWidth = 10; lf.lfWidth = 10;
zfont = (HFONT) SelectObject(hdc, CreateFontIndirectA(&lf)); zfont = (HFONT) SelectObject(hdc, CreateFontIndirectA(&lf));
Charset = -1; /* this flag indicates unicode input */
/* Test without hdc to get E_INVALIDARG */ /* Test without hdc to get E_INVALIDARG */
hr = ScriptStringAnalyse( NULL, pString, cString, cGlyphs, iCharset, dwFlags, hr = ScriptStringAnalyse( NULL, teststr, String, Glyphs, Charset, Flags,
iReqWidth, &psControl, &psState, piDx, &pTabdef, ReqWidth, &Control, &State, Dx, &Tabdef,
&pbInClass, &pssa); &InClass, &ssa);
ok(hr == E_PENDING, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr); ok(hr == E_PENDING, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr);
/* test with hdc, this should be a valid test */ /* test with hdc, this should be a valid test */
hr = ScriptStringAnalyse( hdc, pString, cString, cGlyphs, iCharset, dwFlags, hr = ScriptStringAnalyse( hdc, teststr, String, Glyphs, Charset, Flags,
iReqWidth, &psControl, &psState, piDx, &pTabdef, ReqWidth, &Control, &State, Dx, &Tabdef,
&pbInClass, &pssa); &InClass, &ssa);
ok(hr == E_NOTIMPL, "ScriptStringAnalyse Stub should return E_NOTIMPL not %08x\n", hr); todo_wine ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);
/* Commented code it pending new code in ScriptStringAnalysis */
/* ok(hr == S_OK, "ScriptStringAnalyse Stub should return S_OK not %08x\n", (unsigned int) hr);*/ /* test makes sure that a call with a valid pssa still works */
/* ok(pssa != NULL, "ScriptStringAnalyse pssa should not be NULL\n");*/ hr = ScriptStringAnalyse( hdc, teststr, String, Glyphs, Charset, Flags,
ReqWidth, &Control, &State, Dx, &Tabdef,
&InClass, &ssa);
todo_wine ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr);
todo_wine ok(ssa != NULL, "ScriptStringAnalyse pssa should not be NULL\n");
if (hr == 0) if (hr == 0)
{ {
hr = ScriptStringOut(pssa, iX, iY, uOptions, &prc, iMinSel, iMaxSel,fDisabled); hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled);
ok(hr == E_NOTIMPL, "ScriptStringOut Stub should return E_NOTIMPL not %08x\n", hr); todo_wine ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr);
hr = ScriptStringFree(&pssa); hr = ScriptStringFree(&ssa);
ok(hr == S_OK, "ScriptStringFree Stub should return S_OK not %08x\n", hr); todo_wine ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);
} }
} }
...@@ -1060,9 +1074,6 @@ START_TEST(usp10) ...@@ -1060,9 +1074,6 @@ START_TEST(usp10)
test_ScriptCacheGetHeight(hdc); test_ScriptCacheGetHeight(hdc);
test_ScriptGetGlyphABCWidth(hdc); test_ScriptGetGlyphABCWidth(hdc);
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
test_ScriptGetFontProperties(); test_ScriptGetFontProperties();
test_ScriptTextOut(); test_ScriptTextOut();
test_ScriptXtoX(); test_ScriptXtoX();
...@@ -1070,4 +1081,7 @@ START_TEST(usp10) ...@@ -1070,4 +1081,7 @@ START_TEST(usp10)
test_ScriptLayout(); test_ScriptLayout();
test_digit_substitution(); test_digit_substitution();
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment