Wine-Devel
Threads by month
- ----- 2026 -----
- 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
- 5 participants
- 84534 discussions
[PATCH 04/12] d2d1/tests: Create a swapchain in init_test_context_().
by Henri Verbeet Jan. 15, 2021
by Henri Verbeet Jan. 15, 2021
Jan. 15, 2021
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
v3:
- Swapchain creation is not supposed to fail.
dlls/d2d1/tests/d2d1.c | 118 ++++++++++-------------------------------
1 file changed, 28 insertions(+), 90 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index dd537c53e73..545f5dc20a7 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -46,6 +46,7 @@ struct d2d1_test_context
{
ID3D10Device1 *device;
HWND window;
+ IDXGISwapChain *swapchain;
};
struct resource_readback
@@ -788,6 +789,7 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface)
#define release_test_context(ctx) release_test_context_(__LINE__, ctx)
static void release_test_context_(unsigned int line, struct d2d1_test_context *ctx)
{
+ IDXGISwapChain_Release(ctx->swapchain);
DestroyWindow(ctx->window);
ID3D10Device1_Release(ctx->device);
}
@@ -805,6 +807,8 @@ static BOOL init_test_context_(unsigned int line, struct d2d1_test_context *ctx)
ctx->window = create_window();
ok_(__FILE__, line)(!!ctx->window, "Failed to create test window.\n");
+ ctx->swapchain = create_swapchain(ctx->device, ctx->window, TRUE);
+ ok_(__FILE__, line)(!!ctx->swapchain, "Failed to create swapchain.\n");
return TRUE;
}
@@ -1118,7 +1122,6 @@ static void geometry_sink_check_(unsigned int line, const struct geometry_sink *
static void test_clip(void)
{
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
D2D1_SIZE_U pixel_size;
ID2D1RenderTarget *rt;
@@ -1140,8 +1143,7 @@ static void test_clip(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -1313,7 +1315,6 @@ static void test_clip(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -1324,7 +1325,6 @@ static void test_state_block(void)
ID2D1DrawingStateBlock *state_block;
IDWriteFactory *dwrite_factory;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1Factory1 *factory1;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
@@ -1353,8 +1353,7 @@ static void test_state_block(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -1582,7 +1581,6 @@ static void test_state_block(void)
ID2D1Factory_Release(factory);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -1593,7 +1591,6 @@ static void test_color_brush(void)
D2D1_COLOR_F color, tmp_color;
struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
D2D1_RECT_F rect;
@@ -1604,8 +1601,7 @@ static void test_color_brush(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -1677,7 +1673,6 @@ static void test_color_brush(void)
ID2D1SolidColorBrush_Release(brush);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -1692,7 +1687,6 @@ static void test_bitmap_brush(void)
D2D1_RECT_F src_rect, dst_rect;
struct d2d1_test_context ctx;
D2D1_EXTEND_MODE extend_mode;
- IDXGISwapChain *swapchain;
ID2D1BitmapBrush1 *brush1;
ID2D1BitmapBrush *brush;
D2D1_SIZE_F image_size;
@@ -1739,8 +1733,7 @@ static void test_bitmap_brush(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -2079,7 +2072,6 @@ static void test_bitmap_brush(void)
ok(!refcount, "Bitmap has %u references left.\n", refcount);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -2093,7 +2085,6 @@ static void test_linear_brush(void)
ID2D1LinearGradientBrush *brush;
struct d2d1_test_context ctx;
struct resource_readback rb;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
ID2D1Factory *factory;
@@ -2145,8 +2136,7 @@ static void test_linear_brush(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -2280,7 +2270,6 @@ static void test_linear_brush(void)
ok(!refcount, "Gradient has %u references left.\n", refcount);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -2294,7 +2283,6 @@ static void test_radial_brush(void)
ID2D1RadialGradientBrush *brush;
struct d2d1_test_context ctx;
struct resource_readback rb;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
ID2D1Factory *factory;
@@ -2346,8 +2334,7 @@ static void test_radial_brush(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -2489,7 +2476,6 @@ static void test_radial_brush(void)
ok(!refcount, "Gradient has %u references left.\n", refcount);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -2619,7 +2605,6 @@ static void test_path_geometry(void)
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
ID2D1Geometry *tmp_geometry;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
ID2D1Factory *factory;
@@ -2947,8 +2932,7 @@ static void test_path_geometry(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -3674,7 +3658,6 @@ static void test_path_geometry(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -4009,7 +3992,6 @@ static void test_bitmap_formats(void)
{
D2D1_BITMAP_PROPERTIES bitmap_desc;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
D2D1_SIZE_U size = {4, 4};
ID2D1RenderTarget *rt;
IDXGISurface *surface;
@@ -4043,8 +4025,7 @@ static void test_bitmap_formats(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -4074,7 +4055,6 @@ static void test_bitmap_formats(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -4085,7 +4065,6 @@ static void test_alpha_mode(void)
ID2D1SolidColorBrush *color_brush;
ID2D1BitmapBrush *bitmap_brush;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
@@ -4107,8 +4086,7 @@ static void test_alpha_mode(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -4298,13 +4276,11 @@ static void test_alpha_mode(void)
ID2D1BitmapBrush_Release(bitmap_brush);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
static void test_shared_bitmap(void)
{
- IDXGISwapChain *swapchain1, *swapchain2;
IWICBitmap *wic_bitmap1, *wic_bitmap2;
ID2D1GdiInteropRenderTarget *interop;
D2D1_RENDER_TARGET_PROPERTIES desc;
@@ -4317,6 +4293,7 @@ static void test_shared_bitmap(void)
DXGI_SURFACE_DESC surface_desc;
D2D1_PIXEL_FORMAT pixel_format;
struct d2d1_test_context ctx;
+ IDXGISwapChain *swapchain2;
D2D1_SIZE_U size = {4, 4};
IDXGISurface1 *surface3;
ID3D10Device1 *device2;
@@ -4327,9 +4304,8 @@ static void test_shared_bitmap(void)
return;
window2 = create_window();
- swapchain1 = create_swapchain(ctx.device, ctx.window, TRUE);
swapchain2 = create_swapchain(ctx.device, window2, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain1, 0, &IID_IDXGISurface, (void **)&surface1);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface1);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = IDXGISwapChain_GetBuffer(swapchain2, 0, &IID_IDXGISurface, (void **)&surface2);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -4547,7 +4523,6 @@ static void test_shared_bitmap(void)
IDXGISurface_Release(surface2);
IDXGISurface_Release(surface1);
IDXGISwapChain_Release(swapchain2);
- IDXGISwapChain_Release(swapchain1);
ID3D10Device1_Release(device2);
release_test_context(&ctx);
DestroyWindow(window2);
@@ -4558,7 +4533,6 @@ static void test_bitmap_updates(void)
{
D2D1_BITMAP_PROPERTIES bitmap_desc;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
D2D1_RECT_U dst_rect;
@@ -4580,8 +4554,7 @@ static void test_bitmap_updates(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -4648,7 +4621,6 @@ static void test_bitmap_updates(void)
ID2D1Bitmap_Release(bitmap);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -4659,7 +4631,6 @@ static void test_opacity_brush(void)
ID2D1RectangleGeometry *geometry;
ID2D1SolidColorBrush *color_brush;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
@@ -4683,8 +4654,7 @@ static void test_opacity_brush(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -4824,14 +4794,12 @@ static void test_opacity_brush(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
static void test_create_target(void)
{
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1Factory *factory;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
@@ -4856,8 +4824,7 @@ static void test_create_target(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
@@ -4910,7 +4877,6 @@ static void test_create_target(void)
ID2D1Factory_Release(factory);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -4948,7 +4914,6 @@ static void test_draw_text_layout(void)
{ D2D1_TEXT_ANTIALIAS_MODE_ALIASED, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, E_INVALIDARG },
};
D2D1_RENDER_TARGET_PROPERTIES desc;
- IDXGISwapChain *swapchain;
ID2D1Factory *factory, *factory2;
ID2D1RenderTarget *rt, *rt2;
IDXGISurface *surface;
@@ -4968,8 +4933,7 @@ static void test_draw_text_layout(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
@@ -5075,7 +5039,6 @@ todo_wine
ID2D1Factory_Release(factory);
ID2D1Factory_Release(factory2);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -5838,7 +5801,6 @@ static void test_gradient(void)
ID2D1GradientStopCollection *gradient;
D2D1_GRADIENT_STOP stops[3], stops2[3];
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
D2D1_COLOR_F color;
@@ -5849,8 +5811,7 @@ static void test_gradient(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -5882,7 +5843,6 @@ static void test_gradient(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -5895,7 +5855,6 @@ static void test_draw_geometry(void)
struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
- IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
@@ -5912,8 +5871,7 @@ static void test_draw_geometry(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -6805,7 +6763,6 @@ static void test_draw_geometry(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -6818,7 +6775,6 @@ static void test_fill_geometry(void)
struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
- IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
@@ -6834,8 +6790,7 @@ static void test_fill_geometry(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -7614,7 +7569,6 @@ static void test_fill_geometry(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -7753,7 +7707,6 @@ static void test_layer(void)
{
ID2D1Factory *factory, *layer_factory;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
ID2D1Layer *layer;
@@ -7764,8 +7717,7 @@ static void test_layer(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -7796,7 +7748,6 @@ static void test_layer(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -7806,7 +7757,6 @@ static void test_bezier_intersect(void)
struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
- IDXGISwapChain *swapchain;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
@@ -7819,8 +7769,7 @@ static void test_bezier_intersect(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -7941,7 +7890,6 @@ static void test_bezier_intersect(void)
refcount = ID2D1Factory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
@@ -8219,7 +8167,6 @@ static void test_bitmap_surface(void)
IDXGISurface *surface, *surface2;
D2D1_PIXEL_FORMAT pixel_format;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
IDXGIDevice *dxgi_device;
ID2D1Factory1 *factory;
ID2D1RenderTarget *rt;
@@ -8245,8 +8192,7 @@ static void test_bitmap_surface(void)
}
/* DXGI target */
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -8449,7 +8395,6 @@ static void test_device_context(void)
struct d2d1_test_context ctx;
D2D1_BITMAP_OPTIONS options;
ID2D1DCRenderTarget *dc_rt;
- IDXGISwapChain *swapchain;
IDXGIDevice *dxgi_device;
D2D1_UNIT_MODE unit_mode;
ID2D1Factory1 *factory;
@@ -8497,8 +8442,7 @@ static void test_device_context(void)
ID2D1DeviceContext_Release(device_context);
/* DXGI target */
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -9155,7 +9099,6 @@ static void test_dpi(void)
ID2D1DeviceContext *device_context;
IWICImagingFactory *wic_factory;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
ID2D1Factory1 *factory;
IDXGISurface *surface;
ID2D1Bitmap1 *bitmap;
@@ -9192,8 +9135,7 @@ static void test_dpi(void)
return;
}
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
device_context = create_device_context(factory, ctx.device);
@@ -9363,7 +9305,6 @@ static void test_dpi(void)
ID2D1DeviceContext_Release(device_context);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
ID2D1Factory1_Release(factory);
release_test_context(&ctx);
}
@@ -9372,7 +9313,6 @@ static void test_wic_bitmap_format(void)
{
IWICImagingFactory *wic_factory;
struct d2d1_test_context ctx;
- IDXGISwapChain *swapchain;
D2D1_PIXEL_FORMAT format;
IWICBitmap *wic_bitmap;
ID2D1RenderTarget *rt;
@@ -9396,8 +9336,7 @@ static void test_wic_bitmap_format(void)
if (!init_test_context(&ctx))
return;
- swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
- hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
+ hr = IDXGISwapChain_GetBuffer(ctx.swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
ok(!!rt, "Failed to create render target.\n");
@@ -9430,7 +9369,6 @@ static void test_wic_bitmap_format(void)
CoUninitialize();
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
}
--
2.20.1
2
1
Jan. 15, 2021
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
v3:
- Window creation is not supposed to fail.
dlls/d2d1/tests/d2d1.c | 120 ++++++++++-------------------------------
1 file changed, 29 insertions(+), 91 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index de3755b9674..dd537c53e73 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -45,6 +45,7 @@ size_t mt_tests_size, mt_test_count;
struct d2d1_test_context
{
ID3D10Device1 *device;
+ HWND window;
};
struct resource_readback
@@ -787,6 +788,7 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface)
#define release_test_context(ctx) release_test_context_(__LINE__, ctx)
static void release_test_context_(unsigned int line, struct d2d1_test_context *ctx)
{
+ DestroyWindow(ctx->window);
ID3D10Device1_Release(ctx->device);
}
@@ -801,6 +803,9 @@ static BOOL init_test_context_(unsigned int line, struct d2d1_test_context *ctx)
return FALSE;
}
+ ctx->window = create_window();
+ ok_(__FILE__, line)(!!ctx->window, "Failed to create test window.\n");
+
return TRUE;
}
@@ -1123,7 +1128,6 @@ static void test_clip(void)
float dpi_x, dpi_y;
D2D1_RECT_F rect;
D2D1_SIZE_F size;
- HWND window;
HRESULT hr;
BOOL match;
static const D2D1_MATRIX_3X2_F identity =
@@ -1136,8 +1140,7 @@ static void test_clip(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1312,7 +1315,6 @@ static void test_clip(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_state_block(void)
@@ -1328,7 +1330,6 @@ static void test_state_block(void)
IDXGISurface *surface;
ID2D1Factory *factory;
ULONG refcount;
- HWND window;
HRESULT hr;
static const D2D1_MATRIX_3X2_F identity =
{{{
@@ -1352,8 +1353,7 @@ static void test_state_block(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1584,7 +1584,6 @@ static void test_state_block(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_color_brush(void)
@@ -1599,15 +1598,13 @@ static void test_color_brush(void)
IDXGISurface *surface;
D2D1_RECT_F rect;
float opacity;
- HWND window;
HRESULT hr;
BOOL match;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1682,7 +1679,6 @@ static void test_color_brush(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_bitmap_brush(void)
@@ -1709,7 +1705,6 @@ static void test_bitmap_brush(void)
unsigned int i;
ULONG refcount;
float opacity;
- HWND window;
HRESULT hr;
BOOL match;
@@ -1744,8 +1739,7 @@ static void test_bitmap_brush(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2087,7 +2081,6 @@ static void test_bitmap_brush(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_linear_brush(void)
@@ -2110,7 +2103,6 @@ static void test_linear_brush(void)
ULONG refcount;
D2D1_RECT_F r;
float opacity;
- HWND window;
HRESULT hr;
static const D2D1_GRADIENT_STOP stops[] =
@@ -2153,8 +2145,7 @@ static void test_linear_brush(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2291,7 +2282,6 @@ static void test_linear_brush(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_radial_brush(void)
@@ -2313,7 +2303,6 @@ static void test_radial_brush(void)
unsigned int i;
ULONG refcount;
D2D1_RECT_F r;
- HWND window;
HRESULT hr;
float f;
@@ -2357,8 +2346,7 @@ static void test_radial_brush(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2503,7 +2491,6 @@ static void test_radial_brush(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void fill_geometry_sink(ID2D1GeometrySink *sink, unsigned int hollow_count)
@@ -2641,7 +2628,6 @@ static void test_path_geometry(void)
D2D1_RECT_F rect;
ULONG refcount;
UINT32 count;
- HWND window;
HRESULT hr;
static const struct geometry_segment expected_segments[] =
@@ -2961,8 +2947,7 @@ static void test_path_geometry(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -3691,7 +3676,6 @@ static void test_path_geometry(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_rectangle_geometry(void)
@@ -4031,7 +4015,6 @@ static void test_bitmap_formats(void)
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
unsigned int i, j;
- HWND window;
HRESULT hr;
static const struct
@@ -4060,8 +4043,7 @@ static void test_bitmap_formats(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4094,7 +4076,6 @@ static void test_bitmap_formats(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_alpha_mode(void)
@@ -4112,7 +4093,6 @@ static void test_alpha_mode(void)
D2D1_RECT_F rect;
D2D1_SIZE_U size;
ULONG refcount;
- HWND window;
HRESULT hr;
BOOL match;
@@ -4127,8 +4107,7 @@ static void test_alpha_mode(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4321,7 +4300,6 @@ static void test_alpha_mode(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_shared_bitmap(void)
@@ -4342,15 +4320,14 @@ static void test_shared_bitmap(void)
D2D1_SIZE_U size = {4, 4};
IDXGISurface1 *surface3;
ID3D10Device1 *device2;
- HWND window1, window2;
+ HWND window2;
HRESULT hr;
if (!init_test_context(&ctx))
return;
- window1 = create_window();
window2 = create_window();
- swapchain1 = create_swapchain(ctx.device, window1, TRUE);
+ swapchain1 = create_swapchain(ctx.device, ctx.window, TRUE);
swapchain2 = create_swapchain(ctx.device, window2, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain1, 0, &IID_IDXGISurface, (void **)&surface1);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -4574,7 +4551,6 @@ static void test_shared_bitmap(void)
ID3D10Device1_Release(device2);
release_test_context(&ctx);
DestroyWindow(window2);
- DestroyWindow(window1);
CoUninitialize();
}
@@ -4590,7 +4566,6 @@ static void test_bitmap_updates(void)
D2D1_COLOR_F color;
D2D1_RECT_F rect;
D2D1_SIZE_U size;
- HWND window;
HRESULT hr;
BOOL match;
@@ -4605,8 +4580,7 @@ static void test_bitmap_updates(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4676,7 +4650,6 @@ static void test_bitmap_updates(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_opacity_brush(void)
@@ -4696,7 +4669,6 @@ static void test_opacity_brush(void)
D2D1_RECT_F rect;
D2D1_SIZE_U size;
ULONG refcount;
- HWND window;
HRESULT hr;
BOOL match;
@@ -4711,8 +4683,7 @@ static void test_opacity_brush(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4855,7 +4826,6 @@ static void test_opacity_brush(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_create_target(void)
@@ -4865,7 +4835,6 @@ static void test_create_target(void)
ID2D1Factory *factory;
ID2D1RenderTarget *rt;
IDXGISurface *surface;
- HWND window;
HRESULT hr;
static const struct
{
@@ -4887,8 +4856,7 @@ static void test_create_target(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -4944,7 +4912,6 @@ static void test_create_target(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_draw_text_layout(void)
@@ -4985,7 +4952,6 @@ static void test_draw_text_layout(void)
ID2D1Factory *factory, *factory2;
ID2D1RenderTarget *rt, *rt2;
IDXGISurface *surface;
- HWND window;
HRESULT hr;
IDWriteFactory *dwrite_factory;
IDWriteTextFormat *text_format;
@@ -5002,8 +4968,7 @@ static void test_draw_text_layout(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -5112,7 +5077,6 @@ todo_wine
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void create_target_dibsection(HDC hdc, UINT32 width, UINT32 height)
@@ -5880,14 +5844,12 @@ static void test_gradient(void)
D2D1_COLOR_F color;
unsigned int i;
UINT32 count;
- HWND window;
HRESULT hr;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -5922,7 +5884,6 @@ static void test_gradient(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_draw_geometry(void)
@@ -5945,15 +5906,13 @@ static void test_draw_geometry(void)
D2D1_COLOR_F color;
D2D1_RECT_F rect;
ULONG refcount;
- HWND window;
HRESULT hr;
BOOL match;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -6848,7 +6807,6 @@ static void test_draw_geometry(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_fill_geometry(void)
@@ -6870,15 +6828,13 @@ static void test_fill_geometry(void)
D2D1_COLOR_F color;
D2D1_RECT_F rect;
ULONG refcount;
- HWND window;
HRESULT hr;
BOOL match;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -7660,7 +7616,6 @@ static void test_fill_geometry(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_gdi_interop(void)
@@ -7804,14 +7759,12 @@ static void test_layer(void)
ID2D1Layer *layer;
D2D1_SIZE_F size;
ULONG refcount;
- HWND window;
HRESULT hr;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -7845,7 +7798,6 @@ static void test_layer(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_bezier_intersect(void)
@@ -7861,15 +7813,13 @@ static void test_bezier_intersect(void)
ID2D1Factory *factory;
D2D1_COLOR_F color;
ULONG refcount;
- HWND window;
HRESULT hr;
BOOL match;
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -7993,7 +7943,6 @@ static void test_bezier_intersect(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_create_device(void)
@@ -8280,7 +8229,6 @@ static void test_bitmap_surface(void)
D2D1_SIZE_U size;
D2D1_TAG t1, t2;
unsigned int i;
- HWND window;
HRESULT hr;
IWICBitmap *wic_bitmap;
@@ -8297,8 +8245,7 @@ static void test_bitmap_surface(void)
}
/* DXGI target */
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -8509,7 +8456,6 @@ static void test_device_context(void)
ID2D1RenderTarget *rt;
ID2D1Bitmap1 *bitmap;
ID2D1Image *target;
- HWND window;
HRESULT hr;
RECT rect;
HDC hdc;
@@ -8551,8 +8497,7 @@ static void test_device_context(void)
ID2D1DeviceContext_Release(device_context);
/* DXGI target */
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -8584,7 +8529,6 @@ static void test_device_context(void)
ID2D1DeviceContext_Release(device_context);
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
- DestroyWindow(window);
/* WIC target */
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -9216,7 +9160,6 @@ static void test_dpi(void)
IDXGISurface *surface;
ID2D1Bitmap1 *bitmap;
float dpi_x, dpi_y;
- HWND window;
HRESULT hr;
static const struct
@@ -9249,8 +9192,7 @@ static void test_dpi(void)
return;
}
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
@@ -9424,7 +9366,6 @@ static void test_dpi(void)
IDXGISwapChain_Release(swapchain);
ID2D1Factory1_Release(factory);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_wic_bitmap_format(void)
@@ -9438,7 +9379,6 @@ static void test_wic_bitmap_format(void)
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
unsigned int i;
- HWND window;
HRESULT hr;
static const struct
@@ -9456,8 +9396,7 @@ static void test_wic_bitmap_format(void)
if (!init_test_context(&ctx))
return;
- window = create_window();
- swapchain = create_swapchain(ctx.device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, ctx.window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -9493,7 +9432,6 @@ static void test_wic_bitmap_format(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
release_test_context(&ctx);
- DestroyWindow(window);
}
static void test_math(void)
--
2.20.1
2
1
Jan. 15, 2021
From: Rémi Bernon <rbernon(a)codeweavers.com>
Analogous to the d3d11 tests.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
v3:
- Add line information to the skip in init_test_context_().
dlls/d2d1/tests/d2d1.c | 374 ++++++++++++++++++-----------------------
1 file changed, 167 insertions(+), 207 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 37cdda0aae6..de3755b9674 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -42,6 +42,11 @@ static struct test_entry
} *mt_tests;
size_t mt_tests_size, mt_test_count;
+struct d2d1_test_context
+{
+ ID3D10Device1 *device;
+};
+
struct resource_readback
{
ID3D10Resource *resource;
@@ -779,6 +784,26 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface)
return create_render_target_desc(surface, &desc);
}
+#define release_test_context(ctx) release_test_context_(__LINE__, ctx)
+static void release_test_context_(unsigned int line, struct d2d1_test_context *ctx)
+{
+ ID3D10Device1_Release(ctx->device);
+}
+
+#define init_test_context(ctx) init_test_context_(__LINE__, ctx)
+static BOOL init_test_context_(unsigned int line, struct d2d1_test_context *ctx)
+{
+ memset(ctx, 0, sizeof(*ctx));
+
+ if (!(ctx->device = create_device()))
+ {
+ skip_(__FILE__, line)("Failed to create device, skipping tests.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
#define check_bitmap_surface(b, s, o) check_bitmap_surface_(__LINE__, b, s, o)
static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap *bitmap, BOOL has_surface, DWORD expected_options)
{
@@ -1087,11 +1112,11 @@ static void geometry_sink_check_(unsigned int line, const struct geometry_sink *
static void test_clip(void)
{
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
D2D1_SIZE_U pixel_size;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
D2D1_POINT_2F point;
D2D1_COLOR_F color;
@@ -1108,13 +1133,11 @@ static void test_clip(void)
0.0f, 0.0f,
}}};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1288,7 +1311,7 @@ static void test_clip(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -1298,10 +1321,10 @@ static void test_state_block(void)
D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
ID2D1DrawingStateBlock *state_block;
IDWriteFactory *dwrite_factory;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1Factory1 *factory1;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
ULONG refcount;
@@ -1326,13 +1349,11 @@ static void test_state_block(void)
11.0f, 12.0f,
}}};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1562,7 +1583,7 @@ static void test_state_block(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -1571,10 +1592,10 @@ static void test_color_brush(void)
D2D1_MATRIX_3X2_F matrix, tmp_matrix;
D2D1_BRUSH_PROPERTIES brush_desc;
D2D1_COLOR_F color, tmp_color;
+ struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
D2D1_RECT_F rect;
float opacity;
@@ -1582,13 +1603,11 @@ static void test_color_brush(void)
HRESULT hr;
BOOL match;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -1662,7 +1681,7 @@ static void test_color_brush(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -1675,13 +1694,13 @@ static void test_bitmap_brush(void)
D2D1_BITMAP_PROPERTIES bitmap_desc;
ID2D1Bitmap *bitmap, *tmp_bitmap;
D2D1_RECT_F src_rect, dst_rect;
+ struct d2d1_test_context ctx;
D2D1_EXTEND_MODE extend_mode;
IDXGISwapChain *swapchain;
ID2D1BitmapBrush1 *brush1;
ID2D1BitmapBrush *brush;
D2D1_SIZE_F image_size;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_COLOR_F color;
@@ -1722,13 +1741,11 @@ static void test_bitmap_brush(void)
0xffffffff, 0xff000000, 0xff000000, 0xff000000,
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2069,7 +2086,7 @@ static void test_bitmap_brush(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -2081,10 +2098,10 @@ static void test_linear_brush(void)
ID2D1RectangleGeometry *rectangle_geometry;
D2D1_MATRIX_3X2_F matrix, tmp_matrix;
ID2D1LinearGradientBrush *brush;
+ struct d2d1_test_context ctx;
struct resource_readback rb;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_COLOR_F colour;
@@ -2133,13 +2150,11 @@ static void test_linear_brush(void)
{520, 390, 0xff90ae40},
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2275,7 +2290,7 @@ static void test_linear_brush(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -2287,10 +2302,10 @@ static void test_radial_brush(void)
ID2D1RectangleGeometry *rectangle_geometry;
D2D1_MATRIX_3X2_F matrix, tmp_matrix;
ID2D1RadialGradientBrush *brush;
+ struct d2d1_test_context ctx;
struct resource_readback rb;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_COLOR_F colour;
@@ -2339,13 +2354,11 @@ static void test_radial_brush(void)
{520, 390, 0xff4059e6},
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -2489,7 +2502,7 @@ static void test_radial_brush(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -2615,12 +2628,12 @@ static void test_path_geometry(void)
ID2D1GeometrySink *sink, *tmp_sink;
struct geometry_sink simplify_sink;
D2D1_POINT_2F point = {0.0f, 0.0f};
+ struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
ID2D1Geometry *tmp_geometry;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
BOOL match, contains;
@@ -2945,13 +2958,11 @@ static void test_path_geometry(void)
{D2D1_FIGURE_BEGIN_HOLLOW, D2D1_FIGURE_END_OPEN, { 40.0f, 20.0f}, 2, &expected_segments[172]},
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -3679,7 +3690,7 @@ static void test_path_geometry(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -4013,10 +4024,10 @@ static void test_rounded_rectangle_geometry(void)
static void test_bitmap_formats(void)
{
D2D1_BITMAP_PROPERTIES bitmap_desc;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
D2D1_SIZE_U size = {4, 4};
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
unsigned int i, j;
@@ -4046,13 +4057,11 @@ static void test_bitmap_formats(void)
{DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, 0x8a},
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4084,7 +4093,7 @@ static void test_bitmap_formats(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -4094,9 +4103,9 @@ static void test_alpha_mode(void)
D2D1_BITMAP_PROPERTIES bitmap_desc;
ID2D1SolidColorBrush *color_brush;
ID2D1BitmapBrush *bitmap_brush;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
D2D1_COLOR_F color;
@@ -4115,13 +4124,11 @@ static void test_alpha_mode(void)
0x7f7f7f7f, 0x7f000000, 0x7f000000, 0x7f000000,
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4313,7 +4320,7 @@ static void test_alpha_mode(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -4327,26 +4334,24 @@ static void test_shared_bitmap(void)
ID2D1RenderTarget *rt1, *rt2, *rt3;
IDXGISurface *surface1, *surface2;
ID2D1Factory *factory1, *factory2;
- ID3D10Device1 *device1, *device2;
IWICImagingFactory *wic_factory;
ID2D1Bitmap *bitmap1, *bitmap2;
DXGI_SURFACE_DESC surface_desc;
D2D1_PIXEL_FORMAT pixel_format;
+ struct d2d1_test_context ctx;
D2D1_SIZE_U size = {4, 4};
IDXGISurface1 *surface3;
+ ID3D10Device1 *device2;
HWND window1, window2;
HRESULT hr;
- if (!(device1 = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
window1 = create_window();
window2 = create_window();
- swapchain1 = create_swapchain(device1, window1, TRUE);
- swapchain2 = create_swapchain(device1, window2, TRUE);
+ swapchain1 = create_swapchain(ctx.device, window1, TRUE);
+ swapchain2 = create_swapchain(ctx.device, window2, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain1, 0, &IID_IDXGISurface, (void **)&surface1);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = IDXGISwapChain_GetBuffer(swapchain2, 0, &IID_IDXGISurface, (void **)&surface2);
@@ -4567,7 +4572,7 @@ static void test_shared_bitmap(void)
IDXGISwapChain_Release(swapchain2);
IDXGISwapChain_Release(swapchain1);
ID3D10Device1_Release(device2);
- ID3D10Device1_Release(device1);
+ release_test_context(&ctx);
DestroyWindow(window2);
DestroyWindow(window1);
CoUninitialize();
@@ -4576,9 +4581,9 @@ static void test_shared_bitmap(void)
static void test_bitmap_updates(void)
{
D2D1_BITMAP_PROPERTIES bitmap_desc;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
D2D1_RECT_U dst_rect;
ID2D1Bitmap *bitmap;
@@ -4597,13 +4602,11 @@ static void test_bitmap_updates(void)
0xffffffff, 0xff000000, 0xff000000, 0xff000000,
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4672,7 +4675,7 @@ static void test_bitmap_updates(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -4682,10 +4685,10 @@ static void test_opacity_brush(void)
D2D1_BITMAP_PROPERTIES bitmap_desc;
ID2D1RectangleGeometry *geometry;
ID2D1SolidColorBrush *color_brush;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
ID2D1Bitmap *bitmap;
@@ -4705,13 +4708,11 @@ static void test_opacity_brush(void)
0xffffffff, 0x40000000, 0x40000000, 0xff000000,
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -4853,16 +4854,16 @@ static void test_opacity_brush(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
static void test_create_target(void)
{
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1Factory *factory;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
HWND window;
HRESULT hr;
@@ -4883,13 +4884,11 @@ static void test_create_target(void)
};
unsigned int i;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -4944,7 +4943,7 @@ static void test_create_target(void)
ID2D1Factory_Release(factory);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -4985,13 +4984,13 @@ static void test_draw_text_layout(void)
IDXGISwapChain *swapchain;
ID2D1Factory *factory, *factory2;
ID2D1RenderTarget *rt, *rt2;
- ID3D10Device1 *device;
IDXGISurface *surface;
HWND window;
HRESULT hr;
IDWriteFactory *dwrite_factory;
IDWriteTextFormat *text_format;
IDWriteTextLayout *text_layout;
+ struct d2d1_test_context ctx;
D2D1_POINT_2F origin;
DWRITE_TEXT_RANGE range;
D2D1_COLOR_F color;
@@ -5000,13 +4999,11 @@ static void test_draw_text_layout(void)
D2D1_RECT_F rect;
unsigned int i;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
@@ -5114,7 +5111,7 @@ todo_wine
ID2D1Factory_Release(factory2);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -5151,11 +5148,11 @@ static void test_dc_target(void)
D2D1_RENDER_TARGET_PROPERTIES desc;
D2D1_MATRIX_3X2_F matrix, matrix2;
ID2D1DCRenderTarget *rt, *rt2;
+ struct d2d1_test_context ctx;
D2D1_ANTIALIAS_MODE aa_mode;
ID2D1SolidColorBrush *brush;
ID2D1RenderTarget *rt3;
ID2D1Factory *factory;
- ID3D10Device1 *device;
FLOAT dpi_x, dpi_y;
D2D1_COLOR_F color;
D2D1_SIZE_U sizeu;
@@ -5168,12 +5165,9 @@ static void test_dc_target(void)
HRESULT hr;
RECT rect;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr);
@@ -5375,18 +5369,15 @@ static void test_hwnd_target(void)
ID2D1GdiInteropRenderTarget *interop;
D2D1_RENDER_TARGET_PROPERTIES desc;
ID2D1HwndRenderTarget *rt, *rt2;
+ struct d2d1_test_context ctx;
ID2D1RenderTarget *rt3;
ID2D1Factory *factory;
- ID3D10Device1 *device;
D2D1_SIZE_U size;
HRESULT hr;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr);
@@ -5541,22 +5532,19 @@ static void test_bitmap_target(void)
ID2D1BitmapRenderTarget *rt, *rt2;
ID2D1HwndRenderTarget *hwnd_rt;
ID2D1Bitmap *bitmap, *bitmap2;
+ struct d2d1_test_context ctx;
ID2D1DCRenderTarget *dc_rt;
D2D1_SIZE_F size, size2;
ID2D1RenderTarget *rt3;
ID2D1Factory *factory;
- ID3D10Device1 *device;
float dpi[2], dpi2[2];
D2D1_COLOR_F color;
ULONG refcount;
HRESULT hr;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr);
@@ -5885,9 +5873,9 @@ static void test_gradient(void)
{
ID2D1GradientStopCollection *gradient;
D2D1_GRADIENT_STOP stops[3], stops2[3];
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
D2D1_COLOR_F color;
unsigned int i;
@@ -5895,13 +5883,11 @@ static void test_gradient(void)
HWND window;
HRESULT hr;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -5935,7 +5921,7 @@ static void test_gradient(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -5945,13 +5931,13 @@ static void test_draw_geometry(void)
ID2D1RectangleGeometry *rect_geometry[2];
D2D1_POINT_2F point = {0.0f, 0.0f};
D2D1_ROUNDED_RECT rounded_rect;
+ struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_POINT_2F p0, p1;
@@ -5963,13 +5949,11 @@ static void test_draw_geometry(void)
HRESULT hr;
BOOL match;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -6863,7 +6847,7 @@ static void test_draw_geometry(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -6873,13 +6857,13 @@ static void test_fill_geometry(void)
ID2D1RectangleGeometry *rect_geometry[2];
D2D1_POINT_2F point = {0.0f, 0.0f};
D2D1_ROUNDED_RECT rounded_rect;
+ struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
IDXGISwapChain *swapchain;
D2D1_MATRIX_3X2_F matrix;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_ELLIPSE ellipse;
@@ -6890,13 +6874,11 @@ static void test_fill_geometry(void)
HRESULT hr;
BOOL match;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -7677,7 +7659,7 @@ static void test_fill_geometry(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
@@ -7686,22 +7668,19 @@ static void test_gdi_interop(void)
ID2D1GdiInteropRenderTarget *interop;
D2D1_RENDER_TARGET_PROPERTIES desc;
IWICImagingFactory *wic_factory;
+ struct d2d1_test_context ctx;
IWICBitmapLock *wic_lock;
IWICBitmap *wic_bitmap;
ID2D1RenderTarget *rt;
ID2D1Factory *factory;
- ID3D10Device1 *device;
D2D1_COLOR_F color;
HRESULT hr;
BOOL match;
RECT rect;
HDC dc;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr);
@@ -7812,14 +7791,15 @@ todo_wine
IWICBitmap_Release(wic_bitmap);
ID2D1Factory_Release(factory);
+ release_test_context(&ctx);
}
static void test_layer(void)
{
ID2D1Factory *factory, *layer_factory;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Layer *layer;
D2D1_SIZE_F size;
@@ -7827,13 +7807,11 @@ static void test_layer(void)
HWND window;
HRESULT hr;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -7866,19 +7844,19 @@ static void test_layer(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
static void test_bezier_intersect(void)
{
D2D1_POINT_2F point = {0.0f, 0.0f};
+ struct d2d1_test_context ctx;
ID2D1SolidColorBrush *brush;
ID2D1PathGeometry *geometry;
IDXGISwapChain *swapchain;
ID2D1GeometrySink *sink;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Factory *factory;
D2D1_COLOR_F color;
@@ -7887,13 +7865,11 @@ static void test_bezier_intersect(void)
HRESULT hr;
BOOL match;
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -8016,14 +7992,14 @@ static void test_bezier_intersect(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
static void test_create_device(void)
{
D2D1_CREATION_PROPERTIES properties = {0};
- ID3D10Device1 *d3d_device;
+ struct d2d1_test_context ctx;
IDXGIDevice *dxgi_device;
ID2D1Factory1 *factory;
ID2D1Factory *factory2;
@@ -8031,20 +8007,17 @@ static void test_create_device(void)
ULONG refcount;
HRESULT hr;
- if (!(d3d_device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
return;
}
- hr = ID3D10Device1_QueryInterface(d3d_device, &IID_IDXGIDevice, (void **)&dxgi_device);
+ hr = ID3D10Device1_QueryInterface(ctx.device, &IID_IDXGIDevice, (void **)&dxgi_device);
ok(SUCCEEDED(hr), "Failed to get IDXGIDevice interface, hr %#x.\n", hr);
hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
@@ -8069,7 +8042,7 @@ static void test_create_device(void)
win_skip("D2D1CreateDevice() is unavailable.\n");
IDXGIDevice_Release(dxgi_device);
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
refcount = ID2D1Factory1_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
@@ -8296,7 +8269,7 @@ static void test_bitmap_surface(void)
ID2D1DeviceContext *device_context;
IDXGISurface *surface, *surface2;
D2D1_PIXEL_FORMAT pixel_format;
- ID3D10Device1 *d3d_device;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
IDXGIDevice *dxgi_device;
ID2D1Factory1 *factory;
@@ -8313,22 +8286,19 @@ static void test_bitmap_surface(void)
IWICBitmap *wic_bitmap;
IWICImagingFactory *wic_factory;
- if (!(d3d_device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
return;
}
/* DXGI target */
window = create_window();
- swapchain = create_swapchain(d3d_device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -8350,7 +8320,7 @@ static void test_bitmap_surface(void)
ID2D1RenderTarget_Release(rt);
/* Bitmap created from DXGI surface. */
- hr = ID3D10Device1_QueryInterface(d3d_device, &IID_IDXGIDevice, (void **)&dxgi_device);
+ hr = ID3D10Device1_QueryInterface(ctx.device, &IID_IDXGIDevice, (void **)&dxgi_device);
ok(SUCCEEDED(hr), "Failed to get IDXGIDevice interface, hr %#x.\n", hr);
hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
@@ -8519,7 +8489,7 @@ static void test_bitmap_surface(void)
CoUninitialize();
ID2D1Factory1_Release(factory);
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
}
static void test_device_context(void)
@@ -8529,9 +8499,9 @@ static void test_device_context(void)
ID2D1DeviceContext *device_context;
IDXGISurface *surface, *surface2;
ID2D1Device *device, *device2;
+ struct d2d1_test_context ctx;
D2D1_BITMAP_OPTIONS options;
ID2D1DCRenderTarget *dc_rt;
- ID3D10Device1 *d3d_device;
IDXGISwapChain *swapchain;
IDXGIDevice *dxgi_device;
D2D1_UNIT_MODE unit_mode;
@@ -8547,20 +8517,17 @@ static void test_device_context(void)
IWICBitmap *wic_bitmap;
IWICImagingFactory *wic_factory;
- if (!(d3d_device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
return;
}
- hr = ID3D10Device1_QueryInterface(d3d_device, &IID_IDXGIDevice, (void **)&dxgi_device);
+ hr = ID3D10Device1_QueryInterface(ctx.device, &IID_IDXGIDevice, (void **)&dxgi_device);
ok(SUCCEEDED(hr), "Failed to get IDXGIDevice interface, hr %#x.\n", hr);
hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
@@ -8585,7 +8552,7 @@ static void test_device_context(void)
/* DXGI target */
window = create_window();
- swapchain = create_swapchain(d3d_device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -8725,7 +8692,7 @@ todo_wine
ID2D1Device_Release(device);
ID2D1Factory1_Release(factory);
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
}
static void test_invert_matrix(void)
@@ -8890,7 +8857,7 @@ static void test_command_list(void)
D2D1_BITMAP_PROPERTIES bitmap_desc;
ID2D1StrokeStyle *stroke_style;
ID2D1CommandList *command_list;
- ID3D10Device1 *d3d_device;
+ struct d2d1_test_context ctx;
ID2D1Geometry *geometry;
ID2D1Factory1 *factory;
ID2D1RenderTarget *rt;
@@ -8904,20 +8871,17 @@ static void test_command_list(void)
ULONG refcount;
HRESULT hr;
- if (!(d3d_device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
return;
}
- device_context = create_device_context(factory, d3d_device);
+ device_context = create_device_context(factory, ctx.device);
ok(device_context != NULL, "Failed to create device context.\n");
hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
@@ -9103,7 +9067,7 @@ todo_wine
ID2D1CommandList_Release(command_list);
/* List created with different context. */
- device_context2 = create_device_context(factory, d3d_device);
+ device_context2 = create_device_context(factory, ctx.device);
ok(device_context2 != NULL, "Failed to create device context.\n");
hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
@@ -9120,6 +9084,7 @@ todo_wine
ID2D1DeviceContext_Release(device_context);
refcount = ID2D1Factory1_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
+ release_test_context(&ctx);
}
static void test_max_bitmap_size(void)
@@ -9245,8 +9210,8 @@ static void test_dpi(void)
D2D1_BITMAP_PROPERTIES1 bitmap_desc;
ID2D1DeviceContext *device_context;
IWICImagingFactory *wic_factory;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
- ID3D10Device1 *d3d_device;
ID2D1Factory1 *factory;
IDXGISurface *surface;
ID2D1Bitmap1 *bitmap;
@@ -9274,25 +9239,22 @@ static void test_dpi(void)
static const float dc_dpi_x = 120.0f, dc_dpi_y = 144.0f;
unsigned int i;
- if (!(d3d_device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
return;
}
window = create_window();
- swapchain = create_swapchain(d3d_device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- device_context = create_device_context(factory, d3d_device);
+ device_context = create_device_context(factory, ctx.device);
ok(!!device_context, "Failed to create device context.\n");
ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
@@ -9461,18 +9423,18 @@ static void test_dpi(void)
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
ID2D1Factory1_Release(factory);
- ID3D10Device1_Release(d3d_device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
static void test_wic_bitmap_format(void)
{
IWICImagingFactory *wic_factory;
+ struct d2d1_test_context ctx;
IDXGISwapChain *swapchain;
D2D1_PIXEL_FORMAT format;
IWICBitmap *wic_bitmap;
ID2D1RenderTarget *rt;
- ID3D10Device1 *device;
IDXGISurface *surface;
ID2D1Bitmap *bitmap;
unsigned int i;
@@ -9491,13 +9453,11 @@ static void test_wic_bitmap_format(void)
{&GUID_WICPixelFormat32bppBGR, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
};
- if (!(device = create_device()))
- {
- skip("Failed to create device, skipping tests.\n");
+ if (!init_test_context(&ctx))
return;
- }
+
window = create_window();
- swapchain = create_swapchain(device, window, TRUE);
+ swapchain = create_swapchain(ctx.device, window, TRUE);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(hr == S_OK, "Failed to get buffer, hr %#x.\n", hr);
rt = create_render_target(surface);
@@ -9532,7 +9492,7 @@ static void test_wic_bitmap_format(void)
ID2D1RenderTarget_Release(rt);
IDXGISurface_Release(surface);
IDXGISwapChain_Release(swapchain);
- ID3D10Device1_Release(device);
+ release_test_context(&ctx);
DestroyWindow(window);
}
--
2.20.1
2
1
Jan. 15, 2021
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
v3:
- Use win_skip instead of skip, we always expect these to be available on
Wine.
- Rebased the series on top of Jactry's patches.
dlls/d2d1/tests/d2d1.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 8627f5ebef6..37cdda0aae6 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -30,6 +30,9 @@
static HRESULT (WINAPI *pD2D1CreateDevice)(IDXGIDevice *dxgi_device,
const D2D1_CREATION_PROPERTIES *properties, ID2D1Device **device);
+static void (WINAPI *pD2D1SinCos)(float angle, float *s, float *c);
+static float (WINAPI *pD2D1Tan)(float angle);
+static float (WINAPI *pD2D1Vec3Length)(float x, float y, float z);
static BOOL use_mt = TRUE;
@@ -9585,9 +9588,15 @@ static void test_math(void)
{1.0f, 2.0f, 3.0f, 3.74165750f},
};
+ if (!pD2D1SinCos || !pD2D1Tan || !pD2D1Vec3Length)
+ {
+ win_skip("D2D1SinCos/D2D1Tan/D2D1Vec3Length not available, skipping test.\n");
+ return;
+ }
+
for (i = 0; i < ARRAY_SIZE(sc_data); ++i)
{
- D2D1SinCos(sc_data[i].x, &s, &c);
+ pD2D1SinCos(sc_data[i].x, &s, &c);
ok(compare_float(s, sc_data[i].s, 0),
"Test %u: Got unexpected sin %.8e, expected %.8e.\n", i, s, sc_data[i].s);
ok(compare_float(c, sc_data[i].c, 0),
@@ -9596,14 +9605,14 @@ static void test_math(void)
for (i = 0; i < ARRAY_SIZE(t_data); ++i)
{
- t = D2D1Tan(t_data[i].x);
+ t = pD2D1Tan(t_data[i].x);
ok(compare_float(t, t_data[i].t, 1),
"Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, t, t_data[i].t);
}
for (i = 0; i < ARRAY_SIZE(l_data); ++i)
{
- l = D2D1Vec3Length(l_data[i].x, l_data[i].y, l_data[i].z);
+ l = pD2D1Vec3Length(l_data[i].x, l_data[i].y, l_data[i].z);
ok(compare_float(l, l_data[i].l, 0),
"Test %u: Got unexpected length %.8e, expected %.8e.\n", i, l, l_data[i].l);
}
@@ -9611,10 +9620,14 @@ static void test_math(void)
START_TEST(d2d1)
{
+ HMODULE d2d1_dll = GetModuleHandleA("d2d1.dll");
unsigned int argc, i;
char **argv;
- pD2D1CreateDevice = (void *)GetProcAddress(GetModuleHandleA("d2d1.dll"), "D2D1CreateDevice");
+ pD2D1CreateDevice = (void *)GetProcAddress(d2d1_dll, "D2D1CreateDevice");
+ pD2D1SinCos = (void *)GetProcAddress(d2d1_dll, "D2D1SinCos");
+ pD2D1Tan = (void *)GetProcAddress(d2d1_dll, "D2D1Tan");
+ pD2D1Vec3Length = (void *)GetProcAddress(d2d1_dll, "D2D1Vec3Length");
use_mt = !getenv("WINETEST_NO_MT_D3D");
--
2.20.1
1
0
[PATCH 1/3] d2d1: Limit source rectangle to the actual size for ID2D1RenderTarget_DrawBitmap().
by Jactry Zeng Jan. 15, 2021
by Jactry Zeng Jan. 15, 2021
Jan. 15, 2021
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
---
dlls/d2d1/device.c | 18 ++++++------------
dlls/d2d1/tests/d2d1.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 3c8431ce8f4..b609a2c1e24 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -1072,25 +1072,19 @@ static void d2d_device_context_draw_bitmap(struct d2d_device_context *context, I
D2D1_BITMAP_BRUSH_PROPERTIES1 bitmap_brush_desc;
D2D1_BRUSH_PROPERTIES brush_desc;
struct d2d_brush *brush;
+ D2D1_SIZE_F size;
D2D1_RECT_F s, d;
HRESULT hr;
if (perspective_transform)
FIXME("Perspective transform is ignored.\n");
- if (src_rect)
+ size = ID2D1Bitmap_GetSize(bitmap);
+ d2d_rect_set(&s, 0.0f, 0.0f, size.width, size.height);
+ if (src_rect && src_rect->left <= src_rect->right
+ && src_rect->top <= src_rect->bottom)
{
- s = *src_rect;
- }
- else
- {
- D2D1_SIZE_F size;
-
- size = ID2D1Bitmap_GetSize(bitmap);
- s.left = 0.0f;
- s.top = 0.0f;
- s.right = size.width;
- s.bottom = size.height;
+ d2d_rect_intersect(&s, src_rect);
}
if (dst_rect)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index d571cfe8d15..6e3bc4a51d2 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -1676,6 +1676,7 @@ static void test_bitmap_brush(void)
IDXGISwapChain *swapchain;
ID2D1BitmapBrush1 *brush1;
ID2D1BitmapBrush *brush;
+ D2D1_SIZE_F image_size;
ID2D1RenderTarget *rt;
ID3D10Device1 *device;
IDXGISurface *surface;
@@ -1740,6 +1741,7 @@ static void test_bitmap_brush(void)
bitmap_desc.dpiY = 96.0f;
hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
+ image_size = ID2D1Bitmap_GetSize(bitmap);
hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Image, (void **)&image);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Vista */, "Failed to get ID2D1Image, hr %#x.\n", hr);
@@ -1810,12 +1812,24 @@ static void test_bitmap_brush(void)
D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL);
set_rect(&dst_rect, 0.0f, 8.0f, 4.0f, 12.0f);
set_rect(&src_rect, 2.0f, 1.0f, 4.0f, 3.0f);
+ ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
+ D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
+ set_rect(&dst_rect, 4.0f, 12.0f, 12.0f, 20.0f);
+ set_rect(&src_rect, 0.0f, 0.0f, image_size.width * 2, image_size.height * 2);
+ ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
+ D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
+ set_rect(&dst_rect, 4.0f, 8.0f, 12.0f, 12.0f);
+ set_rect(&src_rect, image_size.width / 2, image_size.height / 2, image_size.width, image_size.height);
+ ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
+ D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
+ set_rect(&dst_rect, 0.0f, 4.0f, 4.0f, 8.0f);
+ set_rect(&src_rect, image_size.width, 0.0f, 0.0f, image_size.height);
ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
- match = compare_surface(surface, "9437f4447d98feaad41a1c4202ee90aadc718ee6");
+ match = compare_surface(surface, "f5d039c280fa33ba05496c9883192a34108efbbe");
ok(match, "Surface does not match.\n");
/* Invalid interpolation mode. */
@@ -1828,7 +1842,19 @@ static void test_bitmap_brush(void)
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- match = compare_surface(surface, "9437f4447d98feaad41a1c4202ee90aadc718ee6");
+ match = compare_surface(surface, "f5d039c280fa33ba05496c9883192a34108efbbe");
+ ok(match, "Surface does not match.\n");
+
+ ID2D1RenderTarget_BeginDraw(rt);
+ ID2D1RenderTarget_Clear(rt, &color);
+
+ set_rect(&src_rect, image_size.width, 0.0f, 0.0f, image_size.height);
+ ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 1.0f,
+ D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
+
+ hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
+ ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
+ match = compare_surface(surface, "59043096393570ad800dbcbfdd644394b79493bd");
ok(match, "Surface does not match.\n");
ID2D1RenderTarget_BeginDraw(rt);
--
2.29.2
3
8
Jan. 15, 2021
From: Sebastian Lackner <sebastian(a)fds-team.de>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
This is a patch series that has been in Wine Staging for ages, and that
I've cleaned up a bit.
The staging patch series actually does more than this, as it also
increase the number of free lists by a lot and does some state caching
and other small optimisations, but this rbtree optimization is the main
source of performance improvement. [1]
Although the series increases performance noticeably on synthethic
benchmarks, as I measured in the past [2], it still isn't great in
multi-threaded allocations scenarios, as it still uses a global lock.
The patch series is in Wine Staging and in Proton though, so I thought
it was still worth cleaning it up and sending it upstream, unless it is
then considered not interesting enough.
[1] I've split and analyzed each part of the patch separately in:
https://bugs.winehq.org/show_bug.cgi?id=49113#c9
[2] https://www.winehq.org/pipermail/wine-devel/2020-May/165892.html
dlls/ntdll/heap.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 88db935746a..31a7ba18d61 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -3,6 +3,7 @@
*
* Copyright 1996 Alexandre Julliard
* Copyright 1998 Ulrich Weigand
+ * Copyright 2017 Sebastian Lackner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -494,6 +495,17 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
}
+/***********************************************************************
+ * HEAP_DeleteFreeBlock
+ *
+ * Delete a free block from the free list.
+ */
+static inline void HEAP_DeleteFreeBlock( HEAP *heap, ARENA_FREE *pArena )
+{
+ list_remove( &pArena->entry );
+}
+
+
/***********************************************************************
* HEAP_FindSubHeap
* Find the sub-heap containing a given address.
@@ -602,7 +614,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, SIZE_T size )
{
/* Remove the next arena from the free list */
ARENA_FREE *pNext = (ARENA_FREE *)((char *)ptr + size);
- list_remove( &pNext->entry );
+ HEAP_DeleteFreeBlock( subheap->heap, pNext );
size += (pNext->size & ARENA_SIZE_MASK) + sizeof(*pNext);
mark_block_free( pNext, sizeof(ARENA_FREE), flags );
}
@@ -657,7 +669,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
pFree = *((ARENA_FREE **)pArena - 1);
size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE);
/* Remove it from the free list */
- list_remove( &pFree->entry );
+ HEAP_DeleteFreeBlock( heap, pFree );
}
else pFree = (ARENA_FREE *)pArena;
@@ -677,7 +689,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
size = 0;
/* Remove the free block from the list */
- list_remove( &pFree->entry );
+ HEAP_DeleteFreeBlock( heap, pFree );
/* Remove the subheap from the list */
list_remove( &subheap->entry );
/* Free the memory */
@@ -1694,7 +1706,7 @@ void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_
/* Remove the arena from the free list */
- list_remove( &pArena->entry );
+ HEAP_DeleteFreeBlock( heapPtr, pArena );
/* Build the in-use arena */
@@ -1851,7 +1863,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size
{
/* The next block is free and large enough */
ARENA_FREE *pFree = (ARENA_FREE *)pNext;
- list_remove( &pFree->entry );
+ HEAP_DeleteFreeBlock( heapPtr, pFree );
pArena->size += (pFree->size & ARENA_SIZE_MASK) + sizeof(*pFree);
if (!HEAP_Commit( subheap, pArena, rounded_size )) goto oom;
notify_realloc( pArena + 1, oldActualSize, size );
@@ -1869,7 +1881,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size
/* Build the in-use arena */
- list_remove( &pNew->entry );
+ HEAP_DeleteFreeBlock( heapPtr, pNew );
pInUse = (ARENA_INUSE *)pNew;
pInUse->size = (pInUse->size & ~ARENA_FLAG_FREE)
+ sizeof(ARENA_FREE) - sizeof(ARENA_INUSE);
--
2.30.0
2
4
Jan. 15, 2021
This matches the MONO_ARCH property.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/Build/Utils.pm | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm
index aa786183b5..a56a4f2a49 100644
--- a/testbot/lib/Build/Utils.pm
+++ b/testbot/lib/Build/Utils.pm
@@ -490,11 +490,7 @@ sub UpdateAddOns()
my $Arch = "";
while (my $Line= <$fh>)
{
- if ($Line =~ /^\s*#\s*define\s+ARCH_STRING\s+"([^"]+)"/)
- {
- $Arch = $1;
- }
- elsif ($Line =~ /^\s*#\s*define\s+(?:GECKO|MONO)_ARCH\s+"([^"]+)"/)
+ if ($Line =~ /^\s*#\s*define\s+(?:GECKO|MONO)_ARCH\s+"([^"]+)"/)
{
$Arch = $1;
}
--
2.20.1
1
0
[PATCH resend] iphlpapi: Reimplement toIPAddressString on top of RtlIpv4AddressToStringA
by Alex Henrie Jan. 15, 2021
by Alex Henrie Jan. 15, 2021
Jan. 15, 2021
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
There's no need to reinvent the wheel here; RtlIpv4AddressToStringA
avoids the need for strcpy and is guaranteed to do nothing if the
pointer to the output string is null.
---
dlls/iphlpapi/ifenum.c | 20 --------------------
dlls/iphlpapi/ifenum.h | 9 ++++++---
2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c
index c3abdf0e536..288e04db7b8 100644
--- a/dlls/iphlpapi/ifenum.c
+++ b/dlls/iphlpapi/ifenum.c
@@ -35,14 +35,6 @@
#include <sys/socket.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
@@ -1106,15 +1098,3 @@ ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_ad
}
#endif
-
-char *toIPAddressString(unsigned int addr, char string[16])
-{
- if (string) {
- struct in_addr iAddr;
-
- iAddr.s_addr = addr;
- /* extra-anal, just to make auditors happy */
- lstrcpynA(string, inet_ntoa(iAddr), 16);
- }
- return string;
-}
diff --git a/dlls/iphlpapi/ifenum.h b/dlls/iphlpapi/ifenum.h
index c6bf9575759..d75d4c0796f 100644
--- a/dlls/iphlpapi/ifenum.h
+++ b/dlls/iphlpapi/ifenum.h
@@ -40,6 +40,7 @@
#define USE_WS_PREFIX
#include "iprtrmib.h"
#include "winsock2.h"
+#include "ip2string.h"
#define MAX_INTERFACE_PHYSADDR 8
#define MAX_INTERFACE_DESCRIPTION 256
@@ -109,10 +110,12 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs,
SOCKET_ADDRESS **masks) DECLSPEC_HIDDEN;
-/* Converts the network-order bytes in addr to a printable string. Returns
- * string.
+/* Converts the network-order bytes in addr to a printable string.
*/
-char *toIPAddressString(unsigned int addr, char string[16]) DECLSPEC_HIDDEN;
+static inline void toIPAddressString(ULONG addr, char string[16])
+{
+ RtlIpv4AddressToStringA((IN_ADDR *)&addr, string);
+}
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) DECLSPEC_HIDDEN;
DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status) DECLSPEC_HIDDEN;
--
2.30.0
2
2
[tools] testbot: Take into account configure for the build timeout.
by Francois Gouget Jan. 15, 2021
by Francois Gouget Jan. 15, 2021
Jan. 15, 2021
It is likely that configure will need to be rerun after a
make_makefiles, even outside of full rebuilds. In particular this is
the case when adding a new dll, program or test directory.
So take the configure time out of the full-rebuild timeouts and into its
own $ReconfigBuildTimeout setting.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
This avoids getting a build timeout when adding a new test
directory, such as happened to the chcp.com test:
https://testbot.winehq.org/JobDetails.pl?Key=83895
(On my box the build clocked in at 26s but on the TestBot configure
alone takes from 40 to 58s.)
testbot/lib/WineTestBot/Config.pm | 11 +++++++----
testbot/lib/WineTestBot/PatchUtils.pm | 7 +++++--
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/Config.pm b/testbot/lib/WineTestBot/Config.pm
index 68709e526e..2f01e951bd 100644
--- a/testbot/lib/WineTestBot/Config.pm
+++ b/testbot/lib/WineTestBot/Config.pm
@@ -31,7 +31,7 @@ use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir
$MaxVMsWhenIdle $WaitForBoot $SleepAfterBoot $SleepAfterRevert
$VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail $RobotEMail
$WinePatchToOverride $WinePatchCc
- $ExeBuildTimeout $ExeModuleTimeout
+ $ReconfigBuildTimeout $ExeBuildTimeout $ExeModuleTimeout
$WineBuildTimeout $WineModuleTimeout $TimeoutMargin
$SuiteTimeout $SingleTimeout $SingleAvgTime $MaxUnitSize
$TagPrefix $ProjectName $PatchesMailingList $LDAPServer
@@ -48,7 +48,7 @@ require Exporter;
$SleepAfterRevert
$VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail
$RobotEMail $WinePatchToOverride $WinePatchCc $SuiteTimeout
- $ExeBuildTimeout $ExeModuleTimeout
+ $ReconfigBuildTimeout $ExeBuildTimeout $ExeModuleTimeout
$WineBuildTimeout $WineModuleTimeout $TimeoutMargin
$SuiteTimeout $SingleTimeout $SingleAvgTime $MaxUnitSize
$TagPrefix $ProjectName $PatchesMailingList
@@ -109,15 +109,18 @@ $MaxVMErrors = 3;
# How many times to run a test that fails before giving up.
$MaxTaskTries = 3;
+# Build configure timeout (in seconds)
+$ReconfigBuildTimeout = 60;
+
# Exe build timeouts (in seconds)
# - For a full build
-$ExeBuildTimeout = 7 * 60;
+$ExeBuildTimeout = 6 * 60;
# - For a single module
$ExeModuleTimeout = 30;
# Wine build timeouts (in seconds)
# - For a full build
-$WineBuildTimeout = 25 * 60;
+$WineBuildTimeout = 24 * 60;
# - For a single module
$WineModuleTimeout = 60;
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index 26c16c4127..974ff8eb6b 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -521,19 +521,22 @@ sub GetBuildTimeout($$)
# Set $ModuleCount to 0 if a full rebuild is needed
my $ModuleCount = (!$Impacts or $Impacts->{RebuildRoot}) ? 0 :
scalar(keys %{$Impacts->{BuildModules}});
+ my $Reconfig = (!$Impacts or $Impacts->{Autoconf} or $Impacts->{MakeMakefiles});
my ($ExeTimeout, $WineTimeout) = (0, 0);
if ($ExeCount)
{
my $OneBuild = $ModuleCount ? $ModuleCount * $ExeModuleTimeout :
$ExeBuildTimeout;
- $ExeTimeout = $ExeCount * min($ExeBuildTimeout, $OneBuild);
+ $ExeTimeout = $ExeCount * min($ExeBuildTimeout, $OneBuild) +
+ ($Reconfig ? $ExeCount * $ReconfigBuildTimeout : 0);
}
if ($WineCount)
{
my $OneBuild = $ModuleCount ? $ModuleCount * $WineModuleTimeout :
$WineBuildTimeout;
- $WineTimeout = $WineCount * min($WineBuildTimeout, $OneBuild);
+ $WineTimeout = $WineCount * min($WineBuildTimeout, $OneBuild) +
+ ($Reconfig ? $WineCount * $ReconfigBuildTimeout : 0);
}
return $ExeTimeout + $WineTimeout;
--
2.20.1
1
0
[PATCH] dwrite: Compatible with windows 6.1 and windows 8.1 words 5 wrapping.
by Haoyang Chen Jan. 15, 2021
by Haoyang Chen Jan. 15, 2021
Jan. 15, 2021
2
1