ReactOS 0.4.17-dev-116-ga4b6fe9
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)
 

Function Documentation

◆ enum_profiles_callbackA()

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

Definition at line 182 of file icm.c.

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

Referenced by test_EnumICMProfilesA().

◆ enum_profiles_callbackW()

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

Definition at line 203 of file icm.c.

204{
205 return 1;
206}

Referenced by test_EnumICMProfilesW().

◆ START_TEST()

START_TEST ( icm  )

Definition at line 305 of file icm.c.

306{
307 HDC dc = GetDC( NULL );
308
316
317 ReleaseDC( NULL, dc );
318}
HDC dc
Definition: cylfrac.c:34
#define NULL
Definition: types.h:112
static HDC
Definition: imagelist.c:88
static void test_SetICMMode(HDC dc)
Definition: icm.c:133
static void test_GetICMProfileA(HDC dc)
Definition: icm.c:30
static void test_SetICMProfileW(HDC dc)
Definition: icm.c:265
static void test_EnumICMProfilesA(HDC dc)
Definition: icm.c:188
static void test_GetICMProfileW(HDC dc)
Definition: icm.c:82
static void test_SetICMProfileA(HDC dc)
Definition: icm.c:222
static void test_EnumICMProfilesW(HDC dc)
Definition: icm.c:208
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

◆ test_EnumICMProfilesA()

static void test_EnumICMProfilesA ( HDC  dc)
static

Definition at line 188 of file icm.c.

189{
190 INT ret;
191
192 ret = EnumICMProfilesA( NULL, NULL, 0 );
193 ok(ret == -1 || broken(ret == 0) /* nt4 */, "expected -1, got %d\n", ret);
194
196 ok(ret == -1 || ret == 1 || broken(ret == 0) /* nt4 */,
197 "expected -1 or 1, got %d\n", ret);
198
199 ret = EnumICMProfilesA( dc, NULL, 0 );
200 ok(ret == -1 || broken(ret == 0) /* nt4 */, "expected -1, got %d\n", ret);
201}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
return ret
Definition: mutex.c:146
static INT CALLBACK enum_profiles_callbackA(LPSTR filename, LPARAM lparam)
Definition: icm.c:182
int32_t INT
Definition: typedefs.h:58
int WINAPI EnumICMProfilesA(_In_ HDC, _In_ ICMENUMPROCA, _In_opt_ LPARAM)

Referenced by START_TEST().

◆ test_EnumICMProfilesW()

static void test_EnumICMProfilesW ( HDC  dc)
static

Definition at line 208 of file icm.c.

209{
210 INT ret;
211
212 ret = EnumICMProfilesW( NULL, NULL, 0 );
213 ok(ret == -1 || broken(ret == 0) /* NT4 */, "expected -1, got %d\n", ret);
214
215 ret = EnumICMProfilesW( dc, NULL, 0 );
216 ok(ret == -1 || broken(ret == 0) /* NT4 */, "expected -1, got %d\n", ret);
217
219 ok(ret == -1 || ret == 1 || broken(ret == 0) /* NT4 */, "expected -1 or 1, got %d\n", ret);
220}
static INT CALLBACK enum_profiles_callbackW(LPWSTR filename, LPARAM lparam)
Definition: icm.c:203
int WINAPI EnumICMProfilesW(_In_ HDC, _In_ ICMENUMPROCW, _In_opt_ LPARAM)

Referenced by START_TEST().

◆ test_GetICMProfileA()

static void test_GetICMProfileA ( HDC  dc)
static

Definition at line 30 of file icm.c.

