2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for SetScrollRange
5 * PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
13 START_TEST(SetScrollRange
)
24 { -1, INT_MAX
, FALSE
},
25 { INT_MIN
, INT_MAX
, FALSE
},
26 { INT_MIN
, 0, FALSE
},
27 { INT_MIN
, -1, TRUE
},
35 hScroll
= CreateWindowExW(0, L
"SCROLLBAR", NULL
, 0, 0, 0, 0, 0, NULL
, NULL
, NULL
, NULL
);
36 ok(hScroll
!= NULL
, "CreateWindowEx failed with %lu\n", GetLastError());
39 skip("No scroll bar\n");
43 for (i
= 0; i
< sizeof(tests
) / sizeof(tests
[0]); i
++)
45 (void)SetScrollRange(hScroll
, SB_CTL
, 123, 456, FALSE
);
46 SetLastError(0xdeaff00d);
47 success
= SetScrollRange(hScroll
, SB_CTL
, tests
[i
].nMin
, tests
[i
].nMax
, FALSE
);
48 error
= GetLastError();
49 (void)GetScrollRange(hScroll
, SB_CTL
, &newMin
, &newMax
);
52 ok(success
== TRUE
, "SetScrollRange(%d, %d) failed with %d %lu\n", tests
[i
].nMin
, tests
[i
].nMax
, success
, error
);
53 ok(newMin
== tests
[i
].nMin
, "nMin was changed to %d\n", tests
[i
].nMin
);
54 ok(newMax
== tests
[i
].nMax
, "nMax was changed to %d\n", tests
[i
].nMax
);
58 ok(success
== FALSE
, "SetScrollRange(%d, %d) succeeded with %d\n", tests
[i
].nMin
, tests
[i
].nMax
, success
);
59 ok(error
== ERROR_INVALID_SCROLLBAR_RANGE
, "Error %lu\n", error
);
60 ok(newMin
== 123, "nMin was changed to %d\n", newMin
);
61 ok(newMax
== 456, "nMax was changed to %d\n", newMax
);
65 DestroyWindow(hScroll
);