Commit 960372f2 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

usp10: Match output of WinXP for ScriptGetProperties.

parent 02d30df0
......@@ -2,6 +2,7 @@
* Tests for usp10 dll
*
* Copyright 2006 Jeff Latimer
* Copyright 2006 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -1255,6 +1256,25 @@ static void test_digit_substitution(void)
}
}
static void test_ScriptGetProperties(void)
{
const SCRIPT_PROPERTIES **props;
HRESULT hr;
int num;
hr = ScriptGetProperties(NULL, NULL);
ok(hr == E_INVALIDARG, "ScriptGetProperties succeeded\n");
hr = ScriptGetProperties(NULL, &num);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
hr = ScriptGetProperties(&props, NULL);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
hr = ScriptGetProperties(&props, &num);
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
}
START_TEST(usp10)
{
HWND hwnd;
......@@ -1286,6 +1306,7 @@ START_TEST(usp10)
test_ScriptLayout();
test_digit_substitution();
test_ScriptGetProperties();
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
......
......@@ -2,6 +2,7 @@
* Implementation of Uniscribe Script Processor (usp10.dll)
*
* Copyright 2005 Steven Edwards for CodeWeavers
* Copyright 2006 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -41,34 +42,106 @@
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
#define MAX_SCRIPTS 8
/* Set up a default for ScriptGetProperties */
static const SCRIPT_PROPERTIES Default_Script_0 = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_1 = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_2 = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_3 = {9, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_4 = {9, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_5 = {9, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_6 = {9, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0};
static const SCRIPT_PROPERTIES Default_Script_7 = {8, 0, 0, 0, 0, 161, 0, 0,
0, 0, 0, 0, 0, 0, 0};
static const SCRIPT_PROPERTIES *Global_Script[MAX_SCRIPTS] =
{&Default_Script_0,
&Default_Script_1,
&Default_Script_2,
&Default_Script_3,
&Default_Script_4,
&Default_Script_5,
&Default_Script_6,
&Default_Script_7};
static const SCRIPT_PROPERTIES props[] =
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 8, 0, 0, 0, 0, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 25, 0, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 55, 0, 0,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0 },
{ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
static const SCRIPT_PROPERTIES *script_props[] =
{
&props[0], &props[1], &props[2], &props[3],
&props[4], &props[5], &props[6], &props[7],
&props[8], &props[9], &props[11], &props[12],
&props[13], &props[14], &props[15], &props[16],
&props[17], &props[18], &props[19], &props[20],
&props[21], &props[22], &props[23], &props[24],
&props[25], &props[26], &props[27], &props[28],
&props[29], &props[30], &props[31], &props[32],
&props[33], &props[34], &props[35], &props[36],
&props[37], &props[38], &props[39], &props[40],
&props[41], &props[42], &props[43], &props[44],
&props[45], &props[46], &props[47], &props[48],
&props[49], &props[50], &props[51], &props[52],
&props[53], &props[54], &props[55], &props[56],
&props[57], &props[58], &props[59], &props[60],
&props[61], &props[62], &props[63], &props[64],
&props[65], &props[66], &props[67], &props[68],
&props[69], &props[70], &props[71], &props[72],
&props[73]
};
typedef struct scriptcache {
HDC hdc;
......@@ -129,20 +202,29 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
/***********************************************************************
* ScriptGetProperties (USP10.@)
*
* Retrieve a list of script properties.
*
* PARAMS
* props [I] Pointer to an array of SCRIPT_PROPERTIES pointers.
* num [I] Pointer to the number of scripts.
*
* RETURNS
* Success: S_OK
* Failure: Non-zero HRESULT value.
*
* NOTES
* Behaviour matches WinXP.
*/
HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***ppSp, int *piNumScripts)
HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***props, int *num)
{
TRACE("%p,%p\n", ppSp, piNumScripts);
TRACE("(%p,%p)\n", props, num);
if (!ppSp && !piNumScripts) return E_INVALIDARG;
if (!props && !num) return E_INVALIDARG;
/* Set up a sensible default and intialise pointers */
if (piNumScripts) *piNumScripts = MAX_SCRIPTS;
if (ppSp) *ppSp = Global_Script;
TRACE("ppSp:%p, *ppSp:%p, **ppSp:%p, %d\n",
ppSp, ppSp ? *ppSp : NULL, (ppSp && *ppSp) ? **ppSp : NULL,
piNumScripts ? *piNumScripts : -1);
return 0;
if (num) *num = sizeof(script_props)/sizeof(script_props[0]);
if (props) *props = script_props;
return S_OK;
}
/***********************************************************************
......
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