Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.

This commit is contained in:
Colin Finck 2017-10-03 07:45:34 +00:00
parent b94e2d8ca0
commit c2c66aff7d
24198 changed files with 0 additions and 37285 deletions

View file

@ -0,0 +1,14 @@
list(APPEND SOURCE
CloseThemeData.c
DrawThemeParentBackground.c
SetWindowTheme.c
SetThemeAppProperties.c
../include/msgtrace.c
testlist.c)
add_executable(uxtheme_apitest ${SOURCE})
target_link_libraries(uxtheme_apitest wine ${PSEH_LIB})
set_module_type(uxtheme_apitest win32cui)
add_importlibs(uxtheme_apitest uxtheme comctl32 user32 msvcrt kernel32)
add_rostests_file(TARGET uxtheme_apitest)

View file

@ -0,0 +1,30 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for CloseThemeData
* PROGRAMMERS: Giannis Adamopoulos
*/
#include <apitest.h>
#include <stdio.h>
#include <windows.h>
#include <uxtheme.h>
static LONG WINAPI VEHandler(PEXCEPTION_POINTERS ExceptionInfo)
{
ok(FALSE, "VEHandler called!\n");
return EXCEPTION_CONTINUE_SEARCH;
}
START_TEST(CloseThemeData)
{
PVOID pVEH;
HRESULT hr;
pVEH = AddVectoredExceptionHandler(1, VEHandler);
hr = CloseThemeData((HTHEME)0xdeaddead);
ok( hr == E_HANDLE, "Expected E_HANDLE, got 0x%lx\n", hr);
RemoveVectoredExceptionHandler(pVEH);
}

View file

