From: Nikolay Sivov Subject: [PATCH 2/3] d2d1/tests: Test that device is reused for compatible targets. Message-Id: <20180924045831.32271-2-nsivov@codeweavers.com> Date: Mon, 24 Sep 2018 07:58:30 +0300 In-Reply-To: <20180924045831.32271-1-nsivov@codeweavers.com> References: <20180924045831.32271-1-nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov --- dlls/d2d1/tests/d2d1.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 9e6ce06543..65ab5c258b 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -6772,14 +6772,26 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B /* Pixel format is not defined until target is set, for DC target it's specified on creation. */ if (target || dc_rt) { + ID2D1Device *device = NULL, *device2 = NULL; ID2D1DeviceContext *context2; + ID2D1DeviceContext_GetDevice(context, &device); + hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, (ID2D1BitmapRenderTarget **)&compatible_rt); ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create compatible render target, hr %#x.\n", hr); hr = ID2D1RenderTarget_QueryInterface(compatible_rt, &IID_ID2D1DeviceContext, (void **)&context2); ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get device context, hr %#x.\n", hr); + + ID2D1DeviceContext_GetDevice(context2, &device2); + ok_(__FILE__, line)(device == device2, "Unexpected device.\n"); + + if (device) + ID2D1Device_Release(device); + if (device2) + ID2D1Device_Release(device2); + ID2D1DeviceContext_Release(context2); hr = ID2D1RenderTarget_CreateBitmap(compatible_rt, size, bitmap_data, sizeof(*bitmap_data), &bitmap_desc, &bitmap); -- 2.19.0