push 83f6eeab4f78cf34cba36fe6c2150f9c23ec0aba
[wine/hacks.git] / dlls / gdiplus / tests / image.c
blob70685098dcc892830ceea9d8f26abffe30cbc06c
1 /*
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
21 #include "windows.h"
22 #include "gdiplus.h"
23 #include "wine/test.h"
25 #define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
27 static void test_Scan0(void)
29 GpBitmap *bm;
30 GpStatus stat;
31 BYTE buff[360];
33 bm = NULL;
34 stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
35 expect(Ok, stat);
36 ok(NULL != bm, "Expected bitmap to be initialized\n");
37 GdipDisposeImage((GpImage*)bm);
39 bm = (GpBitmap*)0xdeadbeef;
40 stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
41 expect(InvalidParameter, stat);
43 expect(NULL, bm);
45 bm = (GpBitmap*)0xdeadbeef;
46 stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
47 expect(InvalidParameter, stat);
49 expect(NULL, bm);
51 bm = (GpBitmap*)0xdeadbeef;
52 stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
53 expect(InvalidParameter, stat);
55 expect(NULL, bm);
57 bm = NULL;
58 stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
59 expect(Ok, stat);
60 ok(NULL != bm, "Expected bitmap to be initialized\n");
61 GdipDisposeImage((GpImage*)bm);
63 bm = (GpBitmap*) 0xdeadbeef;
64 stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
65 expect(InvalidParameter, stat);
66 expect(NULL, bm);
68 bm = (GpBitmap*)0xdeadbeef;
69 stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
70 expect(InvalidParameter, stat);
71 expect(0xdeadbeef, bm);
74 START_TEST(image)
76 struct GdiplusStartupInput gdiplusStartupInput;
77 ULONG_PTR gdiplusToken;
79 gdiplusStartupInput.GdiplusVersion = 1;
80 gdiplusStartupInput.DebugEventCallback = NULL;
81 gdiplusStartupInput.SuppressBackgroundThread = 0;
82 gdiplusStartupInput.SuppressExternalCodecs = 0;
84 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
86 test_Scan0();
88 GdiplusShutdown(gdiplusToken);