[PATCH 1/6] dwrite: Test IDWriteTextFormat with nonexistent font

Lucian Poston lucianposton at pm.me
Wed May 23 13:02:30 CDT 2018


Signed-off-by: Lucian Poston <lucianposton at pm.me>
---
 dlls/dwrite/tests/layout.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index c2dd273c6c..ac36aff5b5 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -32,6 +32,7 @@
 #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
 
 static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
+static const WCHAR nonExistentFontW[]  = {'B','l','a','h','!',0};
 static const WCHAR enusW[] = {'e','n','-','u','s',0};
 
 struct testanalysissink
@@ -3294,6 +3295,51 @@ todo_wine
     ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
     IDWriteTextLayout_Release(layout);
 
+    IDWriteTextFormat_Release(format);
+
+    /* nonexistent font */
+    hr = IDWriteFactory_CreateTextFormat(factory, nonExistentFontW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+        DWRITE_FONT_STRETCH_NORMAL, 10.0, enusW, &format);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    count = 0;
+    hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+todo_wine
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+    ok(count == 4, "got %u\n", count);
+    for (i = 0, width = 0.0; i < count; i++)
+        width += clusters[i].width;
+
+    memset(&metrics, 0xcc, sizeof(metrics));
+    hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+todo_wine
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+    ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+todo_wine
+    ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+todo_wine
+    ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+todo_wine
+    ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+        metrics.widthIncludingTrailingWhitespace, width);
+todo_wine
+    ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+todo_wine
+    ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth);
+todo_wine
+    ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+todo_wine
+    ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+todo_wine
+    ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+
+    IDWriteTextLayout_Release(layout);
+
     IDWriteTextFormat_Release(format);
     IDWriteFactory_Release(factory);
 }
-- 
2.16.1





More information about the wine-devel mailing list