[PATCH 4/5] ddraw/tests: Add tests for DDBLT_DEPTHFILL.
Stefan Dösinger
stefan at codeweavers.com
Mon Mar 16 08:48:55 CDT 2015
---
dlls/ddraw/tests/ddraw7.c | 122 +++++++++++++++++++++++++++++++++++++---------
1 file changed, 98 insertions(+), 24 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index d08dd8e..5b8dd18 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -8540,7 +8540,7 @@ static void test_color_fill(void)
static const struct
{
DWORD caps, caps2;
- HRESULT hr;
+ HRESULT colorfill_hr, depthfill_hr;
const char *name;
DWORD result;
BOOL check_result;
@@ -8550,7 +8550,7 @@ static void test_color_fill(void)
{
{
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem offscreenplain RGB", 0xdeadbeef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem offscreenplain RGB", 0xdeadbeef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
@@ -8558,7 +8558,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0,
- DD_OK, "sysmem offscreenplain RGB", 0xdeadbeef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "sysmem offscreenplain RGB", 0xdeadbeef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
@@ -8566,7 +8566,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem texture RGB", 0xdeadbeef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem texture RGB", 0xdeadbeef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
@@ -8574,7 +8574,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0,
- DD_OK, "sysmem texture RGB", 0xdeadbeef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "sysmem texture RGB", 0xdeadbeef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
@@ -8582,7 +8582,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE,
- DD_OK, "managed texture RGB", 0xdeadbeef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "managed texture RGB", 0xdeadbeef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
@@ -8590,12 +8590,12 @@ static void test_color_fill(void)
},
{
DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY, 0,
- DDERR_INVALIDPARAMS, "vidmem zbuffer", 0, FALSE,
+ DDERR_INVALIDPARAMS, DD_OK, "vidmem zbuffer", 0, FALSE,
{0, 0, 0, {0}, {0}, {0}, {0}, {0}}
},
{
DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY, 0,
- DDERR_INVALIDPARAMS, "sysmem zbuffer", 0, FALSE,
+ DDERR_INVALIDPARAMS, DD_OK, "sysmem zbuffer", 0, FALSE,
{0, 0, 0, {0}, {0}, {0}, {0}, {0}}
},
{
@@ -8605,7 +8605,7 @@ static void test_color_fill(void)
* value they set. r200 (dx8) just sets the entire block to the clear
* value. */
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem offscreenplain YUY2", 0, FALSE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem offscreenplain YUY2", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'U', 'Y', '2'),
{0}, {0}, {0}, {0}, {0}
@@ -8613,7 +8613,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem offscreenplain UYVY", 0, FALSE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem offscreenplain UYVY", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U', 'Y', 'V', 'Y'),
{0}, {0}, {0}, {0}, {0}
@@ -8621,7 +8621,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem overlay YUY2", 0, FALSE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem overlay YUY2", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'U', 'Y', '2'),
{0}, {0}, {0}, {0}, {0}
@@ -8629,7 +8629,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem overlay UYVY", 0, FALSE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem overlay UYVY", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U', 'Y', 'V', 'Y'),
{0}, {0}, {0}, {0}, {0}
@@ -8637,7 +8637,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0,
- E_NOTIMPL, "vidmem texture DXT1", 0, FALSE,
+ E_NOTIMPL, DDERR_INVALIDPARAMS, "vidmem texture DXT1", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D', 'X', 'T', '1'),
{0}, {0}, {0}, {0}, {0}
@@ -8645,7 +8645,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0,
- E_NOTIMPL, "sysmem texture DXT1", 0, FALSE,
+ E_NOTIMPL, DDERR_INVALIDPARAMS, "sysmem texture DXT1", 0, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D', 'X', 'T', '1'),
{0}, {0}, {0}, {0}, {0}
@@ -8656,7 +8656,7 @@ static void test_color_fill(void)
* surface works, presumably because it is handled by the runtime instead of
* the driver. */
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0,
- DD_OK, "vidmem offscreenplain P8", 0xefefefef, FALSE,
+ DD_OK, DDERR_INVALIDPARAMS, "vidmem offscreenplain P8", 0xefefefef, FALSE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_PALETTEINDEXED8, 0,
{8}, {0}, {0}, {0}, {0}
@@ -8664,7 +8664,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0,
- DD_OK, "sysmem offscreenplain P8", 0xefefefef, TRUE,
+ DD_OK, DDERR_INVALIDPARAMS, "sysmem offscreenplain P8", 0xefefefef, TRUE,
{
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_PALETTEINDEXED8, 0,
{8}, {0}, {0}, {0}, {0}
@@ -8761,19 +8761,19 @@ static void test_color_fill(void)
hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
if (tests[i].format.dwFourCC)
- todo_wine ok(hr == tests[i].hr, "Blt returned %#x, expected %#x, surface %s.\n",
- hr, tests[i].hr, tests[i].name);
+ todo_wine ok(hr == tests[i].colorfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].colorfill_hr, tests[i].name);
else
- ok(hr == tests[i].hr, "Blt returned %#x, expected %#x, surface %s.\n",
- hr, tests[i].hr, tests[i].name);
+ ok(hr == tests[i].colorfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].colorfill_hr, tests[i].name);
hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
if (tests[i].format.dwFourCC)
- todo_wine ok(hr == tests[i].hr, "Blt returned %#x, expected %#x, surface %s.\n",
- hr, tests[i].hr, tests[i].name);
+ todo_wine ok(hr == tests[i].colorfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].colorfill_hr, tests[i].name);
else
- ok(hr == tests[i].hr, "Blt returned %#x, expected %#x, surface %s.\n",
- hr, tests[i].hr, tests[i].name);
+ ok(hr == tests[i].colorfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].colorfill_hr, tests[i].name);
if (SUCCEEDED(hr) && tests[i].check_result)
{
@@ -8788,6 +8788,13 @@ static void test_color_fill(void)
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, surface %s.\n", hr, tests[i].name);
}
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == tests[i].depthfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].depthfill_hr, tests[i].name);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == tests[i].depthfill_hr, "Blt returned %#x, expected %#x, surface %s.\n",
+ hr, tests[i].depthfill_hr, tests[i].name);
+
IDirectDrawSurface7_Release(surface);
}
@@ -8849,6 +8856,73 @@ static void test_color_fill(void)
hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(hr == DDERR_INVALIDRECT, "Got unexpected hr %#x.\n", hr);
+ /* Combine multiple flags. */
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+
+ IDirectDrawSurface7_Release(surface2);
+ IDirectDrawSurface7_Release(surface);
+
+ if (!z_fmt.dwSize)
+ goto done;
+
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.dwWidth = 64;
+ surface_desc.dwHeight = 64;
+ U4(surface_desc).ddpfPixelFormat = z_fmt;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface2, NULL);
+ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+
+ /* No DDBLTFX. */
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, NULL);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
+ /* Unused source rectangle. */
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+
+ /* Unused source surface. */
+ hr = IDirectDrawSurface7_Blt(surface, NULL, surface2, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, NULL, surface2, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
+ /* Inverted destination or source rectangle. */
+ SetRect(&rect, 5, 7, 7, 5);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDRECT, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, surface2, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, NULL, surface2, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
+ /* Negative rectangle. */
+ SetRect(&rect, -1, -1, 5, 5);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDRECT, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, surface2, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, surface2, &rect, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
+ /* Out of bounds rectangle. */
+ SetRect(&rect, 0, 0, 65, 65);
+ hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDRECT, "Got unexpected hr %#x.\n", hr);
+
+ /* Combine multiple flags. */
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_DEPTHFILL | DDBLT_WAIT, &fx);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
IDirectDrawSurface7_Release(surface2);
IDirectDrawSurface7_Release(surface);
--
2.3.2
More information about the wine-patches
mailing list