[PATCH 1/2] dwrite: test font collection fallback logic
Lucian Poston
lucian.poston at gmail.com
Wed Nov 22 13:51:52 CST 2017
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston at gmail.com>
---
dlls/dwrite/tests/font.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 7a14180979..744ae18445 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -2934,6 +2934,51 @@ todo_wine
ok(ref == 0, "factory not released, %u\n", ref);
}
+static void test_CustomFontCollection_fallback(void)
+{
+ static const WCHAR strW[] = {'a','b','c','d',0};
+ static const WCHAR enusW[] = {'e','n','-','u','s',0};
+ IDWriteFontCollectionLoader *loader;
+ IDWriteTextFormat *format;
+ IDWriteTextLayout *layout;
+ IDWriteFactory *factory;
+ LONG font_coll_key = 1;
+ IDWriteFontCollection *font_collection;
+ DWRITE_TEXT_METRICS metrics;
+ HRESULT hr;
+
+ factory = create_factory();
+ loader = create_collection_loader();
+ hr = IDWriteFactory_RegisterFontCollectionLoader(factory, loader);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IDWriteFactory_CreateCustomFontCollection(factory, loader,
+ &font_coll_key, sizeof(font_coll_key), &font_collection);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, font_collection,
+ 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,
+ 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IDWriteFactory_UnregisterFontCollectionLoader(factory, loader);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ IDWriteFontCollectionLoader_Release(loader);
+ IDWriteFontCollection_Release(font_collection);
+ IDWriteTextFormat_Release(format);
+ IDWriteTextLayout_Release(layout);
+ IDWriteFactory_Release(factory);
+}
+
static HRESULT WINAPI fontfileloader_QueryInterface(IDWriteFontFileLoader *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFontFileLoader))
@@ -8467,6 +8512,7 @@ START_TEST(font)
test_system_fontcollection();
test_ConvertFontFaceToLOGFONT();
test_CustomFontCollection();
+ test_CustomFontCollection_fallback();
test_CreateCustomFontFileReference();
test_CreateFontFileReference();
test_shared_isolated();
--
2.13.6
More information about the wine-devel
mailing list