On Tue, May 28, 2019 at 3:47 PM Lorenzo Ferrillo lorenzofersteam@live.it wrote:
diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 56b79d80cb..a31a110357 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -1323,6 +1323,14 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device) ok(size > 0, "ID3DXBuffer_GetBufferSize returned %u, expected > 0\n", size); ID3DXBuffer_Release(buffer); }
- SetRectEmpty(&rect);
- hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_TGA, surface, NULL, &rect);
- ok(hr == D3D_OK, "D3DXSaveSurfaceToFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
- if (SUCCEEDED(hr)) {
DWORD size = ID3DXBuffer_GetBufferSize(buffer);
ok(size > 0, "ID3DXBuffer_GetBufferSize returned %u, expected > 0\n", size);
ID3DXBuffer_Release(buffer);
- }
You're passing an empty rect to D3DXSaveSurfaceToFileInMemory(), which is a weird edge cases that succeeds and returns "some" data. Our implementation of that is a few lines below your other change, although it's probably wrong: the DDS test immediately below suggests that it should be a proper image header.
It turns out we already have a test for saving TGA files, in test_D3DXSaveSurfaceToFile(). It's inside a todo_wine i.e. known not to pass on Wine. It still doesn't pass with this patch because we don't have a TGA encoder in windowscodecs right now.