On 19 August 2018 at 17:18, Nikolay Sivov nsivov@codeweavers.com wrote:
+static void test_check_bitmap_surface(ID2D1Bitmap1 *bitmap, BOOL has_surface, DWORD expected_options) +{
- D2D1_BITMAP_OPTIONS options;
- IDXGISurface *surface;
- HRESULT hr;
- options = ID2D1Bitmap1_GetOptions(bitmap);
- ok(options == expected_options, "Unexpected bitmap options %#x, expected %#x.\n", options, expected_options);
- surface = (void *)0xdeadbeef;
- hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
- if (has_surface)
- {
D3D10_TEXTURE2D_DESC desc;
ID3D10Texture2D *texture;
- todo_wine
ok(SUCCEEDED(hr), "Failed to get bitmap surface, hr %#x.\n", hr);
ok(!!surface, "Expected surface instance.\n");
- if (SUCCEEDED(hr))
- {
/* Correlate with resource configuration. */
hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
ok(SUCCEEDED(hr), "Failed to get texture pointer, hr %#x.\n", hr);
ID3D10Texture2D_GetDesc(texture, &desc);
ok(desc.Usage == 0, "Unexpected usage %#x.\n", desc.Usage);
ok(desc.BindFlags == (options & D2D1_BITMAP_OPTIONS_TARGET ? D3D10_BIND_RENDER_TARGET : D3D10_BIND_SHADER_RESOURCE),
"Unexpected bind flags %#x, bitmap options %#x.\n", desc.BindFlags, options);
ok(desc.CPUAccessFlags == 0, "Unexpected cpu access flags %#x.\n", desc.CPUAccessFlags);
ok(desc.MiscFlags == 0, "Unexpected misc flags %#x.\n", desc.MiscFlags);
ID3D10Texture2D_Release(texture);
IDXGISurface_Release(surface);
- }
- }
- else
- {
- todo_wine {
ok(hr == D2DERR_INVALID_CALL, "Unexpected hr %#x.\n", hr);
ok(!surface, "Unexpected surface instance.\n");
- }
- }
+}
That's going to be a bit of a pain to trace back to the test if it fails. Would something along the lines of e.g. check_texture_color() in the d3d11 tests work?