[PATCH 1/2] comctl32/tests: Some cleanup for SysLink tests

Nikolay Sivov nsivov at codeweavers.com
Thu Nov 30 23:30:16 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/comctl32/tests/syslink.c | 75 ++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 48 deletions(-)

diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c
index 94569d6f20..382c89d208 100644
--- a/dlls/comctl32/tests/syslink.c
+++ b/dlls/comctl32/tests/syslink.c
@@ -180,39 +180,44 @@ static HWND create_syslink(DWORD style, HWND parent)
     return hWndSysLink;
 }
 
+static void test_create_syslink(void)
+{
+    HWND hWndSysLink;
+    LONG oldstyle;
+
+    /* Create an invisible SysLink control */
+    flush_sequences(sequences, NUM_MSG_SEQUENCE);
+    hWndSysLink = create_syslink(WS_CHILD | WS_TABSTOP, hWndParent);
+    ok(hWndSysLink != NULL, "Expected non NULL value (le %u)\n", GetLastError());
+    flush_events();
+    ok_sequence(sequences, SYSLINK_SEQ_INDEX, empty_wnd_seq, "create SysLink", FALSE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_syslink_wnd_seq, "create SysLink (parent)", TRUE);
+
+    /* Make the SysLink control visible */
+    flush_sequences(sequences, NUM_MSG_SEQUENCE);
+    oldstyle = GetWindowLongA(hWndSysLink, GWL_STYLE);
+    SetWindowLongA(hWndSysLink, GWL_STYLE, oldstyle | WS_VISIBLE);
+    RedrawWindow(hWndSysLink, NULL, NULL, RDW_INVALIDATE);
+    flush_events();
+    ok_sequence(sequences, SYSLINK_SEQ_INDEX, visible_syslink_wnd_seq, "visible SysLink", TRUE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_visible_syslink_wnd_seq, "visible SysLink (parent)", TRUE);
+
+    DestroyWindow(hWndSysLink);
+}
 
 START_TEST(syslink)
 {
     ULONG_PTR ctx_cookie;
-    HANDLE hCtx;
     HMODULE hComctl32;
-    BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
-    INITCOMMONCONTROLSEX iccex;
-    BOOL rc;
-    HWND hWndSysLink;
-    LONG oldstyle;
     POINT orig_pos;
+    HANDLE hCtx;
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
         return;
 
     /* LoadLibrary is needed. This file has no reference to functions in comctl32 */
     hComctl32 = LoadLibraryA("comctl32.dll");
-    pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
-    if (!pInitCommonControlsEx)
-    {
-        win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
-        return;
-    }
-    iccex.dwSize = sizeof(iccex);
-    iccex.dwICC = ICC_LINK_CLASS;
-    rc = pInitCommonControlsEx(&iccex);
-    ok(rc, "InitCommonControlsEx failed (le %u)\n", GetLastError());
-    if (!rc)
-    {
-        skip("Could not register ICC_LINK_CLASS\n");
-        return;
-    }
+    ok(hComctl32 != NULL, "Failed to load comctl32.dll.\n");
 
     /* Move the cursor off the parent window */
     GetCursorPos(&orig_pos);
@@ -223,36 +228,10 @@ START_TEST(syslink)
     /* Create parent window */
     hWndParent = create_parent_window();
     ok(hWndParent != NULL, "Failed to create parent Window!\n");
-    if (!hWndParent)
-    {
-        skip("Parent window not present\n");
-        return;
-    }
-    flush_events();
-
-    /* Create an invisible SysLink control */
-    flush_sequences(sequences, NUM_MSG_SEQUENCE);
-    hWndSysLink = create_syslink(WS_CHILD | WS_TABSTOP, hWndParent);
-    ok(hWndSysLink != NULL, "Expected non NULL value (le %u)\n", GetLastError());
-    if (!hWndSysLink)
-    {
-        skip("SysLink control not present?\n");
-        return;
-    }
     flush_events();
-    ok_sequence(sequences, SYSLINK_SEQ_INDEX, empty_wnd_seq, "create SysLink", FALSE);
-    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_syslink_wnd_seq, "create SysLink (parent)", TRUE);
 
-    /* Make the SysLink control visible */
-    flush_sequences(sequences, NUM_MSG_SEQUENCE);
-    oldstyle = GetWindowLongA(hWndSysLink, GWL_STYLE);
-    SetWindowLongA(hWndSysLink, GWL_STYLE, oldstyle | WS_VISIBLE);
-    RedrawWindow(hWndSysLink, NULL, NULL, RDW_INVALIDATE);
-    flush_events();
-    ok_sequence(sequences, SYSLINK_SEQ_INDEX, visible_syslink_wnd_seq, "visible SysLink", TRUE);
-    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_visible_syslink_wnd_seq, "visible SysLink (parent)", TRUE);
+    test_create_syslink();
 
-    DestroyWindow(hWndSysLink);
     DestroyWindow(hWndParent);
     unload_v6_module(ctx_cookie, hCtx);
     SetCursorPos(orig_pos.x, orig_pos.y);
-- 
2.15.0




More information about the wine-devel mailing list