=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d9/tests: Block validation checks the surface size too.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 18 11:09:03 CST 2016
Module: wine
Branch: master
Commit: 460ae01d981353c5268b0dfe26e47458ddab90a6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=460ae01d981353c5268b0dfe26e47458ddab90a6
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Sun Jan 17 14:40:06 2016 +0000
d3d9/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/d3d9/tests/device.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 0c7afd8..ee8556f 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -7646,7 +7646,7 @@ static void test_surface_blocks(void)
IDirect3DSurface9 *surface;
D3DLOCKED_RECT locked_rect;
IDirect3DDevice9 *device;
- unsigned int i, j, w, h;
+ unsigned int i, j, k, w, h;
BOOL surface_only;
IDirect3D9 *d3d;
ULONG refcount;
@@ -7655,6 +7655,21 @@ static void test_surface_blocks(void)
RECT rect;
BOOL tex_pow2, cube_pow2;
D3DCAPS9 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("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
@@ -7903,6 +7918,19 @@ static void test_surface_blocks(void)
}
}
+ for (k = 0; k < sizeof(invalid) / sizeof(*invalid); ++k)
+ {
+ hr = IDirect3DSurface9_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 = IDirect3DSurface9_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 = IDirect3DSurface9_LockRect(surface, &locked_rect, &rect, 0);
ok(SUCCEEDED(hr), "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