=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d9/tests: Test user memory and getdc interaction.
Alexandre Julliard
julliard at winehq.org
Thu Dec 12 12:48:08 CST 2013
Module: wine
Branch: master
Commit: 03fe6f3e0781b09073541ca65b9ffcc0bb2f5cc7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03fe6f3e0781b09073541ca65b9ffcc0bb2f5cc7
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Wed Dec 11 22:30:43 2013 +0100
d3d9/tests: Test user memory and getdc interaction.
---
dlls/d3d9/tests/Makefile.in | 2 +-
dlls/d3d9/tests/d3d9ex.c | 45 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d9/tests/Makefile.in b/dlls/d3d9/tests/Makefile.in
index 380d105..7b205be 100644
--- a/dlls/d3d9/tests/Makefile.in
+++ b/dlls/d3d9/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = d3d9.dll
-IMPORTS = user32
+IMPORTS = user32 gdi32
C_SRCS = \
d3d9ex.c \
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 7f39d70..7ac8bb3 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -1151,6 +1151,50 @@ done:
DestroyWindow(window);
}
+static void test_user_memory_getdc(void)
+{
+ IDirect3DDevice9Ex *device;
+ HWND window;
+ HRESULT hr;
+ ULONG ref;
+ IDirect3DSurface9 *surface;
+ DWORD *data;
+ HDC dc;
+
+ window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, 0, 0, 0, 0);
+ if (!(device = create_device(window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ goto done;
+ }
+
+ data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) * 16 * 16);
+ memset(data, 0xaa, sizeof(*data) * 16 * 16);
+ hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurface(device, 16, 16,
+ D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surface, (HANDLE *)&data);
+ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+
+ hr = IDirect3DSurface9_GetDC(surface, &dc);
+ ok(SUCCEEDED(hr), "Failed to get dc, hr %#x.\n", hr);
+ BitBlt(dc, 0, 0, 16, 8, NULL, 0, 0, WHITENESS);
+ BitBlt(dc, 0, 8, 16, 8, NULL, 0, 0, BLACKNESS);
+ hr = IDirect3DSurface9_ReleaseDC(surface, dc);
+ ok(SUCCEEDED(hr), "Failed to release dc, hr %#x.\n", hr);
+
+ ok(data[0] == 0xffffffff, "Expected color 0xffffffff, got %#x.\n", data[0]);
+ ok(data[8 * 16] == 0x00000000, "Expected color 0x00000000, got %#x.\n", data[8 * 16]);
+
+ IDirect3DSurface9_Release(surface);
+ HeapFree(GetProcessHeap(), 0, data);
+
+ ref = IDirect3DDevice9_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+
+done:
+ DestroyWindow(window);
+}
+
START_TEST(d3d9ex)
{
d3d9_handle = LoadLibraryA("d3d9.dll");
@@ -1180,4 +1224,5 @@ START_TEST(d3d9ex)
test_reset();
test_reset_resources();
test_vidmem_accounting();
+ test_user_memory_getdc();
}
More information about the wine-cvs
mailing list