31{
32 BOOL ret;
34 char filename[MAX_PATH];
35
36 SetLastError( 0xdeadbeef );
39 {
40 win_skip( "GetICMProfileA is not implemented\n" );
41 return;
42 }
43 ok( !ret, "GetICMProfileA succeeded\n" );
44
46 ok( !ret, "GetICMProfileA succeeded\n" );
47
48 size = MAX_PATH;
50 ok( !ret, "GetICMProfileA succeeded\n" );
51 ok( size > 0, "got %lu\n", size );
52
53 size = 0;
55 ok( !ret, "GetICMProfileA succeeded\n" );
56 ok( size > 0, "got %lu\n", size );
57
58 size = MAX_PATH;
60 ok( !ret, "GetICMProfileA succeeded\n" );
61
62 size = 0;
63 filename[0] = 0;
64 SetLastError(0xdeadbeef);
67 ok( !ret, "GetICMProfileA succeeded\n" );
68 ok( size, "expected size > 0\n" );
69 ok( filename[0] == 0, "Expected filename to be empty\n" );
70 ok( error == ERROR_INSUFFICIENT_BUFFER, "got %ld, expected ERROR_INSUFFICIENT_BUFFER\n", error );
71
73 ok( !ret, "GetICMProfileA succeeded\n" );
74
75 size = MAX_PATH;
77 ok( ret, "GetICMProfileA failed %ld\n", GetLastError() );
78
79 trace( "%s\n", filename );
80}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
#define win_skip
Definition: minitest.h:67
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI GetICMProfileA(_In_ HDC hdc, _Inout_ LPDWORD pBufSize, _Out_writes_opt_(*pBufSize) LPSTR pszFilename)

Referenced by START_TEST().

◆ test_GetICMProfileW()

static void test_GetICMProfileW ( HDC  dc)
static

Definition at line 82 of file icm.c.

83{
84 BOOL ret;
87
88 SetLastError( 0xdeadbeef );
91 {
92 win_skip( "GetICMProfileW is not implemented\n" );
93 return;
94 }
95 ok( !ret, "GetICMProfileW succeeded\n" );
96
98 ok( !ret, "GetICMProfileW succeeded\n" );
99
100 if (0)
101 {
102 /* Vista crashes */
103 size = MAX_PATH;
104 ret = GetICMProfileW( dc, &size, NULL );
105 ok( ret, "GetICMProfileW failed %ld\n", GetLastError() );
106 }
107
109 ok( !ret, "GetICMProfileW succeeded\n" );
110
111 size = MAX_PATH;
113 ok( !ret, "GetICMProfileW succeeded\n" );
114
115 size = 0;
116 ret = GetICMProfileW( dc, &size, NULL );
117 ok( !ret, "GetICMProfileW succeeded\n" );
118 ok( size > 0, "got %lu\n", size );
119
120 size = 0;
121 SetLastError(0xdeadbeef);
124 ok( !ret, "GetICMProfileW succeeded\n" );
125 ok( size, "expected size > 0\n" );
126 ok( error == ERROR_INSUFFICIENT_BUFFER, "got %ld, expected ERROR_INSUFFICIENT_BUFFER\n", error );
127
128 size = MAX_PATH;
130 ok( ret, "GetICMProfileW failed %ld\n", GetLastError() );
131}
short WCHAR
Definition: pedump.c:58
BOOL WINAPI GetICMProfileW(_In_ HDC hdc, _Inout_ LPDWORD pBufSize, _Out_writes_opt_(*pBufSize) LPWSTR pszFilename)

Referenced by START_TEST().

◆ test_SetICMMode()

static void test_SetICMMode ( HDC  dc)
static

Definition at line 133 of file icm.c.

