ReactOS  0.4.14-dev-376-gaedba84
icm.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/test.h"
Include dependency graph for icm.c:

Go to the source code of this file.

Functions

static void test_GetICMProfileA (HDC dc)
 
static void test_GetICMProfileW (HDC dc)
 
static void test_SetICMMode (HDC dc)
 
static INT CALLBACK enum_profiles_callbackA (LPSTR filename, LPARAM lparam)
 
static void test_EnumICMProfilesA (HDC dc)
 
static INT CALLBACK enum_profiles_callbackW (LPWSTR filename, LPARAM lparam)
 
static void test_EnumICMProfilesW (HDC dc)
 
static void test_SetICMProfileA (HDC dc)
 
static void test_SetICMProfileW (HDC dc)
 
 START_TEST (icm)
 

Variables

static const WCHAR displayW [] = {'D','I','S','P','L','A','Y',0}
 

Function Documentation

◆ enum_profiles_callbackA()

static INT CALLBACK enum_profiles_callbackA ( LPSTR  filename,
LPARAM  lparam 
)
static

Definition at line 184 of file icm.c.

185 {
186  trace("%s\n", filename);
187  return 1;
188 }
const char * filename
Definition: ioapi.h:135
#define trace
Definition: atltest.h:70

Referenced by test_EnumICMProfilesA().

◆ enum_profiles_callbackW()

static INT CALLBACK enum_profiles_callbackW ( LPWSTR  filename,
LPARAM  lparam 
)
static

Definition at line 205 of file icm.c.

206 {
207  return 1;
208 }

Referenced by test_EnumICMProfilesW().

◆ START_TEST()

START_TEST ( icm  )

Definition at line 307 of file icm.c.

