Sync trunk head (r41026)
[reactos.git] / rostests / winetests / gdiplus / brush.c
1 /*
2 * Unit test suite for brushes
3 *
4 * Copyright (C) 2007 Google (Evan Stade)
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include "windows.h"
22 #include "gdiplus.h"
23 #include "wine/test.h"
24
25 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
26
27 static void test_constructor_destructor(void)
28 {
29 GpStatus status;
30 GpSolidFill *brush = NULL;
31
32 status = GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
33 expect(Ok, status);
34 ok(brush != NULL, "Expected brush to be initialized\n");
35
36 status = GdipDeleteBrush(NULL);
37 expect(InvalidParameter, status);
38
39 status = GdipDeleteBrush((GpBrush*) brush);
40 expect(Ok, status);
41 }
42
43 static void test_type(void)
44 {
45 GpStatus status;
46 GpBrushType bt;
47 GpSolidFill *brush = NULL;
48
49 GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
50
51 status = GdipGetBrushType((GpBrush*)brush, &bt);
52 expect(status, Ok);
53 expect(bt, BrushTypeSolidColor);
54
55 GdipDeleteBrush((GpBrush*) brush);
56 }
57
58 START_TEST(brush)
59 {
60 struct GdiplusStartupInput gdiplusStartupInput;
61 ULONG_PTR gdiplusToken;
62
63 gdiplusStartupInput.GdiplusVersion = 1;
64 gdiplusStartupInput.DebugEventCallback = NULL;
65 gdiplusStartupInput.SuppressBackgroundThread = 0;
66 gdiplusStartupInput.SuppressExternalCodecs = 0;
67
68 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
69
70 test_constructor_destructor();
71 test_type();
72
73 GdiplusShutdown(gdiplusToken);
74 }