@ -0,0 +1,209 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for DrawThemeParentBackground
* PROGRAMMERS: Giannis Adamopoulos
*/
#include <apitest.h>
#include <stdio.h>
#include <windows.h>
#include <uxtheme.h>
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
HWND hWnd1, hWnd2;
static int get_iwnd(HWND hWnd)
{
if(hWnd == hWnd1) return 1;
else if(hWnd == hWnd2) return 2;
else return 0;
}
static LRESULT CALLBACK TestProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int iwnd = get_iwnd(hwnd);
if(message > WM_USER || !iwnd || message == WM_GETICON)
return DefWindowProc(hwnd, message, wParam, lParam);
RECORD_MESSAGE(iwnd, message, SENT, 0,0);
return DefWindowProc(hwnd, message, wParam, lParam);
}
static void FlushMessages()
{
MSG msg;
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
{
int iwnd = get_iwnd(msg.hwnd);
if(iwnd && msg.message <= WM_USER)
RECORD_MESSAGE(iwnd, msg.message, POST,0,0);
DispatchMessageW( &msg );
}
}
MSG_ENTRY draw_parent_chain[]={{1, WM_ERASEBKGND},
{1, WM_PRINTCLIENT},
{0,0}};
void Test_Messages()
{
HDC hdc;
RECT rc;
RegisterSimpleClass(TestProc, L"testClass");
hWnd1 = CreateWindowW(L"testClass", L"Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
ok (hWnd1 != NULL, "Expected CreateWindowW to succeed\n");
hWnd2 = CreateWindowW(L"testClass", L"test window", WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hWnd1, NULL, NULL, NULL);
ok (hWnd2 != NULL, "Expected CreateWindowW to succeed\n");
FlushMessages();
EMPTY_CACHE();
hdc = GetDC(hWnd1);
DrawThemeParentBackground(hWnd2, hdc, NULL);
FlushMessages();
COMPARE_CACHE(draw_parent_chain);
DrawThemeParentBackground(hWnd1, hdc, NULL);
FlushMessages();
COMPARE_CACHE(empty_chain);
ShowWindow(hWnd1, SW_SHOW);
UpdateWindow(hWnd1);
ShowWindow(hWnd2, SW_SHOW);
UpdateWindow(hWnd2);
FlushMessages();
EMPTY_CACHE();
DrawThemeParentBackground(hWnd2, NULL, NULL);
FlushMessages();
COMPARE_CACHE(empty_chain);
DrawThemeParentBackground(hWnd1, NULL, NULL);
FlushMessages();
COMPARE_CACHE(empty_chain);
DrawThemeParentBackground(hWnd2, hdc, NULL);
FlushMessages();
COMPARE_CACHE(draw_parent_chain);
DrawThemeParentBackground(hWnd1, hdc, NULL);
FlushMessages();
COMPARE_CACHE(empty_chain);
memset(&rc, 0, sizeof(rc));
DrawThemeParentBackground(hWnd2, hdc, &rc);
FlushMessages();
COMPARE_CACHE(draw_parent_chain);
DrawThemeParentBackground(hWnd1, hdc, &rc);
FlushMessages();
COMPARE_CACHE(empty_chain);
}
BOOL bGotException;
static LONG WINAPI VEHandler_1(PEXCEPTION_POINTERS ExceptionInfo)
{
ok(FALSE, "VEHandler_1 called!\n");
return EXCEPTION_CONTINUE_SEARCH;
}
static LONG WINAPI VEHandler_2(PEXCEPTION_POINTERS ExceptionInfo)
{
bGotException = TRUE;
return EXCEPTION_CONTINUE_SEARCH;
}
void Test_Params()
{
HRESULT hr;
HDC hdc;
PVOID pVEH;
bGotException = FALSE;
pVEH = AddVectoredExceptionHandler(1, VEHandler_1);
hr = DrawThemeParentBackground(NULL, NULL, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hr = DrawThemeParentBackground((HWND)0xdeaddead, NULL, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hr = DrawThemeParentBackground(NULL, (HDC)0xdeaddead, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hr = DrawThemeParentBackground((HWND)0xdeaddead, (HDC)0xdeaddead, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
RemoveVectoredExceptionHandler(pVEH);
RegisterSimpleClass(DefWindowProcW, L"testClass2");
hWnd1 = CreateWindowW(L"testClass2", L"Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
ok (hWnd1 != NULL, "Expected CreateWindowW to succeed\n");
hWnd2 = CreateWindowW(L"testClass2", L"test window", WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hWnd1, NULL, NULL, NULL);
ok (hWnd2 != NULL, "Expected CreateWindowW to succeed\n");
ShowWindow(hWnd1, SW_SHOW);
UpdateWindow(hWnd1);
ShowWindow(hWnd2, SW_SHOW);
UpdateWindow(hWnd2);
hr = DrawThemeParentBackground(hWnd1, NULL, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hdc = GetDC(hWnd1);
ok (hdc != NULL, "Expected GetDC to succeed\n");
hr = DrawThemeParentBackground(NULL, hdc, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hr = DrawThemeParentBackground(hWnd1, hdc, NULL);
ok (hr == S_OK, "Expected success got 0x%lx error\n", hr);
hr = DrawThemeParentBackground(hWnd1, (HDC)0xdeaddead, NULL);
ok (hr == S_OK, "Expected success got 0x%lx error\n", hr);
pVEH = AddVectoredExceptionHandler(1, VEHandler_2);
hr = DrawThemeParentBackground(hWnd1, hdc, (RECT*)0xdeaddead);
ok (hr == E_POINTER, "Expected success got 0x%lx error\n", hr);
RemoveVectoredExceptionHandler(pVEH);
ok (bGotException == TRUE, "Excepted a handled exception\n");
hr = DrawThemeParentBackground(hWnd2, NULL, NULL);
ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
hr = DrawThemeParentBackground(hWnd2, hdc, NULL);
ok (hr == S_FALSE, "Expected S_FALSE got 0x%lx error\n", hr);
ReleaseDC(hWnd1, hdc);
hdc = GetDC(hWnd2);
ok (hdc != NULL, "Expected GetDC to succeed\n");
hr = DrawThemeParentBackground(hWnd1, hdc, NULL);
ok (hr == S_OK, "Expected success got 0x%lx error\n", hr);
hr = DrawThemeParentBackground(hWnd2, hdc, NULL);
ok (hr == S_FALSE, "Expected S_FALSE got 0x%lx error\n", hr);
ReleaseDC(hWnd2, hdc);
}
START_TEST(DrawThemeParentBackground)
{
Test_Messages();
Test_Params();
}

View file

@ -0,0 +1,84 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for SetThemeAppProperties
* PROGRAMMERS: Giannis Adamopoulos
*/
#include <apitest.h>
#include <stdio.h>
#include <windows.h>
#include <uxtheme.h>
#include <vfwmsgs.h>
START_TEST(SetThemeAppProperties)
{
BOOL bThemeActive;
HTHEME hTheme;
HWND hWnd;
bThemeActive = IsThemeActive();
if (!bThemeActive)
{
skip("No active theme, skipping SetWindowTheme tests\n");
return;
}
SetLastError(0xdeadbeef);
bThemeActive = IsAppThemed();
ok (bThemeActive == FALSE, "\n");
ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
SetLastError(0xdeadbeef);
hTheme = OpenThemeData(NULL, L"BUTTON");
ok (hTheme == NULL, "\n");
ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
ok (hWnd != NULL, "\n");
SetLastError(0xdeadbeef);
bThemeActive = IsAppThemed();
ok (bThemeActive == TRUE, "\n");
ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
SetLastError(0xdeadbeef);
hTheme = OpenThemeData(NULL, L"BUTTON");
ok (hTheme != NULL, "\n");
ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
SetLastError(0xdeadbeef);
SetThemeAppProperties(0);
ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
bThemeActive = IsThemeActive();
ok (bThemeActive == TRUE, "\n");
bThemeActive = IsAppThemed();
ok (bThemeActive == TRUE, "\n");
SetLastError(0xdeadbeef);
hTheme = OpenThemeData(NULL, L"BUTTON");
ok (hTheme == NULL, "\n");
ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
ok (hTheme != NULL, "\n");
SetLastError(0xdeadbeef);
hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
ok (hTheme == NULL, "\n");
ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
SetThemeAppProperties(STAP_ALLOW_CONTROLS);
SetLastError(0xdeadbeef);
hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
ok (hTheme == NULL, "\n");
ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
ok (hTheme != NULL, "\n");
}

View 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);
}

View file

@ -0,0 +1,18 @@
#define __ROS_LONG64__
#define STANDALONE
#include <apitest.h>
extern void func_CloseThemeData(void);
extern void func_DrawThemeParentBackground(void);
extern void func_SetThemeAppProperties(void);
extern void func_SetWindowTheme(void);
const struct test winetest_testlist[] =
{
{ "CloseThemeData", func_CloseThemeData },
{ "DrawThemeParentBackground", func_DrawThemeParentBackground },
{ "SetWindowTheme", func_SetWindowTheme },
{ "SetThemeAppProperties", func_SetThemeAppProperties },
{ 0, 0 }
};