ReactOS  0.4.14-dev-317-g96040ec
SetScrollRange.c File Reference
#include "precomp.h"
Include dependency graph for SetScrollRange.c:

Go to the source code of this file.

Functions

 START_TEST (SetScrollRange)
 

Function Documentation

◆ START_TEST()

START_TEST ( SetScrollRange  )

Definition at line 10 of file SetScrollRange.c.

11 {
12  struct
13  {
14  INT nMin;
15  INT nMax;
16  BOOL result;
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;
27  HWND hScroll;
28  BOOL success;
29  DWORD error;
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  {
42  (void)SetScrollRange(hScroll, SB_CTL, 123, 456, FALSE);
43  SetLastError(0xdeaff00d);
44  success = SetScrollRange(hScroll, SB_CTL, tests[i].nMin, tests[i].nMax, FALSE);
45  error = GetLastError();
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 }
BOOL WINAPI GetScrollRange(_In_ HWND, _In_ int, _Out_ LPINT, _Out_ LPINT)
struct param_test tests[]
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define INT_MAX
Definition: limits.h:40
#define error(str)
Definition: mkdosfs.c:1605
#define SB_CTL
Definition: winuser.h:554
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_INVALID_SCROLLBAR_RANGE
Definition: winerror.h:929
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define success(from, fromstr, to, tostr)
#define SetLastError(x)
Definition: compat.h:409
static HWND hScroll
Definition: scroll.c:28
static const WCHAR L[]
Definition: oid.c:1250
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 INT_MIN
Definition: limits.h:39
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define skip(...)
Definition: atltest.h:64
GLuint64EXT * result
Definition: glext.h:11304