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
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)
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
);
44 stat
= GdipGetLogFontW(font
, graphics
, &lfw2
);
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
);
63 memset(&lfw
, 0, sizeof(LOGFONTW
));
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
);
74 stat
= GdipGetLogFontW(font
, graphics
, &lfw2
);
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
);
93 GdipDeleteGraphics(graphics
);
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
);
111 GdiplusShutdown(gdiplusToken
);