https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3df31a821741e7abf5fa9…
commit 3df31a821741e7abf5fa9a2f3ab8a1355d1f7338
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sun Jan 20 20:34:57 2019 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Mon Jan 21 22:25:35 2019 +0100
[USER32_APITEST] Show that scrollbars can be created when extra window data is
requested.
---
modules/rostests/apitests/user32/CMakeLists.txt | 1 +
.../rostests/apitests/user32/ScrollBarWndExtra.c | 61 ++++++++++++++++++++++
modules/rostests/apitests/user32/testlist.c | 2 +
3 files changed, 64 insertions(+)
diff --git a/modules/rostests/apitests/user32/CMakeLists.txt
b/modules/rostests/apitests/user32/CMakeLists.txt
index cdd36cc0c2..5652cc76bf 100644
--- a/modules/rostests/apitests/user32/CMakeLists.txt
+++ b/modules/rostests/apitests/user32/CMakeLists.txt
@@ -29,6 +29,7 @@ list(APPEND SOURCE
RedrawWindow.c
RegisterClassEx.c
RegisterHotKey.c
+ ScrollBarWndExtra.c
ScrollDC.c
ScrollWindowEx.c
SendMessageTimeout.c
diff --git a/modules/rostests/apitests/user32/ScrollBarWndExtra.c
b/modules/rostests/apitests/user32/ScrollBarWndExtra.c
new file mode 100644
index 0000000000..8f4cb9c8cb
--- /dev/null
+++ b/modules/rostests/apitests/user32/ScrollBarWndExtra.c
@@ -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(a)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));
+}
diff --git a/modules/rostests/apitests/user32/testlist.c
b/modules/rostests/apitests/user32/testlist.c
index 0fe6488a9e..82af0c926d 100644
--- a/modules/rostests/apitests/user32/testlist.c
+++ b/modules/rostests/apitests/user32/testlist.c
@@ -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 },