Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 28 +++++++++-------- dlls/ddraw/tests/ddraw2.c | 57 ++++++++++++++++++---------------- dlls/ddraw/tests/ddraw4.c | 56 ++++++++++++++++++--------------- dlls/ddraw/tests/ddraw7.c | 65 +++++++++++++++++++++++---------------- 4 files changed, 116 insertions(+), 90 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index e0393a3a591..84bdda82978 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -386,7 +386,7 @@ static void fill_surface(IDirectDrawSurface *surface, D3DCOLOR color) ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); }
-static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) +static void check_rect(IDirectDrawSurface *surface, RECT r) { LONG x_coords[2][2] = { @@ -417,8 +417,7 @@ static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) if (x < 0 || x >= 640 || y < 0 || y >= 480) continue; color = get_surface_color(surface, x, y); - ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", - message, x, y, color, expected); + ok(color == expected, "Pixel (%d, %d) has color %08x, expected %08x.\n", x, y, color, expected); } } } @@ -13277,11 +13276,13 @@ static void test_viewport(void)
for (j = 0; j < ARRAY_SIZE(tests); ++j) { + winetest_push_context(tests[j].message); + hr = IDirect3DViewport_Clear(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET); - ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D_CreateViewport(d3d, &viewport, NULL); - ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); memset(&vp, 0, sizeof(vp)); vp.dwSize = sizeof(vp); vp.dwX = tests[j].vp.dwX; @@ -13295,26 +13296,27 @@ static void test_viewport(void) vp.dvMinZ = 0.0f; vp.dvMaxZ = 1.0f; hr = IDirect3DViewport_SetViewport(viewport, &vp); - ok(hr == D3DERR_VIEWPORTHASNODEVICE, - "Setting viewport data returned unexpected hr %#x (j %u).\n", hr, j); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice_AddViewport(device, viewport); - ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport_SetViewport(viewport, &vp); - ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
set_execute_data(execute_buffer, 4, sizeof(quad), inst_length); hr = IDirect3DDevice_Execute(device, execute_buffer, viewport, D3DEXECUTE_CLIPPED); - ok(SUCCEEDED(hr), "Failed to execute exec buffer, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (j %u).\n", hr, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
- check_rect(rt, tests[j].expected_rect, tests[j].message); + check_rect(rt, tests[j].expected_rect);
destroy_viewport(device, viewport); + + winetest_pop_context(); }
destroy_viewport(device, full_viewport); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 03f1d488673..f67aae9db5b 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -388,7 +388,7 @@ static void fill_surface(IDirectDrawSurface *surface, D3DCOLOR color) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
-static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) +static void check_rect(IDirectDrawSurface *surface, RECT r) { LONG x_coords[2][2] = { @@ -419,8 +419,7 @@ static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) if (x < 0 || x >= 640 || y < 0 || y >= 480) continue; color = get_surface_color(surface, x, y); - ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", - message, x, y, color, expected); + ok(color == expected, "Pixel (%d, %d) has color %08x, expected %08x.\n", x, y, color, expected); } } } @@ -14154,7 +14153,11 @@ static void test_viewport(void) {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, {{ 0, 0, 8192, 8192}, {-10, -10, -10, -10}, "Viewport (0, 0) - (8192, 8192)"}, }; - static const struct vec2 rt_sizes[] = + static const struct + { + unsigned int x, y; + } + rt_sizes[] = { {640, 480}, {1280, 960}, {320, 240}, {800, 600}, }; @@ -14225,6 +14228,8 @@ static void test_viewport(void)
for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i) { + winetest_push_context("Size %ux%u", rt_sizes[i].x, rt_sizes[i].y); + if (i) { memset(&surface_desc, 0, sizeof(surface_desc)); @@ -14234,23 +14239,23 @@ static void test_viewport(void) surface_desc.dwHeight = rt_sizes[i].y; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(SUCCEEDED(hr), "Failed to create render target, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; surface_desc.ddpfPixelFormat = z_fmt; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &ds, NULL); - ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface_AddAttachedSurface(rt, ds); - ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0); - ok(SUCCEEDED(hr), "Failed to set render target, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); } else { hr = IDirect3DDevice2_GetRenderTarget(device, &rt); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
full_viewport = create_viewport(device, 0, 0, rt_sizes[i].x, rt_sizes[i].y); @@ -14262,17 +14267,18 @@ static void test_viewport(void)
for (j = 0; j < ARRAY_SIZE(tests); ++j) { + winetest_push_context(tests[j].message); + expected_failure = tests[j].vp.dwX + tests[j].vp.dwWidth > rt_sizes[i].x || tests[j].vp.dwY + tests[j].vp.dwHeight > rt_sizes[i].y;
hr = IDirect3DViewport2_Clear(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET); - ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D2_CreateViewport(d3d, &viewport, NULL); - ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport2_SetViewport2(viewport, NULL); - ok(hr == E_INVALIDARG, "Setting NULL viewport data returned unexpected hr %#x (i %u, j %u).\n", - hr, i, j); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); memset(&vp, 0, sizeof(vp)); vp.dwSize = sizeof(vp); vp.dwX = tests[j].vp.dwX; @@ -14284,35 +14290,32 @@ static void test_viewport(void) vp.dvMinZ = 0.0f; vp.dvMaxZ = 1.0f; hr = IDirect3DViewport2_SetViewport(viewport, &vp); - ok(hr == D3DERR_VIEWPORTHASNODEVICE, - "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice2_AddViewport(device, viewport); - ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport2_SetViewport(viewport, &vp); - if (expected_failure) - ok(hr == E_INVALIDARG, "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", - hr, i, j); - else - ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == (expected_failure ? E_INVALIDARG : DD_OK), "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_SetCurrentViewport(device, viewport); - ok(SUCCEEDED(hr), "Failed to set the viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (expected_failure) { destroy_viewport(device, viewport); + winetest_pop_context(); continue; }
hr = IDirect3DDevice2_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, quad, 4, 0); - ok(SUCCEEDED(hr), "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice2_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
- check_rect(rt, tests[j].expected_rect, tests[j].message); + check_rect(rt, tests[j].expected_rect);
destroy_viewport(device, viewport); + winetest_pop_context(); }
destroy_viewport(device, full_viewport); @@ -14322,6 +14325,8 @@ static void test_viewport(void) IDirectDrawSurface_Release(ds);
IDirectDrawSurface_Release(rt); + + winetest_pop_context(); }
destroy_material(black_background); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 858d39e6f8e..8f85c5bc01b 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -389,7 +389,7 @@ static void fill_surface(IDirectDrawSurface4 *surface, D3DCOLOR color) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
-static void check_rect(IDirectDrawSurface4 *surface, RECT r, const char *message) +static void check_rect(IDirectDrawSurface4 *surface, RECT r) { LONG x_coords[2][2] = { @@ -420,8 +420,7 @@ static void check_rect(IDirectDrawSurface4 *surface, RECT r, const char *message if (x < 0 || x >= 640 || y < 0 || y >= 480) continue; color = get_surface_color(surface, x, y); - ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", - message, x, y, color, expected); + ok(color == expected, "Pixel (%d, %d) has color %08x, expected %08x.\n", x, y, color, expected); } } } @@ -16758,7 +16757,11 @@ static void test_viewport(void) {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, {{ 0, 0, 8192, 8192}, {-10, -10, -10, -10}, "Viewport (0, 0) - (8192, 8192)"}, }; - static const struct vec2 rt_sizes[] = + static const struct + { + unsigned int x, y; + } + rt_sizes[] = { {640, 480}, {1280, 960}, {320, 240}, {800, 600}, }; @@ -16825,6 +16828,8 @@ static void test_viewport(void)
for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i) { + winetest_push_context("Size %ux%u", rt_sizes[i].x, rt_sizes[i].y); + if (i) { memset(&surface_desc, 0, sizeof(surface_desc)); @@ -16834,23 +16839,23 @@ static void test_viewport(void) surface_desc.dwHeight = rt_sizes[i].y; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(SUCCEEDED(hr), "Failed to create render target, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; U4(surface_desc).ddpfPixelFormat = z_fmt; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &ds, NULL); - ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface4_AddAttachedSurface(rt, ds); - ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0); - ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); } else { hr = IDirect3DDevice3_GetRenderTarget(device, &rt); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
full_viewport = create_viewport(device, 0, 0, rt_sizes[i].x, rt_sizes[i].y); @@ -16861,16 +16866,18 @@ static void test_viewport(void)
for (j = 0; j < ARRAY_SIZE(tests); ++j) { + winetest_push_context(tests[j].message); + expected_failure = tests[j].vp.dwX + tests[j].vp.dwWidth > rt_sizes[i].x || tests[j].vp.dwY + tests[j].vp.dwHeight > rt_sizes[i].y;
hr = IDirect3DViewport3_Clear2(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xff000000, 0.0f, 0); - ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D3_CreateViewport(d3d, &viewport, NULL); - ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport3_SetViewport2(viewport, NULL); - ok(hr == E_INVALIDARG, "Setting NULL viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); memset(&vp, 0, sizeof(vp)); vp.dwSize = sizeof(vp); vp.dwX = tests[j].vp.dwX; @@ -16884,35 +16891,32 @@ static void test_viewport(void) vp.dvMinZ = 0.0f; vp.dvMaxZ = 1.0f; hr = IDirect3DViewport3_SetViewport2(viewport, &vp); - ok(hr == D3DERR_VIEWPORTHASNODEVICE, - "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice3_AddViewport(device, viewport); - ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport3_SetViewport2(viewport, &vp); - if (expected_failure) - ok(hr == E_INVALIDARG, - "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); - else - ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == (expected_failure ? E_INVALIDARG : DD_OK), "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_SetCurrentViewport(device, viewport); - ok(SUCCEEDED(hr), "Failed to set the viewport, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (expected_failure) { destroy_viewport(device, viewport); + winetest_pop_context(); continue; }
hr = IDirect3DDevice3_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, 0); - ok(SUCCEEDED(hr), "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice3_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
- check_rect(rt, tests[j].expected_rect, tests[j].message); + check_rect(rt, tests[j].expected_rect);
destroy_viewport(device, viewport); + winetest_pop_context(); }
destroy_viewport(device, full_viewport); @@ -16922,6 +16926,8 @@ static void test_viewport(void) IDirectDrawSurface4_Release(ds);
IDirectDrawSurface4_Release(rt); + + winetest_pop_context(); }
refcount = IDirect3DDevice3_Release(device); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d448bd76c01..3dfd590c42c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -411,8 +411,8 @@ static void fill_surface(IDirectDrawSurface7 *surface, D3DCOLOR color) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
-#define check_rect(a, b, c) check_rect_(__LINE__, a, b, c) -static void check_rect_(unsigned int line, IDirectDrawSurface7 *surface, RECT r, const char *message) +#define check_rect(a, b) check_rect_(__LINE__, a, b) +static void check_rect_(unsigned int line, IDirectDrawSurface7 *surface, RECT r) { LONG x_coords[2][2] = { @@ -443,8 +443,8 @@ static void check_rect_(unsigned int line, IDirectDrawSurface7 *surface, RECT r, if (x < 0 || x >= 640 || y < 0 || y >= 480) continue; color = get_surface_color(surface, x, y); - ok_(__FILE__, line)(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x.\n", - message, x, y, color, expected); + ok_(__FILE__, line)(color == expected, "Pixel (%d, %d) has color %08x, expected %08x.\n", + x, y, color, expected); } } } @@ -16200,7 +16200,11 @@ static void test_viewport(void) { 0.5f, -0.5f, 1.0f}, { 0.5f, 0.5f, 1.0f}, }; - static const struct vec2 rt_sizes[] = + static const struct + { + unsigned int x, y; + } + rt_sizes[] = { {640, 480}, {1280, 960}, {320, 240}, {800, 600}, }; @@ -16255,6 +16259,8 @@ static void test_viewport(void)
for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i) { + winetest_push_context("Size %ux%u", rt_sizes[i].x, rt_sizes[i].y); + if (i) { memset(&surface_desc, 0, sizeof(surface_desc)); @@ -16264,80 +16270,87 @@ static void test_viewport(void) surface_desc.dwHeight = rt_sizes[i].y; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; U4(surface_desc).ddpfPixelFormat = z_fmt; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &ds, NULL); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface7_AddAttachedSurface(rt, ds); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); } else { hr = IDirect3DDevice7_GetRenderTarget(device, &rt); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
for (j = 0; j < ARRAY_SIZE(tests); ++j) { + winetest_push_context(tests[j].message); + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, tests[j].expected_z - z_eps, 0); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZFUNC, D3DCMP_GREATER); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, !i); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_SetViewport(device, &tests[j].vp); if (tests[j].vp.dwX + tests[j].vp.dwWidth > rt_sizes[i].x || tests[j].vp.dwY + tests[j].vp.dwHeight > rt_sizes[i].y) { - ok(hr == E_INVALIDARG, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + winetest_pop_context(); continue; } else { - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); }
hr = IDirect3DDevice7_BeginScene(device); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, 0); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_EndScene(device); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
- check_rect(rt, tests[j].expected_rect, tests[j].message); + check_rect(rt, tests[j].expected_rect);
if (!i) { hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, tests[j].expected_z + z_eps, 0); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZFUNC, D3DCMP_LESS); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_BeginScene(device); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, 0); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice7_EndScene(device); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
- check_rect(rt, tests[j].expected_rect, tests[j].message); + check_rect(rt, tests[j].expected_rect); } + + winetest_pop_context(); }
hr = IDirectDrawSurface7_DeleteAttachedSurface(rt, 0, ds); - ok(hr == DD_OK, "Got unexpected hr %#x (i %u).\n", hr, i); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); IDirectDrawSurface7_Release(ds); IDirectDrawSurface7_Release(rt); + + winetest_pop_context(); }
refcount = IDirect3DDevice7_Release(device);