mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 10:45:24 +00:00
[UXTHEME] -Add tests for SetWindowTheme to test the behavior that was changed in r74038.
svn path=/trunk/; revision=74144
This commit is contained in:
parent
0b0e9bd364
commit
0feb059c77
|
@ -2,6 +2,7 @@
|
|||
list(APPEND SOURCE
|
||||
CloseThemeData.c
|
||||
DrawThemeParentBackground.c
|
||||
SetWindowTheme.c
|
||||
../include/msgtrace.c
|
||||
testlist.c)
|
||||
|
||||
|
|
80
rostests/apitests/uxtheme/SetWindowTheme.c
Normal file
80
rostests/apitests/uxtheme/SetWindowTheme.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SetWindowTheme
|
||||
* PROGRAMMERS: Giannis Adamopoulos
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
void TestParams(HWND hwnd)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = SetWindowTheme(0, NULL, NULL);
|
||||
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme((HWND)0xdeaddead, NULL, NULL);
|
||||
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme(hwnd, NULL, NULL);
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"none", L"none");
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme(hwnd, NULL, L"none");
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"none", NULL);
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"", L"");
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
}
|
||||
|
||||
void TestTheme(HWND hwnd)
|
||||
{
|
||||
HRESULT hr;
|
||||
HTHEME htheme1, htheme2;
|
||||
|
||||
hr = SetWindowTheme(hwnd, NULL, NULL);
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
htheme1 = OpenThemeData(hwnd, L"Toolbar");
|
||||
ok (htheme1 != NULL, "OpenThemeData failed\n");
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"", L"");
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
htheme2 = OpenThemeData(hwnd, L"Toolbar");
|
||||
ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"TrayNotify", L"");
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
htheme2 = OpenThemeData(hwnd, L"Toolbar");
|
||||
ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
|
||||
|
||||
hr = SetWindowTheme(hwnd, L"TrayNotify", NULL);
|
||||
ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
|
||||
|
||||
htheme2 = OpenThemeData(hwnd, L"Toolbar");
|
||||
ok (htheme2 != NULL, "OpenThemeData failed\n");
|
||||
|
||||
ok(htheme1 != htheme2, "Expected different theme data\n");
|
||||
}
|
||||
|
||||
START_TEST(SetWindowTheme)
|
||||
{
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = CreateWindowW(L"button", L"Test window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
|
||||
ok (hwnd != NULL, "Expected CreateWindowW to succeed\n");
|
||||
|
||||
TestParams(hwnd);
|
||||
TestTheme(hwnd);
|
||||
}
|
|
@ -3,12 +3,14 @@
|
|||
#define STANDALONE
|
||||
#include <apitest.h>
|
||||
|
||||
extern void func_DrawThemeParentBackground(void);
|
||||
extern void func_CloseThemeData(void);
|
||||
extern void func_DrawThemeParentBackground(void);
|
||||
extern void func_SetWindowTheme(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "DrawThemeParentBackground", func_DrawThemeParentBackground },
|
||||
{ "CloseThemeData", func_CloseThemeData },
|
||||
{ "DrawThemeParentBackground", func_DrawThemeParentBackground },
|
||||
{ "SetWindowTheme", func_SetWindowTheme },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue