John Edmonds : d3d9/tests: Added a test for resetting an invisible, inactive window to fullscreen mode.

Alexandre Julliard julliard at winehq.org
Wed May 4 13:47:42 CDT 2011


Module: wine
Branch: master
Commit: 1772a043db3ee0c1f807eb1cec6ee64c5a1e168c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1772a043db3ee0c1f807eb1cec6ee64c5a1e168c

Author: John Edmonds <pocketcookies2 at gmail.com>
Date:   Tue May  3 20:22:12 2011 -0400

d3d9/tests: Added a test for resetting an invisible, inactive window to fullscreen mode.

---

 dlls/d3d9/tests/device.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 27eae10..576e61f 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2814,6 +2814,63 @@ done:
     UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL));
 }
 
+static void test_reset_fullscreen(void)
+{
+    WNDCLASSEX wc = {0};
+    IDirect3DDevice9 *device = NULL;
+    IDirect3D9 *d3d = NULL;
+    static const struct message messages[] =
+    {
+        {WM_ACTIVATEAPP,    FOCUS_WINDOW},
+        {0,                     0},
+    };
+
+    d3d = pDirect3DCreate9(D3D_SDK_VERSION);
+    ok(d3d != NULL, "Failed to create an IDirect3D object.\n");
+    expect_messages = messages;
+
+    wc.cbSize = sizeof(WNDCLASSEX);
+    wc.lpfnWndProc = test_proc;
+    wc.lpszClassName = "test_reset_fullscreen";
+
+    ok(RegisterClassEx(&wc), "Failed to register a new window class. GetLastError:%d\n", GetLastError());
+
+    device_window = focus_window = CreateWindowEx(0, wc.lpszClassName, "Test Reset Fullscreen", 0, 0, 0, screen_width, screen_height, NULL, NULL, NULL, NULL);
+    ok(device_window != NULL, "Failed to create a window. GetLastError:%d\n", GetLastError());
+
+    /*
+     * 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);
+    if (!device)
+    {
+        skip("Unable to create device.  Skipping test.");
+        goto cleanup;
+    }
+
+    /*
+     * Switch to fullscreen mode.
+     * This will force the window to be shown and will cause the WM_ACTIVATEAPP
+     * message to be sent.
+     */
+    ok(SUCCEEDED(reset_device(device, device_window, FALSE)), "Failed to reset device.\n");
+
+    flush_events();
+    todo_wine ok(expect_messages->message == 0, "Expected to receive message %#x.\n", expect_messages->message);
+    expect_messages = NULL;
+
+cleanup:
+    if (device) IDirect3DDevice9_Release(device);
+    if (d3d) 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__))
@@ -3007,6 +3064,7 @@ START_TEST(device)
         test_mipmap_levels();
         test_checkdevicemultisampletype();
         test_cursor();
+        test_reset_fullscreen();
         test_reset();
         test_scene();
         test_limits();




More information about the wine-cvs mailing list