advapi32: Use exponential backoff when waiting for a service to start.
[wine/multimedia.git] / dlls / gdiplus / tests / font.c
blob71e6f9a7bf296b1a3b2212692a993589c9aec8e1
1 /*
2 * Unit test suite for fonts
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(got == expected, "Expected %.8x, got %.8x\n", expected, got)
27 static WCHAR arial[] = {'A','r','i','a','l','\0'};
29 static void test_logfont(void)
31 LOGFONTW lfw, lfw2;
32 GpFont *font;
33 GpStatus stat;
34 GpGraphics *graphics;
35 HDC hdc = GetDC(0);
37 GdipCreateFromHDC(hdc, &graphics);
38 memset(&lfw, 0, sizeof(LOGFONTW));
39 memset(&lfw2, 0xff, sizeof(LOGFONTW));
40 memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR));
42 stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font);
43 expect(Ok, stat);
44 stat = GdipGetLogFontW(font, graphics, &lfw2);
45 expect(Ok, stat);
47 ok(lfw2.lfHeight < 0, "Expected negative height\n");
48 expect(0, lfw2.lfWidth);
49 expect(0, lfw2.lfEscapement);
50 expect(0, lfw2.lfOrientation);
51 ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n");
52 expect(0, lfw2.lfItalic);
53 expect(0, lfw2.lfUnderline);
54 expect(0, lfw2.lfStrikeOut);
55 expect(0, lfw2.lfCharSet);
56 expect(0, lfw2.lfOutPrecision);
57 expect(0, lfw2.lfClipPrecision);
58 expect(0, lfw2.lfQuality);
59 expect(0, lfw2.lfPitchAndFamily);
61 GdipDeleteFont(font);
63 memset(&lfw, 0, sizeof(LOGFONTW));
64 lfw.lfHeight = 25;
65 lfw.lfWidth = 25;
66 lfw.lfEscapement = lfw.lfOrientation = 50;
67 lfw.lfItalic = lfw.lfUnderline = lfw.lfStrikeOut = TRUE;
69 memset(&lfw2, 0xff, sizeof(LOGFONTW));
70 memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR));
72 stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font);
73 expect(Ok, stat);
74 stat = GdipGetLogFontW(font, graphics, &lfw2);
75 expect(Ok, stat);
77 ok(lfw2.lfHeight < 0, "Expected negative height\n");
78 expect(0, lfw2.lfWidth);
79 expect(0, lfw2.lfEscapement);
80 expect(0, lfw2.lfOrientation);
81 ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n");
82 expect(TRUE, lfw2.lfItalic);
83 expect(TRUE, lfw2.lfUnderline);
84 expect(TRUE, lfw2.lfStrikeOut);
85 expect(0, lfw2.lfCharSet);
86 expect(0, lfw2.lfOutPrecision);
87 expect(0, lfw2.lfClipPrecision);
88 expect(0, lfw2.lfQuality);
89 expect(0, lfw2.lfPitchAndFamily);
91 GdipDeleteFont(font);
93 GdipDeleteGraphics(graphics);
94 ReleaseDC(0, hdc);
97 START_TEST(font)
99 struct GdiplusStartupInput gdiplusStartupInput;
100 ULONG_PTR gdiplusToken;
102 gdiplusStartupInput.GdiplusVersion = 1;
103 gdiplusStartupInput.DebugEventCallback = NULL;
104 gdiplusStartupInput.SuppressBackgroundThread = 0;
105 gdiplusStartupInput.SuppressExternalCodecs = 0;
107 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
109 test_logfont();
111 GdiplusShutdown(gdiplusToken);