dwrite/tests: Use wide string literals for some tests.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
56c5b064b8
commit
c18d2d1c0d
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Text analyzing tests
|
||||
*
|
||||
* Copyright 2012-2014 Nikolay Sivov for CodeWeavers
|
||||
* Copyright 2012-2020 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -34,7 +34,6 @@
|
|||
#include "wine/test.h"
|
||||
|
||||
static IDWriteFactory *factory;
|
||||
static const WCHAR test_fontfile[] = {'w','i','n','e','_','t','e','s','t','_','f','o','n','t','.','t','t','f',0};
|
||||
|
||||
#define LRE 0x202a
|
||||
#define RLE 0x202b
|
||||
|
@ -485,7 +484,6 @@ static struct testanalysissource analysissource = { { &analysissourcevtbl } };
|
|||
|
||||
static IDWriteFontFace *create_fontface(void)
|
||||
{
|
||||
static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
|
||||
IDWriteGdiInterop *interop;
|
||||
IDWriteFontFace *fontface;
|
||||
IDWriteFont *font;
|
||||
|
@ -500,7 +498,7 @@ static IDWriteFontFace *create_fontface(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -1160,7 +1158,6 @@ static void compare_breakpoints(const struct linebreaks_test *test, DWRITE_LINE_
|
|||
|
||||
static void test_AnalyzeLineBreakpoints(void)
|
||||
{
|
||||
static const WCHAR emptyW[] = {0};
|
||||
const struct linebreaks_test *ptr = linebreaks_tests;
|
||||
IDWriteTextAnalyzer *analyzer;
|
||||
UINT32 i = 0;
|
||||
|
@ -1169,7 +1166,7 @@ static void test_AnalyzeLineBreakpoints(void)
|
|||
hr = IDWriteFactory_CreateTextAnalyzer(factory, &analyzer);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
init_textsource(&analysissource, emptyW, DWRITE_READING_DIRECTION_LEFT_TO_RIGHT);
|
||||
init_textsource(&analysissource, L"", DWRITE_READING_DIRECTION_LEFT_TO_RIGHT);
|
||||
hr = IDWriteTextAnalyzer_AnalyzeLineBreakpoints(analyzer, &analysissource.IDWriteTextAnalysisSource_iface, 0, 0,
|
||||
&analysissink);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -1265,7 +1262,6 @@ static const struct textcomplexity_test textcomplexity_tests[] = {
|
|||
|
||||
static void test_GetTextComplexity(void)
|
||||
{
|
||||
static const WCHAR textW[] = {'A','B','C',0};
|
||||
IDWriteTextAnalyzer1 *analyzer1;
|
||||
IDWriteTextAnalyzer *analyzer;
|
||||
IDWriteFontFace *fontface;
|
||||
|
@ -1288,9 +1284,9 @@ static void test_GetTextComplexity(void)
|
|||
if (0) { /* crashes on native */
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, NULL, 0, NULL, NULL, NULL, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, NULL, 0, NULL, NULL, &len, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, textW, 3, NULL, NULL, NULL, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, textW, 3, NULL, NULL, &len, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, textW, 3, NULL, &simple, NULL, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, L"ABC", 3, NULL, NULL, NULL, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, L"ABC", 3, NULL, NULL, &len, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, L"ABC", 3, NULL, &simple, NULL, NULL);
|
||||
}
|
||||
|
||||
len = 1;
|
||||
|
@ -1303,7 +1299,7 @@ if (0) { /* crashes on native */
|
|||
len = 1;
|
||||
simple = TRUE;
|
||||
indices[0] = 1;
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, textW, 3, NULL, &simple, &len, NULL);
|
||||
hr = IDWriteTextAnalyzer1_GetTextComplexity(analyzer1, L"ABC", 3, NULL, &simple, &len, NULL);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
ok(len == 0, "got %d\n", len);
|
||||
ok(simple == FALSE, "got %d\n", simple);
|
||||
|
@ -1332,7 +1328,6 @@ if (0) { /* crashes on native */
|
|||
|
||||
static void test_numbersubstitution(void)
|
||||
{
|
||||
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
|
||||
IDWriteNumberSubstitution *substitution;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1342,8 +1337,9 @@ static void test_numbersubstitution(void)
|
|||
IDWriteNumberSubstitution_Release(substitution);
|
||||
|
||||
/* invalid locale name, method does not require it */
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, dummyW, FALSE, &substitution);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, L"dummy",
|
||||
FALSE, &substitution);
|
||||
ok(hr == S_OK, "Failed to create number substitution, hr %#x.\n", hr);
|
||||
IDWriteNumberSubstitution_Release(substitution);
|
||||
|
||||
/* invalid method */
|
||||
|
@ -1358,18 +1354,22 @@ static void test_numbersubstitution(void)
|
|||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, NULL, FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, dummyW, FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, L"dummy",
|
||||
FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, dummyW, FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, L"dummy",
|
||||
FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, dummyW, FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, L"dummy",
|
||||
FALSE, &substitution);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
/* invalid locale, but it's not needed for this method */
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, dummyW, FALSE, &substitution);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory_CreateNumberSubstitution(factory, DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, L"dummy", FALSE,
|
||||
&substitution);
|
||||
ok(hr == S_OK, "Failed to create number substitution, hr %#x.\n", hr);
|
||||
IDWriteNumberSubstitution_Release(substitution);
|
||||
}
|
||||
|
||||
|
@ -1494,12 +1494,11 @@ static unsigned int get_glyph_class(const struct dwrite_fonttable *table, UINT16
|
|||
|
||||
static void get_enus_string(IDWriteLocalizedStrings *strings, WCHAR *buff, unsigned int size)
|
||||
{
|
||||
static const WCHAR enusW[] = {'e','n','-','u','s',0};
|
||||
BOOL exists = FALSE;
|
||||
unsigned int index;
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, enusW, &index, &exists);
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, L"en-us", &index, &exists);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(exists, "Failed to find locale name %d.\n", exists);
|
||||
|
||||
|
@ -1811,9 +1810,7 @@ static BOOL has_feature(const DWRITE_FONT_FEATURE_TAG *tags, UINT32 count, DWRIT
|
|||
|
||||
static void test_GetTypographicFeatures(void)
|
||||
{
|
||||
static const WCHAR localeW[] = {'c','a','d','a','b','r','a',0};
|
||||
static const WCHAR arabicW[] = {0x064a,0x064f,0x0633,0};
|
||||
static const WCHAR abcW[] = {'a','b','c',0};
|
||||
DWRITE_FONT_FEATURE_TAG tags[20];
|
||||
IDWriteTextAnalyzer2 *analyzer2;
|
||||
IDWriteTextAnalyzer *analyzer;
|
||||
|
@ -1835,7 +1832,7 @@ static void test_GetTypographicFeatures(void)
|
|||
|
||||
fontface = create_fontface();
|
||||
|
||||
get_script_analysis(abcW, &sa);
|
||||
get_script_analysis(L"abc", &sa);
|
||||
count = 0;
|
||||
hr = IDWriteTextAnalyzer2_GetTypographicFeatures(analyzer2, fontface, sa, NULL, 0, &count, NULL);
|
||||
todo_wine {
|
||||
|
@ -1843,9 +1840,9 @@ todo_wine {
|
|||
ok(count > 0, "got %u\n", count);
|
||||
}
|
||||
/* invalid locale name is ignored */
|
||||
get_script_analysis(abcW, &sa);
|
||||
get_script_analysis(L"abc", &sa);
|
||||
count = 0;
|
||||
hr = IDWriteTextAnalyzer2_GetTypographicFeatures(analyzer2, fontface, sa, localeW, 0, &count, NULL);
|
||||
hr = IDWriteTextAnalyzer2_GetTypographicFeatures(analyzer2, fontface, sa, L"cadabra", 0, &count, NULL);
|
||||
todo_wine {
|
||||
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr);
|
||||
ok(count > 0, "got %u\n", count);
|
||||
|
@ -1863,7 +1860,7 @@ todo_wine {
|
|||
ret = has_feature(tags, count, DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING);
|
||||
ok(ret, "expected 'mkmk' feature\n");
|
||||
}
|
||||
get_script_analysis(abcW, &sa);
|
||||
get_script_analysis(L"abc", &sa);
|
||||
memset(tags, 0, sizeof(tags));
|
||||
count = 0;
|
||||
hr = IDWriteTextAnalyzer2_GetTypographicFeatures(analyzer2, fontface, sa, NULL, ARRAY_SIZE(tags), &count, tags);
|
||||
|
@ -1900,7 +1897,7 @@ static void test_GetGlyphPlacements(void)
|
|||
hr = IDWriteFactory_CreateTextAnalyzer(factory, &analyzer);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
path = create_testfontfile(test_fontfile);
|
||||
path = create_testfontfile(L"wine_test_font.ttf");
|
||||
fontface = create_testfontface(path);
|
||||
|
||||
get_script_analysis(aW, &sa);
|
||||
|
@ -2543,7 +2540,6 @@ static inline BOOL float_eq(FLOAT left, FLOAT right)
|
|||
|
||||
static void test_GetGdiCompatibleGlyphPlacements(void)
|
||||
{
|
||||
static const WCHAR strW[] = {'A',0};
|
||||
DWRITE_SHAPING_GLYPH_PROPERTIES glyphprops[1];
|
||||
DWRITE_SHAPING_TEXT_PROPERTIES textprops[1];
|
||||
DWRITE_SCRIPT_ANALYSIS sa = { 0 };
|
||||
|
@ -2556,7 +2552,7 @@ static void test_GetGdiCompatibleGlyphPlacements(void)
|
|||
FLOAT advance;
|
||||
DWRITE_GLYPH_OFFSET offsets[1];
|
||||
DWRITE_FONT_METRICS fontmetrics;
|
||||
FLOAT emsize;
|
||||
float emsize;
|
||||
|
||||
hr = IDWriteFactory_CreateTextAnalyzer(factory, &analyzer);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -2566,21 +2562,20 @@ static void test_GetGdiCompatibleGlyphPlacements(void)
|
|||
IDWriteFontFace_GetMetrics(fontface, &fontmetrics);
|
||||
|
||||
count = 0;
|
||||
hr = IDWriteTextAnalyzer_GetGlyphs(analyzer, strW, 1, fontface,
|
||||
FALSE, FALSE, &sa, NULL, NULL, NULL, NULL, 0, 1, clustermap,
|
||||
textprops, glyphs, glyphprops, &count);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteTextAnalyzer_GetGlyphs(analyzer, L"A", 1, fontface, FALSE, FALSE, &sa, NULL, NULL, NULL, NULL, 0, 1,
|
||||
clustermap, textprops, glyphs, glyphprops, &count);
|
||||
ok(hr == S_OK, "Failed to get glyphs, hr %#x.\n", hr);
|
||||
ok(count == 1, "got %u\n", count);
|
||||
|
||||
for (emsize = 12.0; emsize <= 20.0; emsize += 1.0) {
|
||||
for (emsize = 12.0f; emsize <= 20.0f; emsize += 1.0f)
|
||||
{
|
||||
FLOAT compatadvance, expected, ppdip;
|
||||
DWRITE_GLYPH_METRICS metrics;
|
||||
|
||||
hr = IDWriteTextAnalyzer_GetGlyphPlacements(analyzer, strW, clustermap,
|
||||
textprops, 1, glyphs, glyphprops, count, fontface, emsize, FALSE, FALSE,
|
||||
&sa, NULL, NULL, NULL, 0, &advance, offsets);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(advance > 0.0, "got %f\n", advance);
|
||||
hr = IDWriteTextAnalyzer_GetGlyphPlacements(analyzer, L"A", clustermap, textprops, 1, glyphs, glyphprops,
|
||||
count, fontface, emsize, FALSE, FALSE, &sa, NULL, NULL, NULL, 0, &advance, offsets);
|
||||
ok(hr == S_OK, "Failed to get glyph placements, hr %#x.\n", hr);
|
||||
ok(advance > 0.0f, "Unexpected advance %f.\n", advance);
|
||||
|
||||
/* 1 ppdip, no transform */
|
||||
ppdip = 1.0;
|
||||
|
@ -2589,24 +2584,24 @@ static void test_GetGdiCompatibleGlyphPlacements(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
expected = floorf(metrics.advanceWidth * emsize * ppdip / fontmetrics.designUnitsPerEm + 0.5f) / ppdip;
|
||||
hr = IDWriteTextAnalyzer_GetGdiCompatibleGlyphPlacements(analyzer, strW,
|
||||
clustermap, textprops, 1, glyphs, glyphprops, count, fontface, emsize,
|
||||
ppdip, NULL, FALSE, FALSE, FALSE, &sa, NULL, NULL, NULL, 0, &compatadvance, offsets);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteTextAnalyzer_GetGdiCompatibleGlyphPlacements(analyzer, L"A", clustermap, textprops, 1, glyphs,
|
||||
glyphprops, count, fontface, emsize, ppdip, NULL, FALSE, FALSE, FALSE, &sa, NULL, NULL, NULL, 0,
|
||||
&compatadvance, offsets);
|
||||
ok(hr == S_OK, "Failed to get glyph placements, hr %#x.\n", hr);
|
||||
ok(compatadvance == expected, "%.0f: got advance %f, expected %f, natural %f\n", emsize,
|
||||
compatadvance, expected, advance);
|
||||
|
||||
/* 1.2 ppdip, no transform */
|
||||
ppdip = 1.2;
|
||||
ppdip = 1.2f;
|
||||
hr = IDWriteFontFace_GetGdiCompatibleGlyphMetrics(fontface, emsize, ppdip, NULL, FALSE,
|
||||
glyphs, 1, &metrics, FALSE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
expected = floorf(metrics.advanceWidth * emsize * ppdip / fontmetrics.designUnitsPerEm + 0.5f) / ppdip;
|
||||
hr = IDWriteTextAnalyzer_GetGdiCompatibleGlyphPlacements(analyzer, strW,
|
||||
clustermap, textprops, 1, glyphs, glyphprops, count, fontface, emsize,
|
||||
ppdip, NULL, FALSE, FALSE, FALSE, &sa, NULL, NULL, NULL, 0, &compatadvance, offsets);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteTextAnalyzer_GetGdiCompatibleGlyphPlacements(analyzer, L"A", clustermap, textprops, 1, glyphs,
|
||||
glyphprops, count, fontface, emsize, ppdip, NULL, FALSE, FALSE, FALSE, &sa, NULL, NULL, NULL, 0,
|
||||
&compatadvance, offsets);
|
||||
ok(hr == S_OK, "Failed to get glyph placements, hr %#x.\n", hr);
|
||||
ok(float_eq(compatadvance, expected), "%.0f: got advance %f, expected %f, natural %f\n", emsize,
|
||||
compatadvance, expected, advance);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Font related tests
|
||||
*
|
||||
* Copyright 2012, 2014-2019 Nikolay Sivov for CodeWeavers
|
||||
* Copyright 2012, 2014-2020 Nikolay Sivov for CodeWeavers
|
||||
* Copyright 2014 Aric Stewart for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -125,12 +125,6 @@ static void _expect_ref_broken(IUnknown* obj, ULONG ref, ULONG brokenref, int li
|
|||
static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, void *);
|
||||
|
||||
static const WCHAR test_fontfile[] = {'w','i','n','e','_','t','e','s','t','_','f','o','n','t','.','t','t','f',0};
|
||||
static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
|
||||
static const WCHAR arialW[] = {'A','r','i','a','l',0};
|
||||
static const WCHAR tahomaUppercaseW[] = {'T','A','H','O','M','A',0};
|
||||
static const WCHAR tahomaStrangecaseW[] = {'t','A','h','O','m','A',0};
|
||||
static const WCHAR blahW[] = {'B','l','a','h','!',0};
|
||||
static const WCHAR emojiW[] = {'S','e','g','o','e',' ','U','I',' ','E','m','o','j','i',0};
|
||||
|
||||
/* PANOSE is 10 bytes in size, need to pack the structure properly */
|
||||
#include "pshpack2.h"
|
||||
|
@ -475,7 +469,6 @@ static IDWriteFactory *create_factory(void)
|
|||
|
||||
static IDWriteFontFace *create_fontface(IDWriteFactory *factory)
|
||||
{
|
||||
static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
|
||||
IDWriteGdiInterop *interop;
|
||||
IDWriteFontFace *fontface;
|
||||
IDWriteFont *font;
|
||||
|
@ -490,7 +483,7 @@ static IDWriteFontFace *create_fontface(IDWriteFactory *factory)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -537,7 +530,7 @@ not_found:
|
|||
|
||||
static IDWriteFont *get_tahoma_instance(IDWriteFactory *factory, DWRITE_FONT_STYLE style)
|
||||
{
|
||||
IDWriteFont *font = get_font(factory, tahomaW, style);
|
||||
IDWriteFont *font = get_font(factory, L"Tahoma", style);
|
||||
ok(font != NULL, "failed to get Tahoma\n");
|
||||
return font;
|
||||
}
|
||||
|
@ -576,9 +569,8 @@ static void _delete_testfontfile(const WCHAR *filename, int line)
|
|||
|
||||
static void get_combined_font_name(const WCHAR *familyW, const WCHAR *faceW, WCHAR *nameW)
|
||||
{
|
||||
static const WCHAR spaceW[] = {' ', 0};
|
||||
lstrcpyW(nameW, familyW);
|
||||
lstrcatW(nameW, spaceW);
|
||||
lstrcatW(nameW, L" ");
|
||||
lstrcatW(nameW, faceW);
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1006,6 @@ static ID2D1SimplifiedGeometrySink test_geomsink2 = { &test_geometrysink2_vtbl }
|
|||
|
||||
static void test_CreateFontFromLOGFONT(void)
|
||||
{
|
||||
static const WCHAR tahomaspW[] = {'T','a','h','o','m','a',' ',0};
|
||||
IDWriteGdiInterop1 *interop1;
|
||||
IDWriteGdiInterop *interop;
|
||||
DWRITE_FONT_WEIGHT weight;
|
||||
|
@ -1066,7 +1057,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
@ -1111,7 +1102,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = weights[i][0];
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
@ -1128,7 +1119,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = 550;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
font = NULL;
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
|
@ -1145,7 +1136,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
lstrcpyW(logfont.lfFaceName, blahW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Blah!");
|
||||
|
||||
font = (void*)0xdeadbeef;
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
|
@ -1157,7 +1148,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaspW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma ");
|
||||
|
||||
font = (void*)0xdeadbeef;
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
|
@ -1183,7 +1174,7 @@ static void test_CreateFontFromLOGFONT(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop1_CreateFontFromLOGFONT(interop1, &logfont, NULL, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -1552,7 +1543,7 @@ static void test_GetFontFamily(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -1700,7 +1691,7 @@ static void test_GetFamilyNames(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
@ -1825,7 +1816,7 @@ static void test_CreateFontFace(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
font = NULL;
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
|
@ -2137,13 +2128,12 @@ static void check_font_metrics(const WCHAR *nameW, IDWriteFontFace *fontface, co
|
|||
|
||||
static void get_enus_string(IDWriteLocalizedStrings *strings, WCHAR *buff, UINT32 size)
|
||||
{
|
||||
static const WCHAR enusW[] = {'e','n','-','u','s',0};
|
||||
BOOL exists = FALSE;
|
||||
UINT32 index;
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, enusW, &index, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, L"en-us", &index, &exists);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(exists, "got %d\n", exists);
|
||||
|
||||
hr = IDWriteLocalizedStrings_GetString(strings, index, buff, size);
|
||||
|
@ -2179,7 +2169,7 @@ static void test_GetMetrics(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -2448,22 +2438,22 @@ static void test_system_fontcollection(void)
|
|||
|
||||
ret = FALSE;
|
||||
i = (UINT32)-1;
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, tahomaW, &i, &ret);
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, L"Tahoma", &i, &ret);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(ret, "got %d\n", ret);
|
||||
ok(i != (UINT32)-1, "got %u\n", i);
|
||||
|
||||
ret = FALSE;
|
||||
i = (UINT32)-1;
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, tahomaUppercaseW, &i, &ret);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, L"TAHOMA", &i, &ret);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(ret, "got %d\n", ret);
|
||||
ok(i != (UINT32)-1, "got %u\n", i);
|
||||
|
||||
ret = FALSE;
|
||||
i = (UINT32)-1;
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, tahomaStrangecaseW, &i, &ret);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, L"tAhOmA", &i, &ret);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(ret, "got %d\n", ret);
|
||||
ok(i != (UINT32)-1, "got %u\n", i);
|
||||
|
||||
|
@ -2517,8 +2507,8 @@ static void test_system_fontcollection(void)
|
|||
|
||||
ret = TRUE;
|
||||
i = 0;
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, blahW, &i, &ret);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFontCollection_FindFamilyName(collection, L"Blah!", &i, &ret);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
ok(i == (UINT32)-1, "got %u\n", i);
|
||||
|
||||
|
@ -2712,9 +2702,10 @@ static void get_logfont_from_font(IDWriteFont *font, LOGFONTW *logfont)
|
|||
exists = FALSE;
|
||||
logfont->lfFaceName[0] = 0;
|
||||
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &names, &exists);
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (exists) {
|
||||
static const WCHAR enusW[] = {'e','n','-','u','s',0};
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (exists)
|
||||
{
|
||||
WCHAR localeW[LOCALE_NAME_MAX_LENGTH];
|
||||
WCHAR nameW[256];
|
||||
UINT32 index;
|
||||
|
@ -2725,7 +2716,7 @@ static void get_logfont_from_font(IDWriteFont *font, LOGFONTW *logfont)
|
|||
IDWriteLocalizedStrings_FindLocaleName(names, localeW, &index, &exists);
|
||||
|
||||
if (!exists)
|
||||
IDWriteLocalizedStrings_FindLocaleName(names, enusW, &index, &exists);
|
||||
IDWriteLocalizedStrings_FindLocaleName(names, L"en-us", &index, &exists);
|
||||
|
||||
if (exists) {
|
||||
nameW[0] = 0;
|
||||
|
@ -2968,7 +2959,6 @@ static IDWriteFontCollectionLoader *create_collection_loader(void)
|
|||
|
||||
static void test_CustomFontCollection(void)
|
||||
{
|
||||
static const WCHAR fontnameW[] = {'w','i','n','e','_','t','e','s','t',0};
|
||||
IDWriteFontCollectionLoader *loader, *loader2, *loader3;
|
||||
IDWriteFontCollection *font_collection = NULL;
|
||||
static IDWriteFontFileLoader rloader = { &resourcefontfileloadervtbl };
|
||||
|
@ -3048,7 +3038,7 @@ todo_wine
|
|||
|
||||
index = 1;
|
||||
exists = FALSE;
|
||||
hr = IDWriteFontCollection_FindFamilyName(font_collection, fontnameW, &index, &exists);
|
||||
hr = IDWriteFontCollection_FindFamilyName(font_collection, L"wine_test", &index, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(index == 0, "got index %i\n", index);
|
||||
ok(exists, "got exists %i\n", exists);
|
||||
|
@ -4173,7 +4163,7 @@ static void test_GetGdiInterop(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop2, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -4269,7 +4259,7 @@ static void test_CreateFontFaceFromHdc(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hfont = CreateFontIndirectW(&logfont);
|
||||
hdc = CreateCompatibleDC(0);
|
||||
|
@ -4447,7 +4437,7 @@ static void test_GetSimulations(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -4466,7 +4456,7 @@ static void test_GetSimulations(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 0;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -4487,9 +4477,6 @@ static void test_GetSimulations(void)
|
|||
|
||||
static void test_GetFaceNames(void)
|
||||
{
|
||||
static const WCHAR obliqueW[] = {'O','b','l','i','q','u','e',0};
|
||||
static const WCHAR enus2W[] = {'e','n','-','U','s',0};
|
||||
static const WCHAR enusW[] = {'e','n','-','u','s',0};
|
||||
IDWriteLocalizedStrings *strings, *strings2, *strings3;
|
||||
IDWriteFontFace3 *fontface3;
|
||||
IDWriteGdiInterop *interop;
|
||||
|
@ -4513,7 +4500,7 @@ static void test_GetFaceNames(void)
|
|||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -4531,8 +4518,8 @@ static void test_GetFaceNames(void)
|
|||
|
||||
index = 1;
|
||||
exists = FALSE;
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, enus2W, &index, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, L"en-Us", &index, &exists);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(index == 0 && exists, "got %d, %d\n", index, exists);
|
||||
|
||||
count = 0;
|
||||
|
@ -4544,12 +4531,12 @@ static void test_GetFaceNames(void)
|
|||
buffW[0] = 0;
|
||||
hr = IDWriteLocalizedStrings_GetLocaleName(strings, 0, buffW, ARRAY_SIZE(buffW));
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(!lstrcmpW(buffW, enusW), "got %s\n", wine_dbgstr_w(buffW));
|
||||
ok(!lstrcmpW(buffW, L"en-us"), "Unexpected locale name %s.\n", wine_dbgstr_w(buffW));
|
||||
|
||||
buffW[0] = 0;
|
||||
hr = IDWriteLocalizedStrings_GetString(strings, 0, buffW, ARRAY_SIZE(buffW));
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(!lstrcmpW(buffW, obliqueW), "got %s\n", wine_dbgstr_w(buffW));
|
||||
ok(!lstrcmpW(buffW, L"Oblique"), "got %s\n", wine_dbgstr_w(buffW));
|
||||
IDWriteLocalizedStrings_Release(strings);
|
||||
|
||||
hr = IDWriteFont_CreateFontFace(font, &fontface);
|
||||
|
@ -4568,7 +4555,7 @@ static void test_GetFaceNames(void)
|
|||
buffW[0] = 0;
|
||||
hr = IDWriteLocalizedStrings_GetString(strings2, 0, buffW, ARRAY_SIZE(buffW));
|
||||
ok(hr == S_OK, "Failed to get a string, hr %#x.\n", hr);
|
||||
ok(!lstrcmpW(buffW, obliqueW), "Unexpected name %s.\n", wine_dbgstr_w(buffW));
|
||||
ok(!lstrcmpW(buffW, L"Oblique"), "Unexpected name %s.\n", wine_dbgstr_w(buffW));
|
||||
IDWriteLocalizedStrings_Release(strings2);
|
||||
|
||||
IDWriteFontFace3_Release(fontface3);
|
||||
|
@ -4741,8 +4728,8 @@ if (0) { /* crashes on native */
|
|||
|
||||
font_count = IDWriteFontFamily_GetFontCount(family);
|
||||
|
||||
for (j = 0; j < font_count; j++) {
|
||||
static const WCHAR spaceW[] = {' ', 0};
|
||||
for (j = 0; j < font_count; ++j)
|
||||
{
|
||||
IDWriteFontFace *fontface;
|
||||
BOOL has_variations;
|
||||
|
||||
|
@ -4756,7 +4743,7 @@ if (0) { /* crashes on native */
|
|||
IDWriteLocalizedStrings_Release(names);
|
||||
|
||||
lstrcpyW(nameW, familynameW);
|
||||
lstrcatW(nameW, spaceW);
|
||||
lstrcatW(nameW, L" ");
|
||||
lstrcatW(nameW, facenameW);
|
||||
|
||||
hr = IDWriteFont_CreateFontFace(font, &fontface);
|
||||
|
@ -6388,14 +6375,14 @@ static void test_GetGdiCompatibleMetrics(void)
|
|||
|
||||
factory = create_factory();
|
||||
|
||||
font = get_font(factory, tahomaW, DWRITE_FONT_STYLE_NORMAL);
|
||||
font = get_font(factory, L"Tahoma", DWRITE_FONT_STYLE_NORMAL);
|
||||
hr = IDWriteFont_CreateFontFace(font, &fontface);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
IDWriteFont_Release(font);
|
||||
test_gdicompat_metrics(fontface);
|
||||
IDWriteFontFace_Release(fontface);
|
||||
|
||||
font = get_font(factory, arialW, DWRITE_FONT_STYLE_NORMAL);
|
||||
font = get_font(factory, L"Arial", DWRITE_FONT_STYLE_NORMAL);
|
||||
if (!font)
|
||||
skip("Skipping tests with Arial\n");
|
||||
else
|
||||
|
@ -6546,7 +6533,7 @@ static INT32 get_gdi_font_advance(HDC hdc, FLOAT emsize)
|
|||
logfont.lfHeight = (LONG)-emsize;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfQuality = CLEARTYPE_QUALITY;
|
||||
lstrcpyW(logfont.lfFaceName, tahomaW);
|
||||
lstrcpyW(logfont.lfFaceName, L"Tahoma");
|
||||
|
||||
hfont = CreateFontIndirectW(&logfont);
|
||||
SelectObject(hdc, hfont);
|
||||
|
@ -7507,7 +7494,7 @@ static void test_GetPaletteEntries(void)
|
|||
IDWriteFontFace2_Release(fontface2);
|
||||
|
||||
/* Segoe UI Emoji, with color support */
|
||||
font = get_font(factory, emojiW, DWRITE_FONT_STYLE_NORMAL);
|
||||
font = get_font(factory, L"Segoe UI Emoji", DWRITE_FONT_STYLE_NORMAL);
|
||||
if (!font) {
|
||||
ref = IDWriteFactory_Release(factory);
|
||||
ok(ref == 0, "factory not released, %u\n", ref);
|
||||
|
@ -7615,7 +7602,7 @@ static void test_TranslateColorGlyphRun(void)
|
|||
IDWriteFontFace_Release(fontface);
|
||||
|
||||
/* Segoe UI Emoji, with color support */
|
||||
font = get_font((IDWriteFactory *)factory, emojiW, DWRITE_FONT_STYLE_NORMAL);
|
||||
font = get_font((IDWriteFactory *)factory, L"Segoe UI Emoji", DWRITE_FONT_STYLE_NORMAL);
|
||||
if (!font) {
|
||||
IDWriteFactory2_Release(factory);
|
||||
skip("Segoe UI Emoji font not found.\n");
|
||||
|
@ -9417,8 +9404,8 @@ todo_wine
|
|||
ok(ref2 != ref, "Unexpected reference.\n");
|
||||
IDWriteFontFaceReference_Release(ref2);
|
||||
|
||||
for (id = DWRITE_FONT_PROPERTY_ID_FAMILY_NAME; id < DWRITE_FONT_PROPERTY_ID_TOTAL; id++) {
|
||||
static const WCHAR fmtW[] = {'%','u',0};
|
||||
for (id = DWRITE_FONT_PROPERTY_ID_FAMILY_NAME; id < DWRITE_FONT_PROPERTY_ID_TOTAL; ++id)
|
||||
{
|
||||
IDWriteLocalizedStrings *values;
|
||||
WCHAR buffW[255], buff2W[255];
|
||||
UINT32 c, ivalue = 0;
|
||||
|
@ -9462,7 +9449,7 @@ todo_wine
|
|||
hr = IDWriteLocalizedStrings_GetString(values, 0, buff2W, ARRAY_SIZE(buff2W));
|
||||
ok(hr == S_OK, "Failed to get property string, hr %#x.\n", hr);
|
||||
|
||||
wsprintfW(buffW, fmtW, ivalue);
|
||||
wsprintfW(buffW, L"%u", ivalue);
|
||||
ok(!lstrcmpW(buffW, buff2W), "Unexpected property value %s, expected %s.\n", wine_dbgstr_w(buff2W),
|
||||
wine_dbgstr_w(buffW));
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue