2015-12-09 5:35 GMT+01:00 Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>:
> Also updates the structure dds_header to be the same as d3dx9_36/surface.c.
>
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
> ---
Thank you for improving the patches according to our comments. I've
found more though.
> dlls/d3dx9_36/tests/surface.c | 45 ++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c
> index 1697a03..eaab0f74 100644
> --- a/dlls/d3dx9_36/tests/surface.c
> +++ b/dlls/d3dx9_36/tests/surface.c
> @@ -211,7 +211,9 @@ struct dds_header
> struct dds_pixel_format pixel_format;
> DWORD caps;
> DWORD caps2;
> - DWORD reserved2[3];
> + DWORD caps3;
> + DWORD caps4;
> + DWORD reserved2;
> };
>
> /* fills dds_header with reasonable default values */
> @@ -1231,6 +1233,8 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
> RECT rect;
> ID3DXBuffer *buffer;
> IDirect3DSurface9 *surface;
> + struct dds_header *header;
> +#define BROKEN_CAPS (DDS_CAPS_TEXTURE | 0x02)
You don't need a define for this, I'd just put the expression in the
ok() or maybe use a const DWORD variable for this kind of situation.
FWIW 0x2 is probably DDSCAPS_ALPHA (see ddraw.h).
Notice though that I always get 0x1002 in the caps field on Windows (7
and XP tested) so probably it isn't right to consider that result as
broken. Did you actually get header->caps == DDS_CAPS_TEXTURE on any
Windows version (and if so, which one)? If not I'd only accept
(DDSCAPS_TEXTURE | DDSCAPS_ALPHA) as a valid result and add a
todo_wine to the relevant ok() call. You don't need a define or const
for the broken caps then and you can just put the expected result in
the ok().
>
> hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 4, 4, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
> if (FAILED(hr)) {
> @@ -1248,6 +1252,45 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
> ID3DXBuffer_Release(buffer);
> }
>
> + SetRectEmpty(&rect);
> + hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_DDS, surface, NULL, &rect);
> + todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x\n", hr);
Missing period.
> + if (SUCCEEDED(hr))
> + {
> + header = ID3DXBuffer_GetBufferPointer(buffer);
> +
> + ok(header->magic == MAKEFOURCC('D','D','S',' '), "Invalid DDS signature.\n");
> + ok(header->size == 124, "Invalid DDS size %u.\n", header->size);
> + ok(!header->height, "Got unexpected height %u.\n", header->height);
> + ok(!header->width, "Got unexpected width %u.\n", header->width);
> + ok(!header->depth, "Got unexpected depth %u.\n", header->depth);
> + ok(!header->miplevels, "Got unexpected miplevels %u.\n", header->miplevels);
> + ok(!header->pitch_or_linear_size, "Got unexpected pitch_or_linear_size %u.\n", header->pitch_or_linear_size);
> + ok(header->caps == DDS_CAPS_TEXTURE || broken(header->caps == BROKEN_CAPS),
> + "Got unexpected caps %x.\n", header->caps);
Indentation.
> + ok(header->flags == (DDS_CAPS | DDS_HEIGHT | DDS_WIDTH | DDS_PIXELFORMAT),
> + "Got unexpected flags %x.\n", header->flags);
> + ID3DXBuffer_Release(buffer);
> + }
> +
> + hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_DDS, surface, NULL, NULL);
> + ok(hr == D3D_OK, "Got unexpected hr %#x\n", hr);
Missing period.
> + header = ID3DXBuffer_GetBufferPointer(buffer);
> +
> + ok(header->magic == MAKEFOURCC('D','D','S',' '), "Invalid DDS signature.\n");
> + todo_wine ok(header->size == 124, "Invalid DDS size %u.\n", header->size);
> + ok(header->height == 4, "Got unexpected height %u.\n", header->height);
> + ok(header->width == 4, "Got unexpected width %u.\n", header->width);
> + todo_wine ok(!header->depth, "Got unexpected depth %u.\n", header->depth);
> + todo_wine ok(!header->miplevels, "Got unexpected miplevels %u.\n", header->miplevels);
> + todo_wine ok(!header->pitch_or_linear_size, "Got unexpected pitch_or_linear_size %u.\n", header->pitch_or_linear_size);
> + ok(header->caps == DDS_CAPS_TEXTURE || broken(header->caps == BROKEN_CAPS),
> + "Got unexpected caps %x.\n", header->caps);
> + todo_wine ok(header->flags == (DDS_CAPS | DDS_HEIGHT | DDS_WIDTH | DDS_PIXELFORMAT),
> + "Got unexpected flags %x.\n", header->flags);
> + ID3DXBuffer_Release(buffer);
> +
> +#undef BROKEN_CAPS
> IDirect3DSurface9_Release(surface);
> }
Looks good to me otherwise.