Example #1
0
File: updown.c Project: devyn/wine
static void test_create_updown_control(void)
{
    CHAR text[MAX_PATH];

    parent_wnd = create_parent_window();
    ok(parent_wnd != NULL, "Failed to create parent window!\n");
    ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent window", TRUE);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    edit = create_edit_control();
    ok(edit != NULL, "Failed to create edit control\n");
    ok_sequence(sequences, PARENT_SEQ_INDEX, add_edit_to_parent_seq, "add edit control to parent", FALSE);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    updown = create_updown_control();
    ok(updown != NULL, "Failed to create updown control\n");
    ok_sequence(sequences, PARENT_SEQ_INDEX, add_updown_to_parent_seq, "add updown control to parent", TRUE);
    ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "add updown control with edit", FALSE);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    GetWindowTextA(edit, text, MAX_PATH);
    ok(lstrlenA(text) == 0, "Expected empty string\n");
    ok_sequence(sequences, EDIT_SEQ_INDEX, get_edit_text_seq, "get edit text", FALSE);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    test_updown_pos();
    test_updown_pos32();
    test_updown_buddy();
    test_updown_base();
    test_updown_unicode();
}
Example #2
0
static void test_updown_buddy(void)
{
    HWND updown, buddyReturn, buddy;
    WNDPROC proc;
    DWORD style;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, (WPARAM) g_edit, 0);
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_buddy_seq, "test updown buddy", TRUE);
    ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "test updown buddy_edit", FALSE);

    DestroyWindow(updown);

    buddy = create_edit_control();
    proc  = (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC);

    updown= create_updown_control(UDS_ALIGNRIGHT, buddy);
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_ARROWKEYS);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(style & UDS_ARROWKEYS, "Expected UDS_ARROWKEYS\n");
    /* no subclass if UDS_ARROWKEYS set after creation */
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    DestroyWindow(updown);

    updown= create_updown_control(UDS_ALIGNRIGHT | UDS_ARROWKEYS, buddy);
    ok(proc != (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "Subclassing expected\n");

    if (pSetWindowSubclass)
    {
        /* updown uses subclass helpers for buddy on >5.8x systems */
        ok(GetPropA(buddy, "CC32SubclassInfo") != NULL, "Expected CC32SubclassInfo property\n");
    }

    DestroyWindow(updown);

    DestroyWindow(buddy);
}
Example #3
0
File: updown.c Project: Jactry/wine
static void test_updown_buddy(void)
{
    HWND updown, buddyReturn, buddy;
    RECT rect, rect2;
    WNDPROC proc;
    DWORD style;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, (WPARAM) g_edit, 0);
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_buddy_seq, "test updown buddy", TRUE);
    ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "test updown buddy_edit", FALSE);

    DestroyWindow(updown);

    buddy = create_edit_control();
    proc  = (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC);

    updown= create_updown_control(UDS_ALIGNRIGHT, buddy);
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_ARROWKEYS);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(style & UDS_ARROWKEYS, "Expected UDS_ARROWKEYS\n");
    /* no subclass if UDS_ARROWKEYS set after creation */
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    DestroyWindow(updown);

    updown= create_updown_control(UDS_ALIGNRIGHT | UDS_ARROWKEYS, buddy);
    ok(proc != (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "Subclassing expected\n");

    if (pSetWindowSubclass)
    {
        /* updown uses subclass helpers for buddy on >5.8x systems */
        ok(GetPropA(buddy, "CC32SubclassInfo") != NULL, "Expected CC32SubclassInfo property\n");
    }

    DestroyWindow(updown);
    DestroyWindow(buddy);

    /* Create with buddy and UDS_HORZ, reset buddy. */
    updown = create_updown_control(UDS_HORZ, g_edit);

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0, 0);
    ok(buddyReturn == g_edit, "Unexpected buddy window.\n");

    GetClientRect(updown, &rect);

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, 0, 0);
    ok(buddyReturn == g_edit, "Unexpected buddy window.\n");

    GetClientRect(updown, &rect2);
    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    /* Remove UDS_HORZ, reset buddy again. */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style & ~UDS_HORZ);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(!(style & UDS_HORZ), "Unexpected style.\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, 0, 0);
    ok(buddyReturn == NULL, "Unexpected buddy window.\n");

    GetClientRect(updown, &rect2);
    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    DestroyWindow(updown);

    /* Without UDS_HORZ. */
    updown = create_updown_control(0, g_edit);

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0, 0);
    ok(buddyReturn == g_edit, "Unexpected buddy window.\n");

    GetClientRect(updown, &rect);

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, 0, 0);
    ok(buddyReturn == g_edit, "Unexpected buddy window.\n");

    GetClientRect(updown, &rect2);
    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    DestroyWindow(updown);

    /* Create without buddy. */
    GetClientRect(parent_wnd, &rect);
    updown = CreateWindowExA(0, UPDOWN_CLASSA, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_HORZ,
        0, 0, rect.right, rect.bottom, parent_wnd, (HMENU)1, GetModuleHandleA(NULL), NULL);
    ok(updown != NULL, "Failed to create UpDown control.\n");

    GetClientRect(updown, &rect);
    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, 0, 0);
    ok(buddyReturn == NULL, "Unexpected buddy window.\n");
    GetClientRect(updown, &rect2);

    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style & ~UDS_HORZ);

    GetClientRect(updown, &rect2);
    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, (WPARAM)g_edit, 0);
    ok(buddyReturn == NULL, "Unexpected buddy window.\n");
    GetClientRect(updown, &rect);

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, 0, 0);
    ok(buddyReturn == g_edit, "Unexpected buddy window.\n");
    GetClientRect(updown, &rect2);
todo_wine
    ok(EqualRect(&rect, &rect2), "Unexpected window rect.\n");

    DestroyWindow(updown);
}