ReactOS 0.4.16-dev-197-g92996da
SetScrollRange.c
Go to the documentation of this file.
1/*
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>
6 */
7
8#include "precomp.h"
9
11{
12 struct
13 {
14 INT nMin;
15 INT nMax;
17 } tests[] =
18 {
19 { 0, 0, TRUE },
20 { 0, INT_MAX, TRUE },
21 { -1, INT_MAX, FALSE },
22 { INT_MIN, INT_MAX, FALSE },
23 { INT_MIN, 0, FALSE },
24 { INT_MIN, -1, TRUE },
25 };
26 unsigned i;
30 INT newMin, newMax;
31
32 hScroll = CreateWindowExW(0, L"SCROLLBAR", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
33 ok(hScroll != NULL, "CreateWindowEx failed with %lu\n", GetLastError());
34 if (!hScroll)
35 {
36 skip("No scroll bar\n");
37 return;
38 }
39
40 for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
41 {
43 SetLastError(0xdeaff00d);
46 (void)GetScrollRange(hScroll, SB_CTL, &newMin, &newMax);
47 if (tests[i].result)
48 {
49 ok(success == TRUE, "SetScrollRange(%d, %d) failed with %d %lu\n", tests[i].nMin, tests[i].nMax, success, error);
50 ok(newMin == tests[i].nMin, "nMin was changed to %d\n", tests[i].nMin);
51 ok(newMax == tests[i].nMax, "nMax was changed to %d\n", tests[i].nMax);
52 }
53 else
54 {
55 ok(success == FALSE, "SetScrollRange(%d, %d) succeeded with %d\n", tests[i].nMin, tests[i].nMax, success);
56 ok(error == ERROR_INVALID_SCROLLBAR_RANGE, "Error %lu\n", error);
57 ok(newMin == 123, "nMin was changed to %d\n", newMin);
58 ok(newMax == 456, "nMax was changed to %d\n", newMax);
59 }
60 }
61
63}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define INT_MIN
Definition: limits.h:39
#define INT_MAX
Definition: limits.h:40
#define error(str)
Definition: mkdosfs.c:1605
static struct test_info tests[]
#define L(x)
Definition: ntvdm.h:50
static HWND hScroll
Definition: scroll.c:28
int32_t INT
Definition: typedefs.h:58
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_SCROLLBAR_RANGE
Definition: winerror.h:929
BOOL WINAPI GetScrollRange(_In_ HWND, _In_ int, _Out_ LPINT, _Out_ LPINT)
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define SB_CTL
Definition: winuser.h:554
BOOL WINAPI DestroyWindow(_In_ HWND)