On 3/4/21 1:23 PM, Giovanni Mascellani wrote:
- /* nonexistent font */
- hr = IDWriteFactory_CreateTextFormat(factory, L"Blah!", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL, 10.0, L"en-us", &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, L"A", 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;
Currently any layout method that triggers font creation will fail on missing font, so for the purposes of such test you can stop right at GetClusterMetrics() return value test.
Also note that specified string length exceeds string constant passed to CreateTextLayout(), remaining 3 clusters are probably not based on meaningful characters, or remaining 2 to be precise.
- memset(&metrics, 0xcc, sizeof(metrics));
- hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
- ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
- ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
- ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
metrics.widthIncludingTrailingWhitespace, width);
+todo_wine
- ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
- ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth);
- ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
- 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);
I don't see any value in testing this.
Patch subject is inaccurate because you're testing layout behavior, format instance does not check or care if font exists, it only holds parameters.