308 {
309  HDC dc = GetDC( NULL );
310 
313  test_SetICMMode( dc );
318 
319  ReleaseDC( NULL, dc );
320 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HDC dc
Definition: cylfrac.c:34
static void test_SetICMProfileA(HDC dc)
Definition: icm.c:224
static void test_EnumICMProfilesA(HDC dc)
Definition: icm.c:190
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static void test_GetICMProfileA(HDC dc)
Definition: icm.c:32
smooth NULL
Definition: ftsmooth.c:416
static void test_EnumICMProfilesW(HDC dc)
Definition: icm.c:210
static void test_GetICMProfileW(HDC dc)
Definition: icm.c:84
static void test_SetICMMode(HDC dc)
Definition: icm.c:135
static void test_SetICMProfileW(HDC dc)
Definition: icm.c:267

◆ test_EnumICMProfilesA()

static void test_EnumICMProfilesA ( HDC  dc)
static

Definition at line 190 of file icm.c.

191 {
192  INT ret;
193 
194  ret = EnumICMProfilesA( NULL, NULL, 0 );
195  ok(ret == -1 || broken(ret == 0) /* nt4 */, "expected -1, got %d\n", ret);
196 
198  ok(ret == -1 || ret == 1 || broken(ret == 0) /* nt4 */,
199  "expected -1 or 1, got %d\n", ret);
200 
201  ret = EnumICMProfilesA( dc, NULL, 0 );
202  ok(ret == -1 || broken(ret == 0) /* nt4 */, "expected -1, got %d\n", ret);
203 }
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static INT CALLBACK enum_profiles_callbackA(LPSTR filename, LPARAM lparam)
Definition: icm.c:184
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
int WINAPI EnumICMProfilesA(HDC a0, ICMENUMPROCA a1, LPARAM a2)
Definition: icm.c:228

Referenced by START_TEST().

◆ test_EnumICMProfilesW()

static void test_EnumICMProfilesW ( HDC  dc)
static

Definition at line 210 of file icm.c.

211 {
212  INT ret;
213 
214  ret = EnumICMProfilesW( NULL, NULL, 0 );
215  ok(ret == -1 || broken(ret == 0) /* NT4 */, "expected -1, got %d\n", ret);
216 
217  ret = EnumICMProfilesW( dc, NULL, 0 );
218  ok(ret == -1 || broken(ret == 0) /* NT4 */, "expected -1, got %d\n", ret);
219 
221  ok(ret == -1 || ret == 1 || broken(ret == 0) /* NT4 */, "expected -1 or 1, got %d\n", ret);
222 }
int WINAPI EnumICMProfilesW(HDC hDC, ICMENUMPROCW lpEnumICMProfilesFunc, LPARAM lParam)
Definition: icm.c:255
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static INT CALLBACK enum_profiles_callbackW(LPWSTR filename, LPARAM lparam)
Definition: icm.c:205
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_GetICMProfileA()

static void test_GetICMProfileA ( HDC  dc)
static

Definition at line 32 of file icm.c.

33 {
34  BOOL ret;
35  DWORD size, error;
36  char filename[MAX_PATH];
37 
38  SetLastError( 0xdeadbeef );
40  if ( !ret && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
41  {
42  win_skip( "GetICMProfileA is not implemented\n" );
43  return;
44  }
45  ok( !ret, "GetICMProfileA succeeded\n" );
46 
47  ret = GetICMProfileA( dc, NULL, NULL );
48  ok( !ret, "GetICMProfileA succeeded\n" );
49 
50  size = MAX_PATH;
51  ret = GetICMProfileA( dc, &size, NULL );
52  ok( !ret, "GetICMProfileA succeeded\n" );
53  ok( size > 0, "got %u\n", size );
54 
55  size = 0;
56  ret = GetICMProfileA( dc, &size, NULL );
57  ok( !ret, "GetICMProfileA succeeded\n" );
58  ok( size > 0, "got %u\n", size );
59 
60  size = MAX_PATH;
62  ok( !ret, "GetICMProfileA succeeded\n" );
63 
64  size = 0;
65  filename[0] = 0;
66  SetLastError(0xdeadbeef);
68  error = GetLastError();
69  ok( !ret, "GetICMProfileA succeeded\n" );
70  ok( size, "expected size > 0\n" );
71  ok( filename[0] == 0, "Expected filename to be empty\n" );
72  ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
73 
75  ok( !ret, "GetICMProfileA succeeded\n" );
76 
77  size = MAX_PATH;
79  ok( ret, "GetICMProfileA failed %d\n", GetLastError() );
80 
81  trace( "%s\n", filename );
82 }
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC dc
Definition: cylfrac.c:34
BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD pBufSize, LPSTR pszFilename)
Definition: icm.c:137
const char * filename
Definition: ioapi.h:135
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_GetICMProfileW()

static void test_GetICMProfileW ( HDC  dc)
static

Definition at line 84 of file icm.c.

85 {
86  BOOL ret;
87  DWORD size, error;
89 
90  SetLastError( 0xdeadbeef );
92  if ( !ret && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
93  {
94  win_skip( "GetICMProfileW is not implemented\n" );
95  return;
96  }
97  ok( !ret, "GetICMProfileW succeeded\n" );
98 
99  ret = GetICMProfileW( dc, NULL, NULL );
100  ok( !ret, "GetICMProfileW succeeded\n" );
101 
102  if (0)
103  {
104  /* Vista crashes */
105  size = MAX_PATH;
106  ret = GetICMProfileW( dc, &size, NULL );
107  ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
108  }
109 
111  ok( !ret, "GetICMProfileW succeeded\n" );
112 
113  size = MAX_PATH;
115  ok( !ret, "GetICMProfileW succeeded\n" );
116 
117  size = 0;
118  ret = GetICMProfileW( dc, &size, NULL );
119  ok( !ret, "GetICMProfileW succeeded\n" );
120  ok( size > 0, "got %u\n", size );
121 
122  size = 0;
123  SetLastError(0xdeadbeef);
125  error = GetLastError();
126  ok( !ret, "GetICMProfileW succeeded\n" );
127  ok( size, "expected size > 0\n" );
128  ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
129 
130  size = MAX_PATH;
132  ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
133 }
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC dc
Definition: cylfrac.c:34
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
Definition: icm.c:177
const char * filename
Definition: ioapi.h:135
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_SetICMMode()

static void test_SetICMMode ( HDC  dc)
static

Definition at line 135 of file icm.c.

136 {
137  INT ret, knob, save;
138  BOOL impl;
139 
140  SetLastError( 0xdeadbeef );
141  impl = GetICMProfileA( NULL, NULL, NULL );
142  if ( !impl && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
143  {
144  win_skip( "On NT4 where SetICMMode is not implemented but this is not advertised\n" );
145  return;
146  }
147 
148  SetLastError( 0xdeadbeef );
149  ret = SetICMMode( NULL, 0 );
150  ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
151 
152  ret = SetICMMode( dc, -1 );
153  ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
154 
155  save = SetICMMode( dc, ICM_QUERY );
156  ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
157 
158  if (save == ICM_ON) knob = ICM_OFF; else knob = ICM_ON;
159 
160  ret = SetICMMode( dc, knob );
161  todo_wine ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
162 
163  ret = SetICMMode( dc, ICM_QUERY );
164  todo_wine ok( ret == knob, "SetICMMode failed (%d)\n", GetLastError() );
165 
166  ret = SetICMMode( dc, save );
167  ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
168 
169  SetLastError( 0xdeadbeef );
170  dc = CreateDCW( displayW, NULL, NULL, NULL );
171  if ( !dc && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
172  {
173  win_skip( "CreateDCW is not implemented\n" );
174  return;
175  }
176  ok( dc != NULL, "CreateDCW failed (%d)\n", GetLastError() );
177 
178  ret = SetICMMode( dc, ICM_QUERY );
179  ok( ret == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
180 
181  DeleteDC( dc );
182 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC dc
Definition: cylfrac.c:34
int WINAPI SetICMMode(HDC hdc, int iEnableICM)
Definition: icm.c:316
BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD pBufSize, LPSTR pszFilename)
Definition: icm.c:137
int32_t INT
Definition: typedefs.h:56
#define ICM_QUERY
Definition: wingdi.h:982
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR displayW[]
Definition: icm.c:30
#define SetLastError(x)
Definition: compat.h:417
int ret
#define todo_wine
Definition: test.h:154
#define ICM_OFF
Definition: wingdi.h:981
#define ICM_ON
Definition: wingdi.h:980
BOOL WINAPI DeleteDC(_In_ HDC)
#define ok(value,...)
Definition: atltest.h:57
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_SetICMProfileA()

static void test_SetICMProfileA ( HDC  dc)
static

Definition at line 224 of file icm.c.

225 {
226  BOOL ret;
227  char profile[MAX_PATH];
228  DWORD len, error;
229 
230  SetLastError( 0xdeadbeef );
231  ret = SetICMProfileA( NULL, NULL );
233  {
234  win_skip("SetICMProfileA is not implemented\n");
235  return;
236  }
237 
238  len = sizeof(profile);
239  ret = GetICMProfileA( dc, &len, profile );
240  ok(ret, "GetICMProfileA failed %u\n", GetLastError());
241 
242  SetLastError( 0xdeadbeef );
243  ret = SetICMProfileA( NULL, NULL );
244  error = GetLastError();
245  ok(!ret, "SetICMProfileA succeeded\n");
247  "expected ERROR_INVALID_PARAMETER, got %u\n", error);
248 
249  SetLastError( 0xdeadbeef );
251  error = GetLastError();
252  ok(!ret, "SetICMProfileA succeeded\n");
254  "expected ERROR_INVALID_HANDLE, got %u\n", error);
255 
256  SetLastError( 0xdeadbeef );
257  ret = SetICMProfileA( dc, NULL );
258  error = GetLastError();
259  ok(!ret, "SetICMProfileA succeeded\n");
261  "expected ERROR_INVALID_PARAMETER, got %u\n", error);
262 
264  ok(ret, "SetICMProfileA failed %u\n", GetLastError());
265 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC dc
Definition: cylfrac.c:34
BOOL WINAPI SetICMProfileA(HDC a0, LPSTR a1)
Definition: icm.c:196
BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD pBufSize, LPSTR pszFilename)
Definition: icm.c:137
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define profile
Definition: kernel32.h:12
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_SetICMProfileW()

static void test_SetICMProfileW ( HDC  dc)
static

Definition at line 267 of file icm.c.

268 {
269  BOOL ret;
271  DWORD len, error;
272 
273  SetLastError( 0xdeadbeef );
274  ret = SetICMProfileW( NULL, NULL );
276  {
277  win_skip("SetICMProfileW is not implemented\n");
278  return;
279  }
280 
281  len = sizeof(profile)/sizeof(profile[0]);
282  ret = GetICMProfileW( dc, &len, profile );
283  ok(ret, "GetICMProfileW failed %u\n", GetLastError());
284 
285  SetLastError( 0xdeadbeef );
286  ret = SetICMProfileW( NULL, NULL );
287  error = GetLastError();
288  ok(!ret, "SetICMProfileW succeeded\n");
289  ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
290 
291  SetLastError( 0xdeadbeef );
293  error = GetLastError();
294  ok(!ret, "SetICMProfileW succeeded\n");
295  ok(error == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %u\n", error);
296 
297  SetLastError( 0xdeadbeef );
298  ret = SetICMProfileW( dc, NULL );
299  error = GetLastError();
300  ok(!ret, "SetICMProfileW succeeded\n");
301  ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
302 
304  ok(ret, "SetICMProfileW failed %u\n", GetLastError());
305 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC dc
Definition: cylfrac.c:34
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
Definition: icm.c:177
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetICMProfileW(HDC a0, LPWSTR a1)
Definition: icm.c:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define profile
Definition: kernel32.h:12
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

Variable Documentation

◆ displayW

const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}
static