On Thu, 7 Jan 2021 at 20:44, RĂ©mi Bernon rbernon@codeweavers.com wrote:
+#define init_test(a, b, c, d, e) init_test_(__LINE__, a, b, c, d, e) +static BOOL init_test_(int line, IDXGIDevice **device, HWND *window, IDXGISwapChain **swapchain, IDXGISurface **surface, ID2D1RenderTarget **rt) +{
- HRESULT hr;
- if (!(*device = create_device()))
- {
skip_(__FILE__, line)("Failed to create device, skipping tests.\n");
return FALSE;
- }
- *window = create_window();
- *swapchain = create_swapchain(*device, *window, TRUE);
- hr = IDXGISwapChain_GetBuffer(*swapchain, 0, &IID_IDXGISurface, (void **)surface);
- ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
- *rt = create_render_target(*surface);
- ok_(__FILE__, line)(!!*rt, "Failed to create render target.\n");
- return TRUE;
+}
We do something fairly similar with init_test_test_context() in d3d11 and d3d10core. It would probably make sense to adopt the same scheme here. (I.e., introduce struct d2d1_test_context, init_test_context(), release_test_context().) That may also make most of patch 1/4 in this series go away.