From 1c7a1c7b049e096b81ad986180f6061b320ad367 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 23 Mar 2025 02:10:06 +0200 Subject: [PATCH] =?UTF-8?q?[test-directwrite]=20Don=E2=80=99t=20fail=20if?= =?UTF-8?q?=20Bahnschrift=20can=E2=80=99t=20be=20loaded=20under=20Wine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is unlikely to be present if one is not running on Windows. --- test/api/test-directwrite.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/api/test-directwrite.cc b/test/api/test-directwrite.cc index c48572192..9367818e3 100644 --- a/test/api/test-directwrite.cc +++ b/test/api/test-directwrite.cc @@ -47,7 +47,7 @@ get_dwfont (const wchar_t *family_name) IDWriteFontCollection3 *collection; UINT32 count; IDWriteFontFamily2 *family; - IDWriteFont *font; + IDWriteFont *font = nullptr; UINT32 index = 0; dwrite_dll = LoadLibrary (TEXT ("DWRITE")); @@ -81,8 +81,8 @@ get_dwfont (const wchar_t *family_name) { BOOL exists; hr = collection->FindFamilyName (family_name, &index, &exists); - g_assert_true (SUCCEEDED (hr)); - g_assert_true (exists); + if (FAILED (hr) || !exists) + goto done; } hr = collection->GetFontFamily (index, &family); @@ -94,6 +94,7 @@ get_dwfont (const wchar_t *family_name) &font); g_assert_true (SUCCEEDED (hr)); +done: factory->Release (); return font; @@ -129,6 +130,14 @@ test_native_directwrite_variations (void) unsigned int length; dwfont = get_dwfont (L"Bahnschrift"); + + const char *env = getenv ("MESON_EXE_WRAPPER"); + if (env && strstr (env, "wine")) + { + g_test_skip ("Failed to load \"Bahnschrift\" font under Wine"); + return; + } + g_assert_nonnull (dwfont); font = hb_directwrite_font_create (dwfont);