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
September 2018
- 70 participants
- 1549 messages
[PATCH v2 1/2] comctl32/listbox: Fix InitStorage heap extension
by Gabriel Ivăncescu
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v2: Assume LB_ARRAY_GRANULARITY is a power of 2 and note it in the comments.
Only increase the item array if we actually have to. Previously, sending
for example just 1 to nb_items repeatedly would always increase the array
by LB_ARRAY_GRANULARITY, even if there was plenty of space.
dlls/comctl32/listbox.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 2137ef8..5c171ab 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -41,7 +41,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(listbox);
-/* Items array granularity */
+/* Items array granularity; must be a power of 2 */
#define LB_ARRAY_GRANULARITY 16
/* Scrolling timeout in ms */
@@ -673,16 +673,18 @@ static LRESULT LISTBOX_InitStorage( LB_DESCR *descr, INT nb_items )
{
LB_ITEMDATA *item;
- nb_items += LB_ARRAY_GRANULARITY - 1;
- nb_items -= (nb_items % LB_ARRAY_GRANULARITY);
if (descr->items) {
- nb_items += HeapSize( GetProcessHeap(), 0, descr->items ) / sizeof(*item);
- item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
- nb_items * sizeof(LB_ITEMDATA));
+ nb_items += descr->nb_items;
+ if (nb_items > HeapSize(GetProcessHeap(), 0, descr->items) / sizeof(*item))
+ {
+ UINT n = (nb_items + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1);
+ item = HeapReAlloc(GetProcessHeap(), 0, descr->items, n * sizeof(*item));
+ }
+ else return LB_OKAY;
}
else {
- item = HeapAlloc( GetProcessHeap(), 0,
- nb_items * sizeof(LB_ITEMDATA));
+ UINT n = (nb_items + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1);
+ item = HeapAlloc(GetProcessHeap(), 0, n * sizeof(*item));
}
if (!item)
--
1.9.1
Sept. 19, 2018
Re: [PATCH 2/3] dxgi/tests: Add test for swapchain window styles.
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=42264
Your paranoid android.
=== wvistau64_zh_CN (32 bit Windows report) ===
dxgi:
dxgi.c:4467: Test failed: Expected message 0x47.
Sept. 19, 2018
Re: [PATCH 1/2] winhttp: Modify index only if query_headers succeeded.
by Jacek Caban
On 09/19/2018 04:58 PM, Marvin wrote:
> 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=42260
>
> Your paranoid android.
>
>
> === w2003std (32 bit Windows report) ===
>
> winhttp:
> winhttp.c:4084: Test failed: got 80072f0d
>
> === wvistau64_he (32 bit Windows report) ===
>
> winhttp:
> winhttp.c:2431: Test failed: failed to receive response 12152
> winhttp.c:2436: Test failed: failed to query status code 12019
> winhttp.c:2437: Test failed: request failed unexpectedly 3735928559
> winhttp.c:2452: Test failed: failed to query for raw headers: 12019
> winhttp.c:2453: Test failed: WinHttpQueryHeaders returned invalid end of header string
> winhttp.c:2459: Test failed: failed to query for raw headers: 12019
> winhttp.c:2460: Test failed: WinHttpQueryHeaders returned invalid end of header string
> winhttp.c:2462: Test failed: returned string has too many NULL characters
> winhttp.c:2467: Test failed: failed to read data 12019
> winhttp.c:2468: Test failed: count was wrong
> winhttp.c:2469: Test failed: http data wrong
Those are already existing failures.
Jacek
Sept. 19, 2018
Re: [PATCH 3/4] msi/tests: Also test full range of properties for MsiSummaryInfoSetPropertyW.
by Zebediah Figura
On 19/09/18 09:15, Francois Gouget wrote:
> On Wed, 19 Sep 2018, Hans Leidekker wrote:
> [...]
>> This is causing new test failures. The testbot fails recognize them
>> however, probably because they come from custom.c instead of the test
>> module that was invoked, install.c.
> I don't know how to improve handling of these cases.
> * The simplest for me would be if they issued 'install' errors instead
> but that would be confusing since the error does not come from
> install.c. So that's out.
Besides which it's used from multiple test units (action.c). Possibly it
shouldn't be, but I think the below proposed solution seems much better.
>
> * Maybe add a new type of line to tie custom messages to the install
> test unit?
>
> 0b40:install: Loading custom sub test unit.
>
>
Sept. 19, 2018
Re: [PATCH 2/2] user32/listbox: Optimize SetCount partly
by Huw Davies
> On 19 Sep 2018, at 15:35, Gabriel Ivăncescu <gabrielopcode(a)gmail.com> wrote:
>
> On Wed, Sep 19, 2018 at 4:53 PM, Huw Davies <huw(a)codeweavers.com> wrote:
>>
>> I think implementing LBS_NODATA should come before adding LB_SETCOUNT
>> code that will need to be changed again. Also, adding a test to
>> show that LB_SETCOUNT fails if the style is LBS_OWNERDRAWFIXED, for
>> example, wouldn't hurt.
> BTW I think you meant OWNERDRAWVARIABLE right? LBS_OWNERDRAWFIXED
> should work (and is actually required) for LBS_NODATA (and thus,
> LB_SETCOUNT), or I'm missing something.
I just meant using the current test for LB_SETCOUNT and removing
the LBS_NODATA, which leaves LBS_OWNERDRAWFIXED on its own.
Huw.
Sept. 19, 2018
Re: [PATCH 2/2] winhttp: Set last error in WinHttpQueryAuthSchemes when no auth scheme is found.
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=42261
Your paranoid android.
=== w2003std (32 bit Windows report) ===
winhttp:
winhttp.c:4084: Test failed: got 80072f0d
Sept. 19, 2018
Re: [PATCH 1/2] winhttp: Modify index only if query_headers succeeded.
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=42260
Your paranoid android.
=== w2003std (32 bit Windows report) ===
winhttp:
winhttp.c:4084: Test failed: got 80072f0d
=== wvistau64_he (32 bit Windows report) ===
winhttp:
winhttp.c:2431: Test failed: failed to receive response 12152
winhttp.c:2436: Test failed: failed to query status code 12019
winhttp.c:2437: Test failed: request failed unexpectedly 3735928559
winhttp.c:2452: Test failed: failed to query for raw headers: 12019
winhttp.c:2453: Test failed: WinHttpQueryHeaders returned invalid end of header string
winhttp.c:2459: Test failed: failed to query for raw headers: 12019
winhttp.c:2460: Test failed: WinHttpQueryHeaders returned invalid end of header string
winhttp.c:2462: Test failed: returned string has too many NULL characters
winhttp.c:2467: Test failed: failed to read data 12019
winhttp.c:2468: Test failed: count was wrong
winhttp.c:2469: Test failed: http data wrong
Sept. 19, 2018
[PATCH 3/3] dxgi/tests: Avoid "skipping tests" in skip() messages.
by Józef Kucia
skip() prints "Tests skipped:".
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/dxgi/tests/dxgi.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 62070e0bcf20..d1908ac1c2b8 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -643,7 +643,7 @@ static void test_adapter_desc(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -884,7 +884,7 @@ static void test_create_surface(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -922,7 +922,7 @@ static void test_parents(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -947,7 +947,7 @@ static void test_parents(void)
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
if (hr == DXGI_ERROR_NOT_FOUND)
{
- skip("Adapter has not outputs, skipping output tests.\n");
+ skip("Adapter has not outputs.\n");
}
else
{
@@ -990,7 +990,7 @@ static void test_output(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -1000,7 +1000,7 @@ static void test_output(void)
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
if (hr == DXGI_ERROR_NOT_FOUND)
{
- skip("Adapter doesn't have any outputs, skipping tests.\n");
+ skip("Adapter doesn't have any outputs.\n");
IDXGIAdapter_Release(adapter);
IDXGIDevice_Release(device);
return;
@@ -1076,7 +1076,7 @@ static void test_output(void)
}
else
{
- skip("Not enough modes for test, skipping.\n");
+ skip("Not enough modes for test.\n");
}
heap_free(modes);
@@ -1308,7 +1308,7 @@ static void test_create_swapchain(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -2916,7 +2916,7 @@ static void test_private_data(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
@@ -3489,7 +3489,7 @@ static void test_swapchain_parameters(void)
if (!(device = create_device(0)))
{
- skip("Failed to create device, skipping tests.\n");
+ skip("Failed to create device.\n");
return;
}
window = CreateWindowA("static", "dxgi_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
--
2.16.4
Sept. 19, 2018
[PATCH 2/3] dxgi/tests: Add test for swapchain window styles.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/dxgi/tests/dxgi.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 140 insertions(+)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 8c41eab41cfe..62070e0bcf20 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -4480,6 +4480,145 @@ done:
UnregisterClassA("dxgi_test_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_swapchain_window_styles(void)
+{
+ LONG style, exstyle, fullscreen_style, fullscreen_exstyle;
+ DXGI_SWAP_CHAIN_DESC swapchain_desc;
+ IDXGISwapChain *swapchain;
+ IDXGIFactory *factory;
+ IDXGIAdapter *adapter;
+ IDXGIDevice *device;
+ ULONG refcount;
+ unsigned int i;
+ HRESULT hr;
+
+ static const struct
+ {
+ LONG style, exstyle;
+ LONG expected_style, expected_exstyle;
+ }
+ tests[] =
+ {
+ {WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0,
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPSIBLINGS,
+ WS_EX_WINDOWEDGE},
+ {WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE, 0,
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPSIBLINGS | WS_VISIBLE,
+ WS_EX_WINDOWEDGE},
+ {WS_OVERLAPPED | WS_VISIBLE, 0,
+ WS_OVERLAPPED | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION, WS_EX_WINDOWEDGE},
+ {WS_CAPTION | WS_DISABLED, WS_EX_TOPMOST,
+ WS_CAPTION | WS_DISABLED | WS_CLIPSIBLINGS, WS_EX_TOPMOST | WS_EX_WINDOWEDGE},
+ {WS_CAPTION | WS_DISABLED | WS_VISIBLE, WS_EX_TOPMOST,
+ WS_CAPTION | WS_DISABLED | WS_VISIBLE | WS_CLIPSIBLINGS, WS_EX_TOPMOST | WS_EX_WINDOWEDGE},
+ {WS_CAPTION | WS_SYSMENU | WS_VISIBLE, WS_EX_APPWINDOW,
+ WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_CLIPSIBLINGS, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE},
+ };
+
+ if (!(device = create_device(0)))
+ {
+ skip("Failed to create device.\n");
+ return;
+ }
+
+ hr = IDXGIDevice_GetAdapter(device, &adapter);
+ ok(hr == S_OK, "Failed to get adapter, hr %#x.\n", hr);
+ hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
+ ok(hr == S_OK, "Failed to get parent, hr %#x.\n", hr);
+ IDXGIAdapter_Release(adapter);
+
+ swapchain_desc.BufferDesc.Width = 800;
+ swapchain_desc.BufferDesc.Height = 600;
+ swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
+ swapchain_desc.BufferDesc.RefreshRate.Denominator = 60;
+ swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ swapchain_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+ swapchain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
+ swapchain_desc.SampleDesc.Count = 1;
+ swapchain_desc.SampleDesc.Quality = 0;
+ swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ swapchain_desc.BufferCount = 1;
+ swapchain_desc.Windowed = TRUE;
+ swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+ swapchain_desc.Flags = 0;
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ swapchain_desc.OutputWindow = CreateWindowExA(tests[i].exstyle, "static", "dxgi_test",
+ tests[i].style, 0, 0, 400, 200, 0, 0, 0, 0);
+
+ style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
+ exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
+ ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
+ i, style, tests[i].expected_style);
+ ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
+ i, exstyle, tests[i].expected_exstyle);
+
+ fullscreen_style = tests[i].expected_style & (WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS);
+ fullscreen_exstyle = (tests[i].expected_exstyle & WS_EX_APPWINDOW) | WS_EX_TOPMOST;
+
+ hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
+ ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr);
+
+ style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
+ exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
+ ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
+ i, style, tests[i].expected_style);
+ ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
+ i, exstyle, tests[i].expected_exstyle);
+
+ hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
+ ok(hr == S_OK || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
+ || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
+ "Failed to set fullscreen state, hr %#x.\n", hr);
+ if (SUCCEEDED(hr))
+ {
+ style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
+ exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
+ todo_wine
+ ok(style == fullscreen_style, "Test %u: Got style %#x, expected %#x.\n",
+ i, style, fullscreen_style);
+ ok(exstyle == fullscreen_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
+ i, exstyle, fullscreen_exstyle);
+
+ hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ }
+ else
+ {
+ skip("Test %u: Could not change fullscreen state.\n", i);
+ }
+
+ style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
+ exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
+ todo_wine_if(!(tests[i].expected_style & WS_VISIBLE))
+ ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
+ i, style, tests[i].expected_style);
+ todo_wine_if(!(tests[i].expected_exstyle & WS_EX_TOPMOST))
+ ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
+ i, exstyle, tests[i].expected_exstyle);
+
+ refcount = IDXGISwapChain_Release(swapchain);
+ ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
+
+ style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
+ exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
+ todo_wine_if(!(tests[i].expected_style & WS_VISIBLE))
+ ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
+ i, style, tests[i].expected_style);
+ todo_wine_if(!(tests[i].expected_exstyle & WS_EX_TOPMOST))
+ ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
+ i, exstyle, tests[i].expected_exstyle);
+
+ DestroyWindow(swapchain_desc.OutputWindow);
+ }
+
+ refcount = IDXGIDevice_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ refcount = IDXGIFactory_Release(factory);
+ ok(!refcount, "Factory has %u references left.\n", refcount);
+}
+
static void run_on_d3d10(void (*test_func)(IUnknown *device, BOOL is_d3d12))
{
IDXGIDevice *device;
@@ -4574,6 +4713,7 @@ START_TEST(dxgi)
test_inexact_modes();
test_swapchain_parameters();
test_swapchain_window_messages();
+ test_swapchain_window_styles();
run_on_d3d10(test_swapchain_resize);
run_on_d3d10(test_swapchain_backbuffer_index);
run_on_d3d10(test_swapchain_formats);
--
2.16.4
Sept. 19, 2018
[PATCH 1/3] dxgi/tests: Add test for swapchain window messages.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
With some tweaks wined3d passes the test.
---
dlls/dxgi/tests/dxgi.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 273 insertions(+), 3 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 9ab247254922..8c41eab41cfe 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -2152,9 +2152,9 @@ static void test_set_fullscreen(void)
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
check_swapchain_fullscreen_state(swapchain, &initial_state);
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
- ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE ||
- broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
- "SetFullscreenState failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
+ || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
+ "SetFullscreenState failed, hr %#x.\n", hr);
if (FAILED(hr))
{
skip("Could not change fullscreen state.\n");
@@ -4211,6 +4211,275 @@ static void test_object_wrapping(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
}
+/* try to make sure pending X events have been processed before continuing */
+static void flush_events(void)
+{
+ int diff = 200;
+ DWORD time;
+ MSG msg;
+
+ time = GetTickCount() + diff;
+ while (diff > 0)
+ {
+ if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) == WAIT_TIMEOUT)
+ break;
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
+ diff = time - GetTickCount();
+ }
+}
+
+struct message
+{
+ unsigned int message;
+ BOOL check_wparam;
+ WPARAM expect_wparam;
+};
+
+static BOOL expect_no_messages;
+static const struct message *expect_messages;
+static const struct message *expect_messages_broken;
+
+static BOOL check_message(const struct message *expected,
+ HWND hwnd, unsigned int message, WPARAM wparam, LPARAM lparam)
+{
+ if (expected->message != message)
+ return FALSE;
+
+ if (expected->check_wparam)
+ {
+ ok(wparam == expected->expect_wparam,
+ "Got unexpected wparam %lx for message %x, expected %lx.\n",
+ wparam, message, expected->expect_wparam);
+ }
+
+ return TRUE;
+}
+
+static LRESULT CALLBACK test_wndproc(HWND hwnd, unsigned int message, WPARAM wparam, LPARAM lparam)
+{
+ ok(!expect_no_messages, "Got unexpected message %#x, hwnd %p, wparam %#lx, lparam %#lx.\n",
+ message, hwnd, wparam, lparam);
+
+ if (expect_messages)
+ {
+ if (check_message(expect_messages, hwnd, message, wparam, lparam))
+ ++expect_messages;
+ }
+
+ if (expect_messages_broken)
+ {
+ if (check_message(expect_messages_broken, hwnd, message, wparam, lparam))
+ ++expect_messages_broken;
+ }
+
+ return DefWindowProcA(hwnd, message, wparam, lparam);
+}
+
+static void test_swapchain_window_messages(void)
+{
+ DXGI_SWAP_CHAIN_DESC swapchain_desc;
+ IDXGISwapChain *swapchain;
+ DXGI_MODE_DESC mode_desc;
+ IDXGIFactory *factory;
+ IDXGIAdapter *adapter;
+ IDXGIDevice *device;
+ ULONG refcount;
+ WNDCLASSA wc;
+ HWND window;
+ HRESULT hr;
+
+ static const struct message enter_fullscreen_messages[] =
+ {
+ {WM_STYLECHANGING, TRUE, GWL_STYLE},
+ {WM_STYLECHANGED, TRUE, GWL_STYLE},
+ {WM_STYLECHANGING, TRUE, GWL_EXSTYLE},
+ {WM_STYLECHANGED, TRUE, GWL_EXSTYLE},
+ {WM_WINDOWPOSCHANGING, FALSE, 0},
+ {WM_GETMINMAXINFO, FALSE, 0},
+ {WM_NCCALCSIZE, FALSE, 0},
+ {WM_WINDOWPOSCHANGED, FALSE, 0},
+ {WM_MOVE, FALSE, 0},
+ {WM_SIZE, FALSE, 0},
+ {0, FALSE, 0},
+ };
+ static const struct message enter_fullscreen_messages_vista[] =
+ {
+ {WM_STYLECHANGING, TRUE, GWL_STYLE},
+ {WM_STYLECHANGED, TRUE, GWL_STYLE},
+ {WM_WINDOWPOSCHANGING, FALSE, 0},
+ {WM_NCCALCSIZE, FALSE, 0},
+ {WM_WINDOWPOSCHANGED, FALSE, 0},
+ {WM_MOVE, FALSE, 0},
+ {WM_SIZE, FALSE, 0},
+ {WM_STYLECHANGING, TRUE, GWL_EXSTYLE},
+ {WM_STYLECHANGED, TRUE, GWL_EXSTYLE},
+ {WM_WINDOWPOSCHANGING, FALSE, 0},
+ {WM_GETMINMAXINFO, FALSE, 0},
+ {WM_NCCALCSIZE, FALSE, 0},
+ {WM_WINDOWPOSCHANGED, FALSE, 0},
+ {WM_SIZE, FALSE, 0},
+ {0, FALSE, 0},
+ };
+ static const struct message leave_fullscreen_messages[] =
+ {
+ {WM_STYLECHANGING, TRUE, GWL_STYLE},
+ {WM_STYLECHANGED, TRUE, GWL_STYLE},
+ {WM_STYLECHANGING, TRUE, GWL_EXSTYLE},
+ {WM_STYLECHANGED, TRUE, GWL_EXSTYLE},
+ {WM_WINDOWPOSCHANGING, FALSE, 0},
+ {WM_GETMINMAXINFO, FALSE, 0},
+ {WM_NCCALCSIZE, FALSE, 0},
+ {WM_WINDOWPOSCHANGED, FALSE, 0},
+ {WM_MOVE, FALSE, 0},
+ {WM_SIZE, FALSE, 0},
+ {0, FALSE, 0},
+ };
+ static const struct message resize_target_messages[] =
+ {
+ {WM_WINDOWPOSCHANGING, FALSE, 0},
+ {WM_GETMINMAXINFO, FALSE, 0},
+ {WM_NCCALCSIZE, FALSE, 0},
+ {WM_WINDOWPOSCHANGED, FALSE, 0},
+ {WM_SIZE, FALSE, 0},
+ {0, FALSE, 0},
+ };
+
+ if (!(device = create_device(0)))
+ {
+ skip("Failed to create device.\n");
+ return;
+ }
+
+ memset(&wc, 0, sizeof(wc));
+ wc.lpfnWndProc = test_wndproc;
+ wc.lpszClassName = "dxgi_test_wndproc_wc";
+ ok(RegisterClassA(&wc), "Failed to register window class.\n");
+ window = CreateWindowA("dxgi_test_wndproc_wc", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0);
+ ok(!!window, "Failed to create window.\n");
+
+ hr = IDXGIDevice_GetAdapter(device, &adapter);
+ ok(hr == S_OK, "Failed to get adapter, hr %#x.\n", hr);
+ hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
+ ok(hr == S_OK, "Failed to get parent, hr %#x.\n", hr);
+ IDXGIAdapter_Release(adapter);
+
+ swapchain_desc.BufferDesc.Width = 800;
+ swapchain_desc.BufferDesc.Height = 600;
+ swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
+ swapchain_desc.BufferDesc.RefreshRate.Denominator = 60;
+ swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ swapchain_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+ swapchain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
+ swapchain_desc.SampleDesc.Count = 1;
+ swapchain_desc.SampleDesc.Quality = 0;
+ swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ swapchain_desc.BufferCount = 1;
+ swapchain_desc.OutputWindow = window;
+ swapchain_desc.Windowed = TRUE;
+ swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+ swapchain_desc.Flags = 0;
+
+ /* create swapchain */
+ flush_events();
+ expect_no_messages = TRUE;
+ hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
+ ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr);
+ flush_events();
+ expect_no_messages = FALSE;
+
+ /* resize target */
+ expect_messages = resize_target_messages;
+ memset(&mode_desc, 0, sizeof(mode_desc));
+ mode_desc.Width = 800;
+ mode_desc.Width = 600;
+ hr = IDXGISwapChain_ResizeTarget(swapchain, &mode_desc);
+ ok(hr == S_OK, "Failed to resize target, hr %#x.\n", hr);
+ flush_events();
+ ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
+
+ expect_messages = resize_target_messages;
+ memset(&mode_desc, 0, sizeof(mode_desc));
+ mode_desc.Width = 400;
+ mode_desc.Width = 200;
+ hr = IDXGISwapChain_ResizeTarget(swapchain, &mode_desc);
+ ok(hr == S_OK, "Failed to resize target, hr %#x.\n", hr);
+ flush_events();
+ ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
+
+ /* enter fullscreen */
+ expect_messages = enter_fullscreen_messages;
+ expect_messages_broken = enter_fullscreen_messages_vista;
+ hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
+ ok(hr == S_OK || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
+ || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
+ "Failed to enter fullscreen, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("Could not change fullscreen state.\n");
+ goto done;
+ }
+ flush_events();
+ todo_wine
+ ok(!expect_messages->message || broken(!expect_messages_broken->message),
+ "Expected message %#x or %#x.\n",
+ expect_messages->message, expect_messages_broken->message);
+ expect_messages_broken = NULL;
+
+ /* leave fullscreen */
+ expect_messages = leave_fullscreen_messages;
+ hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ flush_events();
+ todo_wine
+ ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
+ expect_messages = NULL;
+
+ refcount = IDXGISwapChain_Release(swapchain);
+ ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
+
+ /* create fullscreen swapchain */
+ DestroyWindow(window);
+ window = CreateWindowA("dxgi_test_wndproc_wc", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0);
+ ok(!!window, "Failed to create window.\n");
+ swapchain_desc.OutputWindow = window;
+ swapchain_desc.Windowed = FALSE;
+ swapchain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
+ flush_events();
+
+ expect_messages = enter_fullscreen_messages;
+ expect_messages_broken = enter_fullscreen_messages_vista;
+ hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
+ ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr);
+ flush_events();
+ todo_wine
+ ok(!expect_messages->message || broken(!expect_messages_broken->message),
+ "Expected message %#x or %#x.\n",
+ expect_messages->message, expect_messages_broken->message);
+ expect_messages_broken = NULL;
+
+ /* leave fullscreen */
+ expect_messages = leave_fullscreen_messages;
+ hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ flush_events();
+ todo_wine
+ ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
+ expect_messages = NULL;
+
+done:
+ refcount = IDXGISwapChain_Release(swapchain);
+ ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
+ DestroyWindow(window);
+
+ refcount = IDXGIDevice_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ refcount = IDXGIFactory_Release(factory);
+ ok(!refcount, "Factory has %u references left.\n", refcount);
+
+ UnregisterClassA("dxgi_test_wndproc_wc", GetModuleHandleA(NULL));
+}
+
static void run_on_d3d10(void (*test_func)(IUnknown *device, BOOL is_d3d12))
{
IDXGIDevice *device;
@@ -4304,6 +4573,7 @@ START_TEST(dxgi)
test_resize_target();
test_inexact_modes();
test_swapchain_parameters();
+ test_swapchain_window_messages();
run_on_d3d10(test_swapchain_resize);
run_on_d3d10(test_swapchain_backbuffer_index);
run_on_d3d10(test_swapchain_formats);
--
2.16.4
Sept. 19, 2018