2 * Unit test suite for images
4 * Copyright (C) 2007 Google (Evan Stade)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/test.h"
30 #define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
31 #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
33 static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo)
41 stat = GdipGetImageRawFormat(img, &raw);
42 ok_(__FILE__, line)(stat == Ok, "GdipGetImageRawFormat failed with %d\n", stat);
43 if(stat != Ok) return;
44 StringFromGUID2(&raw, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
45 WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
46 StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
47 WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL);
49 todo_wine ok_(__FILE__, line)(IsEqualGUID(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer);
51 ok_(__FILE__, line)(IsEqualGUID(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer);
54 static void test_bufferrawformat(void* buff, int size, REFGUID expected, int line, BOOL todo)
63 hglob = GlobalAlloc (0, size);
64 data = GlobalLock (hglob);
65 memcpy(data, buff, size);
66 GlobalUnlock(hglob); data = NULL;
68 hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
69 ok_(__FILE__, line)(hres == S_OK, "Failed to create a stream\n");
70 if(hres != S_OK) return;
72 stat = GdipCreateBitmapFromStream(stream, &bmp);
73 ok_(__FILE__, line)(stat == Ok, "Failed to create a Bitmap\n");
75 IStream_Release(stream);
79 expect_rawformat(expected, (GpImage*)bmp, line, todo);
81 GdipDisposeImage((GpImage*)bmp);
82 IStream_Release(stream);
85 static void test_Scan0(void)
92 stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
94 ok(NULL != bm, "Expected bitmap to be initialized\n");
96 GdipDisposeImage((GpImage*)bm);
98 bm = (GpBitmap*)0xdeadbeef;
99 stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
100 expect(InvalidParameter, stat);
101 ok( !bm, "expected null bitmap\n" );
103 bm = (GpBitmap*)0xdeadbeef;
104 stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
105 expect(InvalidParameter, stat);
106 ok( !bm, "expected null bitmap\n" );
108 bm = (GpBitmap*)0xdeadbeef;
109 stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
110 expect(InvalidParameter, stat);
111 ok( !bm, "expected null bitmap\n" );
114 stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
116 ok(NULL != bm, "Expected bitmap to be initialized\n");
118 GdipDisposeImage((GpImage*)bm);
120 bm = (GpBitmap*) 0xdeadbeef;
121 stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
122 expect(InvalidParameter, stat);
123 ok( !bm, "expected null bitmap\n" );
125 bm = (GpBitmap*)0xdeadbeef;
126 stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
127 expect(InvalidParameter, stat);
128 ok( bm == (GpBitmap*)0xdeadbeef, "expected deadbeef bitmap\n" );
131 stat = GdipCreateBitmapFromScan0(10, 10, -8, PixelFormat24bppRGB, buff, &bm);
133 ok(NULL != bm, "Expected bitmap to be initialized\n");
135 GdipDisposeImage((GpImage*)bm);
137 bm = (GpBitmap*)0xdeadbeef;
138 stat = GdipCreateBitmapFromScan0(10, 10, -10, PixelFormat24bppRGB, buff, &bm);
139 expect(InvalidParameter, stat);
140 ok( !bm, "expected null bitmap\n" );
143 static void test_GetImageDimension(void)
147 const REAL WIDTH = 10.0, HEIGHT = 20.0;
150 bm = (GpBitmap*)0xdeadbeef;
151 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
153 ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
154 ok(NULL != bm, "Expected bitmap to not be NULL\n");
156 stat = GdipGetImageDimension(NULL,&w,&h);
157 expect(InvalidParameter, stat);
159 stat = GdipGetImageDimension((GpImage*)bm,NULL,&h);
160 expect(InvalidParameter, stat);
162 stat = GdipGetImageDimension((GpImage*)bm,&w,NULL);
163 expect(InvalidParameter, stat);
167 stat = GdipGetImageDimension((GpImage*)bm,&w,&h);
171 GdipDisposeImage((GpImage*)bm);
174 static void test_GdipImageGetFrameDimensionsCount(void)
178 const REAL WIDTH = 10.0, HEIGHT = 20.0;
181 bm = (GpBitmap*)0xdeadbeef;
182 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
184 ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
185 ok(NULL != bm, "Expected bitmap to not be NULL\n");
187 stat = GdipImageGetFrameDimensionsCount(NULL,&w);
188 expect(InvalidParameter, stat);
190 stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,NULL);
191 expect(InvalidParameter, stat);
194 stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,&w);
197 GdipDisposeImage((GpImage*)bm);
200 static void test_LoadingImages(void)
204 stat = GdipCreateBitmapFromFile(0, 0);
205 expect(InvalidParameter, stat);
207 stat = GdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef);
208 expect(InvalidParameter, stat);
210 stat = GdipLoadImageFromFile(0, 0);
211 expect(InvalidParameter, stat);
213 stat = GdipLoadImageFromFile(0, (GpImage**)0xdeadbeef);
214 expect(InvalidParameter, stat);
216 stat = GdipLoadImageFromFileICM(0, 0);
217 expect(InvalidParameter, stat);
219 stat = GdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef);
220 expect(InvalidParameter, stat);
223 static void test_SavingImages(void)
229 const REAL WIDTH = 10.0, HEIGHT = 20.0;
231 ImageCodecInfo *codecs;
232 static const CHAR filenameA[] = "a.bmp";
233 static const WCHAR filename[] = { 'a','.','b','m','p',0 };
237 stat = GdipSaveImageToFile(0, 0, 0, 0);
238 expect(InvalidParameter, stat);
241 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
247 stat = GdipSaveImageToFile((GpImage*)bm, 0, 0, 0);
248 expect(InvalidParameter, stat);
250 stat = GdipSaveImageToFile((GpImage*)bm, filename, 0, 0);
251 expect(InvalidParameter, stat);
253 /* encoder tests should succeed -- already tested */
254 stat = GdipGetImageEncodersSize(&n, &s);
255 if (stat != Ok || n == 0) goto cleanup;
257 codecs = GdipAlloc(s);
258 if (!codecs) goto cleanup;
260 stat = GdipGetImageEncoders(n, s, codecs);
261 if (stat != Ok) goto cleanup;
263 stat = GdipSaveImageToFile((GpImage*)bm, filename, &codecs[0].Clsid, 0);
266 GdipDisposeImage((GpImage*)bm);
269 /* re-load and check image stats */
270 stat = GdipLoadImageFromFile(filename, (GpImage**)&bm);
272 if (stat != Ok) goto cleanup;
274 stat = GdipGetImageDimension((GpImage*)bm, &w, &h);
275 if (stat != Ok) goto cleanup;
283 GdipDisposeImage((GpImage*)bm);
284 ok(DeleteFileA(filenameA), "Delete failed.\n");
287 static void test_encoders(void)
292 ImageCodecInfo *codecs;
296 static const CHAR bmp_format[] = "BMP";
298 stat = GdipGetImageEncodersSize(&n, &s);
301 codecs = GdipAlloc(s);
305 stat = GdipGetImageEncoders(n, s, NULL);
306 expect(GenericError, stat);
308 stat = GdipGetImageEncoders(0, s, codecs);
309 expect(GenericError, stat);
311 stat = GdipGetImageEncoders(n, s-1, codecs);
312 expect(GenericError, stat);
314 stat = GdipGetImageEncoders(n, s+1, codecs);
315 expect(GenericError, stat);
317 stat = GdipGetImageEncoders(n, s, codecs);
321 for (i = 0; i < n; i++)
325 WideCharToMultiByte(CP_ACP, 0, codecs[i].FormatDescription, -1,
328 if (CompareStringA(LOCALE_SYSTEM_DEFAULT, 0,
330 bmp_format, -1) == CSTR_EQUAL) {
336 ok(FALSE, "No BMP codec found.\n");
341 static void test_LockBits(void)
347 const INT WIDTH = 10, HEIGHT = 20;
350 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
359 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
363 stat = GdipBitmapUnlockBits(bm, &bd);
367 /* read-only, with NULL rect -> whole bitmap lock */
368 stat = GdipBitmapLockBits(bm, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd);
370 expect(bd.Width, WIDTH);
371 expect(bd.Height, HEIGHT);
374 stat = GdipBitmapUnlockBits(bm, &bd);
378 /* read-only, consecutive */
379 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
383 stat = GdipBitmapUnlockBits(bm, &bd);
387 stat = GdipDisposeImage((GpImage*)bm);
389 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
393 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
395 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
396 expect(WrongState, stat);
398 stat = GdipBitmapUnlockBits(bm, &bd);
401 stat = GdipDisposeImage((GpImage*)bm);
403 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
406 /* write, no modification */
407 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
411 stat = GdipBitmapUnlockBits(bm, &bd);
415 /* write, consecutive */
416 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
420 stat = GdipBitmapUnlockBits(bm, &bd);
424 stat = GdipDisposeImage((GpImage*)bm);
426 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
430 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
435 ((char*)bd.Scan0)[2] = 0xff;
437 stat = GdipBitmapUnlockBits(bm, &bd);
441 stat = GdipDisposeImage((GpImage*)bm);
445 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
447 stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
449 stat = GdipDisposeImage((GpImage*)bm);
453 static void test_GdipCreateBitmapFromHBITMAP(void)
455 GpBitmap* gpbm = NULL;
457 HPALETTE hpal = NULL;
460 LOGPALETTE* LogPal = NULL;
462 const REAL WIDTH1 = 5;
463 const REAL HEIGHT1 = 15;
464 const REAL WIDTH2 = 10;
465 const REAL HEIGHT2 = 20;
469 stat = GdipCreateBitmapFromHBITMAP(NULL, NULL, NULL);
470 expect(InvalidParameter, stat);
472 hbm = CreateBitmap(WIDTH1, HEIGHT1, 1, 1, NULL);
473 stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, NULL);
474 expect(InvalidParameter, stat);
476 stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
478 expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
479 expectf(WIDTH1, width);
480 expectf(HEIGHT1, height);
482 GdipDisposeImage((GpImage*)gpbm);
485 hbm = CreateBitmap(WIDTH2, HEIGHT2, 1, 1, &buff);
486 stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
489 expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)gpbm, __LINE__, TRUE);
491 expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
492 expectf(WIDTH2, width);
493 expectf(HEIGHT2, height);
495 GdipDisposeImage((GpImage*)gpbm);
498 hdc = CreateCompatibleDC(0);
499 ok(hdc != NULL, "CreateCompatibleDC failed\n");
500 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
501 bmi.bmiHeader.biHeight = HEIGHT1;
502 bmi.bmiHeader.biWidth = WIDTH1;
503 bmi.bmiHeader.biBitCount = 24;
504 bmi.bmiHeader.biPlanes = 1;
505 bmi.bmiHeader.biCompression = BI_RGB;
507 hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
508 ok(hbm != NULL, "CreateDIBSection failed\n");
510 stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
512 expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
513 expectf(WIDTH1, width);
514 expectf(HEIGHT1, height);
516 GdipDisposeImage((GpImage*)gpbm);
518 LogPal = GdipAlloc(sizeof(LOGPALETTE));
519 ok(LogPal != NULL, "unable to allocate LOGPALETTE\n");
520 LogPal->palVersion = 0x300;
521 hpal = CreatePalette(LogPal);
522 ok(hpal != NULL, "CreatePalette failed\n");
525 stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm);
531 GdipDisposeImage((GpImage*)gpbm);
537 static void test_GdipGetImageFlags(void)
543 img = (GpImage*)0xdeadbeef;
545 stat = GdipGetImageFlags(NULL, NULL);
546 expect(InvalidParameter, stat);
548 stat = GdipGetImageFlags(NULL, &flags);
549 expect(InvalidParameter, stat);
551 stat = GdipGetImageFlags(img, NULL);
552 expect(InvalidParameter, stat);
555 static void test_GdipCloneImage(void)
561 GpImage *image_src, *image_dest = NULL;
562 const INT WIDTH = 10, HEIGHT = 20;
564 /* Create an image, clone it, delete the original, make sure the copy works */
565 stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
567 expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bm, __LINE__, TRUE);
569 image_src = ((GpImage*)bm);
570 stat = GdipCloneImage(image_src, &image_dest);
572 expect_rawformat(&ImageFormatMemoryBMP, image_dest, __LINE__, TRUE);
574 stat = GdipDisposeImage((GpImage*)bm);
576 stat = GdipGetImageBounds(image_dest, &rectF, &unit);
579 /* Treat FP values carefully */
580 expectf((REAL)WIDTH, rectF.Width);
581 expectf((REAL)HEIGHT, rectF.Height);
583 stat = GdipDisposeImage(image_dest);
587 static void test_testcontrol(void)
593 stat = GdipTestControl(TestControlGetBuildNumber, ¶m);
595 ok(param != 0, "Build number expected, got %u\n", param);
598 static void test_fromhicon(void)
600 static const BYTE bmp_bits[1024];
601 HBITMAP hbmMask, hbmColor;
605 GpBitmap *bitmap = NULL;
611 stat = GdipCreateBitmapFromHICON(NULL, NULL);
612 expect(InvalidParameter, stat);
613 stat = GdipCreateBitmapFromHICON(NULL, &bitmap);
614 expect(InvalidParameter, stat);
616 /* color icon 1 bit */
617 hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits);
618 ok(hbmMask != 0, "CreateBitmap failed\n");
619 hbmColor = CreateBitmap(16, 16, 1, 1, bmp_bits);
620 ok(hbmColor != 0, "CreateBitmap failed\n");
624 info.hbmMask = hbmMask;
625 info.hbmColor = hbmColor;
626 hIcon = CreateIconIndirect(&info);
627 ok(hIcon != 0, "CreateIconIndirect failed\n");
628 DeleteObject(hbmMask);
629 DeleteObject(hbmColor);
631 stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
633 broken(stat == InvalidParameter), /* Win98 */
634 "Expected Ok, got %.8x\n", stat);
636 /* check attributes */
637 stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
640 stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
643 stat = GdipGetImageType((GpImage*)bitmap, &type);
645 expect(ImageTypeBitmap, type);
646 stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
647 expect(PixelFormat32bppARGB, format);
649 expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, TRUE);
650 GdipDisposeImage((GpImage*)bitmap);
654 /* color icon 8 bpp */
655 hbmMask = CreateBitmap(16, 16, 1, 8, bmp_bits);
656 ok(hbmMask != 0, "CreateBitmap failed\n");
657 hbmColor = CreateBitmap(16, 16, 1, 8, bmp_bits);
658 ok(hbmColor != 0, "CreateBitmap failed\n");
662 info.hbmMask = hbmMask;
663 info.hbmColor = hbmColor;
664 hIcon = CreateIconIndirect(&info);
665 ok(hIcon != 0, "CreateIconIndirect failed\n");
666 DeleteObject(hbmMask);
667 DeleteObject(hbmColor);
669 stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
672 /* check attributes */
673 stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
676 stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
679 stat = GdipGetImageType((GpImage*)bitmap, &type);
681 expect(ImageTypeBitmap, type);
682 stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
683 expect(PixelFormat32bppARGB, format);
685 expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, TRUE);
686 GdipDisposeImage((GpImage*)bitmap);
692 static const unsigned char pngimage[285] = {
693 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
694 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,
695 0xde,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,
696 0x13,0x01,0x00,0x9a,0x9c,0x18,0x00,0x00,0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd5,
697 0x06,0x03,0x0f,0x07,0x2d,0x12,0x10,0xf0,0xfd,0x00,0x00,0x00,0x0c,0x49,0x44,0x41,
698 0x54,0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,
699 0xe7,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
702 static const unsigned char gifimage[35] = {
703 0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x00,0xff,0xff,0xff,
704 0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
708 static const unsigned char bmpimage[66] = {
709 0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00,
710 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
711 0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x02,0x00,
712 0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,0x00,
716 static const unsigned char jpgimage[285] = {
717 0xff,0xd8,0xff,0xe0,0x00,0x10,0x4a,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x01,0x2c,
718 0x01,0x2c,0x00,0x00,0xff,0xdb,0x00,0x43,0x00,0x05,0x03,0x04,0x04,0x04,0x03,0x05,
719 0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x07,0x0c,0x08,0x07,0x07,0x07,0x07,0x0f,0x0b,
720 0x0b,0x09,0x0c,0x11,0x0f,0x12,0x12,0x11,0x0f,0x11,0x11,0x13,0x16,0x1c,0x17,0x13,
721 0x14,0x1a,0x15,0x11,0x11,0x18,0x21,0x18,0x1a,0x1d,0x1d,0x1f,0x1f,0x1f,0x13,0x17,
722 0x22,0x24,0x22,0x1e,0x24,0x1c,0x1e,0x1f,0x1e,0xff,0xdb,0x00,0x43,0x01,0x05,0x05,
723 0x05,0x07,0x06,0x07,0x0e,0x08,0x08,0x0e,0x1e,0x14,0x11,0x14,0x1e,0x1e,0x1e,0x1e,
724 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,
725 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,
726 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0xff,0xc0,
727 0x00,0x11,0x08,0x00,0x01,0x00,0x01,0x03,0x01,0x22,0x00,0x02,0x11,0x01,0x03,0x11,
728 0x01,0xff,0xc4,0x00,0x15,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
729 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xff,0xc4,0x00,0x14,0x10,0x01,0x00,0x00,
730 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xc4,
731 0x00,0x14,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
732 0x00,0x00,0x00,0x00,0xff,0xc4,0x00,0x14,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
733 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xda,0x00,0x0c,0x03,0x01,
734 0x00,0x02,0x11,0x03,0x11,0x00,0x3f,0x00,0xb2,0xc0,0x07,0xff,0xd9
736 static void test_getrawformat(void)
738 test_bufferrawformat((void*)pngimage, sizeof(pngimage), &ImageFormatPNG, __LINE__, TRUE);
739 test_bufferrawformat((void*)gifimage, sizeof(gifimage), &ImageFormatGIF, __LINE__, TRUE);
740 test_bufferrawformat((void*)bmpimage, sizeof(bmpimage), &ImageFormatBMP, __LINE__, FALSE);
741 test_bufferrawformat((void*)jpgimage, sizeof(jpgimage), &ImageFormatJPEG, __LINE__, TRUE);
746 struct GdiplusStartupInput gdiplusStartupInput;
747 ULONG_PTR gdiplusToken;
749 gdiplusStartupInput.GdiplusVersion = 1;
750 gdiplusStartupInput.DebugEventCallback = NULL;
751 gdiplusStartupInput.SuppressBackgroundThread = 0;
752 gdiplusStartupInput.SuppressExternalCodecs = 0;
754 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
757 test_GetImageDimension();
758 test_GdipImageGetFrameDimensionsCount();
759 test_LoadingImages();
763 test_GdipCreateBitmapFromHBITMAP();
764 test_GdipGetImageFlags();
765 test_GdipCloneImage();
770 GdiplusShutdown(gdiplusToken);