ReactOS 0.4.15-dev-7897-g78dc504
CImage.cpp
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 CImage and CImageDC
5 * PROGRAMMER: Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include <atlimage.h>
9#include <strsafe.h>
10#include "resource.h"
11
12#ifdef HAVE_APITEST
13 #include <apitest.h>
14#else
15 #include "atltest.h"
16#endif
17
19{
20 RGBQUAD bmiColorsExtra[256 - 1];
21};
22
23static void
24Test_PixelAddress(INT iLine, const CImage &image1, const BITMAP &bm, INT x, INT y, BOOL bTopDown)
25{
26 LPBYTE pb = (LPBYTE)bm.bmBits;
27
28 if (bTopDown)
29 pb += bm.bmWidthBytes * y;
30 else
31 pb += bm.bmWidthBytes * (bm.bmHeight - y - 1);
32
33 pb += (x * bm.bmBitsPixel) / 8;
34
35 LPCVOID addr = image1.GetPixelAddress(x, y);
36 ok(pb == addr, "Line %d: (%d, %d): %p vs %p\n", iLine, x, y, pb, addr);
37}
38
39static void
41{
43 ok(hBitmap != NULL, "Line %d: hBitmap was NULL\n", iLine);
44
45 CImage image1;
46
47 ok(image1.IsNull(), "Line %d: IsNull() was TRUE\n", iLine);
49
50 ok(!image1.IsNull(), "Line %d: IsNull() was FALSE\n", iLine);
51 ok(!image1.IsDIBSection(), "Line %d: IsDIBSection() was TRUE\n", iLine);
52
53 ok(image1.GetWidth() == width, "Line %d: %d vs %d\n", iLine, image1.GetWidth(), width);
54 ok(image1.GetHeight() == height, "Line %d: %d vs %d\n", iLine, image1.GetHeight(), height);
55 ok(image1.GetBPP() == bpp, "Line %d: %d vs %d\n", iLine, image1.GetBPP(), 1);
56}
57
58static void Test_Bitmap(void)
59{
60 Test_BitmapEntry(__LINE__, 1, 20, 30, FALSE);
61 Test_BitmapEntry(__LINE__, 1, 30, 20, TRUE);
62 Test_BitmapEntry(__LINE__, 4, 20, 30, FALSE);
63 Test_BitmapEntry(__LINE__, 4, 30, 20, TRUE);
64 Test_BitmapEntry(__LINE__, 8, 20, 30, FALSE);
65 Test_BitmapEntry(__LINE__, 8, 30, 20, TRUE);
66 Test_BitmapEntry(__LINE__, 24, 20, 30, FALSE);
67 Test_BitmapEntry(__LINE__, 24, 30, 20, TRUE);
68 Test_BitmapEntry(__LINE__, 32, 20, 30, FALSE);
69 Test_BitmapEntry(__LINE__, 32, 30, 20, TRUE);
70}
71
73{
75 ok(hBitmap != NULL, "Line %d: hBitmap was NULL\n", iLine);
76
77 CImage image1;
78
79 ok(image1.IsNull(), "Line %d: IsNull() was TRUE\n", iLine);
80 image1.Attach(hBitmap);
81
82 ok(!image1.IsNull(), "Line %d: IsNull() was FALSE\n", iLine);
83 ok(!image1.IsDIBSection(), "Line %d: IsDIBSection() was TRUE\n", iLine);
84
85 ok(image1.GetWidth() == width, "Line %d: %d vs %d\n", iLine, image1.GetWidth(), width);
86 ok(image1.GetHeight() == height, "Line %d: %d vs %d\n", iLine, image1.GetHeight(), height);
87}
88
89static void Test_CompatBitmap(void)
90{
92
93 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
94 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
95 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
96 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
97 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
98
100
101 hdc = ::GetDC(NULL);
102
103 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
104 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
105 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
106 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
107 Test_CompatBitmapEntry(__LINE__, hdc, 20, 30);
108
110}
111
112static void
114{
115 // Initialize BITMAPINFOEX
116 BITMAPINFOEX bmi;
117 ZeroMemory(&bmi, sizeof(bmi));
118 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
119 bmi.bmiHeader.biWidth = width;
120 bmi.bmiHeader.biHeight = (bTopDown ? -height : height);
121 bmi.bmiHeader.biPlanes = 1;
123 switch (bpp)
124 {
125 case 1:
126 bmi.bmiHeader.biClrUsed = 2;
127 bmi.bmiColorsExtra[0].rgbBlue = 0xFF;
128 bmi.bmiColorsExtra[0].rgbGreen = 0xFF;
129 bmi.bmiColorsExtra[0].rgbRed = 0xFF;
130 break;
131 case 4:
132 case 8:
133 bmi.bmiHeader.biClrUsed = 3;
134 bmi.bmiColorsExtra[0].rgbBlue = 0xFF;
135 bmi.bmiColorsExtra[0].rgbGreen = 0xFF;
136 bmi.bmiColorsExtra[0].rgbRed = 0xFF;
137 bmi.bmiColorsExtra[1].rgbBlue = 0;
138 bmi.bmiColorsExtra[1].rgbGreen = 0;
139 bmi.bmiColorsExtra[1].rgbRed = 0xFF;
140 break;
141 default:
142 break;
143 }
144
145 // Create a DIB bitmap
147 ok(hBitmap != NULL, "Line %d: hBitmap was NULL\n", iLine);
148
149 BITMAP bm;
150 ::GetObject(hBitmap, sizeof(bm), &bm);
151 INT pitch = (bTopDown ? bm.bmWidthBytes : -bm.bmWidthBytes);
152
153 CImage image1;
154
155 ok(image1.IsNull(), "Line %d: IsNull() was FALSE\n", iLine);
156
158
159 ok(!image1.IsNull(), "Line %d: IsNull() was FALSE\n", iLine);
160 ok(image1.IsDIBSection(), "Line %d: IsDIBSection() was FALSE\n", iLine);
161 if (bpp == 4 || bpp == 8)
162 {
163 ok(image1.GetTransparentColor() == 0xFFFFFFFF, "Line %d: 0x%08lX\n", iLine,
164 image1.GetTransparentColor());
165 }
166
167 switch (bpp)
168 {
169 case 1:
170 ok(image1.GetMaxColorTableEntries() == 2,
171 "Line %d: %d\n", iLine, image1.GetMaxColorTableEntries());
172 break;
173 case 4:
174 ok(image1.GetMaxColorTableEntries() == 16,
175 "Line %d: %d\n", iLine, image1.GetMaxColorTableEntries());
176 break;
177 case 8:
178 ok(image1.GetMaxColorTableEntries() == 256,
179 "Line %d: %d\n", iLine, image1.GetMaxColorTableEntries());
180 break;
181 case 24:
182 case 32:
183 ok(image1.GetMaxColorTableEntries() == 0,
184 "Line %d: %d\n", iLine, image1.GetMaxColorTableEntries());
185 break;
186 }
187
188 ok(image1.GetWidth() == width, "Line %d: %d vs %d\n", iLine, image1.GetWidth(), width);
189 ok(image1.GetHeight() == height, "Line %d: %d vs %d\n", iLine, image1.GetHeight(), height);
190 ok(image1.GetBPP() == bpp, "Line %d: %d vs %d\n", iLine, image1.GetBPP(), bpp);
191 ok(image1.GetPitch() == pitch, "Line %d: %d vs %d\n", iLine, image1.GetPitch(), pitch);
192
193 LPBYTE pbBits = (LPBYTE)bm.bmBits;
194 if (!bTopDown)
195 pbBits += bm.bmWidthBytes * (height - 1);
196 ok(image1.GetBits() == pbBits, "Line %d: %p vs %p\n", iLine, image1.GetBits(), pbBits);
197
198 // Test Color Table
199 if (bpp <= 8)
200 {
201 DWORD Colors[3];
202 C_ASSERT(sizeof(DWORD) == sizeof(RGBQUAD));
203 FillMemory(Colors, sizeof(Colors), 0xCC);
205 ok(Colors[0] == 0, "Line %d: 0x%08lX\n", iLine, Colors[0]);
206 ok(Colors[1] == 0xFFFFFF, "Line %d: 0x%08lX\n", iLine, Colors[1]);
207 if (bpp >= 4)
208 ok(Colors[2] == 0xFF0000, "Line %d: 0x%08lX\n", iLine, Colors[2]);
209 }
210
211 // Test SetPixel/GetPixel
213 image1.SetPixel(0, 0, RGB(255, 255, 255));
214 color = image1.GetPixel(0, 0);
215 ok(color == RGB(255, 255, 255), "Line %d: color was 0x%08lX\n", iLine, color);
216 image1.SetPixel(0, 0, RGB(0, 0, 0));
217 color = image1.GetPixel(0, 0);
218 ok(color == RGB(0, 0, 0), "Line %d: color was 0x%08lX\n", iLine, color);
219
220 // Test GetDC/ReleaseDC
221 {
222 HDC hdc1 = image1.GetDC();
223 ok(hdc1 != NULL, "Line %d: hdc1 was NULL\n", iLine);
224 ::SetPixelV(hdc1, 2, 2, RGB(255, 255, 255));
225 {
226 HDC hdc2 = image1.GetDC();
227 ok(hdc2 != NULL, "Line %d: hdc2 was NULL\n", iLine);
228 color = ::GetPixel(hdc2, 2, 2);
229 ok(color == RGB(255, 255, 255), "Line %d: color was 0x%08lX\n", iLine, color);
230 image1.ReleaseDC();
231 }
232 image1.ReleaseDC();
233 }
234
235 // Test CImageDC
236 {
237 CImageDC hdc1(image1);
238 ok(hdc1 != NULL, "Line %d: hdc1 was NULL\n", iLine);
239 ::SetPixelV(hdc1, 1, 0, RGB(255, 255, 255));
240 {
241 CImageDC hdc2(image1);
242 ok(hdc2 != NULL, "Line %d: hdc2 was NULL\n", iLine);
243 color = ::GetPixel(hdc2, 1, 0);
244 ok(color == RGB(255, 255, 255), "Line %d: color was 0x%08lX\n", iLine, color);
245 }
246 }
247
248 HRESULT hr;
249 TCHAR szFileName[MAX_PATH];
250 LPCTSTR dotexts[] =
251 {
252 TEXT(".bmp"), TEXT(".jpg"), TEXT(".png"), TEXT(".gif"), TEXT(".tif")
253 };
254
255 // Test Save/Load
256 for (UINT iDotExt = 0; iDotExt < _countof(dotexts); ++iDotExt)
257 {
258 ::ExpandEnvironmentStrings(TEXT("%TEMP%\\CImage"), szFileName, _countof(szFileName));
259 StringCchCat(szFileName, _countof(szFileName), dotexts[iDotExt]);
260 hr = image1.Save(szFileName);
261 ok(hr == S_OK, "Line %d: %d: hr was 0x%08lX\n", iLine, iDotExt, hr);
262
263 CImage image2;
264 hr = image2.Load(szFileName);
265 ok(hr == S_OK, "Line %d: %d: hr was 0x%08lX\n", iLine, iDotExt, hr);
266 ::DeleteFile(szFileName);
267
268 CImageDC hdc2(image2);
269 ok(hdc2 != NULL, "Line %d: %d: hdc2 was NULL\n", iLine, iDotExt);
270 color = ::GetPixel(hdc2, 0, 0);
271 ok(color == RGB(0, 0, 0), "Line %d: %d: color was 0x%08lX\n", iLine, iDotExt, color);
272 color = ::GetPixel(hdc2, 1, 0);
273 ok(color == RGB(255, 255, 255), "Line %d: %d: color was 0x%08lX\n", iLine, iDotExt, color);
274 }
275
276 // Test GetPixelAddress
277 Test_PixelAddress(iLine, image1, bm, 0, 0, bTopDown);
278 Test_PixelAddress(iLine, image1, bm, 10, 0, bTopDown);
279 Test_PixelAddress(iLine, image1, bm, 0, 10, bTopDown);
280 Test_PixelAddress(iLine, image1, bm, 4, 6, bTopDown);
281 Test_PixelAddress(iLine, image1, bm, 6, 2, bTopDown);
282}
283
284static void Test_DIBSection(void)
285{
287
288 Test_DIBSectionEntry(__LINE__, hdc, 1, 30, 20, FALSE);
289 Test_DIBSectionEntry(__LINE__, hdc, 1, 20, 30, TRUE);
290 Test_DIBSectionEntry(__LINE__, hdc, 4, 30, 20, FALSE);
291 Test_DIBSectionEntry(__LINE__, hdc, 4, 20, 30, TRUE);
292 Test_DIBSectionEntry(__LINE__, hdc, 8, 30, 20, FALSE);
293 Test_DIBSectionEntry(__LINE__, hdc, 8, 20, 30, TRUE);
294 Test_DIBSectionEntry(__LINE__, hdc, 24, 30, 20, FALSE);
295 Test_DIBSectionEntry(__LINE__, hdc, 24, 20, 30, TRUE);
296 Test_DIBSectionEntry(__LINE__, hdc, 32, 30, 20, FALSE);
297 Test_DIBSectionEntry(__LINE__, hdc, 32, 20, 30, TRUE);
298
300}
301
302static void Test_ResBitmap(void)
303{
305
306 CImage image1;
307 ok_int(image1.IsNull(), TRUE);
309 ok_int(image1.IsNull(), FALSE);
310
311 ok_int(image1.GetWidth(), 48);
312 ok_int(image1.GetHeight(), 48);
313 ok_int(image1.GetBPP(), 8);
314 ok_int(image1.GetPitch(), -48);
315
316 CImage image2;
317 ok_int(image2.IsNull(), TRUE);
319 ok_int(image2.IsNull(), FALSE);
320
321 ok_int(image2.GetWidth(), 32);
322 ok_int(image2.GetHeight(), 32);
323 ok_int(image2.GetBPP(), 8);
324 ok_int(image2.GetPitch(), -32);
325}
326
327static INT FindGUID(REFGUID rguid, const CSimpleArray<GUID>& guids)
328{
329 for (INT i = 0; i < guids.GetSize(); ++i)
330 {
331 if (memcmp(&rguid, &guids[i], sizeof(GUID)) == 0)
332 return i;
333 }
334 return -1;
335}
336
337static INT FindFilterItem(const TCHAR *filter, const TCHAR *item)
338{
339 INT iFilter = 0;
340 DWORD cbItem = lstrlen(item) * sizeof(TCHAR);
341 BOOL bSep = TRUE;
342
343 for (; *filter; ++filter)
344 {
345 if (bSep && memcmp(item, filter, cbItem) == 0)
346 return (iFilter + 1) / 2;
347
348 bSep = (*filter == TEXT('|'));
349 if (bSep)
350 ++iFilter;
351 }
352
353 return -1;
354}
355
356static void Test_Importer(void)
357{
358 HRESULT hr;
360 CSimpleArray<GUID> aguidFileTypes;
361 INT iNULL, iBMP, iJPEG, iGIF, iPNG, iTIFF, iEMF, iWMF;
362
363 // Try importer with "All Image Files"
364 CSimpleString strImporters(mgr);
365 aguidFileTypes.RemoveAll();
366 hr = CImage::GetImporterFilterString(strImporters, aguidFileTypes, TEXT("All Image Files"), 0);
367 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
368 ok(aguidFileTypes.GetSize() >= 8,
369 "Expected aguidFileTypes.GetSize() to be >= 8, was %d.", aguidFileTypes.GetSize());
370
371 iNULL = FindGUID(GUID_NULL, aguidFileTypes);
372 iBMP = FindGUID(Gdiplus::ImageFormatBMP, aguidFileTypes);
373 iJPEG = FindGUID(Gdiplus::ImageFormatJPEG, aguidFileTypes);
374 iGIF = FindGUID(Gdiplus::ImageFormatGIF, aguidFileTypes);
375 iPNG = FindGUID(Gdiplus::ImageFormatPNG, aguidFileTypes);
376 iTIFF = FindGUID(Gdiplus::ImageFormatTIFF, aguidFileTypes);
377 iEMF = FindGUID(Gdiplus::ImageFormatEMF, aguidFileTypes);
378 iWMF = FindGUID(Gdiplus::ImageFormatWMF, aguidFileTypes);
379
380 ok_int(iNULL, 0);
381 ok(iBMP > 0, "iBMP was %d\n", iBMP);
382 ok(iJPEG > 0, "iJPEG was %d\n", iJPEG);
383 ok(iGIF > 0, "iGIF was %d\n", iGIF);
384 ok(iPNG > 0, "iPNG was %d\n", iPNG);
385 ok(iTIFF > 0, "iTIFF was %d\n", iTIFF);
386 ok(iEMF > 0, "iEMF was %d\n", iEMF);
387 ok(iWMF > 0, "iWMF was %d\n", iWMF);
388
389 ok_int(memcmp(strImporters, TEXT("All Image Files|"), sizeof(TEXT("All Image Files|")) - sizeof(TCHAR)), 0);
390 ok_int(iBMP, FindFilterItem(strImporters, TEXT("BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|")));
391 ok_int(iJPEG, FindFilterItem(strImporters, TEXT("JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|")));
392 ok_int(iGIF, FindFilterItem(strImporters, TEXT("GIF (*.GIF)|*.GIF|")));
393 ok_int(iPNG, FindFilterItem(strImporters, TEXT("PNG (*.PNG)|*.PNG|")));
394 ok_int(iTIFF, FindFilterItem(strImporters, TEXT("TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|")));
395
396 // Try importer without "All Image Files"
397 aguidFileTypes.RemoveAll();
398 strImporters.Empty();
399 hr = CImage::GetImporterFilterString(strImporters, aguidFileTypes, NULL, 0);
400 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
401 ok(aguidFileTypes.GetSize() >= 7,
402 "Expected aguidFileTypes.GetSize() to be >= 7, was %d.", aguidFileTypes.GetSize());
403
404 iNULL = FindGUID(GUID_NULL, aguidFileTypes);
405 iBMP = FindGUID(Gdiplus::ImageFormatBMP, aguidFileTypes);
406 iJPEG = FindGUID(Gdiplus::ImageFormatJPEG, aguidFileTypes);
407 iGIF = FindGUID(Gdiplus::ImageFormatGIF, aguidFileTypes);
408 iPNG = FindGUID(Gdiplus::ImageFormatPNG, aguidFileTypes);
409 iTIFF = FindGUID(Gdiplus::ImageFormatTIFF, aguidFileTypes);
410 iEMF = FindGUID(Gdiplus::ImageFormatEMF, aguidFileTypes);
411 iWMF = FindGUID(Gdiplus::ImageFormatWMF, aguidFileTypes);
412
413 ok_int(iNULL, -1);
414 ok_int(iBMP, 0);
415 ok(iJPEG > 0, "iJPEG was %d\n", iJPEG);
416 ok(iGIF > 0, "iGIF was %d\n", iGIF);
417 ok(iPNG > 0, "iPNG was %d\n", iPNG);
418 ok(iTIFF > 0, "iTIFF was %d\n", iTIFF);
419 ok(iEMF > 0, "iEMF was %d\n", iEMF);
420 ok(iWMF > 0, "iWMF was %d\n", iWMF);
421
422 ok_int(iBMP, FindFilterItem(strImporters, TEXT("BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|")));
423 ok_int(iJPEG, FindFilterItem(strImporters, TEXT("JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|")));
424 ok_int(iGIF, FindFilterItem(strImporters, TEXT("GIF (*.GIF)|*.GIF|")));
425 ok_int(iPNG, FindFilterItem(strImporters, TEXT("PNG (*.PNG)|*.PNG|")));
426 ok_int(iTIFF, FindFilterItem(strImporters, TEXT("TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|")));
427}
428
429static void Test_Exporter(void)
430{
431 HRESULT hr;
433 CSimpleArray<GUID> aguidFileTypes;
434 INT iNULL, iBMP, iJPEG, iGIF, iPNG, iTIFF;
435
436 // Try exporter with "All Image Files"
437 CSimpleString strExporters(mgr);
438 aguidFileTypes.RemoveAll();
439 hr = CImage::GetExporterFilterString(strExporters, aguidFileTypes, TEXT("All Image Files"), 0);
440 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
441 ok(aguidFileTypes.GetSize() >= 6,
442 "Expected aguidFileTypes.GetSize() to be >= 6, was %d.", aguidFileTypes.GetSize());
443
444 iNULL = FindGUID(GUID_NULL, aguidFileTypes);
445 iBMP = FindGUID(Gdiplus::ImageFormatBMP, aguidFileTypes);
446 iJPEG = FindGUID(Gdiplus::ImageFormatJPEG, aguidFileTypes);
447 iGIF = FindGUID(Gdiplus::ImageFormatGIF, aguidFileTypes);
448 iPNG = FindGUID(Gdiplus::ImageFormatPNG, aguidFileTypes);
449 iTIFF = FindGUID(Gdiplus::ImageFormatTIFF, aguidFileTypes);
450
451 ok_int(iNULL, 0);
452 ok(iBMP > 0, "iBMP was %d\n", iBMP);
453 ok(iJPEG > 0, "iJPEG was %d\n", iJPEG);
454 ok(iGIF > 0, "iGIF was %d\n", iGIF);
455 ok(iPNG > 0, "iPNG was %d\n", iPNG);
456 ok(iTIFF > 0, "iTIFF was %d\n", iTIFF);
457
458 ok_int(iBMP, FindFilterItem(strExporters, TEXT("BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|")));
459 ok_int(iJPEG, FindFilterItem(strExporters, TEXT("JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|")));
460 ok_int(iGIF, FindFilterItem(strExporters, TEXT("GIF (*.GIF)|*.GIF|")));
461 ok_int(iPNG, FindFilterItem(strExporters, TEXT("PNG (*.PNG)|*.PNG|")));
462 ok_int(iTIFF, FindFilterItem(strExporters, TEXT("TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|")));
463
464 // Try exporter without "All Image Files"
465 strExporters.Empty();
466 aguidFileTypes.RemoveAll();
467 hr = CImage::GetExporterFilterString(strExporters, aguidFileTypes, NULL, 0);
468 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
469 ok(aguidFileTypes.GetSize() >= 5,
470 "Expected aguidFileTypes.GetSize() to be >= 5, was %d.", aguidFileTypes.GetSize());
471
472 iNULL = FindGUID(GUID_NULL, aguidFileTypes);
473 iBMP = FindGUID(Gdiplus::ImageFormatBMP, aguidFileTypes);
474 iJPEG = FindGUID(Gdiplus::ImageFormatJPEG, aguidFileTypes);
475 iGIF = FindGUID(Gdiplus::ImageFormatGIF, aguidFileTypes);
476 iPNG = FindGUID(Gdiplus::ImageFormatPNG, aguidFileTypes);
477 iTIFF = FindGUID(Gdiplus::ImageFormatTIFF, aguidFileTypes);
478
479 ok_int(iNULL, -1);
480 ok_int(iBMP, 0);
481 ok(iJPEG > 0, "iJPEG was %d\n", iJPEG);
482 ok(iGIF > 0, "iGIF was %d\n", iGIF);
483 ok(iPNG > 0, "iPNG was %d\n", iPNG);
484 ok(iTIFF > 0, "iTIFF was %d\n", iTIFF);
485
486 ok_int(iBMP, FindFilterItem(strExporters, TEXT("BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|")));
487 ok_int(iJPEG, FindFilterItem(strExporters, TEXT("JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|")));
488 ok_int(iGIF, FindFilterItem(strExporters, TEXT("GIF (*.GIF)|*.GIF|")));
489 ok_int(iPNG, FindFilterItem(strExporters, TEXT("PNG (*.PNG)|*.PNG|")));
490 ok_int(iTIFF, FindFilterItem(strExporters, TEXT("TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|")));
491}
492
494{
495 Test_Bitmap();
501}
static void Test_CompatBitmapEntry(INT iLine, HDC hdc, INT width, INT height)
Definition: CImage.cpp:72
static void Test_Exporter(void)
Definition: CImage.cpp:429
static void Test_Bitmap(void)
Definition: CImage.cpp:58
static void Test_DIBSection(void)
Definition: CImage.cpp:284
static INT FindFilterItem(const TCHAR *filter, const TCHAR *item)
Definition: CImage.cpp:337
static void Test_ResBitmap(void)
Definition: CImage.cpp:302
static void Test_BitmapEntry(INT iLine, INT bpp, INT width, INT height, BOOL bTopDown)
Definition: CImage.cpp:40
static void Test_PixelAddress(INT iLine, const CImage &image1, const BITMAP &bm, INT x, INT y, BOOL bTopDown)
Definition: CImage.cpp:24
static void Test_DIBSectionEntry(INT iLine, HDC hdc, INT bpp, INT width, INT height, BOOL bTopDown)
Definition: CImage.cpp:113
static INT FindGUID(REFGUID rguid, const CSimpleArray< GUID > &guids)
Definition: CImage.cpp:327
static void Test_Importer(void)
Definition: CImage.cpp:356
static void Test_CompatBitmap(void)
Definition: CImage.cpp:89
HDC hdc1
Definition: SelectObject.c:10
HDC hdc2
Definition: SelectObject.c:10
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Colors
Definition: ansiprsr.h:4
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
static IAtlStringMgr * GetInstance(void)
Definition: atlstr.h:28
HDC GetDC() const noexcept
Definition: atlimage.h:80
bool IsDIBSection() const noexcept
Definition: atlimage.h:352
COLORREF GetPixel(int x, int y) const noexcept
Definition: atlimage.h:319
COLORREF GetTransparentColor() const noexcept
Definition: atlimage.h:341
void SetPixel(int x, int y, COLORREF color) noexcept
Definition: atlimage.h:584
HRESULT Save(IStream *pStream, GUID *guidFileType) const noexcept
Definition: atlimage.h:503
static HRESULT GetImporterFilterString(CSimpleString &strImporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultLoad, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:794
void * GetBits() noexcept
Definition: atlimage.h:267
void ReleaseDC() const noexcept
Definition: atlimage.h:98
int GetHeight() const noexcept
Definition: atlimage.h:293
@ DIBOR_TOPDOWN
Definition: atlimage.h:36
@ DIBOR_BOTTOMUP
Definition: atlimage.h:37
void LoadFromResource(HINSTANCE hInstance, LPCTSTR pszResourceName) noexcept
Definition: atlimage.h:426
int GetWidth() const noexcept
Definition: atlimage.h:346
int GetMaxColorTableEntries() const noexcept
Definition: atlimage.h:299
void GetColorTable(UINT iFirstColor, UINT nColors, RGBQUAD *prgbColors) const noexcept
Definition: atlimage.h:284
int GetBPP() const noexcept
Definition: atlimage.h:278
static HRESULT GetExporterFilterString(CSimpleString &strExporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultSave, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:817
void Attach(HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT) noexcept
Definition: atlimage.h:61
bool IsNull() const noexcept
Definition: atlimage.h:364
void * GetPixelAddress(int x, int y) noexcept
Definition: atlimage.h:327
int GetPitch() const noexcept
Definition: atlimage.h:313
HRESULT Load(LPCTSTR pszFileName) noexcept
Definition: atlimage.h:369
void Empty() noexcept
Definition: atlsimpstr.h:253
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HBITMAP hBitmap
Definition: timezone.c:26
DWORD bpp
Definition: surface.c:185
#define MAX_PATH
Definition: compat.h:34
#define RGB(r, g, b)
Definition: precomp.h:71
ULONG RGBQUAD
Definition: precomp.h:59
HINSTANCE hInst
Definition: dxdiag.c:13
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLenum const GLvoid * addr
Definition: glext.h:9621
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
int iLine
Definition: hpp.c:35
#define S_OK
Definition: intsafe.h:52
#define C_ASSERT(e)
Definition: intsafe.h:73
#define TEXT(s)
Definition: k32.h:26
#define GUID_NULL
Definition: ks.h:106
if(dx< 0)
Definition: linetemp.h:194
#define IDB_CROSS
Definition: resource.h:6
#define IDB_ANT
Definition: resource.h:5
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static ATOM item
Definition: dde.c:856
unsigned int UINT
Definition: ndis.h:50
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:68
#define StringCchCat
Definition: strsafe.h:317
RGBQUAD bmiColorsExtra[256 - 1]
Definition: dib.cpp:19
Definition: bl.h:1331
Definition: scsiwmi.h:51
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define ZeroMemory
Definition: winbase.h:1712
#define ExpandEnvironmentStrings
Definition: winbase.h:3774
#define GetModuleHandle
Definition: winbase.h:3827
#define DeleteFile
Definition: winbase.h:3764
#define lstrlen
Definition: winbase.h:3876
DWORD COLORREF
Definition: windef.h:300
CONST void * LPCVOID
Definition: windef.h:191
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
char TCHAR
Definition: xmlstorage.h:189
const CHAR * LPCTSTR
Definition: xmlstorage.h:193