[PATCH 1/2] d3d9/tests: Added a test for resetting an invisible, inactive window to fullscreen mode.

John Edmonds pocketcookies2 at gmail.com
Mon May 2 06:18:03 CDT 2011


This tests that Wine sends the WM_ACTIVATEAPP message when a window changes from inactive, invisible, windowed mode into fullscreen mode.
The test addresses bug #25640.
---
 dlls/d3d9/tests/device.c |   54 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index b377bee..9e4dea5 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2808,6 +2808,59 @@ done:
     UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL));
 }
 
+static void test_reset_fullscreen(void)
+{
+    WNDCLASSEX wc = {0};
+    IDirect3DDevice9 *device;
+    IDirect3D9 *d3d;
+    MSG msg;
+    static const struct message messages[] =
+    {
+        {WM_ACTIVATEAPP,    FOCUS_WINDOW},
+        {0,                     0},
+    };
+
+    d3d = pDirect3DCreate9(D3D_SDK_VERSION);
+    expect_messages = messages;
+
+    wc.cbSize = sizeof(WNDCLASSEX);
+    wc.lpfnWndProc = test_proc;
+    wc.lpszClassName = "test_reset_fullscreen";
+
+    RegisterClassEx(&wc);
+
+    device_window = focus_window = CreateWindowEx(0, wc.lpszClassName, "Test Reset Fullscreen", 0, 0, 0, screen_width, screen_height, NULL, NULL, NULL, NULL);
+
+    /*
+     * Create a device in windowed mode.
+     * Since the device is windowed and we haven't called any methods that
+     * could show the window (such as ShowWindow or SetWindowPos) yet,
+     * WM_ACTIVATEAPP will not have been sent.
+     */
+    device = create_device(d3d, device_window, focus_window, TRUE);
+    /*
+     * Switch to fullscreen mode.
+     * This will force the window to be shown and will cause the WM_ACTIVATEAPP
+     * message to be sent.
+     */
+    reset_device(device, device_window, FALSE);
+
+    /*Pull all currently available messages.  We don't care about messages generated after this loop exits.*/
+    while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+    {
+        TranslateMessage(&msg);
+        DispatchMessage(&msg);
+    }
+    todo_wine ok(expect_messages->message == 0, "Expected to receive message %#x.\n", expect_messages->message);
+    expect_messages = NULL;
+
+    IDirect3DDevice9_Release(device);
+    IDirect3D9_Release(d3d);
+    DestroyWindow(device_window);
+    device_window = focus_window = NULL;
+    UnregisterClass(wc.lpszClassName, GetModuleHandle(NULL));
+}
+
 static inline void set_fpu_cw(WORD cw)
 {
 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -2927,6 +2980,7 @@ START_TEST(device)
         test_mipmap_levels();
         test_checkdevicemultisampletype();
         test_cursor();
+        test_reset_fullscreen();
         test_reset();
         test_scene();
         test_limits();
-- 
1.7.4.1





More information about the wine-patches mailing list