1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPL - See COPYING in the top level directory 4 * PURPOSE: Test for SetThemeAppProperties 5 * PROGRAMMERS: Giannis Adamopoulos 6 */ 7 8 #include <apitest.h> 9 #include <stdio.h> 10 #include <windows.h> 11 #include <uxtheme.h> 12 #include <vfwmsgs.h> 13 14 START_TEST(SetThemeAppProperties) 15 { 16 BOOL bThemeActive; 17 HTHEME hTheme; 18 HWND hWnd; 19 20 bThemeActive = IsThemeActive(); 21 if (!bThemeActive) 22 { 23 skip("No active theme, skipping SetWindowTheme tests\n"); 24 return; 25 } 26 27 SetLastError(0xdeadbeef); 28 29 bThemeActive = IsAppThemed(); 30 ok (bThemeActive == FALSE, "\n"); 31 ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError()); 32 33 SetLastError(0xdeadbeef); 34 hTheme = OpenThemeData(NULL, L"BUTTON"); 35 ok (hTheme == NULL, "\n"); 36 ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError()); 37 38 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL); 39 ok (hWnd != NULL, "\n"); 40 41 SetLastError(0xdeadbeef); 42 bThemeActive = IsAppThemed(); 43 ok (bThemeActive == TRUE, "\n"); 44 ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError()); 45 46 SetLastError(0xdeadbeef); 47 hTheme = OpenThemeData(NULL, L"BUTTON"); 48 ok (hTheme != NULL, "\n"); 49 ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError()); 50 51 SetLastError(0xdeadbeef); 52 SetThemeAppProperties(0); 53 ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError()); 54 55 bThemeActive = IsThemeActive(); 56 ok (bThemeActive == TRUE, "\n"); 57 58 bThemeActive = IsAppThemed(); 59 ok (bThemeActive == TRUE, "\n"); 60 61 SetLastError(0xdeadbeef); 62 hTheme = OpenThemeData(NULL, L"BUTTON"); 63 ok (hTheme == NULL, "\n"); 64 ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError()); 65 66 SetThemeAppProperties(STAP_ALLOW_NONCLIENT); 67 68 hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT); 69 ok (hTheme != NULL, "\n"); 70 SetLastError(0xdeadbeef); 71 hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0); 72 ok (hTheme == NULL, "\n"); 73 ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError()); 74 75 SetThemeAppProperties(STAP_ALLOW_CONTROLS); 76 77 SetLastError(0xdeadbeef); 78 hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT); 79 ok (hTheme == NULL, "\n"); 80 ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError()); 81 hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0); 82 ok (hTheme != NULL, "\n"); 83 84 } 85