Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/uxtheme/system.c | 2 + dlls/uxtheme/tests/system.c | 103 ++++++++++-------------------------- 2 files changed, 29 insertions(+), 76 deletions(-)
diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index aaef03f0205..1c25f38d5d9 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -642,6 +642,8 @@ HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags) if(IsWindow(hwnd)) SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme); TRACE(" = %p\n", hTheme); + + SetLastError(hTheme ? ERROR_SUCCESS : E_PROP_ID_UNSUPPORTED); return hTheme; }
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 3f259d08f79..a5d962d17a3 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -165,28 +165,21 @@ static void test_OpenThemeData(void) SetLastError(0xdeadbeef); hTheme = OpenThemeData(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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() );
SetLastError(0xdeadbeef); hTheme = OpenThemeData(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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() ); }
/* Only do the bare minimum to get a valid hdc */ @@ -203,20 +196,16 @@ static void test_OpenThemeData(void) SetLastError(0xdeadbeef); hTheme = OpenThemeData(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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() );
if (!bThemeActive) { SetLastError(0xdeadbeef); hTheme = OpenThemeData(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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() ); skip("No active theme, skipping rest of OpenThemeData tests\n"); return; } @@ -226,27 +215,18 @@ static void test_OpenThemeData(void) SetLastError(0xdeadbeef); hTheme = OpenThemeData(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 = OpenThemeData(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 = OpenThemeData(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); @@ -318,28 +298,21 @@ static void test_OpenThemeDataEx(void) SetLastError(0xdeadbeef); hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0); 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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() );
SetLastError(0xdeadbeef); hTheme = pOpenThemeDataEx(NULL, szClassList, 0); 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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() ); }
/* Only do the bare minimum to get a valid hdc */ @@ -356,20 +329,16 @@ static void test_OpenThemeDataEx(void) SetLastError(0xdeadbeef); hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0); 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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() );
if (!bThemeActive) { SetLastError(0xdeadbeef); hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0); 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 0x%08x, got 0x%08x\n", + E_PROP_ID_UNSUPPORTED, GetLastError() ); skip("No active theme, skipping rest of OpenThemeDataEx tests\n"); return; } @@ -379,51 +348,33 @@ static void test_OpenThemeDataEx(void) SetLastError(0xdeadbeef); hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0); 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 = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING); 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 = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT); 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 = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3); 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 = pOpenThemeDataEx(hWnd, szButtonClassList2, 0); 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 = pOpenThemeDataEx(hWnd, szClassList, 0); 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() );
DestroyWindow(hWnd); }