d3d8/tests: Block validation checks the surface size too.

Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-01-18 22:20:09 +00:00 committed by Alexandre Julliard
parent 062c0a90a2
commit 5b63c93f3e
1 changed files with 29 additions and 1 deletions

View File

@ -5350,7 +5350,7 @@ static void test_surface_blocks(void)
IDirect3DSurface8 *surface;
D3DLOCKED_RECT locked_rect;
IDirect3DDevice8 *device;
unsigned int i, j, w, h;
unsigned int i, j, k, w, h;
IDirect3D8 *d3d;
ULONG refcount;
HWND window;
@ -5358,6 +5358,21 @@ static void test_surface_blocks(void)
RECT rect;
BOOL tex_pow2, cube_pow2;
D3DCAPS8 caps;
static const RECT invalid[] =
{
{60, 60, 60, 68}, /* 0 height */
{60, 60, 68, 60}, /* 0 width */
{68, 60, 60, 68}, /* left > right */
{60, 68, 68, 60}, /* top > bottom */
{-8, 60, 0, 68}, /* left < surface */
{60, -8, 68, 0}, /* top < surface */
{-16, 60, -8, 68}, /* right < surface */
{60, -16, 68, -8}, /* bottom < surface */
{60, 60, 136, 68}, /* right > surface */
{60, 60, 68, 136}, /* bottom > surface */
{136, 60, 144, 68}, /* left > surface */
{60, 136, 68, 144}, /* top > surface */
};
window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
@ -5573,6 +5588,19 @@ static void test_surface_blocks(void)
}
}
for (k = 0; k < sizeof(invalid) / sizeof(*invalid); ++k)
{
hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &invalid[k], 0);
ok(FAILED(hr) == !pools[j].success, "Invalid lock %s(%#x), expected %s, format %s, pool %s, case %u.\n",
SUCCEEDED(hr) ? "succeeded" : "failed", hr, pools[j].success ? "success" : "failure",
formats[i].name, pools[j].name, k);
if (SUCCEEDED(hr))
{
hr = IDirect3DSurface8_UnlockRect(surface);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr);
}
}
SetRect(&rect, 0, 0, formats[i].block_width, formats[i].block_height);
hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0);
ok(hr == D3D_OK, "Got unexpected hr %#x for format %s, pool %s.\n", hr, formats[i].name, pools[j].name);