gdiplus/tests: Fix test failures on Win98 by using A-functions.

This commit is contained in:
Paul Vriens 2009-04-23 21:29:22 +02:00 committed by Alexandre Julliard
parent 40f812c110
commit 163b046ec5
1 changed files with 43 additions and 44 deletions

View File

@ -97,7 +97,7 @@ static void test_createfont(void)
static void test_logfont(void) static void test_logfont(void)
{ {
LOGFONTW lfw, lfw2; LOGFONTA lfa, lfa2;
GpFont *font; GpFont *font;
GpStatus stat; GpStatus stat;
GpGraphics *graphics; GpGraphics *graphics;
@ -105,70 +105,69 @@ static void test_logfont(void)
INT style; INT style;
GdipCreateFromHDC(hdc, &graphics); GdipCreateFromHDC(hdc, &graphics);
memset(&lfw, 0, sizeof(LOGFONTW)); memset(&lfa, 0, sizeof(LOGFONTA));
memset(&lfw2, 0xff, sizeof(LOGFONTW)); memset(&lfa2, 0xff, sizeof(LOGFONTA));
/* empty FaceName */ /* empty FaceName */
lfw.lfFaceName[0] = 0; lfa.lfFaceName[0] = 0;
stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font); stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
expect(NotTrueTypeFont, stat); expect(NotTrueTypeFont, stat);
memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR)); lstrcpyA(lfa.lfFaceName, "Arial");
stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font); stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
if (stat == FileNotFound) if (stat == FileNotFound)
{ {
skip("Arial not installed.\n"); skip("Arial not installed.\n");
return; return;
} }
expect(Ok, stat); expect(Ok, stat);
stat = GdipGetLogFontW(font, graphics, &lfw2); stat = GdipGetLogFontA(font, graphics, &lfa2);
expect(Ok, stat); expect(Ok, stat);
ok(lfw2.lfHeight < 0, "Expected negative height\n"); ok(lfa2.lfHeight < 0, "Expected negative height\n");
expect(0, lfw2.lfWidth); expect(0, lfa2.lfWidth);
expect(0, lfw2.lfEscapement); expect(0, lfa2.lfEscapement);
expect(0, lfw2.lfOrientation); expect(0, lfa2.lfOrientation);
ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n"); ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
expect(0, lfw2.lfItalic); expect(0, lfa2.lfItalic);
expect(0, lfw2.lfUnderline); expect(0, lfa2.lfUnderline);
expect(0, lfw2.lfStrikeOut); expect(0, lfa2.lfStrikeOut);
expect(GetTextCharset(hdc), lfw2.lfCharSet); expect(GetTextCharset(hdc), lfa2.lfCharSet);
expect(0, lfw2.lfOutPrecision); expect(0, lfa2.lfOutPrecision);
expect(0, lfw2.lfClipPrecision); expect(0, lfa2.lfClipPrecision);
expect(0, lfw2.lfQuality); expect(0, lfa2.lfQuality);
expect(0, lfw2.lfPitchAndFamily); expect(0, lfa2.lfPitchAndFamily);
GdipDeleteFont(font); GdipDeleteFont(font);
memset(&lfw, 0, sizeof(LOGFONTW)); memset(&lfa, 0, sizeof(LOGFONTA));
lfw.lfHeight = 25; lfa.lfHeight = 25;
lfw.lfWidth = 25; lfa.lfWidth = 25;
lfw.lfEscapement = lfw.lfOrientation = 50; lfa.lfEscapement = lfa.lfOrientation = 50;
lfw.lfItalic = lfw.lfUnderline = lfw.lfStrikeOut = TRUE; lfa.lfItalic = lfa.lfUnderline = lfa.lfStrikeOut = TRUE;
memset(&lfw2, 0xff, sizeof(LOGFONTW)); memset(&lfa2, 0xff, sizeof(LOGFONTA));
memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR)); lstrcpyA(lfa.lfFaceName, "Arial");
stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font); stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
expect(Ok, stat); expect(Ok, stat);
stat = GdipGetLogFontW(font, graphics, &lfw2); stat = GdipGetLogFontA(font, graphics, &lfa2);
expect(Ok, stat); expect(Ok, stat);
ok(lfw2.lfHeight < 0, "Expected negative height\n"); ok(lfa2.lfHeight < 0, "Expected negative height\n");
expect(0, lfw2.lfWidth); expect(0, lfa2.lfWidth);
expect(0, lfw2.lfEscapement); expect(0, lfa2.lfEscapement);
expect(0, lfw2.lfOrientation); expect(0, lfa2.lfOrientation);
ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n"); ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
expect(TRUE, lfw2.lfItalic); expect(TRUE, lfa2.lfItalic);
expect(TRUE, lfw2.lfUnderline); expect(TRUE, lfa2.lfUnderline);
expect(TRUE, lfw2.lfStrikeOut); expect(TRUE, lfa2.lfStrikeOut);
expect(GetTextCharset(hdc), lfw2.lfCharSet); expect(GetTextCharset(hdc), lfa2.lfCharSet);
expect(0, lfw2.lfOutPrecision); expect(0, lfa2.lfOutPrecision);
expect(0, lfw2.lfClipPrecision); expect(0, lfa2.lfClipPrecision);
expect(0, lfw2.lfQuality); expect(0, lfa2.lfQuality);
expect(0, lfw2.lfPitchAndFamily); expect(0, lfa2.lfPitchAndFamily);
stat = GdipGetFontStyle(font, &style); stat = GdipGetFontStyle(font, &style);
expect(Ok, stat); expect(Ok, stat);