[PATCH 5/5] d3d8/tests: Extend focus loss tests.

Stefan Dösinger stefan at codeweavers.com
Tue Sep 23 05:57:18 CDT 2014


---
 dlls/d3d8/tests/device.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index a92ca81..c2ca0ff 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -6257,12 +6257,22 @@ static void test_lost_device(void)
     HWND window;
     HRESULT hr;
     BOOL ret;
+    DEVMODEW mode;
+    D3DPRESENT_PARAMETERS present_parameters = {0};
 
     window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW,
             0, 0, 640, 480, NULL, NULL, NULL, NULL);
     d3d = Direct3DCreate8(D3D_SDK_VERSION);
     ok(!!d3d, "Failed to create a D3D object.\n");
-    if (!(device = create_device(d3d, window, window, FALSE)))
+
+    present_parameters.Windowed = FALSE;
+    present_parameters.hDeviceWindow = window;
+    present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+    present_parameters.BackBufferWidth = 640;
+    present_parameters.BackBufferHeight = 480;
+    present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
+    if (FAILED(IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
+            D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device)))
     {
         skip("Failed to create a D3D device, skipping tests.\n");
         goto done;
@@ -6279,6 +6289,13 @@ static void test_lost_device(void)
     hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
+    memset(&mode, 0, sizeof(mode));
+    mode.dmSize = sizeof(mode);
+    ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &mode);
+    ok(ret, "Failed to get display mode.\n");
+    ok(mode.dmPelsWidth == 640 && mode.dmPelsHeight == 480,
+            "Got unexpected mode %ux%u, expected 640x480.\n", mode.dmPelsWidth, mode.dmPelsHeight);
+
     ret = SetForegroundWindow(GetDesktopWindow());
     ok(ret, "Failed to set foreground window.\n");
     hr = IDirect3DDevice8_TestCooperativeLevel(device);
@@ -6286,6 +6303,15 @@ static void test_lost_device(void)
     hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr);
 
+    memset(&mode, 0, sizeof(mode));
+    mode.dmSize = sizeof(mode);
+    ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &mode);
+    ok(ret, "Failed to get display mode.\n");
+    ok(mode.dmPelsWidth == screen_width && mode.dmPelsHeight == screen_height,
+            "Got unexpected mode %ux%u, expected %ux%u.\n", mode.dmPelsWidth, mode.dmPelsHeight,
+            screen_width, screen_height);
+    ok(IsIconic(window), "Expected window to be iconic.\n");
+
     ret = ShowWindow(window, SW_RESTORE);
     ok(ret, "Failed to restore window.\n");
     ret = SetForegroundWindow(window);
@@ -6295,6 +6321,15 @@ static void test_lost_device(void)
     hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr);
 
+    memset(&mode, 0, sizeof(mode));
+    mode.dmSize = sizeof(mode);
+    ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &mode);
+    ok(ret, "Failed to get display mode.\n");
+    ok(mode.dmPelsWidth == screen_width && mode.dmPelsHeight == screen_height,
+            "Got unexpected mode %ux%u, expected %ux%u.\n", mode.dmPelsWidth, mode.dmPelsHeight,
+            screen_width, screen_height);
+    ok(!IsIconic(window), "Expected window not to be iconic.\n");
+
     hr = reset_device(device, window, FALSE);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     hr = IDirect3DDevice8_TestCooperativeLevel(device);
@@ -6302,6 +6337,15 @@ static void test_lost_device(void)
     hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
+    memset(&mode, 0, sizeof(mode));
+    mode.dmSize = sizeof(mode);
+    ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &mode);
+    ok(ret, "Failed to get display mode.\n");
+    ok(mode.dmPelsWidth == screen_width && mode.dmPelsHeight == screen_height,
+            "Got unexpected mode %ux%u, expected %ux%u.\n", mode.dmPelsWidth, mode.dmPelsHeight,
+            screen_width, screen_height);
+    ok(!IsIconic(window), "Expected window not to be iconic.\n");
+
     hr = reset_device(device, window, TRUE);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     hr = IDirect3DDevice8_TestCooperativeLevel(device);
-- 
1.8.5.5




More information about the wine-patches mailing list