wine-staging/patches/dwrite-FontFallback/0001-dwrite-test-font-collection-fallback-logic.patch
2018-05-04 09:32:17 +10:00

80 lines
2.8 KiB
Diff

From cd1fcc1f8bc4b196304930254dc87ce34f6e9558 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Mon, 20 Nov 2017 20:50:19 -0800
Subject: [PATCH 1/2] dwrite: test font collection fallback logic
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@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 c226dba..ae386e6 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -2926,6 +2926,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))
@@ -8459,6 +8504,7 @@ START_TEST(font)
test_system_fontcollection();
test_ConvertFontFaceToLOGFONT();
test_CustomFontCollection();
+ test_CustomFontCollection_fallback();
test_CreateCustomFontFileReference();
test_CreateFontFileReference();
test_shared_isolated();
--
1.9.1