Commit c90edc19 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme: Implement GetThemeTransitionDuration().

Fix Nokia SDK 2.0 for Java installer buttons not changing state after clicking. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 59007aae
...@@ -228,8 +228,32 @@ HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID, ...@@ -228,8 +228,32 @@ HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID,
HRESULT WINAPI GetThemeTransitionDuration(HTHEME hTheme, int iPartId, int iStateIdFrom, HRESULT WINAPI GetThemeTransitionDuration(HTHEME hTheme, int iPartId, int iStateIdFrom,
int iStateIdTo, int iPropId, DWORD *pdwDuration) int iStateIdTo, int iPropId, DWORD *pdwDuration)
{ {
FIXME("(%p, %u, %u, %u, %u, %p) stub\n", hTheme, iPartId, iStateIdFrom, iStateIdTo, INTLIST intlist;
iPropId, pdwDuration); HRESULT hr;
TRACE("(%p, %d, %d, %d, %d, %p)\n", hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId,
pdwDuration);
if (!pdwDuration || iStateIdFrom < 1 || iStateIdTo < 1)
return E_INVALIDARG;
hr = GetThemeIntList(hTheme, iPartId, 0, iPropId, &intlist);
if (FAILED(hr))
{
if (hr == E_PROP_ID_UNSUPPORTED)
*pdwDuration = 0;
return hr;
}
if (intlist.iValueCount < 1 || iStateIdFrom > intlist.iValues[0]
|| iStateIdTo > intlist.iValues[0]
|| intlist.iValueCount != 1 + intlist.iValues[0] * intlist.iValues[0])
{
*pdwDuration = 0;
return E_INVALIDARG;
}
return E_NOTIMPL; *pdwDuration = intlist.iValues[1 + intlist.iValues[0] * (iStateIdFrom - 1) + (iStateIdTo - 1)];
return S_OK;
} }
...@@ -1329,74 +1329,64 @@ static void test_GetThemeTransitionDuration(void) ...@@ -1329,74 +1329,64 @@ static void test_GetThemeTransitionDuration(void)
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(NULL, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(NULL, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
/* Crash on Wine. HTHEME is not a pointer that can be directly referenced. */
if (strcmp(winetest_platform, "wine"))
{
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration((HTHEME)0xdeadbeef, BP_PUSHBUTTON, PBS_NORMAL, hr = pGetThemeTransitionDuration((HTHEME)0xdeadbeef, BP_PUSHBUTTON, PBS_NORMAL,
PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration);
todo_wine todo_wine
ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
}
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, 0xdeadbeef, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(theme, 0xdeadbeef, PBS_NORMAL, PBS_DEFAULTED_ANIMATING,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL - 1, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL - 1, PBS_DEFAULTED_ANIMATING,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_DEFAULTED_ANIMATING + 1, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_DEFAULTED_ANIMATING + 1,
PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_NORMAL - 1, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_NORMAL - 1,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING + 1, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING + 1,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING,
TMT_BACKGROUND, &duration); TMT_BACKGROUND, &duration);
todo_wine
ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING,
0xdeadbeef, &duration); 0xdeadbeef, &duration);
todo_wine
ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING,
TMT_TRANSITIONDURATIONS, NULL); TMT_TRANSITIONDURATIONS, NULL);
todo_wine
ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
/* Parts that don't have TMT_TRANSITIONDURATIONS */ /* Parts that don't have TMT_TRANSITIONDURATIONS */
...@@ -1406,9 +1396,7 @@ static void test_GetThemeTransitionDuration(void) ...@@ -1406,9 +1396,7 @@ static void test_GetThemeTransitionDuration(void)
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_GROUPBOX, GBS_NORMAL, GBS_DISABLED, hr = pGetThemeTransitionDuration(theme, BP_GROUPBOX, GBS_NORMAL, GBS_DISABLED,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
todo_wine
ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration); ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
/* Test parsing TMT_TRANSITIONDURATIONS property. TMT_TRANSITIONDURATIONS is a vista+ property */ /* Test parsing TMT_TRANSITIONDURATIONS property. TMT_TRANSITIONDURATIONS is a vista+ property */
...@@ -1436,10 +1424,8 @@ static void test_GetThemeTransitionDuration(void) ...@@ -1436,10 +1424,8 @@ static void test_GetThemeTransitionDuration(void)
duration = 0xdeadbeef; duration = 0xdeadbeef;
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, from_state, to_state, hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, from_state, to_state,
TMT_TRANSITIONDURATIONS, &duration); TMT_TRANSITIONDURATIONS, &duration);
todo_wine
ok(hr == S_OK, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(hr == S_OK, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
expected = intlist.iValues[1 + intlist.iValues[0] * (from_state - 1) + (to_state - 1)]; expected = intlist.iValues[1 + intlist.iValues[0] * (from_state - 1) + (to_state - 1)];
todo_wine
ok(duration == expected, "Expected duration %d, got %d.\n", expected, duration); ok(duration == expected, "Expected duration %d, got %d.\n", expected, duration);
winetest_pop_context(); winetest_pop_context();
......
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