[PATCH v2 5/6] d3d8/tests: Use correct index variable in test_resource_access() (Coverity).
Matteo Bruni
mbruni at codeweavers.com
Fri Feb 1 05:59:32 CST 2019
From: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2: Fix the tests on Windows (and also accept Nvidia behavior).
dlls/d3d8/tests/device.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index ac04a6ad649..1e1764edebd 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -8951,7 +8951,9 @@ static void test_resource_access(void)
hr = IDirect3DDevice8_CreateDepthStencilSurface(device,
16, 16, format, D3DMULTISAMPLE_NONE, &surface);
todo_wine_if(tests[j].format == FORMAT_ATI2)
- ok(hr == (tests[j].format != FORMAT_COLOUR ? D3D_OK : D3DERR_INVALIDCALL),
+ ok(hr == (tests[j].format == FORMAT_DEPTH ? D3D_OK
+ : tests[j].format == FORMAT_COLOUR ? D3DERR_INVALIDCALL : E_INVALIDARG)
+ || (tests[j].format == FORMAT_ATI2 && hr == D3D_OK),
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
if (FAILED(hr))
continue;
@@ -9047,17 +9049,20 @@ static void test_resource_access(void)
HRESULT expected_hr;
D3DLOCKED_BOX lb;
- if (tests[j].format == FORMAT_DEPTH)
+ if (tests[i].format == FORMAT_DEPTH)
continue;
- if (tests[j].format == FORMAT_ATI2)
+ if (tests[i].format == FORMAT_ATI2)
format = MAKEFOURCC('A','T','I','2');
else
format = colour_format;
hr = IDirect3DDevice8_CreateVolumeTexture(device, 16, 16, 1, 1,
tests[i].usage, format, tests[i].pool, &texture);
- ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL),
+ ok((hr == ((!(tests[i].usage & ~D3DUSAGE_DYNAMIC) && tests[i].format != FORMAT_ATI2)
+ || (tests[i].pool == D3DPOOL_SCRATCH && !tests[i].usage)
+ ? D3D_OK : D3DERR_INVALIDCALL))
+ || (tests[i].format == FORMAT_ATI2 && hr == D3D_OK),
"Test %u: Got unexpected hr %#x.\n", i, hr);
if (FAILED(hr))
continue;
@@ -9075,9 +9080,11 @@ static void test_resource_access(void)
expected_hr = D3D_OK;
else
expected_hr = D3DERR_INVALIDCALL;
- ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK),
+ "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DVolume8_UnlockBox(volume);
- ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK),
+ "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)texture);
ok(hr == D3D_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
--
2.19.2
More information about the wine-devel
mailing list