Author: tfaber
Date: Sat Mar 4 18:34:35 2017
New Revision: 74058
URL:
http://svn.reactos.org/svn/reactos?rev=74058&view=rev
Log:
[USER32_APITEST]
- Add a test for SetScrollRange
CORE-12763
Added:
trunk/rostests/apitests/user32/SetScrollRange.c (with props)
Modified:
trunk/rostests/apitests/user32/CMakeLists.txt
trunk/rostests/apitests/user32/testlist.c
Modified: trunk/rostests/apitests/user32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeList…
==============================================================================
--- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Sat Mar 4 18:34:35 2017
@@ -32,6 +32,7 @@
SetParent.c
SetProp.c
SetScrollInfo.c
+ SetScrollRange.c
SystemParametersInfo.c
TrackMouseEvent.c
WndProc.c
Added: trunk/rostests/apitests/user32/SetScrollRange.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SetScroll…
==============================================================================
--- trunk/rostests/apitests/user32/SetScrollRange.c (added)
+++ trunk/rostests/apitests/user32/SetScrollRange.c [iso-8859-1] Sat Mar 4 18:34:35 2017
@@ -0,0 +1,66 @@
+/*
+ * PROJECT: ReactOS API tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for SetScrollRange
+ * PROGRAMMERS: Thomas Faber <thomas.faber(a)reactos.org>
+ */
+
+#include <apitest.h>
+
+#include <wingdi.h>
+#include <winuser.h>
+
+START_TEST(SetScrollRange)
+{
+ struct
+ {
+ INT nMin;
+ INT nMax;
+ BOOL result;
+ } tests[] =
+ {
+ { 0, 0, TRUE },
+ { 0, INT_MAX, TRUE },
+ { -1, INT_MAX, FALSE },
+ { INT_MIN, INT_MAX, FALSE },
+ { INT_MIN, 0, FALSE },
+ { INT_MIN, -1, TRUE },
+ };
+ unsigned i;
+ HWND hScroll;
+ BOOL success;
+ DWORD error;
+ INT newMin, newMax;
+
+ hScroll = CreateWindowExW(0, L"SCROLLBAR", NULL, 0, 0, 0, 0, 0, NULL, NULL,
NULL, NULL);
+ ok(hScroll != NULL, "CreateWindowEx failed with %lu\n", GetLastError());
+ if (!hScroll)
+ {
+ skip("No scroll bar\n");
+ return;
+ }
+
+ for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ {
+ (void)SetScrollRange(hScroll, SB_CTL, 123, 456, FALSE);
+ SetLastError(0xdeaff00d);
+ success = SetScrollRange(hScroll, SB_CTL, tests[i].nMin, tests[i].nMax, FALSE);
+ error = GetLastError();
+ (void)GetScrollRange(hScroll, SB_CTL, &newMin, &newMax);
+ if (tests[i].result)
+ {
+ ok(success == TRUE, "SetScrollRange(%d, %d) failed with %d %lu\n",
tests[i].nMin, tests[i].nMax, success, error);
+ ok(newMin == tests[i].nMin, "nMin was changed to %d\n",
tests[i].nMin);
+ ok(newMax == tests[i].nMax, "nMax was changed to %d\n",
tests[i].nMax);
+ }
+ else
+ {
+ ok(success == FALSE, "SetScrollRange(%d, %d) succeeded with %d\n",
tests[i].nMin, tests[i].nMax, success);
+ ok(error == ERROR_INVALID_SCROLLBAR_RANGE, "Error %lu\n", error);
+ ok(newMin == 123, "nMin was changed to %d\n", newMin);
+ ok(newMax == 456, "nMax was changed to %d\n", newMax);
+ }
+ }
+
+ DestroyWindow(hScroll);
+}
Propchange: trunk/rostests/apitests/user32/SetScrollRange.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/user32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.…
==============================================================================
--- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Sat Mar 4 18:34:35 2017
@@ -34,6 +34,7 @@
extern void func_SetParent(void);
extern void func_SetProp(void);
extern void func_SetScrollInfo(void);
+extern void func_SetScrollRange(void);
extern void func_SystemParametersInfo(void);
extern void func_TrackMouseEvent(void);
extern void func_WndProc(void);
@@ -72,6 +73,7 @@
{ "SetParent", func_SetParent },
{ "SetProp", func_SetProp },
{ "SetScrollInfo", func_SetScrollInfo },
+ { "SetScrollRange", func_SetScrollRange },
{ "SystemParametersInfo", func_SystemParametersInfo },
{ "TrackMouseEvent", func_TrackMouseEvent },
{ "WndProc", func_WndProc },