Commit 16df0ea0 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d8/tests: Add more tests for UnlockRect().

parent 58056728
...@@ -4808,12 +4808,12 @@ static void test_lockrect_invalid(void) ...@@ -4808,12 +4808,12 @@ static void test_lockrect_invalid(void)
IDirect3DCubeTexture8 *cube_texture; IDirect3DCubeTexture8 *cube_texture;
D3DLOCKED_RECT locked_rect; D3DLOCKED_RECT locked_rect;
IDirect3DDevice8 *device; IDirect3DDevice8 *device;
HRESULT hr, expected_hr;
IDirect3D8 *d3d8; IDirect3D8 *d3d8;
unsigned int i, r; unsigned int i, r;
ULONG refcount; ULONG refcount;
HWND window; HWND window;
BYTE *base; BYTE *base;
HRESULT hr;
unsigned int offset, expected_offset; unsigned int offset, expected_offset;
static const struct static const struct
{ {
...@@ -4875,11 +4875,16 @@ static void test_lockrect_invalid(void) ...@@ -4875,11 +4875,16 @@ static void test_lockrect_invalid(void)
default: default:
break; break;
} }
hr = IDirect3DSurface8_LockRect(surface, &locked_rect, NULL, 0); hr = IDirect3DSurface8_LockRect(surface, &locked_rect, NULL, 0);
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x, type %s.\n", hr, resources[r].name); ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x, type %s.\n", hr, resources[r].name);
base = locked_rect.pBits; base = locked_rect.pBits;
hr = IDirect3DSurface8_UnlockRect(surface); hr = IDirect3DSurface8_UnlockRect(surface);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, type %s.\n", hr, resources[r].name); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, type %s.\n", hr, resources[r].name);
expected_hr = resources[r].type == D3DRTYPE_TEXTURE ? D3D_OK : D3DERR_INVALIDCALL;
hr = IDirect3DSurface8_UnlockRect(surface);
todo_wine_if(resources[r].type == D3DRTYPE_TEXTURE)
ok(hr == expected_hr, "Got hr %#x, expected %#x, type %s.\n", hr, expected_hr, resources[r].name);
for (i = 0; i < (sizeof(valid) / sizeof(*valid)); ++i) for (i = 0; i < (sizeof(valid) / sizeof(*valid)); ++i)
{ {
...@@ -5019,6 +5024,8 @@ static void test_lockrect_invalid(void) ...@@ -5019,6 +5024,8 @@ static void test_lockrect_invalid(void)
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DTexture8_UnlockRect(texture, 0); hr = IDirect3DTexture8_UnlockRect(texture, 0);
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DTexture8_UnlockRect(texture, 0);
todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DTexture8_LockRect(texture, 0, &locked_rect, &valid[0], 0); hr = IDirect3DTexture8_LockRect(texture, 0, &locked_rect, &valid[0], 0);
ok(hr == D3D_OK, "Got unexpected hr %#x for rect %s, type %s.\n", ok(hr == D3D_OK, "Got unexpected hr %#x for rect %s, type %s.\n",
...@@ -5054,6 +5061,8 @@ static void test_lockrect_invalid(void) ...@@ -5054,6 +5061,8 @@ static void test_lockrect_invalid(void)
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DCubeTexture8_UnlockRect(cube_texture, D3DCUBEMAP_FACE_NEGATIVE_X, 0); hr = IDirect3DCubeTexture8_UnlockRect(cube_texture, D3DCUBEMAP_FACE_NEGATIVE_X, 0);
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DCubeTexture8_UnlockRect(cube_texture, D3DCUBEMAP_FACE_NEGATIVE_X, 0);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
hr = IDirect3DCubeTexture8_LockRect(cube_texture, D3DCUBEMAP_FACE_NEGATIVE_X, 0, hr = IDirect3DCubeTexture8_LockRect(cube_texture, D3DCUBEMAP_FACE_NEGATIVE_X, 0,
&locked_rect, &valid[0], 0); &locked_rect, &valid[0], 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment