rpcrt4: Try a lot harder to resuse existing connections by comparing inside the RpcQu...
[wine] / dlls / gdiplus / tests / pen.c
1 /*
2  * Unit test suite for pens (and init)
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 <stdarg.h>
22
23 #include "windef.h"
24 #include "gdiplus.h"
25 #include "wine/test.h"
26
27 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
28
29 static void test_startup(void)
30 {
31     GpPen *pen;
32     Status status;
33     struct GdiplusStartupInput gdiplusStartupInput;
34     ULONG_PTR gdiplusToken;
35
36     gdiplusStartupInput.GdiplusVersion              = 1;
37     gdiplusStartupInput.DebugEventCallback          = NULL;
38     gdiplusStartupInput.SuppressBackgroundThread    = 0;
39     gdiplusStartupInput.SuppressExternalCodecs      = 0;
40
41     status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
42     expect(Ok, status);
43     GdiplusShutdown(gdiplusToken);
44
45     gdiplusStartupInput.GdiplusVersion = 2;
46
47     status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
48     expect(UnsupportedGdiplusVersion, status);
49     GdiplusShutdown(gdiplusToken);
50
51     status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
52
53     todo_wine
54         expect(GdiplusNotInitialized, status);
55
56     GdipDeletePen(pen);
57 }
58
59 static void test_constructor_destructor(void)
60 {
61     GpStatus status;
62     GpPen *pen = NULL;
63
64     status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
65     expect(Ok, status);
66     ok(pen != NULL, "Expected pen to be initialized\n");
67
68     status = GdipDeletePen(NULL);
69     expect(InvalidParameter, status);
70
71     status = GdipDeletePen(pen);
72     expect(Ok, status);
73 }
74
75 START_TEST(pen)
76 {
77     struct GdiplusStartupInput gdiplusStartupInput;
78     ULONG_PTR gdiplusToken;
79
80     test_startup();
81
82     gdiplusStartupInput.GdiplusVersion              = 1;
83     gdiplusStartupInput.DebugEventCallback          = NULL;
84     gdiplusStartupInput.SuppressBackgroundThread    = 0;
85     gdiplusStartupInput.SuppressExternalCodecs      = 0;
86
87     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
88
89     test_constructor_destructor();
90
91     GdiplusShutdown(gdiplusToken);
92 }