[3/3]uxtheme: fix GetLastError messages in OpenThemeData
André Hentschel
nerv at dawncrow.de
Thu Aug 13 13:25:58 CDT 2009
---
dlls/uxtheme/system.c | 4 +++
dlls/uxtheme/tests/system.c | 56 ++++++++++++++++++------------------------
2 files changed, 28 insertions(+), 32 deletions(-)
diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c
index d6410f0..693efa4 100644
--- a/dlls/uxtheme/system.c
+++ b/dlls/uxtheme/system.c
@@ -661,6 +661,10 @@ HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
}
if(IsWindow(hwnd))
SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme);
+ if(hTheme)
+ SetLastError(ERROR_SUCCESS);
+ else
+ SetLastError(E_PROP_ID_UNSUPPORTED);
TRACE(" = %p\n", hTheme);
return hTheme;
}
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c
index 115e48b..d9d8836 100644
--- a/dlls/uxtheme/tests/system.c
+++ b/dlls/uxtheme/tests/system.c
@@ -198,28 +198,25 @@ static void test_OpenThemeData(void)
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(NULL, szInvalidClassList);
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
- todo_wine
- ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
- "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
+ "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
+ GetLastError());
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(NULL, szClassList);
if (bThemeActive)
{
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
- todo_wine
- ok( GetLastError() == ERROR_SUCCESS,
- "Expected ERROR_SUCCESS, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got 0x%08x\n",
+ GetLastError());
}
else
{
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
- todo_wine
- ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
- "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
+ "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
+ GetLastError());
}
/* Only do the bare minimum to get a valid hdc */
@@ -236,20 +233,18 @@ static void test_OpenThemeData(void)
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(hWnd, szInvalidClassList);
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
- todo_wine
- ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
- "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
+ "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
+ GetLastError());
if (!bThemeActive)
{
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(hWnd, szButtonClassList);
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
- todo_wine
- ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
- "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
+ "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
+ GetLastError());
skip("No active theme, skipping rest of OpenThemeData tests\n");
return;
}
@@ -259,27 +254,24 @@ static void test_OpenThemeData(void)
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(hWnd, szButtonClassList);
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
- todo_wine
- ok( GetLastError() == ERROR_SUCCESS,
- "Expected ERROR_SUCCESS, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got 0x%08x\n",
+ GetLastError());
/* Test with bUtToN instead of Button */
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(hWnd, szButtonClassList2);
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
- todo_wine
- ok( GetLastError() == ERROR_SUCCESS,
- "Expected ERROR_SUCCESS, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got 0x%08x\n",
+ GetLastError());
SetLastError(0xdeadbeef);
hTheme = pOpenThemeData(hWnd, szClassList);
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
- todo_wine
- ok( GetLastError() == ERROR_SUCCESS,
- "Expected ERROR_SUCCESS, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got 0x%08x\n",
+ GetLastError());
/* GetWindowTheme should return the last handle opened by OpenThemeData */
SetLastError(0xdeadbeef);
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list