[USER32_APITEST] Show that scrollbars can be created when extra window data is requested.

This commit is contained in:
Mark Jansen 2019-01-20 20:34:57 +01:00
parent e022d8d7cb
commit 3df31a8217
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
3 changed files with 64 additions and 0 deletions

View file

@ -29,6 +29,7 @@ list(APPEND SOURCE
RedrawWindow.c
RegisterClassEx.c
RegisterHotKey.c
ScrollBarWndExtra.c
ScrollDC.c
ScrollWindowEx.c
SendMessageTimeout.c

View file

@ -0,0 +1,61 @@
/*
* PROJECT: ReactOS API tests
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
* PURPOSE: Test for ScrollBar cbWndExtra
* COPYRIGHT: Copyright 2019 Mark Jansen <mark.jansen@reactos.org>
*
* Why do we need this test?
* Ask the authors of Civilization II...
*/
#include "precomp.h"
#define BUILTIN_SCROLLBAR "Scrollbar"
#define CUSTOM_SCROLLBAR "MSScrollBarClass"
START_TEST(ScrollBarWndExtra)
{
HWND hScrollBar;
HWND hScrollBarImpersonator;
WNDCLASSA WndClass;
ATOM ClassAtom;
LONG_PTR dummyData = (LONG_PTR)0xbeefbeefbeefbeefULL, result;
WNDPROC lpfnWndProc;
DWORD dwExtra;
hScrollBar = CreateWindowExA(0, BUILTIN_SCROLLBAR, "", WS_POPUP,
20, 20, 120, 120, NULL, 0, GetModuleHandle(NULL), 0);
ok(hScrollBar != NULL, "Scrollbar creation failed (%lu)\n", GetLastError());
lpfnWndProc = (WNDPROC)GetWindowLongPtrA(hScrollBar, GWL_WNDPROC);
dwExtra = GetClassLongPtrA(hScrollBar, GCL_CBWNDEXTRA);
ZeroMemory(&WndClass, sizeof(WndClass));
WndClass.style = CS_DBLCLKS | CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = lpfnWndProc;
WndClass.cbWndExtra = dwExtra + sizeof(LONG_PTR);
WndClass.hInstance = GetModuleHandle(NULL);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = GetStockObject(LTGRAY_BRUSH);
WndClass.lpszClassName = CUSTOM_SCROLLBAR;
ClassAtom = RegisterClassA(&WndClass);
ok(ClassAtom != 0, "RegisterClassA failed (%lu)\n", GetLastError());
DestroyWindow(hScrollBar);
hScrollBarImpersonator = CreateWindowExA(0, CUSTOM_SCROLLBAR, "", WS_POPUP,
20, 20, 120, 120, NULL, 0, GetModuleHandle(NULL), 0);
ok(hScrollBarImpersonator != NULL, "Scrollbar creation failed (%lu)\n", GetLastError());
SetWindowLongPtrA(hScrollBarImpersonator, dwExtra, dummyData);
result = GetWindowLongPtrA(hScrollBarImpersonator, dwExtra);
ok(result == dummyData, "Invalid dummyData\n");
DestroyWindow(hScrollBarImpersonator);
UnregisterClassA(CUSTOM_SCROLLBAR, GetModuleHandle(NULL));
}

View file

@ -31,6 +31,7 @@ extern void func_RealGetWindowClass(void);
extern void func_RedrawWindow(void);
extern void func_RegisterHotKey(void);
extern void func_RegisterClassEx(void);
extern void func_ScrollBarWndExtra(void);
extern void func_ScrollDC(void);
extern void func_ScrollWindowEx(void);
extern void func_SendMessageTimeout(void);
@ -76,6 +77,7 @@ const struct test winetest_testlist[] =
{ "RedrawWindow", func_RedrawWindow },
{ "RegisterHotKey", func_RegisterHotKey },
{ "RegisterClassEx", func_RegisterClassEx },
{ "ScrollBarWndExtra", func_ScrollBarWndExtra },
{ "ScrollDC", func_ScrollDC },
{ "ScrollWindowEx", func_ScrollWindowEx },
{ "SendMessageTimeout", func_SendMessageTimeout },