[PATCH] gdiplus/tests: Improve metafile DrawDriverString test.

Shawn M. Chapla schapla at codeweavers.com
Wed Jul 15 17:35:58 CDT 2020


Signed-off-by: Shawn M. Chapla <schapla at codeweavers.com>
---

This patch isn't strictly necessary, but it may clear up some potential
for confusion in cases where test metafiles are being saved/loaded in a
prefix where Times New Roman is not installed.

 dlls/gdiplus/tests/metafile.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
index 371a3c21b4..d2912f40ea 100644
--- a/dlls/gdiplus/tests/metafile.c
+++ b/dlls/gdiplus/tests/metafile.c
@@ -2977,6 +2977,8 @@ static void test_drawdriverstring(void)
     GpStatus stat;
     GpGraphics *graphics;
     GpFont *solidfont, *hatchfont;
+    GpFontFamily *family;
+    WCHAR familyname[LF_FACESIZE];
     GpBrush *solidbrush, *hatchbrush;
     HDC hdc;
     GpMatrix *matrix;
@@ -2990,12 +2992,17 @@ static void test_drawdriverstring(void)
     logfont.lfCharSet = DEFAULT_CHARSET;
 
     stat = GdipCreateFontFromLogfontA(hdc, &logfont, &solidfont);
-    if (stat == NotTrueTypeFont || stat == FileNotFound)
-    {
-        DeleteDC(hdc);
-        skip("Times New Roman not installed.\n");
-        return;
-    }
+    expect(Ok, stat);
+
+    stat = GdipGetFamily(solidfont, &family);
+    expect(Ok, stat);
+
+    familyname[0] = 0;
+    stat = GdipGetFamilyName(family, familyname, LANG_NEUTRAL);
+    expect(Ok, stat);
+
+    if (lstrcmpiW(familyname, L"Times New Roman"))
+        trace("Times New Roman is not installed. save/load may not yield expected results.\n");
 
     stat = GdipCloneFont(solidfont, &hatchfont);
     expect(Ok, stat);
@@ -3031,7 +3038,7 @@ static void test_drawdriverstring(void)
         DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, matrix);
     expect(Ok, stat);
 
-    stat = GdipDeleteGraphics(graphics);
+    GdipDeleteGraphics(graphics);
     graphics = NULL;
 
     check_metafile(metafile, drawdriverstring_records, "drawdriverstring metafile", dst_points,
-- 
2.27.0




More information about the wine-devel mailing list