=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d8/tests: Block validation checks the surface size too.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 20 10:50:02 CST 2016
Module: wine
Branch: master
Commit: 5b63c93f3e0b5ba21195a90db3aef170df9c6df5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b63c93f3e0b5ba21195a90db3aef170df9c6df5
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Mon Jan 18 22:20:09 2016 +0000
d3d8/tests: Block validation checks the surface size too.
Signed-off-by: Stefan Dösinger <stefandoesinger at gmx.at>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d8/tests/device.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 18ea559..c1dc886 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -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);
More information about the wine-cvs
mailing list