Пример #1
0
static void test_UDS_SETBUDDYINT(void)
{
    HWND updown;
    DWORD style, ret;
    CHAR text[10];

    /* cleanup buddy */
    text[0] = '\0';
    SetWindowTextA(g_edit, text);

    /* creating without UDS_SETBUDDYINT */
    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);
    /* try to set UDS_SETBUDDYINT after creation */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(style & UDS_SETBUDDYINT, "Expected UDS_SETBUDDY to be set\n");
    SendMessageA(updown, UDM_SETPOS, 0, 20);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrlenA(text) == 0, "Expected empty string\n");
    DestroyWindow(updown);

    /* creating with UDS_SETBUDDYINT */
    updown = create_updown_control(UDS_SETBUDDYINT | UDS_ALIGNRIGHT, g_edit);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    /* 50 is initial value here */
    ok(lstrcmpA(text, "50") == 0, "Expected '50', got '%s'\n", text);
    /* now remove style flag */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style & ~UDS_SETBUDDYINT);
    SendMessageA(updown, UDM_SETPOS, 0, 20);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrcmpA(text, "20") == 0, "Expected '20', got '%s'\n", text);
    /* set edit text directly, check position */
    strcpy(text, "10");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(10, ret);
    strcpy(text, "11");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(11, LOWORD(ret));
    expect(0,  HIWORD(ret));
    /* set to invalid value */
    strcpy(text, "21st");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(11, LOWORD(ret));
    expect(TRUE, HIWORD(ret));
    /* set style back */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
    SendMessageA(updown, UDM_SETPOS, 0, 30);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrcmpA(text, "30") == 0, "Expected '30', got '%s'\n", text);
    DestroyWindow(updown);
}
Пример #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);
}
Пример #3
0
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();
}
Пример #4
0
static void test_updown_unicode(void)
{
    HWND updown;
    int r;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    /* Set it to ANSI, don't check return as we don't know previous state */
    SendMessageA(updown, UDM_SETUNICODEFORMAT, 0 , 0);
    r = SendMessageA(updown, UDM_GETUNICODEFORMAT, 0 , 0);
    expect(0,r);

    /* Now set it to Unicode format */
    r = SendMessageA(updown, UDM_SETUNICODEFORMAT, 1 , 0);
    expect(0,r);
    r = SendMessageA(updown, UDM_GETUNICODEFORMAT, 0 , 0);
    if (!r)
    {
        win_skip("UDM_SETUNICODEFORMAT not available\n");
        DestroyWindow(updown);
        return;
    }
    expect(1,r);

    /* And now set it back to ANSI */
    r = SendMessageA(updown, UDM_SETUNICODEFORMAT, 0 , 0);
    expect(1,r);
    r = SendMessageA(updown, UDM_GETUNICODEFORMAT, 0 , 0);
    expect(0,r);

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_unicode_seq, "test updown unicode", FALSE);

    DestroyWindow(updown);
}
Пример #5
0
static void test_updown_create(void)
{
    CHAR text[MAX_PATH];
    HWND updown;
    RECT r;

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);
    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(g_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);

    DestroyWindow(updown);

    /* create with zero width */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 0, 0,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.right = 0;
    GetClientRect(updown, &r);
    ok(r.right > 0, "Expected default width, got %d\n", r.right);
    DestroyWindow(updown);
    /* create with really small width */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 2, 0,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.right = 0;
    GetClientRect(updown, &r);
    ok(r.right != 2 && r.right > 0, "Expected default width, got %d\n", r.right);
    DestroyWindow(updown);
    /* create with width greater than default */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 100, 0,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.right = 0;
    GetClientRect(updown, &r);
    ok(r.right < 100 && r.right > 0, "Expected default width, got %d\n", r.right);
    DestroyWindow(updown);
    /* create with zero height, UDS_HORZ */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, UDS_HORZ | WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 0, 0,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.bottom = 0;
    GetClientRect(updown, &r);
    ok(r.bottom == 0, "Expected zero height, got %d\n", r.bottom);
    DestroyWindow(updown);
    /* create with really small height, UDS_HORZ */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, UDS_HORZ | WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 0, 2,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.bottom = 0;
    GetClientRect(updown, &r);
    ok(r.bottom == 0, "Expected zero height, got %d\n", r.bottom);
    DestroyWindow(updown);
    /* create with height greater than default, UDS_HORZ */
    updown = CreateWindowA (UPDOWN_CLASSA, 0, UDS_HORZ | WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 0, 100,
                   parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0);
    ok(updown != NULL, "Failed to create updown control\n");
    r.bottom = 0;
    GetClientRect(updown, &r);
    ok(r.bottom < 100 && r.bottom > 0, "Expected default height, got %d\n", r.bottom);
    DestroyWindow(updown);
}
Пример #6
0
static void test_updown_base(void)
{
    HWND updown;
    int r;
    CHAR text[10];

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    SendMessageA(updown, UDM_SETBASE, 10 , 0);
    r = SendMessageA(updown, UDM_GETBASE, 0 , 0);
    expect(10,r);

    /* Set base to an invalid value, should return 0 and stay at 10 */
    r = SendMessageA(updown, UDM_SETBASE, 80 , 0);
    expect(0,r);
    r = SendMessageA(updown, UDM_GETBASE, 0 , 0);
    expect(10,r);

    /* Set base to 16 now, should get 16 as the return */
    r = SendMessageA(updown, UDM_SETBASE, 16 , 0);
    expect(10,r);
    r = SendMessageA(updown, UDM_GETBASE, 0 , 0);
    expect(16,r);

    /* Set base to an invalid value, should return 0 and stay at 16 */
    r = SendMessageA(updown, UDM_SETBASE, 80 , 0);
    expect(0,r);
    r = SendMessageA(updown, UDM_GETBASE, 0 , 0);
    expect(16,r);

    /* Set base back to 10, return should be 16 */
    r = SendMessageA(updown, UDM_SETBASE, 10 , 0);
    expect(16,r);
    r = SendMessageA(updown, UDM_GETBASE, 0 , 0);
    expect(10,r);

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_base_seq, "test updown base", FALSE);

    DestroyWindow(updown);

    /* switch base with buddy attached */
    updown = create_updown_control(UDS_SETBUDDYINT | UDS_ALIGNRIGHT, g_edit);

    r = SendMessageA(updown, UDM_SETPOS, 0, 10);
    expect(50, r);

    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrcmpA(text, "10") == 0, "Expected '10', got '%s'\n", text);

    r = SendMessageA(updown, UDM_SETBASE, 16, 0);
    expect(10, r);

    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    /* FIXME: currently hex output isn't properly formatted, but for this
       test only change from initial text matters */
    ok(lstrcmpA(text, "10") != 0, "Expected '0x000A', got '%s'\n", text);

    DestroyWindow(updown);
}
Пример #7
0
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);
}
Пример #8
0
static void test_updown_pos32(void)
{
    HWND updown;
    int r;
    int low, high;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    /* Set the position to 0 to 1000 */
    SendMessageA(updown, UDM_SETRANGE32, 0 , 1000 );

    low = high = -1;
    r = SendMessageA(updown, UDM_GETRANGE32, (WPARAM) &low , (LPARAM) &high );
    expect(0,r);
    if (low == -1)
    {
        win_skip("UDM_SETRANGE32/UDM_GETRANGE32 not available\n");
        DestroyWindow(updown);
        return;
    }

    expect(0,low);
    expect(1000,high);

    /* Set position to 500 */
    r = SendMessageA(updown, UDM_SETPOS32, 0 , 500 );
    if (!r)
    {
        win_skip("UDM_SETPOS32 and UDM_GETPOS32 need 5.80\n");
        DestroyWindow(updown);
        return;
    }
    expect(50,r);

    /* Since UDM_SETBUDDYINT was not set at creation bRet will always be true as a return from UDM_GETPOS32 */

    r = SendMessageA(updown, UDM_GETPOS32, 0 , (LPARAM) &high );
    expect(500,r);
    expect(1,high);

    /* Set position to 0, return should be 500 */
    r = SendMessageA(updown, UDM_SETPOS32, 0 , 0 );
    expect(500,r);
    r = SendMessageA(updown, UDM_GETPOS32, 0 , (LPARAM) &high );
    expect(0,r);
    expect(1,high);

    /* Set position to -1 which should become 0, return should be 0 */
    r = SendMessageA(updown, UDM_SETPOS32, 0 , -1 );
    expect(0,r);
    r = SendMessageA(updown, UDM_GETPOS32, 0 , (LPARAM) &high );
    expect(0,r);
    expect(1,high);

    /* Set position to 1000, return should be 0 */
    r = SendMessageA(updown, UDM_SETPOS32, 0 , 1000 );
    expect(0,r);
    r = SendMessageA(updown, UDM_GETPOS32, 0 , (LPARAM) &high );
    expect(1000,r);
    expect(1,high);

    /* Set position to 1001 which should become 1000, return should be 1000 */
    r = SendMessageA(updown, UDM_SETPOS32, 0 , 1001 );
    expect(1000,r);
    r = SendMessageA(updown, UDM_GETPOS32, 0 , (LPARAM) &high );
    expect(1000,r);
    expect(1,high);

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos32_seq, "test updown pos32", FALSE);

    DestroyWindow(updown);

    /* there's no attempt to update buddy Edit if text didn't change */
    SetWindowTextA(g_edit, "50");
    updown = create_updown_control(UDS_ALIGNRIGHT | UDS_SETBUDDYINT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    r = SendMessageA(updown, UDM_SETPOS32, 0, 50);
    expect(50,r);
    ok_sequence(sequences, EDIT_SEQ_INDEX, test_updown_pos_nochange_seq,
                "test updown pos, no change", FALSE);

    DestroyWindow(updown);
}
Пример #9
0
static void test_updown_pos(void)
{
    HWND updown;
    int r;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    /* Set Range from 0 to 100 */
    SendMessageA(updown, UDM_SETRANGE, 0 , MAKELONG(100,0) );
    r = SendMessageA(updown, UDM_GETRANGE, 0,0);
    expect(100,LOWORD(r));
    expect(0,HIWORD(r));

    /* Set the position to 5, return is not checked as it was set before func call */
    SendMessageA(updown, UDM_SETPOS, 0 , MAKELONG(5,0) );
    /* Since UDM_SETBUDDYINT was not set at creation HIWORD(r) will always be 1 as a return from UDM_GETPOS */
    /* Get the position, which should be 5 */
    r = SendMessageA(updown, UDM_GETPOS, 0 , 0 );
    expect(5,LOWORD(r));
    expect(1,HIWORD(r));

    /* Set the position to 0, return should be 5 */
    r = SendMessageA(updown, UDM_SETPOS, 0 , MAKELONG(0,0) );
    expect(5,r);
    /* Get the position, which should be 0 */
    r = SendMessageA(updown, UDM_GETPOS, 0 , 0 );
    expect(0,LOWORD(r));
    expect(1,HIWORD(r));

    /* Set the position to -1, return should be 0 */
    r = SendMessageA(updown, UDM_SETPOS, 0 , MAKELONG(-1,0) );
    expect(0,r);
    /* Get the position, which should be 0 */
    r = SendMessageA(updown, UDM_GETPOS, 0 , 0 );
    expect(0,LOWORD(r));
    expect(1,HIWORD(r));

    /* Set the position to 100, return should be 0 */
    r = SendMessageA(updown, UDM_SETPOS, 0 , MAKELONG(100,0) );
    expect(0,r);
    /* Get the position, which should be 100 */
    r = SendMessageA(updown, UDM_GETPOS, 0 , 0 );
    expect(100,LOWORD(r));
    expect(1,HIWORD(r));

    /* Set the position to 101, return should be 100 */
    r = SendMessageA(updown, UDM_SETPOS, 0 , MAKELONG(101,0) );
    expect(100,r);
    /* Get the position, which should be 100 */
    r = SendMessageA(updown, UDM_GETPOS, 0 , 0 );
    expect(100,LOWORD(r));
    expect(1,HIWORD(r));

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos_seq , "test updown pos", FALSE);

    DestroyWindow(updown);

    /* there's no attempt to update buddy Edit if text didn't change */
    SetWindowTextA(g_edit, "50");
    updown = create_updown_control(UDS_ALIGNRIGHT | UDS_SETBUDDYINT | UDS_ARROWKEYS, g_edit);

    /* test sequence only on 5.8x versions */
    r = SendMessageA(updown, UDM_GETPOS32, 0, 0);
    if (r)
    {
        UDACCEL accel;

        flush_sequences(sequences, NUM_MSG_SEQUENCES);

        r = SendMessageA(updown, UDM_SETPOS, 0, 50);
        expect(50,r);

        ok_sequence(sequences, EDIT_SEQ_INDEX, test_updown_pos_nochange_seq,
                    "test updown pos, no change", FALSE);

        SendMessageA(updown, UDM_SETRANGE, 0, MAKELONG(1, 40));
        r = SendMessageA(updown, UDM_GETRANGE, 0, 0);
        expect(1, LOWORD(r));
        expect(40, HIWORD(r));

        accel.nSec = 0;
        accel.nInc = 5;
        r = SendMessageA(updown, UDM_SETACCEL, 1, (LPARAM)&accel);
        expect(TRUE, r);

        r = SendMessageA(updown, UDM_GETPOS, 0, 0);
        expect(40, LOWORD(r));
        expect(1, HIWORD(r));

        r = SendMessageA(updown, UDM_SETPOS, 0, MAKELONG(0, 0));
        expect(40, LOWORD(r));
        expect(0, HIWORD(r));

        r = SendMessageA(updown, UDM_GETPOS, 0, 0);
        expect(1, LOWORD(r));
        expect(0, HIWORD(r));

        r = SendMessageA(updown, UDM_SETPOS, 0, MAKELONG(2, 0));
        expect(1, LOWORD(r));
        expect(0, HIWORD(r));

        r = SendMessageA(g_edit, WM_KEYDOWN, VK_UP, 0);
        expect(0, r);
        r = SendMessageA(updown, UDM_GETPOS, 0, 0);
        expect(1, LOWORD(r));
        expect(0, HIWORD(r));

        r = SendMessageA(updown, UDM_SETPOS, 0, MAKELONG(50, 0));
        expect(1, LOWORD(r));
        expect(0, HIWORD(r));

        r = SendMessageA(updown, UDM_GETPOS, 0, 0);
        expect(40, LOWORD(r));
        expect(0, HIWORD(r));
    }

    DestroyWindow(updown);
}