mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 23:48:12 +00:00
[USER32_APITEST]
- Add a test for SetScrollRange CORE-12763 svn path=/trunk/; revision=74058
This commit is contained in:
parent
5641391fa5
commit
3df8b3ccc8
3 changed files with 69 additions and 0 deletions
|
@ -32,6 +32,7 @@ list(APPEND SOURCE
|
|||
SetParent.c
|
||||
SetProp.c
|
||||
SetScrollInfo.c
|
||||
SetScrollRange.c
|
||||
SystemParametersInfo.c
|
||||
TrackMouseEvent.c
|
||||
WndProc.c
|
||||
|
|
66
rostests/apitests/user32/SetScrollRange.c
Normal file
66
rostests/apitests/user32/SetScrollRange.c
Normal file
|
@ -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@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);
|
||||
}
|
|
@ -34,6 +34,7 @@ extern void func_SetCursorPos(void);
|
|||
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 @@ const struct test winetest_testlist[] =
|
|||
{ "SetParent", func_SetParent },
|
||||
{ "SetProp", func_SetProp },
|
||||
{ "SetScrollInfo", func_SetScrollInfo },
|
||||
{ "SetScrollRange", func_SetScrollRange },
|
||||
{ "SystemParametersInfo", func_SystemParametersInfo },
|
||||
{ "TrackMouseEvent", func_TrackMouseEvent },
|
||||
{ "WndProc", func_WndProc },
|
||||
|
|
Loading…
Reference in a new issue