134{
135 INT ret, knob, save;
136 BOOL impl;
137
138 SetLastError( 0xdeadbeef );
139 impl = GetICMProfileA( NULL, NULL, NULL );
140 if ( !impl && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
141 {
142 win_skip( "On NT4 where SetICMMode is not implemented but this is not advertised\n" );
143 return;
144 }
145
146 SetLastError( 0xdeadbeef );
147 ret = SetICMMode( NULL, 0 );
148 ok( !ret, "SetICMMode succeeded (%ld)\n", GetLastError() );
149
150 ret = SetICMMode( dc, -1 );
151 ok( !ret, "SetICMMode succeeded (%ld)\n", GetLastError() );
152
153 save = SetICMMode( dc, ICM_QUERY );
154 ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%ld)\n", GetLastError() );
155
156 if (save == ICM_ON) knob = ICM_OFF; else knob = ICM_ON;
157
158 ret = SetICMMode( dc, knob );
159 todo_wine ok( ret, "SetICMMode failed (%ld)\n", GetLastError() );
160
162 todo_wine ok( ret == knob, "SetICMMode failed (%ld)\n", GetLastError() );
163
164 ret = SetICMMode( dc, save );
165 ok( ret, "SetICMMode failed (%ld)\n", GetLastError() );
166
167 SetLastError( 0xdeadbeef );
168 dc = CreateDCW( L"DISPLAY", NULL, NULL, NULL );
169 if ( !dc && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
170 {
171 win_skip( "CreateDCW is not implemented\n" );
172 return;
173 }
174 ok( dc != NULL, "CreateDCW failed (%ld)\n", GetLastError() );
175
177 ok( ret == ICM_OFF, "SetICMMode failed (%ld)\n", GetLastError() );
178
179 DeleteDC( dc );
180}
#define L(x)
Definition: resources.c:13
#define todo_wine
Definition: minitest.h:80
int WINAPI SetICMMode(_In_ HDC, _In_ int)
#define ICM_QUERY
Definition: wingdi.h:983
#define ICM_OFF
Definition: wingdi.h:982
#define ICM_ON
Definition: wingdi.h:981
BOOL WINAPI DeleteDC(_In_ HDC)
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)

Referenced by START_TEST().

◆ test_SetICMProfileA()

static void test_SetICMProfileA ( HDC  dc)
static

Definition at line 222 of file icm.c.

223{
224 BOOL ret;
225 char profile[MAX_PATH];
226 DWORD len, error;
227
228 SetLastError( 0xdeadbeef );
231 {
232 win_skip("SetICMProfileA is not implemented\n");
233 return;
234 }
235
236 len = sizeof(profile);
238 ok(ret, "GetICMProfileA failed %lu\n", GetLastError());
239
240 SetLastError( 0xdeadbeef );
243 ok(!ret, "SetICMProfileA succeeded\n");
245 "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
246
247 SetLastError( 0xdeadbeef );
250 ok(!ret, "SetICMProfileA succeeded\n");
252 "expected ERROR_INVALID_HANDLE, got %lu\n", error);
253
254 SetLastError( 0xdeadbeef );
257 ok(!ret, "SetICMProfileA succeeded\n");
259 "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
260
262 ok(ret, "SetICMProfileA failed %lu\n", GetLastError());
263}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
GLenum GLsizei len
Definition: glext.h:6722
#define profile
Definition: kernel32.h:12
BOOL WINAPI SetICMProfileA(_In_ HDC, _In_ LPSTR)

Referenced by START_TEST().

◆ test_SetICMProfileW()

static void test_SetICMProfileW ( HDC  dc)
static

Definition at line 265 of file icm.c.

266{
267 BOOL ret;
269 DWORD len, error;
270
271 SetLastError( 0xdeadbeef );
274 {
275 win_skip("SetICMProfileW is not implemented\n");
276 return;
277 }
278
281 ok(ret, "GetICMProfileW failed %lu\n", GetLastError());
282
283 SetLastError( 0xdeadbeef );
286 ok(!ret, "SetICMProfileW succeeded\n");
287 ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
288
289 SetLastError( 0xdeadbeef );
292 ok(!ret, "SetICMProfileW succeeded\n");
293 ok(error == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %lu\n", error);
294
295 SetLastError( 0xdeadbeef );
298 ok(!ret, "SetICMProfileW succeeded\n");
299 ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
300
302 ok(ret, "SetICMProfileW failed %lu\n", GetLastError());
303}
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL WINAPI SetICMProfileW(_In_ HDC, _In_ LPWSTR)

Referenced by START_TEST().