ReactOS 0.4.15-dev-7942-gd23573b
SetSysColors.c File Reference
#include "precomp.h"
Include dependency graph for SetSysColors.c:

Go to the source code of this file.

Macros

#define NUM_SYSCOLORS   31
 

Functions

void Test_SetSysColors ()
 
 START_TEST (SetSysColors)
 

Macro Definition Documentation

◆ NUM_SYSCOLORS

#define NUM_SYSCOLORS   31

Definition at line 10 of file SetSysColors.c.

Function Documentation

◆ START_TEST()

START_TEST ( SetSysColors  )

Definition at line 54 of file SetSysColors.c.

55{
57}
void Test_SetSysColors()
Definition: SetSysColors.c:12

◆ Test_SetSysColors()

void Test_SetSysColors ( )

Definition at line 12 of file SetSysColors.c.

13{
14 INT i;
15 INT nElements[NUM_SYSCOLORS+1];
16 COLORREF crOldColors[NUM_SYSCOLORS];
17 COLORREF crColors[NUM_SYSCOLORS+1];
18
19 /* First save the Old colors */
20 for (i = 0; i < NUM_SYSCOLORS; i++)
21 {
22 nElements[i] = i;
23 crOldColors[i] = GetSysColor(i);
24 }
25
26 for (i = 0; i < NUM_SYSCOLORS+1; i++)
27 crColors[i] = RGB(i, 255-i, i*3);
28 nElements[NUM_SYSCOLORS] = nElements[0];
29
30 SetLastError(0xdeadbeef);
31 ok(SetSysColors(-1, nElements, crColors) == FALSE, "Expected FALSE, got TRUE\n");
32 ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
33 ok(SetSysColors(0, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
34 ok(SetSysColors(0, NULL, crColors) == TRUE, "Expected TRUE, got FALSE\n");
35 ok(SetSysColors(0, nElements, NULL) == TRUE, "Expected TRUE, got FALSE\n");
36 ok(SetSysColors(1, NULL, crColors) == FALSE, "Expected FALSE, got TRUE\n");
37 ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
38 ok(SetSysColors(1, nElements, NULL) == FALSE, "Expected FALSE, got TRUE\n");
39 ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
40 ok(SetSysColors(1, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
41 ok(SetSysColors(NUM_SYSCOLORS, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
42 for (i = 0; i < NUM_SYSCOLORS; i++)
43 ok(GetSysColor(nElements[i]) == crColors[i], "Expected %06lx, got %06lx\n", crColors[i], GetSysColor(nElements[i]));
44
45 /* try more than NUM_SYSCOLORS */
46 ok(SetSysColors(NUM_SYSCOLORS+1, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
47 nElements[NUM_SYSCOLORS] = 10000;
48 ok(SetSysColors(NUM_SYSCOLORS+1, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
49
50 /* restore old SysColors */
51 SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);
52}
#define NUM_SYSCOLORS
Definition: SetSysColors.c:10
#define ok(value,...)
Definition: atltest.h:57
#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
#define RGB(r, g, b)
Definition: precomp.h:71
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
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD COLORREF
Definition: windef.h:300
#define ERROR_NOACCESS
Definition: winerror.h:578
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI SetSysColors(_In_ int cElements, _In_reads_(cElements) CONST INT *lpaElements, _In_reads_(cElements) CONST COLORREF *lpaRgbValues)

Referenced by START_TEST().