Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
February 2020
- 80 participants
- 745 discussions
[PATCH 1/3] ole32: Fix CoGetApartmentType() return value for implicit MTA case.
by Nikolay Sivov 14 Feb '20
by Nikolay Sivov 14 Feb '20
14 Feb '20
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/ole32/compobj.c | 1 +
dlls/ole32/tests/compobj.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index aeed3b85fa..bd28f42b33 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -5264,6 +5264,7 @@ HRESULT WINAPI CoGetApartmentType(APTTYPE *type, APTTYPEQUALIFIER *qualifier)
apartment_release(apt);
*type = APTTYPE_MTA;
*qualifier = APTTYPEQUALIFIER_IMPLICIT_MTA;
+ return S_OK;
}
return info->apt ? S_OK : CO_E_NOTINITIALIZED;
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 7eb25af9e6..624120890d 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -648,7 +648,8 @@ static void _test_apt_type(APTTYPE expected_type, APTTYPEQUALIFIER expected_qual
return;
hr = pCoGetApartmentType(&type, &qualifier);
- ok_(__FILE__, line)(hr == S_OK || hr == CO_E_NOTINITIALIZED, "Unexpected return code: 0x%08x\n", hr);
+ ok_(__FILE__, line)(hr == S_OK || (type == APTTYPE_CURRENT && hr == CO_E_NOTINITIALIZED),
+ "Unexpected hr %#x.\n", hr);
ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
expected_qualifier);
--
2.25.0
3
6
The buffer size was previously limited to 20 in:
8d052561724f9c8d9e7770964bfaebdd01e98e60
Testing shows that it is somewhere around 1024 on Windows, and using a
smaller buffer causes some input data to be lost with high polling rate
mouses. It can be spotted in Wolfenstein II: New Colossus menus.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/dinput/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index d18292192a5..bcb893e6324 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1400,7 +1400,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
EnterCriticalSection(&This->crit);
This->buffersize = pd->dwData;
- This->queue_len = min(This->buffersize, 20);
+ This->queue_len = min(This->buffersize, 1024);
HeapFree(GetProcessHeap(), 0, This->data_queue);
This->data_queue = !This->queue_len ? NULL : HeapAlloc(GetProcessHeap(), 0,
--
2.25.0
2
1
[PATCH] user32/caret.c: Avoid SetSystemTimer / KillSystemTimer with null hwnd.
by Robert Schlicht 14 Feb '20
by Robert Schlicht 14 Feb '20
14 Feb '20
Check that hwnd is not null before calling SetSystemTimer or
KillSystemTimer in functions ShowCaret, HideCaret and SetCaretPos.
Reason:
If there is no caret window, the call in ShowCaret,
SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
will create (and leak) a timer since TIMERID is not used if hwnd is
null. Similar issues affect the other functions.
Illustration:
Depending on your system (Alt+Tab or Alt+Esc switching between
applications), this is seen even in standard applications:
(1) Start Notepad.exe.
(2) Hold down Alt (do not release).
(3) Rick-click to open the context menu.
(4) Switch to another application without first returning the focus to
the edit field by pressing Tab or Esc. (The context menu should
remain open.)
(5) Close the context menu while Notepad is not active.
Now SetSystemTimer has been called with a null hwnd (via ShowCaret(0)
in MENU_ExitTracking() in menu.c) and a timer has been leaked. When
you switch back to Notepad, the caret flashes more frequently /
irregularly. The patch fixes this.
Signed-off-by: Robert Schlicht <patch(a)rschlicht.eu>
---
dlls/user32/caret.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c
index 686dade410..edcbc3cd6b 100644
--- a/dlls/user32/caret.c
+++ b/dlls/user32/caret.c
@@ -269,7 +269,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
}
}
SERVER_END_REQ;
- if (ret && !hidden && (x != r.left || y != r.top))
+ if (ret && hwnd && !hidden && (x != r.left || y != r.top))
{
if (old_state) CARET_DisplayCaret( hwnd, &r );
r.right += x - r.left;
@@ -314,7 +314,7 @@ BOOL WINAPI HideCaret( HWND hwnd )
}
SERVER_END_REQ;
- if (ret && !hidden)
+ if (ret && hwnd && !hidden)
{
if (old_state) CARET_DisplayCaret( hwnd, &r );
KillSystemTimer( hwnd, TIMERID );
@@ -352,7 +352,7 @@ BOOL WINAPI ShowCaret( HWND hwnd )
}
SERVER_END_REQ;
- if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */
+ if (ret && hwnd && (hidden == 1)) /* hidden was 1 so it's now 0 */
{
CARET_DisplayCaret( hwnd, &r );
SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
--
2.17.1
2
1
14 Feb '20
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/dwrite/tests/analyzer.c | 99 +++--
dlls/dwrite/tests/font.c | 113 +++---
dlls/dwrite/tests/layout.c | 736 +++++++++++++++++------------------
3 files changed, 449 insertions(+), 499 deletions(-)
diff --git a/dlls/dwrite/tests/analyzer.c b/dlls/dwrite/tests/analyzer.c
index 99b415a3fb..38d6a68ef8 100644
--- a/dlls/dwrite/tests/analyzer.c
+++ b/dlls/dwrite/tests/analyzer.c
@@ -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);
}
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 38a7b4f3f8..7c48a57eab 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -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;
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 48b2880079..d19f91311d 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -1,7 +1,7 @@
/*
* Text layout/format tests
*
- * Copyright 2012, 2014-2017 Nikolay Sivov for CodeWeavers
+ * Copyright 2012, 2014-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
@@ -29,9 +29,6 @@
#include "wine/test.h"
-static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
-static const WCHAR enusW[] = {'e','n','-','u','s',0};
-
struct testanalysissink
{
IDWriteTextAnalysisSink IDWriteTextAnalysisSink_iface;
@@ -900,7 +897,6 @@ static IUnknown *create_test_effect(void)
static void test_CreateTextLayout(void)
{
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
IDWriteTextLayout4 *layout4;
IDWriteTextLayout2 *layout2 = NULL;
IDWriteTextLayout *layout;
@@ -917,41 +913,41 @@ static void test_CreateTextLayout(void)
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 0.0, 0.0, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, NULL, 0.0f, 0.0f, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 1.0, 0.0, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, NULL, 1.0f, 0.0f, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 0.0, 1.0, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, NULL, 0.0f, 1.0f, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 1000.0, 1000.0, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, NULL, 1000.0f, 1000.0f, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
layout = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateTextLayout(factory, NULL, 0, format, 100.0f, 100.0f, &layout);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(layout == NULL, "got %p\n", layout);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 0, format, 0.0f, 0.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 0, format, 0.0f, 0.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
EXPECT_REF(format, 1);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
EXPECT_REF(format, 1);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
@@ -1025,7 +1021,6 @@ static DWRITE_MATRIX layoutcreate_transforms[] = {
static void test_CreateGdiCompatibleTextLayout(void)
{
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
IDWriteTextLayout *layout;
IDWriteTextFormat *format;
IDWriteFactory *factory;
@@ -1041,29 +1036,33 @@ static void test_CreateGdiCompatibleTextLayout(void)
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 0.0, 0.0, 0.0, NULL, FALSE, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, NULL, 0.0f, 0.0f, 0.0f, NULL,
+ FALSE, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1.0, 0.0, 0.0, NULL, FALSE, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, NULL, 1.0f, 0.0f, 0.0f, NULL,
+ FALSE, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1.0, 0.0, 1.0, NULL, FALSE, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, NULL, 1.0f, 0.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
layout = (void*)0xdeadbeef;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1000.0, 1000.0, 1.0, NULL, FALSE, &layout);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, NULL, 1000.0f, 1000.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(layout == NULL, "got %p\n", layout);
/* create with text format */
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
EXPECT_REF(format, 1);
layout = (void*)0xdeadbeef;
@@ -1071,8 +1070,9 @@ static void test_CreateGdiCompatibleTextLayout(void)
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(layout == NULL, "got %p\n", layout);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
EXPECT_REF(format, 1);
EXPECT_REF(layout, 1);
@@ -1083,8 +1083,9 @@ static void test_CreateGdiCompatibleTextLayout(void)
IDWriteTextLayout_Release(layout);
/* zero length string is okay */
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 0, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 0, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
dimension = IDWriteTextLayout_GetMaxWidth(layout);
ok(dimension == 100.0, "got %f\n", dimension);
@@ -1095,19 +1096,22 @@ static void test_CreateGdiCompatibleTextLayout(void)
IDWriteTextLayout_Release(layout);
/* negative, zero ppdip */
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 1, format, 100.0, 100.0, -1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 1, format, 100.0f, 100.0f, -1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 1, format, 100.0, 100.0, 0.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 1, format, 100.0f, 100.0f, 0.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
/* transforms */
- for (i = 0; i < ARRAY_SIZE(layoutcreate_transforms); i++) {
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 1, format, 100.0, 100.0, 1.0,
- &layoutcreate_transforms[i], FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ for (i = 0; i < ARRAY_SIZE(layoutcreate_transforms); ++i)
+ {
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 1, format, 100.0f, 100.0f, 1.0f,
+ &layoutcreate_transforms[i], FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
}
@@ -1117,7 +1121,6 @@ static void test_CreateGdiCompatibleTextLayout(void)
static void test_CreateTextFormat(void)
{
- static const WCHAR emptyW[] = {0};
IDWriteFontCollection *collection, *syscoll;
DWRITE_PARAGRAPH_ALIGNMENT paralign;
DWRITE_READING_DIRECTION readdir;
@@ -1135,36 +1138,36 @@ static void test_CreateTextFormat(void)
factory = create_factory();
/* zero/negative font size */
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 0.0f, enusW, &format);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 0.0f, L"en-us", &format);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, -10.0f, enusW, &format);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, -10.0f, L"en-us", &format);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
/* invalid font properties */
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 1000, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, 1000, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_ITALIC + 1,
- DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL,
+ DWRITE_FONT_STYLE_ITALIC + 1, DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_ITALIC,
- 10, 10.0f, enusW, &format);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_ITALIC,
+ 10, 10.0f, L"en-us", &format);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
/* empty family name */
- hr = IDWriteFactory_CreateTextFormat(factory, emptyW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
IDWriteTextFormat_Release(format);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
if (0) /* crashes on native */
hr = IDWriteTextFormat_GetFontCollection(format, NULL);
@@ -1255,10 +1258,8 @@ static void test_CreateTextFormat(void)
static void test_GetLocaleName(void)
{
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
- static const WCHAR ruW[] = {'r','u',0};
- IDWriteTextLayout *layout;
IDWriteTextFormat *format, *format2;
+ IDWriteTextLayout *layout;
IDWriteFactory *factory;
WCHAR buff[10];
UINT32 len;
@@ -1266,12 +1267,13 @@ static void test_GetLocaleName(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"ru", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 0, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 0, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextFormat, (void**)&format2);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1284,12 +1286,12 @@ static void test_GetLocaleName(void)
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr);
hr = IDWriteTextFormat_GetLocaleName(format2, buff, len+1);
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(buff, ruW), "got %s\n", wine_dbgstr_w(buff));
+ ok(!lstrcmpW(buff, L"ru"), "Unexpected locale name %s.\n", wine_dbgstr_w(buff));
hr = IDWriteTextFormat_GetLocaleName(format, buff, len);
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr);
hr = IDWriteTextFormat_GetLocaleName(format, buff, len+1);
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(buff, ruW), "got %s\n", wine_dbgstr_w(buff));
+ ok(!lstrcmpW(buff, L"ru"), "Unexpected locale name %s.\n", wine_dbgstr_w(buff));
IDWriteTextLayout_Release(layout);
IDWriteTextFormat_Release(format);
@@ -1304,7 +1306,6 @@ static const struct drawcall_entry drawellipsis_seq[] = {
static void test_CreateEllipsisTrimmingSign(void)
{
- static const WCHAR engbW[] = {'e','n','-','G','B',0};
DWRITE_INLINE_OBJECT_METRICS metrics;
DWRITE_BREAK_CONDITION before, after;
struct renderer_context ctxt;
@@ -1316,9 +1317,9 @@ static void test_CreateEllipsisTrimmingSign(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, engbW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-GB", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
EXPECT_REF(format, 1);
hr = IDWriteFactory_CreateEllipsisTrimmingSign(factory, format, &sign);
@@ -1409,8 +1410,6 @@ if (0) {/* crashes on native */
static void test_fontweight(void)
{
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
- static const WCHAR ruW[] = {'r','u',0};
IDWriteTextFormat *format, *fmt2;
IDWriteTextLayout *layout;
DWRITE_FONT_WEIGHT weight;
@@ -1421,12 +1420,13 @@ static void test_fontweight(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0, L"ru", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextFormat, (void**)&fmt2);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1515,24 +1515,22 @@ static void test_fontweight(void)
static void test_SetInlineObject(void)
{
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
- static const WCHAR ruW[] = {'r','u',0};
-
IDWriteInlineObject *inlineobj, *inlineobj2, *inlinetest;
+ DWRITE_TEXT_RANGE range, r2;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
- DWRITE_TEXT_RANGE range, r2;
IDWriteFactory *factory;
HRESULT hr;
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"ru", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteFactory_CreateEllipsisTrimmingSign(factory, format, &inlineobj);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1718,9 +1716,7 @@ static void test_Draw(void)
{
static const WCHAR str3W[] = {'1','2','3','-','5','2',0x64a,0x64f,0x633,0x627,0x648,0x650,
0x64a,'7','1','.',0};
- static const WCHAR strW[] = {'s','t','r','i','n','g',0};
static const WCHAR str2W[] = {0x202a,0x202c,'a','b',0};
- static const WCHAR ruW[] = {'r','u',0};
IDWriteInlineObject *inlineobj;
struct renderer_context ctxt;
IDWriteTextFormat *format;
@@ -1736,12 +1732,12 @@ static void test_Draw(void)
memset(&ctxt, 0, sizeof(ctxt));
ctxt.snapping_disabled = TRUE;
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"ru", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, format, 100.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteFactory_CreateEllipsisTrimmingSign(factory, format, &inlineobj);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1773,8 +1769,8 @@ static void test_Draw(void)
IDWriteTextLayout_Release(layout);
/* with reduced width DrawGlyphRun() is called for every line */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, format, 5.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, format, 5.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1796,8 +1792,8 @@ todo_wine
/* strikethrough splits ranges from renderer point of view, but doesn't break
shaping */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
range.startPosition = 0;
@@ -1810,9 +1806,9 @@ todo_wine
ok_sequence(sequences, RENDERER_ID, draw_seq4, "draw test 4", FALSE);
IDWriteTextLayout_Release(layout);
- /* strikethrough somewhere in the middle */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ /* Strike through somewhere in the middle */
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 6, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
range.startPosition = 2;
@@ -1826,8 +1822,8 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* empty string */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 0, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"string", 0, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
@@ -1839,8 +1835,9 @@ todo_wine
ctxt.use_gdi_natural = TRUE;
/* different parameter combinations with gdi-compatible layout */
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, TRUE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, NULL,
+ TRUE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1868,8 +1865,9 @@ todo_wine
ctxt.gdicompat = TRUE;
ctxt.use_gdi_natural = FALSE;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1881,8 +1879,9 @@ todo_wine
m.m11 = m.m22 = 2.0;
m.m12 = m.m21 = m.dx = m.dy = 0.0;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, &m, TRUE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, &m,
+ TRUE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1894,8 +1893,9 @@ todo_wine
m.m11 = m.m22 = 2.0;
m.m12 = m.m21 = m.dx = m.dy = 0.0;
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, &m, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"string", 6, format, 100.0f, 100.0f, 1.0f, &m,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -2001,9 +2001,6 @@ static void test_GetClusterMetrics(void)
'g',0x0085,'h',0x2028,'i',0x2029,0xad,0xa,0};
static const WCHAR str3W[] = {0x2066,')',')',0x661,'(',0x627,')',0};
static const WCHAR str2W[] = {0x202a,0x202c,'a',0};
- static const WCHAR strW[] = {'a','b','c','d',0};
- static const WCHAR str4W[] = {'a',' ',0};
- static const WCHAR str6W[] = {'a',' ','b',0};
DWRITE_INLINE_OBJECT_METRICS inline_metrics;
DWRITE_CLUSTER_METRICS metrics[22];
DWRITE_TEXT_METRICS text_metrics;
@@ -2021,9 +2018,9 @@ static void test_GetClusterMetrics(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, str3W, 7, format, 1000.0, 1000.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -2032,8 +2029,8 @@ static void test_GetClusterMetrics(void)
ok(count == 7, "got %u\n", count);
IDWriteTextLayout_Release(layout);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
hr = IDWriteTextLayout_GetClusterMetrics(layout, NULL, 0, &count);
@@ -2170,8 +2167,8 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* single inline object that fails to report its metrics */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
range.startPosition = 0;
range.length = 4;
@@ -2224,8 +2221,8 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* zero length string */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 0, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 0, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 1;
memset(metrics, 0, sizeof(metrics));
@@ -2234,9 +2231,9 @@ todo_wine
ok(count == 0, "got %u\n", count);
IDWriteTextLayout_Release(layout);
- /* whitespace */
- hr = IDWriteFactory_CreateTextLayout(factory, str4W, 2, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ /* Whitespace */
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a ", 2, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
memset(metrics, 0, sizeof(metrics));
@@ -2249,9 +2246,9 @@ todo_wine
ok(metrics[1].canWrapLineAfter == 1, "got %d\n", metrics[1].canWrapLineAfter);
IDWriteTextLayout_Release(layout);
- /* layout is fully covered by inline object with after condition DWRITE_BREAK_CONDITION_MAY_NOT_BREAK */
- hr = IDWriteFactory_CreateTextLayout(factory, str4W, 2, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ /* Layout is fully covered by inline object with after condition DWRITE_BREAK_CONDITION_MAY_NOT_BREAK. */
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a ", 2, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
range.startPosition = 0;
range.length = ~0u;
@@ -2268,8 +2265,8 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* compare natural cluster width with gdi layout */
- hr = IDWriteFactory_CreateTextLayout(factory, str4W, 1, format, 100.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a ", 1, format, 100.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
memset(metrics, 0, sizeof(metrics));
@@ -2280,8 +2277,9 @@ todo_wine
IDWriteTextLayout_Release(layout);
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, str4W, 1, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"a ", 1, format, 100.0f, 100.0f, 1.0f, NULL,
+ FALSE, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
memset(metrics, 0, sizeof(metrics));
@@ -2360,9 +2358,9 @@ todo_wine
IDWriteTextLayout_Release(layout);
- /* trigger line trimming */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, lstrlenW(strW), format, 100.0f, 200.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ /* Trigger line trimming. */
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 100.0f, 200.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
memset(metrics, 0, sizeof(metrics));
@@ -2404,8 +2402,8 @@ todo_wine
hr = IDWriteTextFormat_SetWordWrapping(format, DWRITE_WORD_WRAPPING_NO_WRAP);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, str6W, lstrlenW(str6W), format, 1000.0f, 200.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a b", 3, format, 1000.0f, 200.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
memset(metrics, 0, sizeof(metrics));
@@ -2420,7 +2418,7 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* Single cluster layout, trigger trimming. */
- hr = IDWriteFactory_CreateTextLayout(factory, str6W, 1, format, 1000.0f, 200.0f, &layout);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a b", 1, format, 1000.0f, 200.0f, &layout);
ok(hr == S_OK, "Failed to create layout, hr %#x.\n", hr);
count = 0;
@@ -2464,9 +2462,7 @@ todo_wine
static void test_SetLocaleName(void)
{
- static const WCHAR eNuSW[] = {'e','N','-','u','S',0};
- static const WCHAR strW[] = {'a','b','c','d',0};
- WCHAR buffW[LOCALE_NAME_MAX_LENGTH + ARRAY_SIZE(strW)];
+ WCHAR buffW[LOCALE_NAME_MAX_LENGTH + 5];
IDWriteTextFormat *format, *format2;
IDWriteTextLayout *layout;
DWRITE_TEXT_RANGE range;
@@ -2476,50 +2472,50 @@ static void test_SetLocaleName(void)
factory = create_factory();
/* create format with mixed case locale name, get it back */
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"eN-uS", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteTextFormat_GetLocaleName(format, 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));
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextFormat, (void**)&format2);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteTextFormat_GetLocaleName(format2, 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));
hr = IDWriteTextLayout_GetLocaleName(layout, 0, buffW, ARRAY_SIZE(buffW), NULL);
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));
IDWriteTextFormat_Release(format2);
IDWriteTextLayout_Release(layout);
IDWriteTextFormat_Release(format);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
range.startPosition = 0;
range.length = 1;
- hr = IDWriteTextLayout_SetLocaleName(layout, enusW, range);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteTextLayout_SetLocaleName(layout, L"en-us", range);
+ ok(hr == S_OK, "Failed to set locale name, hr %#x.\n", hr);
hr = IDWriteTextLayout_SetLocaleName(layout, NULL, range);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
/* invalid locale name is allowed */
- hr = IDWriteTextLayout_SetLocaleName(layout, strW, range);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteTextLayout_SetLocaleName(layout, L"abcd", range);
+ ok(hr == S_OK, "Failed to set locale name, hr %#x.\n", hr);
hr = IDWriteTextLayout_GetLocaleName(layout, 0, NULL, 0, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
@@ -2531,7 +2527,7 @@ static void test_SetLocaleName(void)
range.length = 0;
hr = IDWriteTextLayout_GetLocaleName(layout, 0, buffW, ARRAY_SIZE(buffW), &range);
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(buffW, strW), "got %s\n", wine_dbgstr_w(buffW));
+ ok(!lstrcmpW(buffW, L"abcd"), "Unexpected locale name %s.\n", wine_dbgstr_w(buffW));
ok(range.startPosition == 0 && range.length == 1, "got %u,%u\n", range.startPosition, range.length);
/* get with a shorter buffer */
@@ -2541,9 +2537,9 @@ static void test_SetLocaleName(void)
ok(buffW[0] == 0, "got %x\n", buffW[0]);
/* name is too long */
- lstrcpyW(buffW, strW);
+ lstrcpyW(buffW, L"abcd");
while (lstrlenW(buffW) <= LOCALE_NAME_MAX_LENGTH)
- lstrcatW(buffW, strW);
+ lstrcatW(buffW, L"abcd");
range.startPosition = 0;
range.length = 1;
@@ -2553,19 +2549,19 @@ static void test_SetLocaleName(void)
buffW[0] = 0;
hr = IDWriteTextLayout_GetLocaleName(layout, 0, buffW, ARRAY_SIZE(buffW), NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(buffW, strW), "got %s\n", wine_dbgstr_w(buffW));
+ ok(!lstrcmpW(buffW, L"abcd"), "Unexpected locale name %s.\n", wine_dbgstr_w(buffW));
/* set initial locale name for whole text, except with a different casing */
range.startPosition = 0;
range.length = 4;
- hr = IDWriteTextLayout_SetLocaleName(layout, eNuSW, range);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteTextLayout_SetLocaleName(layout, L"eN-uS", range);
+ ok(hr == S_OK, "Failed to set locale name, hr %#x.\n", hr);
buffW[0] = 0;
range.length = 0;
hr = IDWriteTextLayout_GetLocaleName(layout, 0, buffW, ARRAY_SIZE(buffW), &range);
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));
ok((range.startPosition == 0 && range.length == ~0u) ||
broken(range.startPosition == 0 && range.length == 4) /* vista/win7 */, "got %u,%u\n", range.startPosition, range.length);
@@ -2574,7 +2570,7 @@ static void test_SetLocaleName(void)
range.length = 0;
hr = IDWriteTextLayout_GetLocaleName(layout, 100, buffW, ARRAY_SIZE(buffW), &range);
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));
ok((range.startPosition == 0 && range.length == ~0u) ||
broken(range.startPosition == 4 && range.length == ~0u-4) /* vista/win7 */, "got %u,%u\n", range.startPosition, range.length);
@@ -2598,9 +2594,9 @@ static void test_SetPairKerning(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -2668,7 +2664,6 @@ if (count == 3) {
static void test_SetVerticalGlyphOrientation(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
DWRITE_VERTICAL_GLYPH_ORIENTATION orientation;
IDWriteTextLayout2 *layout2;
IDWriteTextFormat *format;
@@ -2678,12 +2673,12 @@ static void test_SetVerticalGlyphOrientation(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextFormat_Release(format);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
@@ -2716,7 +2711,6 @@ static void test_DetermineMinWidth(void)
{ {'a','\n',' ',' ','b',0}, {'b',0} },
{ {'a','b','c','\n',' ',' ','b',0}, {'a','b','c',0} },
};
- static const WCHAR strW[] = {'a','b','c','d',0};
DWRITE_CLUSTER_METRICS metrics[10];
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -2727,20 +2721,20 @@ static void test_DetermineMinWidth(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, lstrlenW(strW), format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_DetermineMinWidth(layout, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
IDWriteTextLayout_Release(layout);
/* empty string */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 0, format, 100.0f, 100.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 0, format, 100.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
minwidth = 1.0f;
hr = IDWriteTextLayout_DetermineMinWidth(layout, &minwidth);
@@ -2780,7 +2774,6 @@ static void test_DetermineMinWidth(void)
static void test_SetFontSize(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
IDWriteFactory *factory;
@@ -2790,12 +2783,12 @@ static void test_SetFontSize(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
/* negative/zero size */
r.startPosition = 1;
@@ -2872,9 +2865,6 @@ static void test_SetFontSize(void)
static void test_SetFontFamilyName(void)
{
- static const WCHAR taHomaW[] = {'T','a','H','o','m','a',0};
- static const WCHAR arialW[] = {'A','r','i','a','l',0};
- static const WCHAR strW[] = {'a','b','c','d',0};
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
IDWriteFactory *factory;
@@ -2884,12 +2874,12 @@ static void test_SetFontFamilyName(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
/* NULL name */
r.startPosition = 1;
@@ -2907,13 +2897,13 @@ static void test_SetFontFamilyName(void)
/* set name only different in casing */
r.startPosition = 1;
r.length = 1;
- hr = IDWriteTextLayout_SetFontFamilyName(layout, taHomaW, r);
+ hr = IDWriteTextLayout_SetFontFamilyName(layout, L"TaHoma", r);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* zero length range */
r.startPosition = 1;
r.length = 0;
- hr = IDWriteTextLayout_SetFontFamilyName(layout, arialW, r);
+ hr = IDWriteTextLayout_SetFontFamilyName(layout, L"Arial", r);
ok(hr == S_OK, "got 0x%08x\n", hr);
r.startPosition = 0;
@@ -2921,12 +2911,12 @@ static void test_SetFontFamilyName(void)
nameW[0] = 0;
hr = IDWriteTextLayout_GetFontFamilyName(layout, 1, nameW, ARRAY_SIZE(nameW), &r);
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(nameW, taHomaW), "got %s\n", wine_dbgstr_w(nameW));
+ ok(!lstrcmpW(nameW, L"TaHoma"), "Unexpected family name %s.\n", wine_dbgstr_w(nameW));
ok(r.startPosition == 1 && r.length == 1, "got %u, %u\n", r.startPosition, r.length);
r.startPosition = 1;
r.length = 1;
- hr = IDWriteTextLayout_SetFontFamilyName(layout, arialW, r);
+ hr = IDWriteTextLayout_SetFontFamilyName(layout, L"Arial", r);
ok(hr == S_OK, "got 0x%08x\n", hr);
r.startPosition = 1;
@@ -2937,14 +2927,14 @@ static void test_SetFontFamilyName(void)
r.startPosition = 0;
r.length = 4;
- hr = IDWriteTextLayout_SetFontFamilyName(layout, arialW, r);
+ hr = IDWriteTextLayout_SetFontFamilyName(layout, L"Arial", r);
ok(hr == S_OK, "got 0x%08x\n", hr);
nameW[0] = 0;
hr = IDWriteTextLayout_GetFontFamilyName(layout, 1, nameW, ARRAY_SIZE(nameW), &r);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(r.startPosition == 0 && r.length == 4, "got %u, %u\n", r.startPosition, r.length);
- ok(!lstrcmpW(nameW, arialW), "got name %s\n", wine_dbgstr_w(nameW));
+ ok(!lstrcmpW(nameW, L"Arial"), "Unexpected family name %s.\n", wine_dbgstr_w(nameW));
IDWriteTextLayout_Release(layout);
IDWriteTextFormat_Release(format);
@@ -2953,7 +2943,6 @@ static void test_SetFontFamilyName(void)
static void test_SetFontStyle(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
IDWriteFactory *factory;
@@ -2963,12 +2952,12 @@ static void test_SetFontStyle(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
/* invalid style value */
r.startPosition = 1;
@@ -3041,7 +3030,6 @@ static void test_SetFontStyle(void)
static void test_SetFontStretch(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
DWRITE_FONT_STRETCH stretch;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -3051,12 +3039,12 @@ static void test_SetFontStretch(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
/* invalid stretch value */
r.startPosition = 1;
@@ -3136,7 +3124,6 @@ static void test_SetFontStretch(void)
static void test_SetStrikethrough(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
IDWriteFactory *factory;
@@ -3146,12 +3133,12 @@ static void test_SetStrikethrough(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
r.startPosition = 1;
r.length = 0;
@@ -3199,9 +3186,6 @@ static void test_SetStrikethrough(void)
static void test_GetMetrics(void)
{
static const WCHAR str2W[] = {0x2066,')',')',0x661,'(',0x627,')',0};
- static const WCHAR strW[] = {'a','b','c','d',0};
- static const WCHAR str3W[] = {'a',0};
- static const WCHAR str4W[] = {' ',0};
DWRITE_CLUSTER_METRICS clusters[4];
DWRITE_TEXT_METRICS metrics;
IDWriteTextFormat *format;
@@ -3213,12 +3197,12 @@ static void test_GetMetrics(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
@@ -3265,8 +3249,8 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* single cluster layout */
- hr = IDWriteFactory_CreateTextLayout(factory, str3W, 1, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 1, &count);
@@ -3288,7 +3272,7 @@ todo_wine
IDWriteTextLayout_Release(layout);
/* Whitespace only. */
- hr = IDWriteFactory_CreateTextLayout(factory, str4W, 1, format, 500.0, 1000.0, &layout);
+ hr = IDWriteFactory_CreateTextLayout(factory, L" ", 1, format, 500.0f, 1000.0f, &layout);
ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
memset(&metrics, 0xcc, sizeof(metrics));
@@ -3312,7 +3296,6 @@ todo_wine
static void test_SetFlowDirection(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
DWRITE_READING_DIRECTION reading;
DWRITE_FLOW_DIRECTION flow;
IDWriteTextFormat *format;
@@ -3322,9 +3305,9 @@ static void test_SetFlowDirection(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
flow = IDWriteTextFormat_GetFlowDirection(format);
ok(flow == DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM, "got %d\n", flow);
@@ -3332,15 +3315,16 @@ static void test_SetFlowDirection(void)
reading = IDWriteTextFormat_GetReadingDirection(format);
ok(reading == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", reading);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
hr = IDWriteTextFormat_SetFlowDirection(format, DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT);
ok(hr == S_OK || broken(hr == E_INVALIDARG) /* vista,win7 */, "got 0x%08x\n", hr);
- if (hr == S_OK) {
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ if (hr == S_OK)
+ {
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
hr = IDWriteTextFormat_SetReadingDirection(format, DWRITE_READING_DIRECTION_TOP_TO_BOTTOM);
@@ -3349,8 +3333,8 @@ static void test_SetFlowDirection(void)
hr = IDWriteTextFormat_SetFlowDirection(format, DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextLayout_Release(layout);
}
else
@@ -3385,7 +3369,6 @@ static const struct drawcall_entry draweffect4_seq[] = {
static void test_SetDrawingEffect(void)
{
static const WCHAR strW[] = {'a','e',0x0300,'d',0}; /* accent grave */
- static const WCHAR str2W[] = {'a','e','c','d',0};
IDWriteInlineObject *sign;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -3399,9 +3382,9 @@ static void test_SetDrawingEffect(void)
effect = create_test_effect();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
/* string with combining mark */
hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
@@ -3439,8 +3422,8 @@ static void test_SetDrawingEffect(void)
IDWriteTextLayout_Release(layout);
/* simple string */
- hr = IDWriteFactory_CreateTextLayout(factory, str2W, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"aecd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
r.startPosition = 0;
r.length = 2;
@@ -3457,8 +3440,8 @@ static void test_SetDrawingEffect(void)
hr = IDWriteFactory_CreateEllipsisTrimmingSign(factory, format, &sign);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, str2W, 4, format, 500.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"aecd", 4, format, 500.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
r.startPosition = 0;
r.length = 4;
@@ -3519,8 +3502,8 @@ static BOOL get_enus_string(IDWriteLocalizedStrings *strings, WCHAR *buff, UINT3
BOOL exists = FALSE;
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);
if (exists) {
hr = IDWriteLocalizedStrings_GetString(strings, index, buff, size);
@@ -3538,7 +3521,6 @@ static void test_GetLineMetrics(void)
static const WCHAR strW[] = {'a','b','c','d',' ',0};
static const WCHAR str2W[] = {'a','b','\r','c','d',0};
static const WCHAR str4W[] = {'a','\r',0};
- static const WCHAR emptyW[] = {0};
IDWriteFontCollection *syscollection;
DWRITE_FONT_METRICS fontmetrics;
DWRITE_LINE_METRICS metrics[6];
@@ -3553,9 +3535,9 @@ static void test_GetLineMetrics(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 2048.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 2048.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, strW, 5, format, 30000.0, 1000.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -3643,11 +3625,11 @@ static void test_GetLineMetrics(void)
IDWriteFontFace_GetMetrics(fontface, &fontmetrics);
hr = IDWriteFactory_CreateTextFormat(factory, nameW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, fontmetrics.designUnitsPerEm, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ DWRITE_FONT_STRETCH_NORMAL, fontmetrics.designUnitsPerEm, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, emptyW, 1, format, 30000.0f, 100.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"", 1, format, 30000.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
memset(metrics, 0, sizeof(metrics));
count = 0;
@@ -3672,9 +3654,9 @@ static void test_GetLineMetrics(void)
}
IDWriteFontCollection_Release(syscollection);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 2048.0f, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 2048.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
fontface = get_fontface_from_format(format);
ok(fontface != NULL, "got %p\n", fontface);
@@ -3696,9 +3678,9 @@ static void test_GetLineMetrics(void)
IDWriteTextFormat_Release(format);
/* line breaks */
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, str3W, 10, format, 100.0, 300.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -3867,8 +3849,6 @@ static void test_GetLineMetrics(void)
static void test_SetTextAlignment(void)
{
- static const WCHAR strW[] = {'a',0};
-
static const WCHAR stringsW[][10] = {
{'a',0},
{0}
@@ -3886,15 +3866,15 @@ static void test_SetTextAlignment(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
v = IDWriteTextFormat_GetTextAlignment(format);
ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
v = IDWriteTextLayout_GetTextAlignment(layout);
ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v);
@@ -4034,7 +4014,6 @@ static void test_SetTextAlignment(void)
static void test_SetParagraphAlignment(void)
{
- static const WCHAR strW[] = {'a',0};
DWRITE_TEXT_METRICS metrics;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -4046,15 +4025,15 @@ static void test_SetParagraphAlignment(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
v = IDWriteTextFormat_GetParagraphAlignment(format);
ok(v == DWRITE_PARAGRAPH_ALIGNMENT_NEAR, "got %d\n", v);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
v = IDWriteTextLayout_GetParagraphAlignment(layout);
ok(v == DWRITE_PARAGRAPH_ALIGNMENT_NEAR, "got %d\n", v);
@@ -4111,8 +4090,8 @@ static void test_SetParagraphAlignment(void)
hr = IDWriteTextFormat_SetParagraphAlignment(format, DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -4128,7 +4107,6 @@ static void test_SetParagraphAlignment(void)
static void test_SetReadingDirection(void)
{
- static const WCHAR strW[] = {'a',0};
DWRITE_CLUSTER_METRICS clusters[1];
DWRITE_TEXT_METRICS metrics;
IDWriteTextFormat *format;
@@ -4141,15 +4119,15 @@ static void test_SetReadingDirection(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
v = IDWriteTextFormat_GetReadingDirection(format);
ok(v == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", v);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
v = IDWriteTextLayout_GetReadingDirection(layout);
ok(v == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", v);
@@ -4316,7 +4294,6 @@ static DWRITE_MATRIX compattransforms[] = {
static void test_pixelsnapping(void)
{
- static const WCHAR strW[] = {'a',0};
IDWriteTextLayout *layout, *layout2;
struct renderer_context ctxt;
DWRITE_FONT_METRICS metrics;
@@ -4329,15 +4306,15 @@ static void test_pixelsnapping(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
fontface = get_fontface_from_format(format);
IDWriteFontFace_GetMetrics(fontface, &metrics);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 500.0f, 100.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
/* disabled snapping */
ctxt.snapping_disabled = TRUE;
@@ -4375,10 +4352,11 @@ static void test_pixelsnapping(void)
i, ctxt.originY, expectedY, baseline);
/* gdicompat layout transform doesn't affect snapping */
- for (j = 0; j < ARRAY_SIZE(compattransforms); j++) {
- hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 1, format, 500.0, 100.0,
- 1.0, &compattransforms[j], FALSE, &layout2);
- ok(hr == S_OK, "%d: got 0x%08x\n", i, hr);
+ for (j = 0; j < ARRAY_SIZE(compattransforms); ++j)
+ {
+ hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, L"a", 1, format, 500.0f, 100.0f,
+ 1.0f, &compattransforms[j], FALSE, &layout2);
+ ok(hr == S_OK, "%d: failed to create text layout, hr %#x.\n", i, hr);
expectedY = snap_coord(&ctxt.m, ctxt.ppdip, baseline);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, originX, 0.0);
@@ -4410,9 +4388,9 @@ static void test_SetWordWrapping(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
v = IDWriteTextFormat_GetWordWrapping(format);
ok(v == DWRITE_WORD_WRAPPING_WRAP, "got %d\n", v);
@@ -4487,7 +4465,8 @@ static UINT32 WINAPI fontcollection_GetFontFamilyCount(IDWriteFontCollection *if
static HRESULT WINAPI fontcollection_GetFontFamily(IDWriteFontCollection *iface, UINT32 index, IDWriteFontFamily **family)
{
- if (index == 123456) {
+ if (index == 123456)
+ {
IDWriteFactory *factory = create_factory();
IDWriteFontCollection *syscollection;
BOOL exists;
@@ -4496,8 +4475,8 @@ static HRESULT WINAPI fontcollection_GetFontFamily(IDWriteFontCollection *iface,
hr = IDWriteFactory_GetSystemFontCollection(factory, &syscollection, FALSE);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFontCollection_FindFamilyName(syscollection, tahomaW, &index, &exists);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFontCollection_FindFamilyName(syscollection, L"Tahoma", &index, &exists);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IDWriteFontCollection_GetFontFamily(syscollection, index, family);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -4506,6 +4485,7 @@ static HRESULT WINAPI fontcollection_GetFontFamily(IDWriteFontCollection *iface,
IDWriteFactory_Release(factory);
return S_OK;
}
+
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
@@ -4541,7 +4521,6 @@ static IDWriteFontCollection fallbackcollection = { &fallbackcollectionvtbl };
static void test_MapCharacters(void)
{
- static const WCHAR strW[] = {'a','b','c',0};
static const WCHAR str2W[] = {'a',0x3058,'b',0};
IDWriteLocalizedStrings *strings;
IDWriteFontFallback *fallback;
@@ -4579,7 +4558,7 @@ static void test_MapCharacters(void)
ok(font == NULL, "got %p\n", font);
/* zero length source */
- g_source = strW;
+ g_source = L"abc";
mappedlength = 1;
scale = 0.0f;
font = (void*)0xdeadbeef;
@@ -4590,7 +4569,7 @@ static void test_MapCharacters(void)
ok(scale == 1.0f, "got %f\n", scale);
ok(font == NULL, "got %p\n", font);
- g_source = strW;
+ g_source = L"abc";
mappedlength = 0;
scale = 0.0f;
font = NULL;
@@ -4606,8 +4585,8 @@ todo_wine
if (font) {
IDWriteFont_Release(font);
}
- /* same latin text, full length */
- g_source = strW;
+ /* same Latin text, full length */
+ g_source = L"abc";
mappedlength = 0;
scale = 0.0f;
font = NULL;
@@ -4680,7 +4659,7 @@ if (font) {
ok(hr == S_OK && exists, "got 0x%08x, exists %d\n", hr, exists);
hr = IDWriteLocalizedStrings_GetString(strings, 0, buffW, ARRAY_SIZE(buffW));
ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(!lstrcmpW(buffW, tahomaW), "%s\n", wine_dbgstr_w(buffW));
+ ok(!lstrcmpW(buffW, L"Tahoma"), "Unexpected string %s.\n", wine_dbgstr_w(buffW));
IDWriteLocalizedStrings_Release(strings);
IDWriteFont_Release(font);
@@ -4702,7 +4681,7 @@ if (font) {
hr = IDWriteLocalizedStrings_GetString(strings, 0, buffW, ARRAY_SIZE(buffW));
ok(hr == S_OK, "got 0x%08x\n", hr);
todo_wine
- ok(lstrcmpW(buffW, tahomaW), "%s\n", wine_dbgstr_w(buffW));
+ ok(lstrcmpW(buffW, L"Tahoma"), "Unexpected string %s.\n", wine_dbgstr_w(buffW));
IDWriteLocalizedStrings_Release(strings);
IDWriteFont_Release(font);
@@ -4712,8 +4691,6 @@ todo_wine
static void test_FontFallbackBuilder(void)
{
- static const WCHAR localeW[] = {'l','o','c','a','l','e',0};
- static const WCHAR strW[] = {'A',0};
IDWriteFontFallback *fallback, *fallback2;
IDWriteFontFallbackBuilder *builder;
IDWriteFontFallback1 *fallback1;
@@ -4816,7 +4793,7 @@ static void test_FontFallbackBuilder(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
/* fallback font missing from system collection */
- g_source = strW;
+ g_source = L"A";
mappedlength = 0;
scale = 0.0f;
font = (void*)0xdeadbeef;
@@ -4838,7 +4815,7 @@ todo_wine {
hr = IDWriteFontFallbackBuilder_CreateFontFallback(builder, &fallback);
ok(hr == S_OK, "got 0x%08x\n", hr);
- g_source = strW;
+ g_source = L"A";
mappedlength = 0;
scale = 0.0f;
font = NULL;
@@ -4863,7 +4840,7 @@ todo_wine {
hr = IDWriteFontFallbackBuilder_CreateFontFallback(builder, &fallback);
ok(hr == S_OK, "got 0x%08x\n", hr);
- g_source = strW;
+ g_source = L"A";
mappedlength = 0;
scale = 0.0f;
font = NULL;
@@ -4883,13 +4860,13 @@ todo_wine {
/* explicit locale */
range.first = 'A';
range.last = 'B';
- hr = IDWriteFontFallbackBuilder_AddMapping(builder, &range, 1, &familyW, 1, &fallbackcollection, localeW, NULL, 6.0f);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFontFallbackBuilder_AddMapping(builder, &range, 1, &familyW, 1, &fallbackcollection, L"locale", NULL, 6.0f);
+ ok(hr == S_OK, "Failed to add mapping, hr %#x.\n", hr);
hr = IDWriteFontFallbackBuilder_CreateFontFallback(builder, &fallback);
ok(hr == S_OK, "got 0x%08x\n", hr);
- g_source = strW;
+ g_source = L"A";
mappedlength = 0;
scale = 0.0f;
font = NULL;
@@ -4920,7 +4897,6 @@ todo_wine {
static void test_fallback(void)
{
- static const WCHAR strW[] = {'a','b','c','d',0};
IDWriteFontFallback *fallback, *fallback2;
IDWriteFontFallback1 *fallback1;
DWRITE_CLUSTER_METRICS clusters[4];
@@ -4939,10 +4915,10 @@ static void test_fallback(void)
/* Font does not exist in system collection. */
hr = IDWriteFactory_CreateTextFormat(factory, g_blahfontW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0, enusW, &format);
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
count = 0;
@@ -4965,13 +4941,13 @@ todo_wine {
IDWriteTextLayout_Release(layout);
IDWriteTextFormat_Release(format);
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
/* Existing font. */
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"abcd", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextFormat_Release(format);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
@@ -5038,7 +5014,6 @@ todo_wine {
static void test_SetTypography(void)
{
- static const WCHAR strW[] = {'a','f','i','b',0};
IDWriteTypography *typography, *typography2;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -5048,12 +5023,12 @@ static void test_SetTypography(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"afib", 4, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
IDWriteTextFormat_Release(format);
hr = IDWriteFactory_CreateTypography(factory, &typography);
@@ -5094,7 +5069,6 @@ static void test_SetTypography(void)
static void test_SetLastLineWrapping(void)
{
- static const WCHAR strW[] = {'a',0};
IDWriteTextLayout2 *layout2;
IDWriteTextFormat1 *format1;
IDWriteTextLayout *layout;
@@ -5105,9 +5079,9 @@ static void test_SetLastLineWrapping(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteTextFormat_QueryInterface(format, &IID_IDWriteTextFormat1, (void**)&format1);
IDWriteTextFormat_Release(format);
@@ -5123,8 +5097,8 @@ static void test_SetLastLineWrapping(void)
hr = IDWriteTextFormat1_SetLastLineWrapping(format1, FALSE);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, (IDWriteTextFormat*)format1, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, (IDWriteTextFormat *)format1, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -5143,7 +5117,6 @@ static void test_SetLastLineWrapping(void)
static void test_SetOpticalAlignment(void)
{
- static const WCHAR strW[] = {'a',0};
DWRITE_OPTICAL_ALIGNMENT alignment;
IDWriteTextLayout2 *layout2;
IDWriteTextFormat1 *format1;
@@ -5154,9 +5127,9 @@ static void test_SetOpticalAlignment(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteTextFormat_QueryInterface(format, &IID_IDWriteTextFormat1, (void**)&format1);
IDWriteTextFormat_Release(format);
@@ -5169,8 +5142,8 @@ static void test_SetOpticalAlignment(void)
alignment = IDWriteTextFormat1_GetOpticalAlignment(format1);
ok(alignment == DWRITE_OPTICAL_ALIGNMENT_NONE, "got %d\n", alignment);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, (IDWriteTextFormat*)format1, 1000.0, 1000.0, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, (IDWriteTextFormat *)format1, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -5241,7 +5214,6 @@ static const struct drawcall_entry drawunderline4_seq[] = {
static void test_SetUnderline(void)
{
- static const WCHAR encaW[] = {'e','n','-','C','A',0};
static const WCHAR strW[] = {'a','e',0x0300,'d',0}; /* accent grave */
IDWriteFontCollection *syscollection;
DWRITE_CLUSTER_METRICS clusters[4];
@@ -5254,9 +5226,9 @@ static void test_SetUnderline(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, 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_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0, 1000.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -5308,7 +5280,7 @@ todo_wine
/* now set different locale for second char, draw again */
range.startPosition = 0;
range.length = 1;
- hr = IDWriteTextLayout_SetLocaleName(layout, encaW, range);
+ hr = IDWriteTextLayout_SetLocaleName(layout, L"en-CA", range);
ok(hr == S_OK, "got 0x%08x\n", hr);
flush_sequence(sequences, RENDERER_ID);
@@ -5414,8 +5386,8 @@ todo_wine
IDWriteFontFace_GetMetrics(fontface, &fontmetrics);
hr = IDWriteFactory_CreateTextFormat(factory, nameW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, fontmetrics.designUnitsPerEm, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ DWRITE_FONT_STRETCH_NORMAL, fontmetrics.designUnitsPerEm, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
/* Look for first supported character to avoid triggering fallback path. With fallback it's harder to test
DrawUnderline() metrics, because actual resolved fontface is not passed to it. Grabbing fontface instance
@@ -5465,7 +5437,6 @@ todo_wine
static void test_InvalidateLayout(void)
{
- static const WCHAR strW[] = {'a',0};
IDWriteTextLayout3 *layout3;
IDWriteTextLayout *layout;
IDWriteTextFormat *format;
@@ -5474,12 +5445,12 @@ static void test_InvalidateLayout(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 1000.0f, 1000.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout3, (void**)&layout3);
if (hr == S_OK) {
@@ -5525,7 +5496,6 @@ static void test_InvalidateLayout(void)
static void test_line_spacing(void)
{
- static const WCHAR strW[] = {'a',0};
IDWriteTextFormat2 *format2;
IDWriteTextLayout *layout;
IDWriteTextFormat *format;
@@ -5534,9 +5504,9 @@ static void test_line_spacing(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
+ ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteTextFormat_SetLineSpacing(format, DWRITE_LINE_SPACING_METHOD_DEFAULT, 0.0f, 0.0f);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -5550,8 +5520,8 @@ static void test_line_spacing(void)
hr = IDWriteTextFormat_SetLineSpacing(format, DWRITE_LINE_SPACING_METHOD_PROPORTIONAL+1, 0.0f, 0.0f);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 1000.0f, 1000.0f, &layout);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"a", 1, format, 1000.0f, 1000.0f, &layout);
+ ok(hr == S_OK, "Failed to create text layout, hr %#x.\n", hr);
hr = IDWriteTextLayout_SetLineSpacing(layout, DWRITE_LINE_SPACING_METHOD_DEFAULT, 0.0f, 0.0f);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -5627,7 +5597,6 @@ static void test_GetOverhangMetrics(void)
{ 16.0f, { 10.0f, 50.0f, 20.0f }, { -1.0f, 0.0f, -3.0f, 4.0f }, { -1.0f, 4.0f, -3.0f, 0.0f } },
{ 15.0f, { 10.0f, 50.0f, 20.0f }, { -1.0f, 10.0f, 3.0f, -4.0f }, { -1.0f, 15.0f, 3.0f, -9.0f } },
};
- static const WCHAR strW[] = {'A',0};
IDWriteFactory *factory;
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
@@ -5636,11 +5605,11 @@ static void test_GetOverhangMetrics(void)
factory = create_factory();
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
- DWRITE_FONT_STRETCH_NORMAL, 100.0f, enusW, &format);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL, 100.0f, L"en-us", &format);
ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 1000.0f, 1000.0f, &layout);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"A", 1, format, 1000.0f, 1000.0f, &layout);
ok(hr == S_OK, "Failed to create text layout, hr %x.\n", hr);
for (i = 0; i < ARRAY_SIZE(overhangs_tests); i++) {
@@ -5686,7 +5655,6 @@ static void test_GetOverhangMetrics(void)
static void test_tab_stops(void)
{
- static const WCHAR strW[] = {'\t','a','\t','b'};
DWRITE_CLUSTER_METRICS clusters[4];
IDWriteTextLayout *layout;
IDWriteTextFormat *format;
@@ -5701,8 +5669,8 @@ static void test_tab_stops(void)
/* Default tab stop value. */
for (size = 1.0f; size < 25.0f; size += 5.0f)
{
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL,
- DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, size, enusW, &format);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL,
+ DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, size, L"en-us", &format);
ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
tabstop = IDWriteTextFormat_GetIncrementalTabStop(format);
@@ -5711,8 +5679,8 @@ static void test_tab_stops(void)
IDWriteTextFormat_Release(format);
}
- hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL,
- DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 10.0f, enusW, &format);
+ hr = IDWriteFactory_CreateTextFormat(factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL,
+ DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"en-us", &format);
ok(hr == S_OK, "Failed to create text format, hr %#x.\n", hr);
hr = IDWriteTextFormat_SetIncrementalTabStop(format, 0.0f);
@@ -5730,7 +5698,7 @@ static void test_tab_stops(void)
tabstop = IDWriteTextFormat_GetIncrementalTabStop(format);
ok(tabstop == 100.0f, "Unexpected tab stop %f.\n", tabstop);
- hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 1000.0f, 1000.0f, &layout);
+ hr = IDWriteFactory_CreateTextLayout(factory, L"\ta\tb", 4, format, 1000.0f, 1000.0f, &layout);
ok(hr == S_OK, "Failed to create text layout, hr %x.\n", hr);
hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
--
2.25.0
1
0
From: Ethan Lee <elee(a)codeweavers.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
include/Makefile.in | 1 +
include/xact3.idl | 531 ++++++++++++++++++++++++++++++++++++++++++++
include/xact3wb.h | 2 +
3 files changed, 534 insertions(+)
create mode 100644 include/xact3.idl
diff --git a/include/Makefile.in b/include/Makefile.in
index 6a822273a9..bb870b9828 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -776,6 +776,7 @@ SOURCES = \
wtypes.idl \
wuapi.idl \
x3daudio.h \
+ xact3.idl \
xact3wb.h \
xapo.idl \
xapofx.h \
diff --git a/include/xact3.idl b/include/xact3.idl
new file mode 100644
index 0000000000..46ce1d3003
--- /dev/null
+++ b/include/xact3.idl
@@ -0,0 +1,531 @@
+/*
+ * Copyright (c) 2018 Ethan Lee for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+import "unknwn.idl";
+import "xaudio2.idl";
+
+import "xact3wb.h";
+
+[
+ uuid(bcc782bc-6492-4c22-8c35-f5d72fe73c6e)
+]
+coclass XACTEngine
+{
+}
+
+interface IXACT3Engine;
+interface IXACT3SoundBank;
+interface IXACT3WaveBank;
+interface IXACT3Cue;
+interface IXACT3Wave;
+
+typedef WORD XACTCATEGORY;
+typedef BYTE XACTCHANNEL;
+typedef WORD XACTINDEX;
+typedef BYTE XACTINSTANCELIMIT;
+typedef BYTE XACTLOOPCOUNT;
+typedef BYTE XACTNOTIFICATIONTYPE;
+typedef SHORT XACTPITCH;
+typedef LONG XACTTIME;
+typedef WORD XACTVARIABLEINDEX;
+typedef FLOAT XACTVARIABLEVALUE;
+typedef BYTE XACTVARIATIONWEIGHT;
+typedef FLOAT XACTVOLUME;
+
+static const INT XACT_RENDERER_ID_LENGTH = 0xff;
+static const INT XACT_RENDERER_NAME_LENGTH = 0xff;
+static const INT XACT_CUE_NAME_LENGTH = 0xff;
+
+#define WAVEBANK_ENTRYNAME_LENGTH 64
+
+typedef struct XACT_RENDERER_DETAILS
+{
+ WCHAR rendererID[XACT_RENDERER_ID_LENGTH];
+ WCHAR displayName[XACT_RENDERER_NAME_LENGTH];
+ BOOL defaultDevice;
+} XACT_RENDERER_DETAILS;
+
+typedef BOOL (__stdcall *XACT_READFILE_CALLBACK)(
+ HANDLE hFile,
+ LPVOID lpBuffer,
+ DWORD nNumberOfBytesRead,
+ LPDWORD lpNumberOfBytesRead,
+ void* lpOverlapped
+);
+typedef BOOL (__stdcall *XACT_GETOVERLAPPEDRESULT_CALLBACK)(
+ HANDLE hFile,
+ void* lpOverlapped,
+ LPDWORD lpNumberOfBytesTransferred,
+ BOOL bWait
+);
+typedef struct XACT_FILEIO_CALLBACKS
+{
+ XACT_READFILE_CALLBACK readFileCallback;
+ XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback;
+} XACT_FILEIO_CALLBACKS;
+
+typedef struct XACT_STREAMING_PARAMETERS
+{
+ HANDLE file;
+ DWORD offset;
+ DWORD flags;
+ WORD packetSize;
+} XACT_STREAMING_PARAMETERS;
+
+typedef struct XACT_WAVE_PROPERTIES
+{
+ char friendlyName[WAVEBANK_ENTRYNAME_LENGTH];
+ WAVEBANKMINIWAVEFORMAT format;
+ DWORD durationInSamples;
+ WAVEBANKSAMPLEREGION loopRegion;
+ BOOL streaming;
+} XACT_WAVE_PROPERTIES;
+
+cpp_quote("#if 0")
+typedef struct XACT_WAVE_INSTANCE_PROPERTIES
+{
+ XACT_WAVE_PROPERTIES waveProperties; /* properties is a keyword for midl */
+ BOOL backgroundMusic;
+} XACT_WAVE_INSTANCE_PROPERTIES;
+cpp_quote("#endif")
+
+cpp_quote("typedef struct XACT_WAVE_INSTANCE_PROPERTIES")
+cpp_quote("{")
+cpp_quote(" XACT_WAVE_PROPERTIES properties;")
+cpp_quote(" BOOL backgroundMusic;")
+cpp_quote("} XACT_WAVE_INSTANCE_PROPERTIES;")
+
+typedef struct XACT_CUE_PROPERTIES
+{
+ char friendlyName[XACT_CUE_NAME_LENGTH];
+ BOOL interactive;
+ XACTINDEX iaVariableIndex;
+ XACTINDEX numVariations;
+ XACTINSTANCELIMIT maxInstances;
+ XACTINSTANCELIMIT currentInstances;
+} XACT_CUE_PROPERTIES;
+
+typedef struct XACT_TRACK_PROPERTIES
+{
+ XACTTIME duration;
+ XACTINDEX numVariations;
+ XACTCHANNEL numChannels;
+ XACTINDEX waveVariation;
+ XACTLOOPCOUNT loopCount;
+} XACT_TRACK_PROPERTIES;
+
+typedef struct XACT_VARIATION_PROPERTIES
+{
+ XACTINDEX index;
+ XACTVARIATIONWEIGHT weight;
+ XACTVARIABLEVALUE iaVariableMin;
+ XACTVARIABLEVALUE iaVariableMax;
+ BOOL linger;
+} XACT_VARIATION_PROPERTIES;
+
+typedef struct XACT_SOUND_PROPERTIES
+{
+ XACTCATEGORY category;
+ BYTE priority;
+ XACTPITCH pitch;
+ XACTVOLUME volume;
+ XACTINDEX numTracks;
+ XACT_TRACK_PROPERTIES arrTrackProperties[1];
+} XACT_SOUND_PROPERTIES;
+
+typedef struct XACT_SOUND_VARIATION_PROPERTIES
+{
+ XACT_VARIATION_PROPERTIES variationProperties;
+ XACT_SOUND_PROPERTIES soundProperties;
+} XACT_SOUND_VARIATION_PROPERTIES;
+
+typedef struct XACT_CUE_INSTANCE_PROPERTIES
+{
+ DWORD allocAttributes;
+ XACT_CUE_PROPERTIES cueProperties;
+ XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties;
+} XACT_CUE_INSTANCE_PROPERTIES;
+
+cpp_quote("#include <pshpack1.h>")
+
+typedef struct XACT_NOTIFICATION_DESCRIPTION
+{
+ XACTNOTIFICATIONTYPE type;
+ BYTE flags;
+ IXACT3SoundBank *pSoundBank;
+ IXACT3WaveBank *pWaveBank;
+ IXACT3Cue *pCue;
+ IXACT3Wave *pWave;
+ XACTINDEX cueIndex;
+ XACTINDEX waveIndex;
+ void* pvContext;
+} XACT_NOTIFICATION_DESCRIPTION;
+
+typedef struct XACT_NOTIFICATION_CUE
+{
+ XACTINDEX cueIndex;
+ IXACT3SoundBank *pSoundBank;
+ IXACT3Cue *pCue;
+} XACT_NOTIFICATION_CUE;
+
+typedef struct XACT_NOTIFICATION_MARKER
+{
+ XACTINDEX cueIndex;
+ IXACT3SoundBank *pSoundBank;
+ IXACT3Cue *pCue;
+ DWORD marker;
+} XACT_NOTIFICATION_MARKER;
+
+typedef struct XACT_NOTIFICATION_SOUNDBANK
+{
+ IXACT3SoundBank *pSoundBank;
+} XACT_NOTIFICATION_SOUNDBANK;
+
+typedef struct XACT_NOTIFICATION_WAVEBANK
+{
+ IXACT3WaveBank *pWaveBank;
+} XACT_NOTIFICATION_WAVEBANK;
+
+typedef struct XACT_NOTIFICATION_VARIABLE
+{
+ XACTINDEX cueIndex;
+ IXACT3SoundBank *pSoundBank;
+ IXACT3Cue *pCue;
+ XACTVARIABLEINDEX variableIndex;
+ XACTVARIABLEVALUE variableValue;
+ BOOL local;
+} XACT_NOTIFICATION_VARIABLE;
+
+typedef struct XACT_NOTIFICATION_GUI
+{
+ DWORD reserved;
+} XACT_NOTIFICATION_GUI;
+
+typedef struct XACT_NOTIFICATION_WAVE
+{
+ IXACT3WaveBank *pWaveBank;
+ XACTINDEX waveIndex;
+ XACTINDEX cueIndex;
+ IXACT3SoundBank *pSoundBank;
+ IXACT3Cue *pCue;
+ IXACT3Wave *pWave;
+} XACT_NOTIFICATION_WAVE;
+
+typedef struct XACT_NOTIFICATION
+{
+ XACTNOTIFICATIONTYPE type;
+ LONG timeStamp;
+ PVOID pvContext;
+ union
+ {
+ XACT_NOTIFICATION_CUE cue;
+ XACT_NOTIFICATION_MARKER marker;
+ XACT_NOTIFICATION_SOUNDBANK soundBank;
+ XACT_NOTIFICATION_WAVEBANK waveBank;
+ XACT_NOTIFICATION_VARIABLE variable;
+ XACT_NOTIFICATION_GUI gui;
+ XACT_NOTIFICATION_WAVE wave;
+ } DUMMYUNIONNAME;
+} XACT_NOTIFICATION;
+
+typedef void (__stdcall *XACT_NOTIFICATION_CALLBACK)(
+ const XACT_NOTIFICATION *pNotification
+);
+
+typedef struct XACT_RUNTIME_PARAMETERS
+{
+ DWORD lookAheadTime;
+ void* pGlobalSettingsBuffer;
+ DWORD globalSettingsBufferSize;
+ DWORD globalSettingsFlags;
+ DWORD globalSettingsAllocAttributes;
+ XACT_FILEIO_CALLBACKS fileIOCallbacks;
+ XACT_NOTIFICATION_CALLBACK fnNotificationCallback;
+ LPCWSTR pRendererID;
+ IXAudio2 *pXAudio2;
+ IXAudio2MasteringVoice *pMasteringVoice;
+} XACT_RUNTIME_PARAMETERS;
+
+
+cpp_quote("#include <poppack.h>")
+
+static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4;
+static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6;
+static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7;
+static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16;
+
+[
+ object,
+ local,
+ uuid(b1ee676a-d9cd-4d2a-89a8-fa53eb9e480b),
+]
+interface IXACT3Engine : IUnknown
+{
+ HRESULT GetRendererCount(XACTINDEX *pnRendererCount);
+
+ HRESULT GetRendererDetails(
+ XACTINDEX nRendererIndex,
+ XACT_RENDERER_DETAILS *pRendererDetails);
+
+ HRESULT GetFinalMixFormat(WAVEFORMATEXTENSIBLE *pFinalMixFormat);
+
+ HRESULT Initialize(const XACT_RUNTIME_PARAMETERS *pParams);
+
+ HRESULT ShutDown();
+
+ HRESULT DoWork();
+
+ HRESULT CreateSoundBank(
+ const void* pvBuffer,
+ DWORD dwSize,
+ DWORD dwFlags,
+ DWORD dwAllocAttributes,
+ IXACT3SoundBank **ppSoundBank);
+
+ HRESULT CreateInMemoryWaveBank(
+ const void* pvBuffer,
+ DWORD dwSize,
+ DWORD dwFlags,
+ DWORD dwAllocAttributes,
+ IXACT3WaveBank **ppWaveBank);
+
+ HRESULT CreateStreamingWaveBank(
+ const XACT_STREAMING_PARAMETERS *pParms,
+ IXACT3WaveBank **ppWaveBank);
+
+ HRESULT PrepareWave(
+ DWORD dwFlags,
+ LPCSTR szWavePath,
+ WORD wStreamingPacketSize,
+ DWORD dwAlignment,
+ DWORD dwPlayOffset,
+ XACTLOOPCOUNT nLoopCount,
+ IXACT3Wave **ppWave);
+
+ HRESULT PrepareInMemoryWave(
+ DWORD dwFlags,
+ WAVEBANKENTRY entry,
+ DWORD *pdwSeekTable,
+ BYTE *pbWaveData,
+ DWORD dwPlayOffset,
+ XACTLOOPCOUNT nLoopCount,
+ IXACT3Wave **ppWave);
+
+ HRESULT PrepareStreamingWave(
+ DWORD dwFlags,
+ WAVEBANKENTRY entry,
+ XACT_STREAMING_PARAMETERS streamingParams,
+ DWORD dwAlignment,
+ DWORD *pdwSeekTable,
+ DWORD dwPlayOffset,
+ XACTLOOPCOUNT nLoopCount,
+ IXACT3Wave **ppWave);
+
+ HRESULT RegisterNotification(
+ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc);
+
+ HRESULT UnRegisterNotification(
+ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc);
+
+ XACTCATEGORY GetCategory(
+ LPCSTR szFriendlyName);
+
+ HRESULT Stop(XACTCATEGORY nCategory, DWORD dwFlags);
+
+ HRESULT SetVolume(XACTCATEGORY nCategory, XACTVOLUME nVolume);
+
+ HRESULT Pause(XACTCATEGORY nCategory, BOOL fPause);
+
+ XACTVARIABLEINDEX GetGlobalVariableIndex(LPCSTR szFriendlyName);
+
+ HRESULT SetGlobalVariable(
+ XACTVARIABLEINDEX nIndex,
+ XACTVARIABLEVALUE nValue);
+
+ HRESULT GetGlobalVariable(
+ XACTVARIABLEINDEX nIndex,
+ XACTVARIABLEVALUE *nValue);
+}
+
+[
+ object,
+ local
+]
+interface IXACT3SoundBank
+{
+ XACTINDEX GetCueIndex(LPCSTR szFriendlyName);
+
+ HRESULT GetNumCues(XACTINDEX *pnNumCues);
+
+ HRESULT GetCueProperties(
+ XACTINDEX nCueIndex,
+ XACT_CUE_PROPERTIES *pProperties);
+
+ HRESULT Prepare(
+ XACTINDEX nCueIndex,
+ DWORD dwFlags,
+ XACTTIME timeOffset,
+ IXACT3Cue **ppCue);
+
+ HRESULT Play(
+ XACTINDEX nCueIndex,
+ DWORD dwFlags,
+ XACTTIME timeOffset,
+ IXACT3Cue **ppCue);
+
+ HRESULT Stop(XACTINDEX nCueIndex, DWORD dwFlags);
+
+ HRESULT Destroy();
+
+ HRESULT GetState(DWORD *pdwState);
+}
+
+[
+ object,
+ local
+]
+interface IXACT3WaveBank
+{
+ HRESULT Destroy();
+
+ HRESULT GetNumWaves(XACTINDEX *pnNumWaves);
+
+ XACTINDEX GetWaveIndex(LPCSTR szFriendlyName);
+
+ HRESULT GetWaveProperties(
+ XACTINDEX nWaveIndex,
+ XACT_WAVE_PROPERTIES *pWaveProperties);
+
+ HRESULT Prepare(
+ XACTINDEX nWaveIndex,
+ DWORD dwFlags,
+ DWORD dwPlayOffset,
+ XACTLOOPCOUNT nLoopCount,
+ IXACT3Wave **ppWave);
+
+ HRESULT Play(
+ XACTINDEX nWaveIndex,
+ DWORD dwFlags,
+ DWORD dwPlayOffset,
+ XACTLOOPCOUNT nLoopCount,
+ IXACT3Wave **ppWave);
+
+ HRESULT Stop(XACTINDEX nWaveIndex, DWORD dwFlags);
+
+ HRESULT GetState(DWORD *pdwState);
+}
+
+[
+ object,
+ local
+]
+interface IXACT34Cue
+{
+ HRESULT Play();
+
+ HRESULT Stop(DWORD dwFlags);
+
+ HRESULT GetState(DWORD *pdwState);
+
+ HRESULT Destroy();
+
+ HRESULT SetMatrixCoefficients(
+ UINT32 uSrcChannelCount,
+ UINT32 uDstChannelCount,
+ float *pMatrixCoefficients);
+
+ XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName);
+
+ HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue);
+
+ HRESULT GetVariable(
+ XACTVARIABLEINDEX nIndex,
+ XACTVARIABLEVALUE *nValue);
+
+ HRESULT Pause(BOOL fPause);
+
+ HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties);
+}
+
+[
+ object,
+ local
+]
+interface IXACT3Cue
+{
+ HRESULT Play();
+
+ HRESULT Stop(DWORD dwFlags);
+
+ HRESULT GetState(DWORD *pdwState);
+
+ HRESULT Destroy();
+
+ HRESULT SetMatrixCoefficients(
+ UINT32 uSrcChannelCount,
+ UINT32 uDstChannelCount,
+ float *pMatrixCoefficients);
+
+ XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName);
+
+ HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue);
+
+ HRESULT GetVariable(
+ XACTVARIABLEINDEX nIndex,
+ XACTVARIABLEVALUE *nValue);
+
+ HRESULT Pause(BOOL fPause);
+
+ HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties);
+
+ HRESULT SetOutputVoices(const XAUDIO2_VOICE_SENDS *pSendList);
+
+ HRESULT SetOutputVoiceMatrix(
+ IXAudio2Voice *pDestinationVoice,
+ UINT32 SourceChannels,
+ UINT32 DestinationChannels,
+ const float *pLevelMatrix);
+}
+
+[
+ object,
+ local
+]
+interface IXACT3Wave
+{
+ HRESULT Destroy();
+
+ HRESULT Play();
+
+ HRESULT Stop(DWORD dwFlags);
+
+ HRESULT Pause(BOOL fPause);
+
+ HRESULT GetState(DWORD *pdwState);
+
+ HRESULT SetPitch(XACTPITCH pitch);
+
+ HRESULT SetVolume(XACTVOLUME volume);
+
+ HRESULT SetMatrixCoefficients(
+ UINT32 uSrcChannelCount,
+ UINT32 uDstChannelCount,
+ float *pMatrixCoefficients);
+
+ HRESULT GetProperties(XACT_WAVE_INSTANCE_PROPERTIES *pProperties);
+}
diff --git a/include/xact3wb.h b/include/xact3wb.h
index b4c5a53d40..130efc9745 100644
--- a/include/xact3wb.h
+++ b/include/xact3wb.h
@@ -18,6 +18,8 @@
#ifndef __XACT3WB_H__
#define __XACT3WB_H__
+#define WAVEBANK_ENTRYNAME_LENGTH 64
+
typedef union WAVEBANKMINIWAVEFORMAT
{
struct
--
2.17.1
2
2
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/iphlpapi/tests/iphlpapi.c | 48 ++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c
index 7a4821aae7..8ccbf5f9b6 100644
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -56,6 +56,7 @@ static DWORD (WINAPI *pAllocateAndGetTcpExTableFromStack)(void**,BOOL,HANDLE,DWO
static DWORD (WINAPI *pGetIfEntry2)(PMIB_IF_ROW2);
static DWORD (WINAPI *pGetIfTable2)(PMIB_IF_TABLE2*);
static DWORD (WINAPI *pGetIfTable2Ex)(MIB_IF_TABLE_LEVEL,PMIB_IF_TABLE2*);
+static DWORD (WINAPI *pGetTcp6Table)(PMIB_TCP6TABLE,PDWORD,BOOL);
static DWORD (WINAPI *pGetUdp6Table)(PMIB_UDP6TABLE,PDWORD,BOOL);
static DWORD (WINAPI *pGetUnicastIpAddressEntry)(MIB_UNICASTIPADDRESS_ROW*);
static DWORD (WINAPI *pGetUnicastIpAddressTable)(ADDRESS_FAMILY,MIB_UNICASTIPADDRESS_TABLE**);
@@ -86,6 +87,7 @@ static void loadIPHlpApi(void)
pGetIfEntry2 = (void *)GetProcAddress(hLibrary, "GetIfEntry2");
pGetIfTable2 = (void *)GetProcAddress(hLibrary, "GetIfTable2");
pGetIfTable2Ex = (void *)GetProcAddress(hLibrary, "GetIfTable2Ex");
+ pGetTcp6Table = (void *)GetProcAddress(hLibrary, "GetTcp6Table");
pGetUdp6Table = (void *)GetProcAddress(hLibrary, "GetUdp6Table");
pGetUnicastIpAddressEntry = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressEntry");
pGetUnicastIpAddressTable = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressTable");
@@ -2095,6 +2097,51 @@ static void test_ConvertLengthToIpv4Mask(void)
ok( mask == INADDR_NONE, "ConvertLengthToIpv4Mask mask value 0x%08x, expected 0x%08x\n", mask, INADDR_NONE );
}
+static void test_GetTcp6Table(void)
+{
+ DWORD ret;
+ ULONG size = 0;
+ PMIB_TCP6TABLE buf;
+
+ if (!pGetTcp6Table)
+ {
+ win_skip("GetTcp6Table not available\n");
+ return;
+ }
+
+ ret = pGetTcp6Table(NULL, &size, FALSE);
+ if (ret == ERROR_NOT_SUPPORTED)
+ {
+ skip("GetTcp6Table is not supported\n");
+ return;
+ }
+ ok(ret == ERROR_INSUFFICIENT_BUFFER,
+ "GetTcp6Table(NULL, &size, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n", ret);
+ if (ret != ERROR_INSUFFICIENT_BUFFER) return;
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+
+ ret = pGetTcp6Table(buf, &size, FALSE);
+ ok(ret == NO_ERROR,
+ "GetTcp6Table(buf, &size, FALSE) returned %d, expected NO_ERROR\n", ret);
+
+ if (ret == NO_ERROR && winetest_debug > 1)
+ {
+ DWORD i;
+ trace("TCP6 table: %u entries\n", buf->dwNumEntries);
+ for (i = 0; i < buf->dwNumEntries; i++)
+ {
+ trace("%u: local %s%%%u:%u remote %s%%%u:%u state %u\n", i,
+ ntoa6(&buf->table[i].LocalAddr), ntohs(buf->table[i].dwLocalScopeId),
+ ntohs(buf->table[i].dwLocalPort), ntoa6(&buf->table[i].RemoteAddr),
+ ntohs(buf->table[i].dwRemoteScopeId), ntohs(buf->table[i].dwRemotePort),
+ buf->table[i].State);
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, buf);
+}
+
static void test_GetUdp6Table(void)
{
DWORD apiReturn;
@@ -2268,6 +2315,7 @@ START_TEST(iphlpapi)
test_GetUnicastIpAddressEntry();
test_GetUnicastIpAddressTable();
test_ConvertLengthToIpv4Mask();
+ test_GetTcp6Table();
test_GetUdp6Table();
test_ParseNetworkString();
freeIPHlpApi();
--
2.25.0
1
2
1
0
[PATCH v2 1/4] shell32: Append a directory separator if necessary in UNIXFS_path_to_pidl().
by Zebediah Figura 14 Feb '20
by Zebediah Figura 14 Feb '20
14 Feb '20
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/shell32/shfldr_unixfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index a37b1bf5881..17a5513bd94 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -640,6 +640,8 @@ static HRESULT UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, LPBC pbc, const WCHA
/* Relative dos or unix path. Concat with this folder's path */
int cBasePathLen = strlen(pUnixFolder->m_pszPath);
memcpy(szCompletePath, pUnixFolder->m_pszPath, cBasePathLen);
+ if (szCompletePath[cBasePathLen - 1] != '/')
+ szCompletePath[cBasePathLen++] = '/';
WideCharToMultiByte(CP_UNIXCP, 0, path, -1, szCompletePath + cBasePathLen,
FILENAME_MAX - cBasePathLen, NULL, NULL);
pNextPathElement = szCompletePath + cBasePathLen - 1;
--
2.25.0
2
4
[PATCH v3 1/3] quartz/filesource: Zero-initialize the file source filter.
by Zebediah Figura 14 Feb '20
by Zebediah Figura 14 Feb '20
14 Feb '20
Fixes: abac070387f908f853f38eddc67206ff7c657ae2
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/filesource.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 11cc438be29..c1f7f69d5e2 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -352,7 +352,7 @@ static void async_reader_destroy(struct strmbase_filter *iface)
CloseHandle(filter->port);
strmbase_filter_cleanup(&filter->filter);
- CoTaskMemFree(filter);
+ free(filter);
}
static HRESULT async_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
@@ -414,31 +414,24 @@ static DWORD CALLBACK io_thread(void *arg)
HRESULT AsyncReader_create(IUnknown *outer, void **out)
{
- AsyncReader *pAsyncRead;
-
- pAsyncRead = CoTaskMemAlloc(sizeof(AsyncReader));
+ AsyncReader *object;
- if (!pAsyncRead)
+ if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
- strmbase_filter_init(&pAsyncRead->filter, outer, &CLSID_AsyncReader, &filter_ops);
+ strmbase_filter_init(&object->filter, outer, &CLSID_AsyncReader, &filter_ops);
- pAsyncRead->IFileSourceFilter_iface.lpVtbl = &FileSource_Vtbl;
+ object->IFileSourceFilter_iface.lpVtbl = &FileSource_Vtbl;
+ object->IAsyncReader_iface.lpVtbl = &FileAsyncReader_Vtbl;
- pAsyncRead->IAsyncReader_iface.lpVtbl = &FileAsyncReader_Vtbl;
-
- pAsyncRead->pszFileName = NULL;
-
- InitializeCriticalSection(&pAsyncRead->sample_cs);
- pAsyncRead->sample_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FileAsyncReader.sample_cs");
- InitializeConditionVariable(&pAsyncRead->sample_cv);
- pAsyncRead->port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
- pAsyncRead->io_thread = CreateThread(NULL, 0, io_thread, pAsyncRead, 0, NULL);
-
- *out = &pAsyncRead->filter.IUnknown_inner;
-
- TRACE("-- created at %p\n", pAsyncRead);
+ InitializeCriticalSection(&object->sample_cs);
+ object->sample_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FileAsyncReader.sample_cs");
+ InitializeConditionVariable(&object->sample_cv);
+ object->port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
+ object->io_thread = CreateThread(NULL, 0, io_thread, object, 0, NULL);
+ TRACE("Created file source %p.\n", object);
+ *out = &object->filter.IUnknown_inner;
return S_OK;
}
--
2.25.0
1
2
[PATCH 1/5] d3d10: Allocate buffers for effect interface local_buffers.
by Connor McAdams 14 Feb '20
by Connor McAdams 14 Feb '20
14 Feb '20
Create ID3D10Buffer interfaces for the constant buffers within the
effect shader.
Signed-off-by: Connor McAdams <conmanx360(a)gmail.com>
---
dlls/d3d10/d3d10_private.h | 10 ++++++
dlls/d3d10/effect.c | 62 ++++++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 96020cd4a0..5c6c7a2d72 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -114,6 +114,15 @@ struct d3d10_effect_state_object_variable
} object;
};
+struct d3d10_effect_buffer_variable
+{
+ ID3D10Buffer *buffer;
+ ID3D10ShaderResourceView *resource_view;
+
+ UINT changed;
+ char *local_buffer;
+};
+
/* ID3D10EffectType */
struct d3d10_effect_type
{
@@ -169,6 +178,7 @@ struct d3d10_effect_variable
{
struct d3d10_effect_state_object_variable state;
struct d3d10_effect_shader_variable shader;
+ struct d3d10_effect_buffer_variable buffer;
} u;
};
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 91e713bdf5..b62b7c0d3a 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -2096,6 +2096,53 @@ static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
return S_OK;
}
+static HRESULT create_variable_buffer(struct d3d10_effect_variable *l, D3D10_CBUFFER_TYPE d3d10_cbuffer_type)
+{
+ D3D10_BUFFER_DESC buffer_desc;
+ D3D10_SUBRESOURCE_DATA subresource_data;
+ D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc;
+ ID3D10Device *device = l->effect->device;
+ HRESULT hr;
+
+ if (!(l->u.buffer.local_buffer = heap_calloc(l->type->size_unpacked, sizeof(unsigned char))))
+ {
+ ERR("Failed to allocate local constant buffer memory.\n");
+ return E_OUTOFMEMORY;
+ }
+
+ buffer_desc.ByteWidth = l->type->size_unpacked;
+ buffer_desc.Usage = D3D10_USAGE_DEFAULT;
+ buffer_desc.CPUAccessFlags = 0;
+ buffer_desc.MiscFlags = 0;
+ if (d3d10_cbuffer_type == D3D10_CT_CBUFFER)
+ buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
+ else if (d3d10_cbuffer_type == D3D10_CT_TBUFFER)
+ buffer_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
+
+ subresource_data.pSysMem = (const void *)l->u.buffer.local_buffer;
+ subresource_data.SysMemPitch = 0;
+ subresource_data.SysMemSlicePitch = 0;
+
+ if (FAILED(hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &subresource_data, &l->u.buffer.buffer)))
+ return hr;
+
+ if (d3d10_cbuffer_type == D3D10_CT_TBUFFER)
+ {
+ srv_desc.Format = DXGI_FORMAT_R32G32B32A32_UINT;
+ srv_desc.ViewDimension = D3D_SRV_DIMENSION_BUFFER;
+ srv_desc.Buffer.ElementOffset = 0;
+ srv_desc.Buffer.ElementWidth = l->type->size_unpacked / 16;
+
+ if (FAILED(hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)l->u.buffer.buffer,
+ (const D3D10_SHADER_RESOURCE_VIEW_DESC *)&srv_desc, &l->u.buffer.resource_view)))
+ return hr;
+ }
+ else
+ l->u.buffer.resource_view = NULL;
+
+ return S_OK;
+}
+
static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
const char **ptr, struct d3d10_effect_variable *l)
{
@@ -2282,6 +2329,12 @@ static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
+ if (l->type->size_unpacked)
+ {
+ if (FAILED(hr = create_variable_buffer(l, d3d10_cbuffer_type)))
+ return hr;
+ }
+
return S_OK;
}
@@ -2760,6 +2813,15 @@ static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
}
heap_free(l->annotations);
}
+
+ if (l->u.buffer.buffer)
+ ID3D10Buffer_Release(l->u.buffer.buffer);
+
+ if (l->u.buffer.local_buffer)
+ heap_free(l->u.buffer.local_buffer);
+
+ if (l->u.buffer.resource_view)
+ ID3D10ShaderResourceView_Release(l->u.buffer.resource_view);
}
/* IUnknown methods */
--
2.20.1
1
5