2 * Unit test suite for GDI objects
4 * Copyright 2002 Mike McCormack
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "wine/test.h"
31 static void test_logfont(void)
36 memset(&lf, 0, sizeof lf);
38 lf.lfCharSet = ANSI_CHARSET;
39 lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
40 lf.lfWeight = FW_DONTCARE;
43 lf.lfQuality = DEFAULT_QUALITY;
44 lstrcpyA(lf.lfFaceName, "Arial");
46 hfont = CreateFontIndirectA(&lf);
47 ok(hfont != 0, "CreateFontIndirect failed\n");
49 ok(GetObjectA(hfont, sizeof(lfout), &lfout) == sizeof(lfout),
50 "GetObject returned wrong size\n");
52 ok(!memcmp(&lfout, &lf, FIELD_OFFSET(LOGFONTA, lfFaceName)), "fonts don't match\n");
53 ok(!lstrcmpA(lfout.lfFaceName, lf.lfFaceName),
54 "font names don't match: %s != %s\n", lfout.lfFaceName, lf.lfFaceName);
58 memset(&lf, 'A', sizeof(lf));
59 hfont = CreateFontIndirectA(&lf);
60 ok(hfont != 0, "CreateFontIndirectA with strange LOGFONT failed\n");
62 ok(GetObjectA(hfont, sizeof(lfout), NULL) == sizeof(lfout),
63 "GetObjectA with NULL failed\n");
65 ok(GetObjectA(hfont, sizeof(lfout), &lfout) == sizeof(lfout),
66 "GetObjectA failed\n");
67 ok(!memcmp(&lfout, &lf, FIELD_OFFSET(LOGFONTA, lfFaceName)), "fonts don't match\n");
68 lf.lfFaceName[LF_FACESIZE - 1] = 0;
69 ok(!lstrcmpA(lfout.lfFaceName, lf.lfFaceName),
70 "font names don't match: %s != %s\n", lfout.lfFaceName, lf.lfFaceName);