[PATCH 2/2] quartz/tests: Test renderer's parent WM_DESTROY notification.

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Jan 9 07:13:10 CST 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/quartz/tests/filtergraph.c | 35 ++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index ca45031..726c54a 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -4232,16 +4232,38 @@ static HWND get_renderer_hwnd(IFilterGraph2 *graph)
     return hwnd;
 }
 
+static LRESULT CALLBACK parent_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    switch (msg)
+    {
+        case WM_PARENTNOTIFY:
+            if (LOWORD(wParam) == WM_DESTROY)
+                ok(0, "Received WM_PARENTNOTIFY with WM_DESTROY.\n");
+        break;
+    }
+    return DefWindowProcA(hwnd, msg, wParam, lParam);
+}
+
 static void test_window_threading(void)
 {
     WCHAR *filename = load_resource(avifile);
     IFilterGraph2 *graph = create_graph();
+    WNDCLASSA cls = { 0 };
+    HWND hwnd, parent;
     HRESULT hr;
     DWORD tid;
     ULONG ref;
-    HWND hwnd;
     BOOL ret;
 
+    cls.lpfnWndProc   = parent_wndproc;
+    cls.hInstance     = GetModuleHandleA(NULL);
+    cls.hCursor       = LoadCursorA(0, (const char*)IDC_ARROW);
+    cls.lpszClassName = "TestParent";
+    RegisterClassA(&cls);
+
+    parent = CreateWindowExA(0, "TestParent", NULL, WS_OVERLAPPEDWINDOW, 50, 50, 150, 150, NULL, NULL, cls.hInstance, NULL);
+    ok(parent != NULL, "Failed to create parent window.\n");
+
     hr = IFilterGraph2_RenderFile(graph, filename, NULL);
     if (FAILED(hr))
     {
@@ -4256,6 +4278,10 @@ static void test_window_threading(void)
     {
         tid = GetWindowThreadProcessId(hwnd, NULL);
         ok(tid != GetCurrentThreadId(), "Window should have been created on a separate thread.\n");
+        ok(!(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_NOPARENTNOTIFY), "Window has WS_EX_NOPARENTNOTIFY.\n");
+
+        SetParent(hwnd, parent);
+        SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CHILD);
 
         /* The thread should be processing messages, or this will hang. */
         SendMessageA(hwnd, WM_NULL, 0, 0);
@@ -4277,6 +4303,10 @@ static void test_window_threading(void)
     {
         tid = GetWindowThreadProcessId(hwnd, NULL);
         ok(tid == GetCurrentThreadId(), "Window should be created on main thread.\n");
+        ok(!(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_NOPARENTNOTIFY), "Window has WS_EX_NOPARENTNOTIFY.\n");
+
+        SetParent(hwnd, parent);
+        SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CHILD);
     }
     else
         skip("Could not find renderer window.\n");
@@ -4285,6 +4315,9 @@ static void test_window_threading(void)
     ok(!ref, "Got outstanding refcount %d.\n", ref);
     ret = DeleteFileW(filename);
     ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+
+    DestroyWindow(parent);
+    UnregisterClassA("TestParent", cls.hInstance);
 }
 
 START_TEST(filtergraph)
-- 
2.21.0




More information about the wine-devel mailing list