Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- 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
June 2018
- 68 participants
- 1149 messages
[PATCH 1/2] devenum/tests: DMORegister() returns E_FAIL if unable to access the registry.
by Zebediah Figura
Fixes https://bugs.winehq.org/show_bug.cgi?id=45390
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/tests/devenum.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c
index 6d4ce2d..bc3d105 100644
--- a/dlls/devenum/tests/devenum.c
+++ b/dlls/devenum/tests/devenum.c
@@ -521,7 +521,7 @@ static void test_dmo(void)
ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
hr = DMORegister(name, &CLSID_TestFilter, &CLSID_AudioRendererCategory, 0, 0, NULL, 0, NULL);
- if (hr != E_ACCESSDENIED)
+ if (hr != E_FAIL)
{
ok(hr == S_OK, "got %#x\n", hr);
--
2.7.4
June 28, 2018
[PATCH vkd3d] tests: Get rid of create_texture().
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
tests/d3d12.c | 80 ++++++++++++++++++++++++------------------------
tests/vkd3d_d3d12_test.h | 1 -
2 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 217b4368a6b2..6128a402d3a6 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -8552,8 +8552,8 @@ static void test_texture(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
- texture = create_texture(context.device,
- tests[i].width, tests[i].height, tests[i].format, D3D12_RESOURCE_STATE_COPY_DEST);
+ texture = create_default_texture(context.device,
+ tests[i].width, tests[i].height, tests[i].format, 0, D3D12_RESOURCE_STATE_COPY_DEST);
upload_texture_data(texture, &tests[i].data, 1, queue, command_list);
reset_command_list(command_list, context.allocator);
@@ -8773,8 +8773,8 @@ static void test_gather(void)
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap);
gpu_handle = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap);
- texture = create_texture(context.device, 4, 4, DXGI_FORMAT_R32G32B32A32_FLOAT,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ texture = create_default_texture(context.device, 4, 4, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
ID3D12Device_CreateShaderResourceView(context.device, texture, NULL, cpu_handle);
upload_texture_data(texture, &resource_data, 1, queue, command_list);
reset_command_list(command_list, context.allocator);
@@ -9412,8 +9412,8 @@ static void test_descriptor_tables(void)
for (i = 0; i < ARRAY_SIZE(textures); ++i)
{
- textures[i] = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_STATE_COPY_DEST);
+ textures[i] = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &texture_data[i];
data.RowPitch = sizeof(texture_data[i]);
data.SlicePitch = data.RowPitch;
@@ -9887,8 +9887,8 @@ static void test_update_descriptor_tables(void)
for (i = 0; i < ARRAY_SIZE(textures); ++i)
{
- textures[i] = create_texture(context.device, 1, 1, DXGI_FORMAT_R32_FLOAT,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ textures[i] = create_default_texture(context.device, 1, 1, DXGI_FORMAT_R32_FLOAT,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &texture_data[i];
data.RowPitch = sizeof(texture_data[i]);
data.SlicePitch = data.RowPitch;
@@ -10020,8 +10020,8 @@ static void test_update_descriptor_heap_after_closing_command_list(void)
cpu_heap = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1);
- red_texture = create_texture(context.device, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ red_texture = create_default_texture(context.device, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
texture_data.pData = red_data;
texture_data.RowPitch = sizeof(*red_data);
texture_data.SlicePitch = texture_data.RowPitch;
@@ -10030,8 +10030,8 @@ static void test_update_descriptor_heap_after_closing_command_list(void)
transition_resource_state(command_list, red_texture,
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
- green_texture = create_texture(context.device, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ green_texture = create_default_texture(context.device, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
texture_data.pData = green_data;
upload_texture_data(green_texture, &texture_data, 1, queue, command_list);
reset_command_list(command_list, context.allocator);
@@ -10425,8 +10425,8 @@ static void test_update_compute_descriptor_tables(void)
transition_resource_state(command_list, input_buffers[4],
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- textures[0] = create_texture(context.device,
- 4, 4, DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_STATE_COPY_DEST);
+ textures[0] = create_default_texture(context.device,
+ 4, 4, DXGI_FORMAT_R32_UINT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
subresource_data.pData = texture0_data;
subresource_data.RowPitch = sizeof(*texture0_data);
subresource_data.SlicePitch = subresource_data.RowPitch;
@@ -10435,8 +10435,8 @@ static void test_update_compute_descriptor_tables(void)
transition_resource_state(command_list, textures[0],
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- textures[1] = create_texture(context.device,
- 4, 4, DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_STATE_COPY_DEST);
+ textures[1] = create_default_texture(context.device,
+ 4, 4, DXGI_FORMAT_R32_UINT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
subresource_data.pData = texture1_data;
subresource_data.RowPitch = sizeof(*texture1_data);
subresource_data.SlicePitch = subresource_data.RowPitch;
@@ -10843,8 +10843,8 @@ static void test_copy_descriptors(void)
/* create SRVs */
cpu_handle = get_cpu_descriptor_handle(&context, cpu_heap, 10);
- t[0] = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ t[0] = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &t0_data;
data.RowPitch = sizeof(t0_data);
data.SlicePitch = data.RowPitch;
@@ -10853,8 +10853,8 @@ static void test_copy_descriptors(void)
transition_resource_state(command_list, t[0],
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- t[1] = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_STATE_COPY_DEST);
+ t[1] = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R32_UINT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &t1_data;
data.RowPitch = sizeof(t1_data);
data.SlicePitch = data.RowPitch;
@@ -10863,8 +10863,8 @@ static void test_copy_descriptors(void)
transition_resource_state(command_list, t[1],
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- t[2] = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_STATE_COPY_DEST);
+ t[2] = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R32_UINT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &t2_data;
data.RowPitch = sizeof(t2_data);
data.SlicePitch = data.RowPitch;
@@ -11231,8 +11231,8 @@ static void test_copy_descriptors_range_sizes(void)
green_handle = get_cpu_descriptor_handle(&context, cpu_heap, 0);
blue_handle = get_cpu_descriptor_handle(&context, cpu_heap, 1);
- green_texture = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ green_texture = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &green;
data.RowPitch = sizeof(green);
data.SlicePitch = data.RowPitch;
@@ -11242,8 +11242,8 @@ static void test_copy_descriptors_range_sizes(void)
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
ID3D12Device_CreateShaderResourceView(device, green_texture, NULL, green_handle);
- blue_texture = create_texture(context.device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ blue_texture = create_default_texture(context.device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &blue;
data.RowPitch = sizeof(blue);
data.SlicePitch = data.RowPitch;
@@ -11544,8 +11544,8 @@ static void test_descriptors_visibility(void)
vs_raw_buffer = create_upload_buffer(device, sizeof(vs_buffer_data), vs_buffer_data);
ps_raw_buffer = create_upload_buffer(device, sizeof(ps_buffer_data), ps_buffer_data);
- vs_texture = create_texture(device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ vs_texture = create_default_texture(device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = vs_texture_data;
data.RowPitch = sizeof(vs_texture_data);
data.SlicePitch = data.RowPitch;
@@ -11554,8 +11554,8 @@ static void test_descriptors_visibility(void)
transition_resource_state(command_list, vs_texture,
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- ps_texture = create_texture(device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ ps_texture = create_default_texture(device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = ps_texture_data;
data.RowPitch = sizeof(ps_texture_data);
data.SlicePitch = data.RowPitch;
@@ -16308,16 +16308,16 @@ static void test_copy_texture_region(void)
for (i = 0; i < ARRAY_SIZE(resource_states); ++i)
{
- src_texture = create_texture(device, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ src_texture = create_default_texture(device, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
texture_data.pData = bitmap_data;
texture_data.RowPitch = 4 * sizeof(*bitmap_data);
texture_data.SlicePitch = texture_data.RowPitch * 4;
upload_texture_data(src_texture, &texture_data, 1, queue, command_list);
reset_command_list(command_list, context.allocator);
- dst_texture = create_texture(device, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ dst_texture = create_default_texture(device, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
texture_data.pData = clear_data;
texture_data.RowPitch = 4 * sizeof(*bitmap_data);
texture_data.SlicePitch = texture_data.RowPitch * 4;
@@ -16374,8 +16374,8 @@ static void test_copy_texture_region(void)
transition_sub_resource_state(command_list, ds.texture, 0,
D3D12_RESOURCE_STATE_DEPTH_WRITE, resource_states[i % ARRAY_SIZE(resource_states)]);
- dst_texture = create_texture(device, 32, 32, DXGI_FORMAT_R32_FLOAT,
- D3D12_RESOURCE_STATE_COPY_DEST);
+ dst_texture = create_default_texture(device, 32, 32, DXGI_FORMAT_R32_FLOAT,
+ 0, D3D12_RESOURCE_STATE_COPY_DEST);
ID3D12Device_CreateShaderResourceView(device, dst_texture, NULL,
ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap));
@@ -16631,8 +16631,8 @@ static void test_separate_bindings(void)
transition_resource_state(command_list, ps_raw_uav_buffer,
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- cs_textures[0] = create_texture(device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ cs_textures[0] = create_default_texture(device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &cs_data;
data.RowPitch = sizeof(cs_data);
data.SlicePitch = data.RowPitch;
@@ -16650,8 +16650,8 @@ static void test_separate_bindings(void)
transition_resource_state(command_list, cs_textures[1],
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- ps_textures[0] = create_texture(device,
- 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D12_RESOURCE_STATE_COPY_DEST);
+ ps_textures[0] = create_default_texture(device,
+ 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_RESOURCE_STATE_COPY_DEST);
data.pData = &ps_data;
data.RowPitch = sizeof(ps_data);
data.SlicePitch = data.RowPitch;
diff --git a/tests/vkd3d_d3d12_test.h b/tests/vkd3d_d3d12_test.h
index 2ebb58f997b3..67e4ddb3aae2 100644
--- a/tests/vkd3d_d3d12_test.h
+++ b/tests/vkd3d_d3d12_test.h
@@ -319,7 +319,6 @@ static void check_sub_resource_uint_(unsigned int line, ID3D12Resource *texture,
}
#define create_default_texture(a, b, c, d, e, f) create_default_texture2d_(__LINE__, a, b, c, 1, 1, d, e, f)
-#define create_texture(a, b, c, d, e) create_default_texture(a, b, c, d, 0, e)
#define create_default_texture2d(a, b, c, d, e, f, g, h) create_default_texture2d_(__LINE__, a, b, c, d, e, f, g, h)
static ID3D12Resource *create_default_texture2d_(unsigned int line, ID3D12Device *device,
unsigned int width, unsigned int height, unsigned int array_size, unsigned int miplevel_count,
--
2.16.4
June 28, 2018
Re: Bug #45385 related to keyboard and probably wineserver - where to start the search
by Kai Krakow
Hello again!
2018-06-28 8:56 GMT+02:00 Kai Krakow <kai(a)kaishome.de>:
> Hello!
>
> 2018-06-27 21:14 GMT+02:00 Alex Henrie <alexhenrie24(a)gmail.com>:
>> On Wed, Jun 27, 2018 at 11:24 AM John Found <johnfound(a)asm32.info> wrote:
>>>
>>> While reading the code in wineX11.drv/keyboard.c I noticed the following fragment from the function X11DRV_KeymapNotify:
>>>
>>> for (vkey = VK_LSHIFT; vkey <= VK_RMENU; vkey++)
>>> {
>>> int m = vkey - VK_LSHIFT;
>>> >>> if (modifiers[m].vkey && !(keystate[vkey] & 0x80) != !modifiers[m].pressed)
>>> {
>>> TRACE( "Adjusting state for vkey %#.2x. State before %#.2x\n",
>>> modifiers[m].vkey, keystate[vkey]);
>>>
>>> update_key_state( keystate, vkey, modifiers[m].pressed );
>>> changed = TRUE;
>>> }
>>> }
>>>
>>> Can someone explain what the condition pointed by >>> is doing? (Unfortunately, my C skills are pretty low...)
>>>
>>> Why not simply "(modifiers[m].vkey && (keystate[vkey] & 0x80) != modifiers[m].pressed)"?
>>
>> I don't immediately know what this if statement is for, but I can tell
>> you that the ! operator converts a value of zero to 1 and a nonzero
>> value to 0. So, if keystate[vkey] & 0x80 is 0 then
>> modifiers[m].pressed must be nonzero and vice versa.
>
> I always was under the impression that the bang operator does a binary
> inversion of the value. Thus, it would convert 0x7F to 0x80. This also
> means it would convert 0x00 (signed) to 0xFF (signed) which turns 0
> into -1, not 1.
>
> But however it works, this code is not working in any obvious way and
> should maybe be rewritten.
>
> Just my two cents.
I just looked it up, the bang operator seems to be a logical (not
binary) operator in C99:
https://stackoverflow.com/questions/3661751/what-is-0-in-c
According to this, I question how the code above is supposed to work
in the first place because "!modifiers[m].pressed" would always be 0
or 1, and it is compared to 0 or 0x80. This is exploiting implicit
behavior which is almost always a bad thing to do if you need to
understand code later.
Regards,
Kai
June 28, 2018
Re: Bug #45385 related to keyboard and probably wineserver - where to start the search
by Kai Krakow
Hello!
2018-06-27 21:14 GMT+02:00 Alex Henrie <alexhenrie24(a)gmail.com>:
> On Wed, Jun 27, 2018 at 11:24 AM John Found <johnfound(a)asm32.info> wrote:
>>
>> While reading the code in wineX11.drv/keyboard.c I noticed the following fragment from the function X11DRV_KeymapNotify:
>>
>> for (vkey = VK_LSHIFT; vkey <= VK_RMENU; vkey++)
>> {
>> int m = vkey - VK_LSHIFT;
>> >>> if (modifiers[m].vkey && !(keystate[vkey] & 0x80) != !modifiers[m].pressed)
>> {
>> TRACE( "Adjusting state for vkey %#.2x. State before %#.2x\n",
>> modifiers[m].vkey, keystate[vkey]);
>>
>> update_key_state( keystate, vkey, modifiers[m].pressed );
>> changed = TRUE;
>> }
>> }
>>
>> Can someone explain what the condition pointed by >>> is doing? (Unfortunately, my C skills are pretty low...)
>>
>> Why not simply "(modifiers[m].vkey && (keystate[vkey] & 0x80) != modifiers[m].pressed)"?
>
> I don't immediately know what this if statement is for, but I can tell
> you that the ! operator converts a value of zero to 1 and a nonzero
> value to 0. So, if keystate[vkey] & 0x80 is 0 then
> modifiers[m].pressed must be nonzero and vice versa.
I always was under the impression that the bang operator does a binary
inversion of the value. Thus, it would convert 0x7F to 0x80. This also
means it would convert 0x00 (signed) to 0xFF (signed) which turns 0
into -1, not 1.
But however it works, this code is not working in any obvious way and
should maybe be rewritten.
Just my two cents.
Regards,
Kai
June 28, 2018
[PATCH v2 2/2] dwrite: Test GetMetrics with custom fontcollection
by Lucian Poston
Signed-off-by: Lucian Poston <lucianposton(a)pm.me>
---
dlls/dwrite/tests/layout.c | 278 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 278 insertions(+)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 4198b8a1b1..7542cad8d7 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4489,6 +4489,7 @@ static void test_SetWordWrapping(void)
/* Collection dedicated to fallback testing */
static const WCHAR g_blahfontW[] = {'B','l','a','h',0};
+static const WCHAR g_fontNotInCollectionW[] = {'n','o','t','B','l','a','h',0};
static HRESULT WINAPI fontcollection_QI(IDWriteFontCollection *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IDWriteFontCollection) || IsEqualIID(riid, &IID_IUnknown)) {
@@ -4548,6 +4549,9 @@ static HRESULT WINAPI fontcollection_FindFamilyName(IDWriteFontCollection *iface
*index = 123456;
*exists = TRUE;
return S_OK;
+ } else if (!lstrcmpW(name, g_fontNotInCollectionW)) {
+ *exists = FALSE;
+ return S_OK;
}
ok(0, "unexpected call, name %s\n", wine_dbgstr_w(name));
return E_NOTIMPL;
@@ -5568,6 +5572,279 @@ static void test_GetOverhangMetrics(void)
IDWriteFactory_Release(factory);
}
+static void test_GetMetrics_with_custom_fontcollection(void)
+{
+ static const WCHAR emptystringW[] = {0};
+ static const WCHAR mappedW[] = {'a','b','c','d',0};
+ static const WCHAR notmappedW[] = {'a',0xffff,'b',0}; // u+ffff = not a unicode character
+ DWRITE_CLUSTER_METRICS clusters[4];
+ DWRITE_TEXT_METRICS metrics;
+ IDWriteTextFormat *format;
+ IDWriteTextLayout *layout;
+ IDWriteFactory *factory;
+ UINT32 count, i;
+ FLOAT width;
+ HRESULT hr;
+
+ factory = create_factory();
+
+ /* font is in font collection */
+ hr = IDWriteFactory_CreateTextFormat(factory, g_blahfontW, &fallbackcollection,
+ 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);
+
+ /* text is mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, mappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* text is not mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, notmappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* zero-length empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 0, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ IDWriteTextFormat_Release(format);
+
+ /* font not in font collection */
+ hr = IDWriteFactory_CreateTextFormat(factory, g_fontNotInCollectionW, &fallbackcollection,
+ 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);
+
+ /* text is mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, mappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* text is not mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, notmappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* zero-length empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 0, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ IDWriteTextFormat_Release(format);
+
+ IDWriteFactory_Release(factory);
+}
+
START_TEST(layout)
{
IDWriteFactory *factory;
@@ -5601,6 +5878,7 @@ START_TEST(layout)
test_SetFontStretch();
test_SetStrikethrough();
test_GetMetrics();
+ test_GetMetrics_with_custom_fontcollection();
test_SetFlowDirection();
test_SetDrawingEffect();
test_GetLineMetrics();
--
2.16.4
June 28, 2018
[PATCH v2 1/2] dwrite: Test IDWriteTextFormat with nonexistent font
by Lucian Poston
Signed-off-by: Lucian Poston <lucianposton(a)pm.me>
---
dlls/dwrite/tests/layout.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 652f6b78ac..4198b8a1b1 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -30,6 +30,7 @@
#include "wine/test.h"
static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0};
+static const WCHAR nonExistentFontW[] = {'B','l','a','h','!',0};
static const WCHAR enusW[] = {'e','n','-','u','s',0};
struct testanalysissink
@@ -3292,6 +3293,51 @@ todo_wine
ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
IDWriteTextLayout_Release(layout);
+ IDWriteTextFormat_Release(format);
+
+ /* nonexistent font */
+ hr = IDWriteFactory_CreateTextFormat(factory, nonExistentFontW, 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_CreateTextLayout(factory, strW, 4, format, 500.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ count = 0;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+todo_wine
+ ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth);
+todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+
+ IDWriteTextLayout_Release(layout);
+
IDWriteTextFormat_Release(format);
IDWriteFactory_Release(factory);
}
--
2.16.4
June 28, 2018
Re: [PATCH 1/2] dwrite: Test IDWriteTextFormat with nonexistent font
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39429
Your paranoid android.
=== build (build) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Build: Patch failed to apply
=== debian9 (win32) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Task: Patch failed to apply
June 28, 2018
Re: [PATCH 2/2] dwrite: Test GetMetrics with custom fontcollection
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39428
Your paranoid android.
=== build (build) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Build: Patch failed to apply
=== debian9 (win32) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Task: Patch failed to apply
June 28, 2018
[PATCH 2/2] dwrite: Test GetMetrics with custom fontcollection
by Lucian Poston
Signed-off-by: Lucian Poston <lucianposton(a)pm.me>
---
dlls/dwrite/tests/layout.c | 278 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 278 insertions(+)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index ac36aff5b5..2b665fd74e 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4491,6 +4491,7 @@ static void test_SetWordWrapping(void)
/* Collection dedicated to fallback testing */
static const WCHAR g_blahfontW[] = {'B','l','a','h',0};
+static const WCHAR g_fontNotInCollectionW[] = {'n','o','t','B','l','a','h',0};
static HRESULT WINAPI fontcollection_QI(IDWriteFontCollection *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IDWriteFontCollection) || IsEqualIID(riid, &IID_IUnknown)) {
@@ -4550,6 +4551,9 @@ static HRESULT WINAPI fontcollection_FindFamilyName(IDWriteFontCollection *iface
*index = 123456;
*exists = TRUE;
return S_OK;
+ } else if (!lstrcmpW(name, g_fontNotInCollectionW)) {
+ *exists = FALSE;
+ return S_OK;
}
ok(0, "unexpected call, name %s\n", wine_dbgstr_w(name));
return E_NOTIMPL;
@@ -5570,6 +5574,279 @@ static void test_GetOverhangMetrics(void)
IDWriteFactory_Release(factory);
}
+static void test_GetMetrics_with_custom_fontcollection(void)
+{
+ static const WCHAR emptystringW[] = {0};
+ static const WCHAR mappedW[] = {'a','b','c','d',0};
+ static const WCHAR notmappedW[] = {'a',0xffff,'b',0}; // u+ffff = not a unicode character
+ DWRITE_CLUSTER_METRICS clusters[4];
+ DWRITE_TEXT_METRICS metrics;
+ IDWriteTextFormat *format;
+ IDWriteTextLayout *layout;
+ IDWriteFactory *factory;
+ UINT32 count, i;
+ FLOAT width;
+ HRESULT hr;
+
+ factory = create_factory();
+
+ /* font is in font collection */
+ hr = IDWriteFactory_CreateTextFormat(factory, g_blahfontW, &fallbackcollection,
+ 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);
+
+ /* text is mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, mappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* text is not mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, notmappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* zero-length empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 0, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ IDWriteTextFormat_Release(format);
+
+ /* font not in font collection */
+ hr = IDWriteFactory_CreateTextFormat(factory, g_fontNotInCollectionW, &fallbackcollection,
+ 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);
+
+ /* text is mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, mappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* text is not mapped by fontfallback */
+ hr = IDWriteFactory_CreateTextLayout(factory, notmappedW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 4, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(count == 4, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ /* zero-length empty string */
+ hr = IDWriteFactory_CreateTextLayout(factory, emptystringW, 0, format, 1000.0, 1000.0, &layout);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ count = 9999;
+ hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ for (i = 0, width = 0.0; i < count; i++)
+ width += clusters[i].width;
+ memset(&metrics, 0xcc, sizeof(metrics));
+ hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
+ todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ todo_wine
+ ok(metrics.left == 0.0, "got %.2f\n", metrics.left);
+ todo_wine
+ ok(metrics.top == 0.0, "got %.2f\n", metrics.top);
+ todo_wine
+ ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width);
+ todo_wine
+ ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n",
+ metrics.widthIncludingTrailingWhitespace, width);
+ todo_wine
+ ok(metrics.height > 0.0, "got %.2f\n", metrics.height);
+ todo_wine
+ ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth);
+ todo_wine
+ ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight);
+ todo_wine
+ ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth);
+ todo_wine
+ ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
+ IDWriteTextLayout_Release(layout);
+
+ IDWriteTextFormat_Release(format);
+
+ IDWriteFactory_Release(factory);
+}
+
START_TEST(layout)
{
IDWriteFactory *factory;
@@ -5603,6 +5880,7 @@ START_TEST(layout)
test_SetFontStretch();
test_SetStrikethrough();
test_GetMetrics();
+ test_GetMetrics_with_custom_fontcollection();
test_SetFlowDirection();
test_SetDrawingEffect();
test_GetLineMetrics();
--
2.16.4
June 28, 2018
Re: [PATCH 1/2] dwrite: Test IDWriteTextFormat with nonexistent font
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39427
Your paranoid android.
=== build (build) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Build: Patch failed to apply
=== debian9 (win32) ===
error: patch failed: dlls/dwrite/tests/layout.c:32
Task: Patch failed to apply
June 28, 2018