[USER32_APITEST] -Move the helper functions in the common include directory

[UXTHEME_APITEST] -Use the helper functions to test the messages sent by DrawThemeParentBackground

svn path=/trunk/; revision=74123
This commit is contained in:
Giannis Adamopoulos 2017-03-07 22:29:48 +00:00
parent f7b5561d60
commit 93bbc9d548
19 changed files with 172 additions and 30 deletions

View file

@ -34,6 +34,7 @@ add_subdirectory(psapi)
add_subdirectory(user32)
add_subdirectory(user32_dynamic)
add_subdirectory(userenv)
add_subdirectory(uxtheme)
if(NOT ARCH STREQUAL "amd64" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
add_subdirectory(win32kdll)
add_subdirectory(win32nt)

View file

@ -9,7 +9,7 @@
#include <stdio.h>
#include <winuser.h>
#include "helper.h"
#include <msgtrace.h>
#include <undocuser.h>
MSG_CACHE default_cache = {
@ -58,6 +58,10 @@ static char* get_msg_name(UINT msg)
case WM_SETICON: return "WM_SETICON";
case WM_KEYDOWN: return "WM_KEYDOWN";
case WM_KEYUP: return "WM_KEYUP";
case WM_NOTIFY: return "WM_NOTIFY";
case WM_COMMAND: return "WM_COMMAND";
case WM_PRINTCLIENT: return "WM_PRINTCLIENT";
case WM_CTLCOLORSTATIC: return "WM_CTLCOLORSTATIC";
default: return NULL;
}
}
@ -203,16 +207,3 @@ void record_message(MSG_CACHE* cache, int iwnd, UINT message, MSG_TYPE type, int
cache->count++;
}
ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
{
WNDCLASSEXW wcex;
memset(&wcex, 0, sizeof(wcex));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = lpfnWndProc;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszClassName = lpszClassName;
return RegisterClassExW(&wcex);
}

View file

@ -1,3 +1,5 @@
#ifndef APITESTS_MSGTRACE_H
#define APITESTS_MSGTRACE_H
typedef enum _MSG_TYPE
{
@ -31,8 +33,6 @@ void compare_cache(MSG_CACHE* cache, const char* file, int line, MSG_ENTRY *msg_
void trace_cache(MSG_CACHE* cache, const char* file, int line);
void empty_message_cache(MSG_CACHE* cache);
ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName);
/* filter messages that are affected by dwm */
static inline BOOL IsDWmMsg(UINT msg)
{
@ -68,3 +68,5 @@ static inline BOOL IseKeyMsg(UINT msg)
if(notexpected) \
ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \
}
#endif

View file

@ -0,0 +1,13 @@
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
{
WNDCLASSEXW wcex;
memset(&wcex, 0, sizeof(wcex));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = lpfnWndProc;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszClassName = lpszClassName;
return RegisterClassExW(&wcex);
}

View file

@ -9,7 +9,8 @@
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <msgtrace.h>
#include <user32testhelpers.h>
#define DESKTOP_ALL_ACCESS 0x01ff

View file

@ -1,7 +1,7 @@
list(APPEND SOURCE
AttachThreadInput.c
helper.c
../include/msgtrace.c
CreateDialog.c
CreateIconFromResourceEx.c
CreateWindowEx.c

View file

@ -8,8 +8,9 @@
#include <apitest.h>
#include <winuser.h>
#include "helper.h"
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
HWND hWnd1, hWnd2, hWnd3, hWnd4;

View file

@ -8,7 +8,6 @@
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include "helper.h"
#define DCX_USESTYLE 0x00010000

View file

@ -12,7 +12,6 @@
#include <wchar.h>
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <undocuser.h>
static ATOM _RegisterClass(LPCWSTR lpwszClassName, HINSTANCE hInstance, UINT style, WNDPROC lpfnWndProc)

View file

@ -7,7 +7,9 @@
#include <apitest.h>
#include <winuser.h>
#include "helper.h"
#include <msgtrace.h>
#include <user32testhelpers.h>
static DWORD dwThread1;
static DWORD dwThread2;

View file

@ -9,9 +9,11 @@
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
HWND hWnd1, hWnd2;
/* FIXME: test for HWND_TOP, etc...*/

View file

@ -8,7 +8,8 @@
#include <apitest.h>
#include <winuser.h>
#include "helper.h"
#include <msgtrace.h>
#include <user32testhelpers.h>
static HWND hWndList[5 + 1];
static const int hWndCount = sizeof(hWndList) / sizeof(hWndList[0]) - 1;

View file

@ -6,9 +6,8 @@
*/
#include <apitest.h>
#include <winuser.h>
#include "helper.h"
#include <user32testhelpers.h>
static ATOM Atom1, Atom2, Atom3;

View file

@ -9,9 +9,11 @@
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
HWND hWnd1, hWnd2;
/* FIXME: test for HWND_TOP, etc...*/

View file

@ -6,12 +6,13 @@
*/
#include <apitest.h>
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
HWND hWnd1, hWnd2, hWnd3;
HHOOK hMouseHookLL, hMouseHook;
int ignore_timer = 0, ignore_mouse = 0, ignore_mousell = 0;

View file

@ -12,7 +12,7 @@
#include <stdio.h>
#include <wingdi.h>
#include <winuser.h>
#include "helper.h"
#include <user32testhelpers.h>
#include <ndk/umtypes.h>
#include <ndk/obfuncs.h>

View file

@ -0,0 +1,11 @@
list(APPEND SOURCE
DrawThemeParentBackground.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,105 @@
/*
* 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");
ShowWindow(hWnd1, SW_SHOW);
UpdateWindow(hWnd1);
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");
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);
hdc = GetDC(hWnd1);
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);
}
START_TEST(DrawThemeParentBackground)
{
Test_Messages();
}

View file

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