static void test_dtm_get_monthcal(void) { LRESULT r; HWND hWnd; hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); todo_wine { r = SendMessageA(hWnd, DTM_GETMONTHCAL, 0, 0); ok(r == 0, "Expected NULL(no child month calendar control), got %ld\n", r); } ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_get_monthcal_seq, "test_dtm_get_monthcal", FALSE); DestroyWindow(hWnd); }
static void test_dtm_set_and_get_mcfont(void) { HFONT hFontOrig, hFontNew; HWND hWnd; hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); hFontOrig = GetStockObject(DEFAULT_GUI_FONT); SendMessageA(hWnd, DTM_SETMCFONT, (WPARAM)hFontOrig, TRUE); hFontNew = (HFONT)SendMessageA(hWnd, DTM_GETMCFONT, 0, 0); ok(hFontOrig == hFontNew, "Expected hFontOrig==hFontNew, hFontOrig=%p, hFontNew=%p\n", hFontOrig, hFontNew); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_mcfont_seq, "test_dtm_set_and_get_mcfont", FALSE); DestroyWindow(hWnd); }
static void test_dtm_set_and_get_mccolor(void) { HWND hWnd; hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); test_mccolor_types(hWnd, MCSC_BACKGROUND, "MCSC_BACKGROUND"); test_mccolor_types(hWnd, MCSC_MONTHBK, "MCSC_MONTHBK"); test_mccolor_types(hWnd, MCSC_TEXT, "MCSC_TEXT"); test_mccolor_types(hWnd, MCSC_TITLEBK, "MCSC_TITLEBK"); test_mccolor_types(hWnd, MCSC_TITLETEXT, "MCSC_TITLETEXT"); test_mccolor_types(hWnd, MCSC_TRAILINGTEXT, "MCSC_TRAILINGTEXT"); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_mccolor_seq, "test_dtm_set_and_get_mccolor", FALSE); DestroyWindow(hWnd); }
static void test_monthcal_firstDay(HWND hwnd) { int res, fday, i, prev; TCHAR b[128]; LCID lcid = LOCALE_USER_DEFAULT; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Setter and Getters for first day of week */ /* check for locale first day */ if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){ fday = atoi(b); trace("fday: %d\n", fday); res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0); expect(fday, res); prev = fday; /* checking for the values that actually will be stored as */ /* current first day when we set a new value */ for (i = -5; i < 12; i++){ res = SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) i); expect(prev, res); res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0); prev = res; if (i == -1){ expect(MAKELONG(fday, FALSE), res); }else if (i >= 7){ /* out of range sets max first day of week, locale is ignored */ expect(MAKELONG(6, TRUE), res); }else{ expect(MAKELONG(i, TRUE), res); } } ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_first_day_seq, "monthcal firstDay", FALSE); }else{ skip("Cannot retrieve first day of the week\n"); } }
static void test_get_set_item(void) { char textA[] = "test"; HWND hComboEx; COMBOBOXEXITEMA item; BOOL ret; hComboEx = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN); subclass_editbox(hComboEx); flush_sequences(sequences, NUM_MSG_SEQUENCES); memset(&item, 0, sizeof(item)); item.mask = CBEIF_TEXT; item.pszText = textA; item.iItem = -1; ret = SendMessageA(hComboEx, CBEM_SETITEMA, 0, (LPARAM)&item); expect(TRUE, ret); ok_sequence(sequences, EDITBOX_SEQ_INDEX, test_setitem_edit_seq, "set item data for edit", FALSE); /* get/set lParam */ item.mask = CBEIF_LPARAM; item.iItem = -1; item.lParam = 0xdeadbeef; ret = SendMessageA(hComboEx, CBEM_GETITEMA, 0, (LPARAM)&item); expect(TRUE, ret); ok(item.lParam == 0, "Expected zero, got %lx\n", item.lParam); item.lParam = 0x1abe11ed; ret = SendMessageA(hComboEx, CBEM_SETITEMA, 0, (LPARAM)&item); expect(TRUE, ret); item.lParam = 0; ret = SendMessageA(hComboEx, CBEM_GETITEMA, 0, (LPARAM)&item); expect(TRUE, ret); ok(item.lParam == 0x1abe11ed, "Expected 0x1abe11ed, got %lx\n", item.lParam); DestroyWindow(hComboEx); }
static void test_messages(void) { HPROPSHEETPAGE hpsp[1]; PROPSHEETPAGEA psp; PROPSHEETHEADERA psh; HWND hdlg; init_msg_sequences(sequences, NUM_MSG_SEQUENCES); memset(&psp, 0, sizeof(psp)); psp.dwSize = sizeof(psp); psp.dwFlags = 0; psp.hInstance = GetModuleHandleA(NULL); U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST); U2(psp).pszIcon = NULL; psp.pfnDlgProc = page_dlg_proc_messages; psp.lParam = 0; hpsp[0] = CreatePropertySheetPageA(&psp); memset(&psh, 0, sizeof(psh)); psh.dwSize = PROPSHEETHEADERA_V1_SIZE; psh.dwFlags = PSH_NOAPPLYNOW | PSH_WIZARD | PSH_USECALLBACK | PSH_MODELESS | PSH_USEICONID; psh.pszCaption = "test caption"; psh.nPages = 1; psh.hwndParent = GetDesktopWindow(); U3(psh).phpage = hpsp; psh.pfnCallback = sheet_callback_messages; hdlg = (HWND)PropertySheetA(&psh); ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg); ShowWindow(hdlg,SW_NORMAL); ok_sequence(sequences, PROPSHEET_SEQ_INDEX, property_sheet_seq, "property sheet with custom window proc", TRUE); DestroyWindow(hdlg); }
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); }
static void test_updown_base(void) { int r; flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessage(updown, UDM_SETBASE, 10 , 0); r = SendMessage(updown, UDM_GETBASE, 0 , 0); expect(10,r); /* Set base to an invalid value, should return 0 and stay at 10 */ r = SendMessage(updown, UDM_SETBASE, 80 , 0); expect(0,r); r = SendMessage(updown, UDM_GETBASE, 0 , 0); expect(10,r); /* Set base to 16 now, should get 16 as the return */ r = SendMessage(updown, UDM_SETBASE, 16 , 0); expect(10,r); r = SendMessage(updown, UDM_GETBASE, 0 , 0); expect(16,r); /* Set base to an invalid value, should return 0 and stay at 16 */ r = SendMessage(updown, UDM_SETBASE, 80 , 0); expect(0,r); r = SendMessage(updown, UDM_GETBASE, 0 , 0); expect(16,r); /* Set base back to 10, return should be 16 */ r = SendMessage(updown, UDM_SETBASE, 10 , 0); expect(16,r); r = SendMessage(updown, UDM_GETBASE, 0 , 0); expect(10,r); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_base_seq, "test updown base", FALSE); }
static void test_getset_item(HWND parent_wnd, INT nTabs) { TCITEM tcItem; DWORD ret; char szText[32] = "New Label"; HWND hTab; hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs); ok(hTab != NULL, "Failed to create tab control\n"); /* passing invalid index should result in initialization to zero for members mentioned in mask requested */ /* valid range here is [0,4] */ memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_IMAGE; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); expect(0, tcItem.iImage); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_TEXT; tcItem.pszText = szText; szText[0] = 'a'; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); expect('a', szText[0]); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = 0; tcItem.dwState = TCIS_BUTTONPRESSED; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.dwState == 0, "Expected zero dwState, got %u\n", tcItem.dwState); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = TCIS_BUTTONPRESSED; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.dwState == 0, "Expected zero dwState\n"); /* check with negative index to be sure */ memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, -1, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, -2, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); flush_sequences(sequences, NUM_MSG_SEQUENCES); tcItem.mask = TCIF_TEXT; tcItem.pszText = &szText[0]; tcItem.cchTextMax = sizeof(szText); strcpy(szText, "New Label"); ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("New Label", tcItem.pszText); ok ( SendMessage(hTab, TCM_GETITEM, 1, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("Tab 2", tcItem.pszText); ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE); /* TCIS_BUTTONPRESSED doesn't depend on tab style */ memset(&tcItem, 0, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = TCIS_BUTTONPRESSED; ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); if (tcItem.dwState) { ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); /* next highlight item, test that dwStateMask actually masks */ tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_HIGHLIGHTED; tcItem.dwState = TCIS_HIGHLIGHTED; ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n"); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); } else win_skip( "Item state mask not supported\n" ); DestroyWindow(hTab); }
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); }
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); }
static void test_pager(void) { HWND pager; RECT rect, rect2; pager = create_pager_control( PGS_HORZ ); if (!pager) { win_skip( "Pager control not supported\n" ); return; } register_child_wnd_class(); child1_wnd = CreateWindowA( "Pager test child class", "button", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 300, 300, pager, 0, GetModuleHandleA(0), 0 ); child2_wnd = CreateWindowA("Pager test child class", "button", WS_CHILD | WS_BORDER, 0, 0, 300, 300, pager, 0, GetModuleHandleA(0), 0); flush_sequences( sequences, NUM_MSG_SEQUENCES ); SendMessageA( pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd ); ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "set child", FALSE); GetWindowRect( pager, &rect ); ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100, "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top ); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child2_wnd); ok_sequence(sequences, PAGER_SEQ_INDEX, switch_child_seq, "switch to invisible child", FALSE); GetWindowRect(pager, &rect); ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100, "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top); ok(!IsWindowVisible(child2_wnd), "Child window 2 is visible\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd); ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "switch to visible child", FALSE); GetWindowRect(pager, &rect); ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100, "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top); flush_sequences( sequences, NUM_MSG_SEQUENCES ); SendMessageA( pager, PGM_SETPOS, 0, 10 ); ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE); GetWindowRect( pager, &rect ); ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100, "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top ); flush_sequences( sequences, NUM_MSG_SEQUENCES ); SendMessageA( pager, PGM_SETPOS, 0, 10 ); ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_empty_seq, "set pos empty", TRUE); flush_sequences( sequences, NUM_MSG_SEQUENCES ); SendMessageA( pager, PGM_SETPOS, 0, 9 ); ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE); DestroyWindow( pager ); /* Test if resizing works */ pager = create_pager_control( CCS_NORESIZE ); ok(pager != NULL, "failed to create pager control\n"); GetWindowRect( pager, &rect ); MoveWindow( pager, 0, 0, 200, 100, TRUE ); GetWindowRect( pager, &rect2 ); ok(rect2.right - rect2.left > rect.right - rect.left, "expected pager window to resize, %s\n", wine_dbgstr_rect( &rect2 )); DestroyWindow( pager ); pager = create_pager_control( CCS_NORESIZE | PGS_HORZ ); ok(pager != NULL, "failed to create pager control\n"); GetWindowRect( pager, &rect ); MoveWindow( pager, 0, 0, 100, 200, TRUE ); GetWindowRect( pager, &rect2 ); ok(rect2.bottom - rect2.top > rect.bottom - rect.top, "expected pager window to resize, %s\n", wine_dbgstr_rect( &rect2 )); DestroyWindow( pager ); }
static void test_getters_setters(HWND parent_wnd, INT nTabs) { HWND hTab; RECT rTab; INT nTabsRetrieved; INT rowCount; INT dpi; HDC hdc; ok(parent_wnd != NULL, "no parent window!\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs); ok(hTab != NULL, "Failed to create tab control\n"); if(!winetest_interactive) ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent, "Tab sequence, after adding tab control to parent", TRUE); else ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent_interactive, "Tab sequence, after adding tab control to parent", TRUE); if(!winetest_interactive) ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq, "Parent after sequence, adding tab control to parent", TRUE); else ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq_interactive, "Parent after sequence, adding tab control to parent", TRUE); flush_sequences(sequences, NUM_MSG_SEQUENCES); ok(SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0,"TCM_SETMINTABWIDTH returned < 0\n"); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE); /* Testing GetItemCount */ flush_sequences(sequences, NUM_MSG_SEQUENCES); nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); expect(nTabs, nTabsRetrieved); ok_sequence(sequences, TAB_SEQ_INDEX, get_item_count_seq, "Get itemCount test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset itemCount test parent sequence", FALSE); /* Testing GetRowCount */ flush_sequences(sequences, NUM_MSG_SEQUENCES); rowCount = SendMessage(hTab, TCM_GETROWCOUNT, 0, 0); expect(1, rowCount); ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE); /* Testing GetItemRect */ flush_sequences(sequences, NUM_MSG_SEQUENCES); ok(SendMessage(hTab, TCM_GETITEMRECT, 0, (LPARAM) &rTab), "GetItemRect failed.\n"); hdc = GetDC(hTab); dpi = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(hTab, hdc); CheckSize(hTab, dpi, -1 , "Default Width"); ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE); /* Testing CurFocus */ { INT focusIndex; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Testing CurFocus with largest appropriate value */ SendMessage(hTab, TCM_SETCURFOCUS, nTabs-1, 0); focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(nTabs-1, focusIndex); /* Testing CurFocus with negative value */ SendMessage(hTab, TCM_SETCURFOCUS, -10, 0); focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(-1, focusIndex); /* Testing CurFocus with value larger than number of tabs */ focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0); todo_wine{ expect(-1, focusIndex); } SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0); focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(1, focusIndex); ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Getset curFoc test sequence", FALSE); } /* Testing CurSel */ { INT selectionIndex; INT focusIndex; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Testing CurSel with largest appropriate value */ selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs-1, 0); expect(1, selectionIndex); selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0); expect(nTabs-1, selectionIndex); /* Focus should switch with selection */ focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(nTabs-1, focusIndex); /* Testing CurSel with negative value */ SendMessage(hTab, TCM_SETCURSEL, -10, 0); selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0); expect(-1, selectionIndex); /* Testing CurSel with value larger than number of tabs */ selectionIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0); expect(-1, selectionIndex); selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0); expect(-1, selectionIndex); selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(1, selectionIndex); ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE); } /* Testing ExtendedStyle */ { DWORD prevExtendedStyle; DWORD extendedStyle; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Testing Flat Separators */ extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0); prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_FLATSEPARATORS); expect(extendedStyle, prevExtendedStyle); extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0); todo_wine{ expect(TCS_EX_FLATSEPARATORS, extendedStyle); } /* Testing Register Drop */ prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_REGISTERDROP); expect(extendedStyle, prevExtendedStyle); extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0); todo_wine{ expect(TCS_EX_REGISTERDROP, extendedStyle); } ok_sequence(sequences, TAB_SEQ_INDEX, getset_extended_style_seq, "Getset extendedStyle test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset extendedStyle test parent sequence", FALSE); } /* Testing UnicodeFormat */ { INT unicodeFormat; flush_sequences(sequences, NUM_MSG_SEQUENCES); unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0); todo_wine{ expect(0, unicodeFormat); } unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0); expect(1, unicodeFormat); unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, FALSE, 0); expect(1, unicodeFormat); unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0); expect(0, unicodeFormat); unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0); expect(0, unicodeFormat); ok_sequence(sequences, TAB_SEQ_INDEX, getset_unicode_format_seq, "Getset unicodeFormat test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset unicodeFormat test parent sequence", FALSE); } /* Testing GetSet Item */ { TCITEM tcItem; char szText[32] = "New Label"; flush_sequences(sequences, NUM_MSG_SEQUENCES); tcItem.mask = TCIF_TEXT; tcItem.pszText = &szText[0]; tcItem.cchTextMax = sizeof(szText); ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("New Label", tcItem.pszText); ok ( SendMessage(hTab, TCM_GETITEM, 1, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("Tab 2", tcItem.pszText); ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE); } /* Testing GetSet ToolTip */ { HWND toolTip; char toolTipText[32] = "ToolTip Text Test"; flush_sequences(sequences, NUM_MSG_SEQUENCES); toolTip = create_tooltip(hTab, toolTipText); SendMessage(hTab, TCM_SETTOOLTIPS, (LPARAM) toolTip, 0); ok (toolTip == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n"); SendMessage(hTab, TCM_SETTOOLTIPS, 0, 0); ok (NULL == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n"); ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, getset_tooltip_parent_seq, "Getset tooltip test parent sequence", TRUE); } DestroyWindow(hTab); }
static void test_monthcal_color(HWND hwnd) { int res, temp; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Setter and Getters for color*/ temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0); expect(RGB(255,255,255), temp); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0); expect(RGB(255,255,255), temp); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0); expect(RGB(255,255,255), temp); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0); expect(RGB(255,255,255), temp); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0); expect(RGB(255,255,255), temp); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(0,0,0)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0); expect(RGB(0,0,0), temp); res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(255,255,255)); expect(temp, res); temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0); expect(RGB(255,255,255), temp); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_color_seq, "monthcal color", FALSE); }
static void test_range(HWND hWndTrackbar){ int r; flush_sequences(sequences, NUM_MSG_SEQUENCE); /* test TBM_SETRANGE */ SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10)); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(10, r); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(0, r); SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-1, 1000)); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(1000, r); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(-1, r); SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(10, 0)); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(0, r); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(10, r); SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(0,10)); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(10, r); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(0, r); /*test TBM_SETRANGEMAX */ SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 10); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(10, r); SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, -1); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(-1, r); SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(10, r); /* testing TBM_SETRANGEMIN */ SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(0, r); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 10); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(10, r); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, -10); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(-10, r); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(5, r); /* test TBM_GETRANGEMAX */ r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); expect(10, r); /* test TBM_GETRANGEMIN */ r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0); expect(5, r); ok_sequence(sequences, TRACKBAR_SEQ_INDEX, range_test_seq, "range test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_range_test_seq, "parent range test sequence", TRUE); }
static void test_GetSetCurrentViewMode(void) { IShellFolder *desktop; IShellView *sview; IFolderView *fview; IShellBrowser *browser; FOLDERSETTINGS fs; UINT viewmode; HWND hwnd; RECT rc = {0, 0, 10, 10}; HRESULT hr; UINT i; static const int winxp_res[11] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; static const int win2k3_res[11] = {0, 1, 2, 3, 4, 5, 6, 5, 8, 0, 0}; static const int vista_res[11] = {0, 1, 5, 3, 4, 5, 6, 7, 7, 0, 0}; static const int win7_res[11] = {1, 1, 1, 3, 4, 1, 6, 1, 8, 8, 8}; hr = SHGetDesktopFolder(&desktop); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&sview); ok(hr == S_OK, "got (0x%08x)\n", hr); fs.ViewMode = 1; fs.fFlags = 0; browser = IShellBrowserImpl_Construct(); hr = IShellView_CreateViewWindow(sview, NULL, &fs, browser, &rc, &hwnd); ok(hr == S_OK || broken(hr == S_FALSE /*Win2k*/ ), "got (0x%08x)\n", hr); hr = IShellView_QueryInterface(sview, &IID_IFolderView, (void**)&fview); ok(hr == S_OK || broken(hr == E_NOINTERFACE), "got (0x%08x)\n", hr); if(SUCCEEDED(hr)) { HWND hwnd_lv; UINT count; if(0) { /* Crashes under Win7/WinXP */ hr = IFolderView_GetCurrentViewMode(fview, NULL); } hr = IFolderView_GetCurrentViewMode(fview, &viewmode); ok(hr == S_OK, "got (0x%08x)\n", hr); ok(viewmode == 1, "ViewMode was %d\n", viewmode); hr = IFolderView_SetCurrentViewMode(fview, FVM_AUTO); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IFolderView_SetCurrentViewMode(fview, 0); ok(hr == E_INVALIDARG || broken(hr == S_OK), "got (0x%08x)\n", hr); hr = IFolderView_GetCurrentViewMode(fview, &viewmode); ok(hr == S_OK, "got (0x%08x)\n", hr); for(i = 1; i < 9; i++) { hr = IFolderView_SetCurrentViewMode(fview, i); ok(hr == S_OK || (i == 8 && hr == E_INVALIDARG /*Vista*/), "(%d) got (0x%08x)\n", i, hr); hr = IFolderView_GetCurrentViewMode(fview, &viewmode); ok(hr == S_OK, "(%d) got (0x%08x)\n", i, hr); /* Wine currently behaves like winxp here. */ ok((viewmode == win7_res[i]) || (viewmode == vista_res[i]) || (viewmode == win2k3_res[i]) || (viewmode == winxp_res[i]), "(%d) got %d\n",i , viewmode); } hr = IFolderView_SetCurrentViewMode(fview, 9); ok(hr == E_INVALIDARG || broken(hr == S_OK), "got (0x%08x)\n", hr); /* Test messages */ hwnd_lv = subclass_listview(hwnd); ok(hwnd_lv != NULL, "Failed to subclass listview\n"); if(hwnd_lv) { /* Vista seems to set the viewmode by other means than sending messages. At least no related messages are captured by subclassing. */ BOOL vista_plus = FALSE; static const UINT vista_plus_msgs[] = { WM_SETREDRAW, WM_NOTIFY, WM_NOTIFYFORMAT, WM_QUERYUISTATE, WM_MENUCHAR, WM_WINDOWPOSCHANGING, WM_NCCALCSIZE, WM_WINDOWPOSCHANGED, WM_PARENTNOTIFY, LVM_GETHEADER, 0 }; flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_SetCurrentViewMode(fview, 1); ok(hr == S_OK, "got 0x%08x\n", hr); /* WM_SETREDRAW is not sent in versions before Vista. */ vista_plus = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, WM_SETREDRAW); if(vista_plus) verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); else ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode1_2_prevista, "IFolderView::SetCurrentViewMode(1)", TRUE); hr = IFolderView_SetCurrentViewMode(fview, 2); ok(hr == S_OK, "got 0x%08x\n", hr); if(vista_plus) verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); else ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode1_2_prevista, "IFolderView::SetCurrentViewMode(2)", TRUE); hr = IFolderView_SetCurrentViewMode(fview, 3); ok(hr == S_OK, "got 0x%08x\n", hr); if(vista_plus) verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); else ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode3_prevista, "IFolderView::SetCurrentViewMode(3)", TRUE); hr = IFolderView_SetCurrentViewMode(fview, 4); ok(hr == S_OK, "got 0x%08x\n", hr); if(vista_plus) verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); else ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode4_prevista, "IFolderView::SetCurrentViewMode(4)", TRUE); hr = IFolderView_SetCurrentViewMode(fview, 5); ok(hr == S_OK, "got 0x%08x\n", hr); todo_wine { if(vista_plus) { verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); } else { count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW); ok(count == 1, "LVM_SETVIEW sent %d times.\n", count); count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE); ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count); flush_sequences(sequences, NUM_MSG_SEQUENCES); } } hr = IFolderView_SetCurrentViewMode(fview, 6); ok(hr == S_OK, "got 0x%08x\n", hr); todo_wine { if(vista_plus) { verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); } else { count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW); ok(count == 1, "LVM_SETVIEW sent %d times.\n", count); count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE); ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count); flush_sequences(sequences, NUM_MSG_SEQUENCES); } } hr = IFolderView_SetCurrentViewMode(fview, 7); ok(hr == S_OK, "got 0x%08x\n", hr); todo_wine { if(vista_plus) { verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); } else { count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW); ok(count == 1, "LVM_SETVIEW sent %d times.\n", count); count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE); ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count); flush_sequences(sequences, NUM_MSG_SEQUENCES); } } hr = IFolderView_SetCurrentViewMode(fview, 8); ok(hr == S_OK || broken(hr == E_INVALIDARG /* Vista */), "got 0x%08x\n", hr); todo_wine { if(vista_plus) { verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs); } else { count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW); ok(count == 1, "LVM_SETVIEW sent %d times.\n", count); count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE); ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count); flush_sequences(sequences, NUM_MSG_SEQUENCES); } } hr = IFolderView_GetCurrentViewMode(fview, &viewmode); ok(hr == S_OK, "Failed to get current viewmode.\n"); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq, "IFolderView::GetCurrentViewMode", FALSE); } IFolderView_Release(fview); } else {
static void test_IFolderView(void) { IShellFolder *desktop, *folder; FOLDERSETTINGS settings; IShellView *view; IShellBrowser *browser; IFolderView *fv; HWND hwnd_view, hwnd_list; PITEMID_CHILD pidl; HRESULT hr; INT ret, count; POINT pt; LONG ref1, ref2; RECT r; hr = SHGetDesktopFolder(&desktop); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IShellView_QueryInterface(view, &IID_IFolderView, (void**)&fv); if (hr != S_OK) { win_skip("IFolderView not supported by desktop folder\n"); IShellView_Release(view); IShellFolder_Release(desktop); return; } /* call methods before window creation */ hr = IFolderView_GetSpacing(fv, NULL); ok(hr == S_FALSE || broken(hr == S_OK) /* win7 */, "got (0x%08x)\n", hr); pidl = (void*)0xdeadbeef; hr = IFolderView_Item(fv, 0, &pidl); ok(hr == E_INVALIDARG || broken(hr == E_FAIL) /* < Vista */, "got (0x%08x)\n", hr); ok(pidl == 0 || broken(pidl == (void*)0xdeadbeef) /* < Vista */, "got %p\n", pidl); if (0) { /* crashes on Vista and Win2k8 - List not created yet case */ hr = IFolderView_GetSpacing(fv, &pt); /* crashes on XP */ hr = IFolderView_GetSelectionMarkedItem(fv, NULL); hr = IFolderView_GetFocusedItem(fv, NULL); /* crashes on Vista+ */ hr = IFolderView_Item(fv, 0, NULL); } browser = IShellBrowserImpl_Construct(); settings.ViewMode = FVM_ICON; settings.fFlags = 0; hwnd_view = (HWND)0xdeadbeef; r.left = r.top = 0; r.right = r.bottom = 100; hr = IShellView_CreateViewWindow(view, NULL, &settings, browser, &r, &hwnd_view); ok(hr == S_OK, "got (0x%08x)\n", hr); ok(IsWindow(hwnd_view), "got %p\n", hwnd_view); hwnd_list = subclass_listview(hwnd_view); if (!hwnd_list) { win_skip("Failed to subclass ListView control\n"); IShellBrowser_Release(browser); IFolderView_Release(fv); IShellView_Release(view); IShellFolder_Release(desktop); return; } /* IFolderView::GetSpacing */ flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_GetSpacing(fv, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq, "IFolderView::GetSpacing, empty", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_GetSpacing(fv, &pt); ok(hr == S_OK, "got (0x%08x)\n", hr); /* fails with empty sequence on win7 for unknown reason */ if (sequences[LISTVIEW_SEQ_INDEX]->count) { ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getspacing_seq, "IFolderView::GetSpacing", FALSE); ok(pt.x > 0, "got %d\n", pt.x); ok(pt.y > 0, "got %d\n", pt.y); ret = SendMessageA(hwnd_list, LVM_GETITEMSPACING, 0, 0); ok(pt.x == LOWORD(ret) && pt.y == HIWORD(ret), "got (%d, %d)\n", LOWORD(ret), HIWORD(ret)); } /* IFolderView::ItemCount */ if (0) { /* crashes on XP */ hr = IFolderView_ItemCount(fv, SVGIO_ALLVIEW, NULL); } flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_ItemCount(fv, SVGIO_ALLVIEW, &count); ok(hr == S_OK, "got (0x%08x)\n", hr); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, count ? folderview_itemcount_seq : empty_seq, "IFolderView::ItemCount", FALSE); /* IFolderView::GetSelectionMarkedItem */ if (0) { /* crashes on XP */ hr = IFolderView_GetSelectionMarkedItem(fv, NULL); } flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_GetSelectionMarkedItem(fv, &ret); if (count) ok(hr == S_OK, "got (0x%08x)\n", hr); else ok(hr == S_FALSE, "got (0x%08x)\n", hr); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getselectionmarked_seq, "IFolderView::GetSelectionMarkedItem", FALSE); /* IFolderView::GetFocusedItem */ flush_sequences(sequences, NUM_MSG_SEQUENCES); hr = IFolderView_GetFocusedItem(fv, &ret); if (count) ok(hr == S_OK, "got (0x%08x)\n", hr); else ok(hr == S_FALSE, "got (0x%08x)\n", hr); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getfocused_seq, "IFolderView::GetFocusedItem", FALSE); /* IFolderView::GetFolder, just return pointer */ if (0) { /* crashes on XP */ hr = IFolderView_GetFolder(fv, NULL, (void**)&folder); hr = IFolderView_GetFolder(fv, NULL, NULL); } hr = IFolderView_GetFolder(fv, &IID_IShellFolder, NULL); ok(hr == E_POINTER, "got (0x%08x)\n", hr); ref1 = IShellFolder_AddRef(desktop); IShellFolder_Release(desktop); hr = IFolderView_GetFolder(fv, &IID_IShellFolder, (void**)&folder); ok(hr == S_OK, "got (0x%08x)\n", hr); ref2 = IShellFolder_AddRef(desktop); IShellFolder_Release(desktop); ok(ref1 == ref2 || ref1 + 1 == ref2, /* >= vista */ "expected same refcount, got %d\n", ref2); ok(desktop == folder, "\n"); IShellBrowser_Release(browser); IFolderView_Release(fv); IShellView_Release(view); IShellFolder_Release(desktop); }
static void test_dtm_set_and_get_system_time(void) { LRESULT r; SYSTEMTIME st, getSt, ref; HWND hWnd, hWndDateTime_test_gdt_none; hWndDateTime_test_gdt_none = create_datetime_control(0); ok(hWndDateTime_test_gdt_none!=NULL, "Expected non NULL, got %p\n", hWndDateTime_test_gdt_none); if(hWndDateTime_test_gdt_none) { r = SendMessageA(hWndDateTime_test_gdt_none, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st); expect(0, r); } else { skip("hWndDateTime_test_gdt_none is NULL\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); return; } DestroyWindow(hWndDateTime_test_gdt_none); hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); ok(r == GDT_NONE, "Expected %d, not %d(GDT_VALID) or %d(GDT_ERROR), got %ld\n", GDT_NONE, GDT_VALID, GDT_ERROR, r); /* set st to lowest possible value */ fill_systime_struct(&st, 1601, 1, 0, 1, 0, 0, 0, 0); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); /* set st to highest possible value */ fill_systime_struct(&st, 30827, 12, 6, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); /* set st to value between min and max */ fill_systime_struct(&st, 1980, 1, 3, 23, 14, 34, 37, 465); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); ok(r == GDT_VALID, "Expected %d, not %d(GDT_NONE) or %d(GDT_ERROR), got %ld\n", GDT_VALID, GDT_NONE, GDT_ERROR, r); expect_systime(&st, &getSt); /* set st to invalid value */ fill_systime_struct(&st, 0, 0, 7, 0, 24, 60, 60, 1000); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect_unsuccess(0, r); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_system_time_seq, "test_dtm_set_and_get_system_time", FALSE); /* set to some valid value */ GetSystemTime(&ref); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&ref); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* year invalid */ st = ref; st.wYear = 0; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); todo_wine expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* month invalid */ st = ref; st.wMonth = 13; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* day invalid */ st = ref; st.wDay = 32; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* day invalid for current month */ st = ref; st.wDay = 30; st.wMonth = 2; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* day of week isn't validated */ st = ref; st.wDayOfWeek = 10; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* hour invalid */ st = ref; st.wHour = 25; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* minute invalid */ st = ref; st.wMinute = 60; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* sec invalid */ st = ref; st.wSecond = 60; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* msec invalid */ st = ref; st.wMilliseconds = 1000; r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(0, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); expect_systime(&ref, &getSt); /* day of week should be calculated automatically, actual day of week for this date is 4 */ fill_systime_struct(&st, 2009, 10, 1, 1, 0, 0, 10, 200); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); expect(GDT_VALID, r); /* 01.10.2009 is Thursday */ expect(4, (LRESULT)getSt.wDayOfWeek); st.wDayOfWeek = 4; expect_systime(&st, &getSt); }
/* when max<min for DTM_SETRANGE, Windows seems to swap the min and max values, although that's undocumented. However, it doesn't seem to be implemented correctly, causing some strange side effects */ static void test_dtm_set_range_swap_min_max(void) { LRESULT r; SYSTEMTIME st[2]; SYSTEMTIME getSt[2]; SYSTEMTIME origSt; HWND hWnd; hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); fill_systime_struct(&st[0], 2007, 2, 4, 15, 2, 2, 2, 2); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st[0]); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&origSt); ok(r == GDT_VALID, "Expected %d, not %d(GDT_NONE) or %d(GDT_ERROR), got %ld\n", GDT_VALID, GDT_NONE, GDT_ERROR, r); expect_systime(&st[0], &origSt); /* set st[0] to value higher than st[1] */ fill_systime_struct(&st[0], 2007, 3, 2, 31, 23, 59, 59, 999); fill_systime_struct(&st[1], 1980, 1, 3, 23, 14, 34, 37, 465); /* since min>max, min and max values should be swapped by DTM_SETRANGE automatically */ r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); todo_wine { ok(compare_systime(&st[0], &getSt[0]) == 1 || broken(compare_systime(&st[0], &getSt[1]) == 1), /* comctl32 version <= 5.80 */ "ST1 != ST2\n"); ok(compare_systime(&st[1], &getSt[1]) == 1 || broken(compare_systime(&st[1], &getSt[0]) == 1), /* comctl32 version <= 5.80 */ "ST1 != ST2\n"); } fill_systime_struct(&st[0], 1980, 1, 3, 23, 14, 34, 37, 465); r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st[0]); expect(1, r); r = SendMessageA(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt[0]); ok(r == GDT_VALID, "Expected %d, not %d(GDT_NONE) or %d(GDT_ERROR), got %ld\n", GDT_VALID, GDT_NONE, GDT_ERROR, r); /* the time part seems to not change after swapping the min and max values and doing DTM_SETSYSTEMTIME */ expect_systime_date(&st[0], &getSt[0]); todo_wine { ok(compare_systime_time(&origSt, &getSt[0]) == 1 || broken(compare_systime_time(&st[0], &getSt[0]) == 1), /* comctl32 version <= 5.80 */ "ST1.time != ST2.time\n"); } /* set st[0] to value higher than minimum */ fill_systime_struct(&st[0], 1980, 1, 3, 23, 14, 34, 37, 465); /* set st[1] to value lower than maximum */ fill_systime_struct(&st[1], 2007, 3, 2, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); /* for some reason after we swapped the min and max values before, whenever we do a DTM_SETRANGE, the DTM_GETRANGE will return the values swapped*/ r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); todo_wine { ok(compare_systime(&st[0], &getSt[1]) == 1 || broken(compare_systime(&st[0], &getSt[0]) == 1), /* comctl32 version <= 5.80 */ "ST1 != ST2\n"); ok(compare_systime(&st[1], &getSt[0]) == 1 || broken(compare_systime(&st[1], &getSt[1]) == 1), /* comctl32 version <= 5.80 */ "ST1 != ST2\n"); } /* set st[0] to value higher than st[1] */ fill_systime_struct(&st[0], 2007, 3, 2, 31, 23, 59, 59, 999); fill_systime_struct(&st[1], 1980, 1, 3, 23, 14, 34, 37, 465); /* set min>max again, so that the return values of DTM_GETRANGE are no longer swapped the next time we do a DTM SETRANGE and DTM_GETRANGE*/ r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[1]); expect_systime(&st[1], &getSt[0]); /* initialize st[0] to lowest possible value */ fill_systime_struct(&st[0], 1601, 1, 0, 1, 0, 0, 0, 0); /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_range_swap_min_max_seq, "test_dtm_set_range_swap_min_max", FALSE); DestroyWindow(hWnd); }
static void test_dtm_set_and_get_range(void) { LRESULT r; SYSTEMTIME st[2]; SYSTEMTIME getSt[2]; HWND hWnd; hWnd = create_datetime_control(DTS_SHOWNONE); flush_sequences(sequences, NUM_MSG_SEQUENCES); /* initialize st[0] to lowest possible value */ fill_systime_struct(&st[0], 1601, 1, 0, 1, 0, 0, 0, 0); /* initialize st[1] to all invalid numbers */ fill_systime_struct(&st[1], 0, 0, 7, 0, 24, 60, 60, 1000); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == GDTR_MIN, "Expected %x, not %x(GDTR_MAX) or %x(GDTR_MIN | GDTR_MAX), got %lx\n", GDTR_MIN, GDTR_MAX, GDTR_MIN | GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); expect_unsuccess(0, r); /* set st[0] to all invalid numbers */ fill_systime_struct(&st[0], 0, 0, 7, 0, 24, 60, 60, 1000); /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == GDTR_MAX, "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MIN | GDTR_MAX), got %lx\n", GDTR_MAX, GDTR_MIN, GDTR_MIN | GDTR_MAX, r); expect_systime(&st[1], &getSt[1]); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); expect_unsuccess(0, r); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect_unsuccess(0, r); /* set st[0] to highest possible value */ fill_systime_struct(&st[0], 30827, 12, 6, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); /* initialize st[0] to lowest possible value */ fill_systime_struct(&st[0], 1601, 1, 0, 1, 0, 0, 0, 0); /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); /* set st[0] to value higher than minimum */ fill_systime_struct(&st[0], 1980, 1, 3, 23, 14, 34, 37, 465); /* set st[1] to value lower than maximum */ fill_systime_struct(&st[1], 2007, 3, 2, 31, 23, 59, 59, 999); r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_range_seq, "test_dtm_set_and_get_range", FALSE); /* DTM_SETRANGE with 0 flags */ r = SendMessageA(hWnd, DTM_SETRANGE, 0, (LPARAM)st); ok(r, "got %lu\n", r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == 0, "got %lu\n", r); ok(getSt[0].wYear == 0 && getSt[1].wYear == 0, "got %u, %u\n", getSt[0].wYear, getSt[1].wYear); DestroyWindow(hWnd); }
static void test_monthcal_HitTest(HWND hwnd) { MCHITTESTINFO mchit; UINT res; SYSTEMTIME st; LONG x; UINT title_index; static const UINT title_hits[] = { MCHT_NOWHERE, MCHT_TITLEBK, MCHT_TITLEBTNPREV, MCHT_TITLEBK, MCHT_TITLEMONTH, MCHT_TITLEBK, MCHT_TITLEYEAR, MCHT_TITLEBK, MCHT_TITLEBTNNEXT, MCHT_TITLEBK, MCHT_NOWHERE }; memset(&mchit, 0, sizeof(MCHITTESTINFO)); flush_sequences(sequences, NUM_MSG_SEQUENCES); st.wYear = 2007; st.wMonth = 4; st.wDay = 11; st.wHour = 1; st.wMinute = 0; st.wSecond = 0; st.wMilliseconds = 0; st.wDayOfWeek = 0; res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st); expect(1,res); /* (0, 0) is the top left of the control and should not be active */ mchit.cbSize = sizeof(MCHITTESTINFO); mchit.pt.x = 0; mchit.pt.y = 0; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(0, mchit.pt.x); expect(0, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_NOWHERE, res);} /* (300, 400) is the bottom right of the control and should not be active */ mchit.pt.x = 300; mchit.pt.y = 400; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(300, mchit.pt.x); expect(400, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_NOWHERE, res);} /* (500, 500) is completely out of the control and should not be active */ mchit.pt.x = 500; mchit.pt.y = 500; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(500, mchit.pt.x); expect(500, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_NOWHERE, res);} /* (120, 180) is in active area - calendar background */ mchit.pt.x = 120; mchit.pt.y = 180; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(120, mchit.pt.x); expect(180, mchit.pt.y); expect(mchit.uHit, res); expect(MCHT_CALENDARBK, res); /* (70, 70) is in active area - day of the week */ mchit.pt.x = 70; mchit.pt.y = 70; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(70, mchit.pt.x); expect(70, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_CALENDARDAY, res);} /* (70, 90) is in active area - date from prev month */ mchit.pt.x = 70; mchit.pt.y = 90; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(70, mchit.pt.x); expect(90, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_CALENDARDATEPREV, res);} #if 0 /* (125, 115) is in active area - date from this month */ mchit.pt.x = 125; mchit.pt.y = 115; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(125, mchit.pt.x); expect(115, mchit.pt.y); expect(mchit.uHit, res); expect(MCHT_CALENDARDATE, res); #endif /* (80, 220) is in active area - background section of the title */ mchit.pt.x = 80; mchit.pt.y = 220; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(80, mchit.pt.x); expect(220, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEBK, res);} /* (140, 215) is in active area - month section of the title */ mchit.pt.x = 140; mchit.pt.y = 215; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(140, mchit.pt.x); expect(215, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEMONTH, res);} /* (170, 215) is in active area - year section of the title */ mchit.pt.x = 170; mchit.pt.y = 215; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(170, mchit.pt.x); expect(215, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEYEAR, res);} /* (150, 260) is in active area - date from this month */ mchit.pt.x = 150; mchit.pt.y = 260; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(150, mchit.pt.x); expect(260, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_CALENDARDATE, res);} /* (150, 350) is in active area - date from next month */ mchit.pt.x = 150; mchit.pt.y = 350; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(150, mchit.pt.x); expect(350, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_CALENDARDATENEXT, res);} /* (150, 370) is in active area - today link */ mchit.pt.x = 150; mchit.pt.y = 370; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(150, mchit.pt.x); expect(370, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TODAYLINK, res);} /* (70, 370) is in active area - today link */ mchit.pt.x = 70; mchit.pt.y = 370; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(70, mchit.pt.x); expect(370, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TODAYLINK, res);} ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE); /* The horizontal position of title bar elements depends on locale (y pos is constant), so we sample across a horizontal line and make sure we find all elements. */ mchit.pt.y = 40; title_index = 0; for (x = 0; x < 300; x++){ mchit.pt.x = x; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(x, mchit.pt.x); expect(40, mchit.pt.y); expect(mchit.uHit, res); if (res != title_hits[title_index]){ title_index++; if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index) break; todo_wine {expect(title_hits[title_index], res);} } }
static void test_getset_item(void) { char szText[32] = "New Label"; const INT nTabs = 5; TCITEM tcItem; LPARAM lparam; DWORD ret; HWND hTab; hTab = CreateWindowA( WC_TABCONTROLA, "TestTab", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | TCS_FIXEDWIDTH | TCS_OWNERDRAWFIXED, 10, 10, 300, 100, parent_wnd, NULL, NULL, 0); ok(GetParent(hTab) == NULL, "got %p, expected null parent\n", GetParent(hTab)); ret = SendMessageA(hTab, TCM_SETITEMEXTRA, sizeof(LPARAM)-1, 0); ok(ret == TRUE, "got %d\n", ret); /* set some item data */ tcItem.lParam = ~0; tcItem.mask = TCIF_PARAM; ret = SendMessageA(hTab, TCM_INSERTITEMA, 0, (LPARAM)&tcItem); ok(ret == 0, "got %d\n", ret); /* all sizeof(LPARAM) returned anyway when using sizeof(LPARAM)-1 size */ memset(&lparam, 0xaa, sizeof(lparam)); tcItem.lParam = lparam; tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, 0, (LPARAM)&tcItem); expect(TRUE, ret); /* everything higher specified size is preserved */ memset(&lparam, 0xff, sizeof(lparam)-1); ok(tcItem.lParam == lparam, "Expected 0x%lx, got 0x%lx\n", lparam, tcItem.lParam); DestroyWindow(hTab); hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs); ok(hTab != NULL, "Failed to create tab control\n"); /* passing invalid index should result in initialization to zero for members mentioned in mask requested */ /* valid range here is [0,4] */ memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_IMAGE; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); expect(0, tcItem.iImage); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_TEXT; tcItem.pszText = szText; szText[0] = 'a'; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); expect('a', szText[0]); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = 0; tcItem.dwState = TCIS_BUTTONPRESSED; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.dwState == 0, "Expected zero dwState, got %u\n", tcItem.dwState); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = TCIS_BUTTONPRESSED; ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.dwState == 0, "Expected zero dwState\n"); /* check with negative index to be sure */ memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, -1, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); memset(&tcItem, 0xcc, sizeof(tcItem)); tcItem.mask = TCIF_PARAM; ret = SendMessage(hTab, TCM_GETITEM, -2, (LPARAM)&tcItem); expect(FALSE, ret); ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam); flush_sequences(sequences, NUM_MSG_SEQUENCES); tcItem.mask = TCIF_TEXT; tcItem.pszText = &szText[0]; tcItem.cchTextMax = sizeof(szText); strcpy(szText, "New Label"); ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("New Label", tcItem.pszText); ok ( SendMessage(hTab, TCM_GETITEM, 1, (LPARAM) &tcItem), "Getting item failed.\n"); expect_str("Tab 2", tcItem.pszText); ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE); /* TCIS_BUTTONPRESSED doesn't depend on tab style */ memset(&tcItem, 0, sizeof(tcItem)); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = TCIS_BUTTONPRESSED; ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); if (tcItem.dwState) { ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); /* next highlight item, test that dwStateMask actually masks */ tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_HIGHLIGHTED; tcItem.dwState = TCIS_HIGHLIGHTED; ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n"); tcItem.mask = TCIF_STATE; tcItem.dwStateMask = TCIS_BUTTONPRESSED; tcItem.dwState = 0; ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); } else win_skip( "Item state mask not supported\n" ); DestroyWindow(hTab); }
static void test_misc(void) { const INT nTabs = 5; HWND hTab; RECT rTab; INT nTabsRetrieved; INT rowCount; INT dpi; HDC hdc; ok(parent_wnd != NULL, "no parent window!\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs); ok(hTab != NULL, "Failed to create tab control\n"); if(!winetest_interactive) ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent, "Tab sequence, after adding tab control to parent", TRUE); else ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent_interactive, "Tab sequence, after adding tab control to parent", TRUE); if(!winetest_interactive) ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq, "Parent after sequence, adding tab control to parent", TRUE); else ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq_interactive, "Parent after sequence, adding tab control to parent", TRUE); flush_sequences(sequences, NUM_MSG_SEQUENCES); ok(SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0,"TCM_SETMINTABWIDTH returned < 0\n"); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE); /* Testing GetItemCount */ flush_sequences(sequences, NUM_MSG_SEQUENCES); nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); expect(nTabs, nTabsRetrieved); ok_sequence(sequences, TAB_SEQ_INDEX, get_item_count_seq, "Get itemCount test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset itemCount test parent sequence", FALSE); /* Testing GetRowCount */ flush_sequences(sequences, NUM_MSG_SEQUENCES); rowCount = SendMessage(hTab, TCM_GETROWCOUNT, 0, 0); expect(1, rowCount); ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE); /* Testing GetItemRect */ flush_sequences(sequences, NUM_MSG_SEQUENCES); ok(SendMessage(hTab, TCM_GETITEMRECT, 0, (LPARAM) &rTab), "GetItemRect failed.\n"); hdc = GetDC(hTab); dpi = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(hTab, hdc); CHECKSIZE(hTab, dpi, -1 , "Default Width"); ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE); DestroyWindow(hTab); }
static void test_monthcal_currDate(HWND hwnd) { SYSTEMTIME st_original, st_new, st_test; int res; flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Setter and Getters for current date selected */ st_original.wYear = 2000; st_original.wMonth = 11; st_original.wDay = 28; st_original.wHour = 11; st_original.wMinute = 59; st_original.wSecond = 30; st_original.wMilliseconds = 0; st_original.wDayOfWeek = 0; st_new = st_test = st_original; /* Should not validate the time */ res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); expect(1,res); /* Overflow matters, check for wDay */ st_test.wDay += 4; res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); expect(0,res); /* correct wDay before checking for wMonth */ st_test.wDay -= 4; expect(st_original.wDay, st_test.wDay); /* Overflow matters, check for wMonth */ st_test.wMonth += 4; res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); expect(0,res); /* checking if gets the information right, modify st_new */ st_new.wYear += 4; st_new.wMonth += 4; st_new.wDay += 4; st_new.wHour += 4; st_new.wMinute += 4; st_new.wSecond += 4; res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_new); expect(1, res); /* st_new change to st_origin, above settings with overflow */ /* should not change the current settings */ expect(st_original.wYear, st_new.wYear); expect(st_original.wMonth, st_new.wMonth); expect(st_original.wDay, st_new.wDay); expect(st_original.wHour, st_new.wHour); expect(st_original.wMinute, st_new.wMinute); expect(st_original.wSecond, st_new.wSecond); /* lparam cannot be NULL */ res = SendMessage(hwnd, MCM_GETCURSEL, 0, 0); expect(0, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE); }
static void test_button_messages(void) { static const struct { DWORD style; DWORD dlg_code; const struct message *setfocus; const struct message *killfocus; const struct message *setstyle; const struct message *setstate; const struct message *clearstate; const struct message *setcheck; } button[] = { { BS_PUSHBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON, setfocus_seq, killfocus_seq, setstyle_seq, setstate_seq, setstate_seq, setcheck_ignored_seq }, { BS_DEFPUSHBUTTON, DLGC_BUTTON | DLGC_DEFPUSHBUTTON, setfocus_seq, killfocus_seq, setstyle_seq, setstate_seq, setstate_seq, setcheck_ignored_seq }, { BS_CHECKBOX, DLGC_BUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_static_seq }, { BS_AUTOCHECKBOX, DLGC_BUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_static_seq }, { BS_RADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_radio_redraw_seq }, { BS_3STATE, DLGC_BUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_static_seq }, { BS_AUTO3STATE, DLGC_BUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_static_seq }, { BS_GROUPBOX, DLGC_STATIC, setfocus_groupbox_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_ignored_seq }, { BS_USERBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON, setfocus_seq, killfocus_seq, setstyle_user_seq, setstate_user_seq, clearstate_seq, setcheck_ignored_seq }, { BS_AUTORADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON, setfocus_static_seq, killfocus_static_seq, setstyle_static_seq, setstate_static_seq, setstate_static_seq, setcheck_radio_redraw_seq }, { BS_OWNERDRAW, DLGC_BUTTON, setfocus_ownerdraw_seq, killfocus_ownerdraw_seq, setstyle_ownerdraw_seq, setstate_ownerdraw_seq, clearstate_ownerdraw_seq, setcheck_ignored_seq }, }; const struct message *seq; unsigned int i; HWND hwnd, parent; DWORD dlg_code; HFONT zfont; BOOL todo; /* selection with VK_SPACE should capture button window */ hwnd = create_button(BS_CHECKBOX | WS_VISIBLE | WS_POPUP, NULL); ok(hwnd != 0, "Failed to create button window\n"); ReleaseCapture(); SetFocus(hwnd); SendMessageA(hwnd, WM_KEYDOWN, VK_SPACE, 0); ok(GetCapture() == hwnd, "Should be captured on VK_SPACE WM_KEYDOWN\n"); SendMessageA(hwnd, WM_KEYUP, VK_SPACE, 0); DestroyWindow(hwnd); parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL); ok(parent != 0, "Failed to create parent window\n"); for (i = 0; i < sizeof(button)/sizeof(button[0]); i++) { MSG msg; DWORD style, state; trace("%d: button test sequence\n", i); hwnd = create_button(button[i].style, parent); style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_CHILD | BS_NOTIFY); /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */ if (button[i].style == BS_USERBUTTON) ok(style == BS_PUSHBUTTON, "expected style BS_PUSHBUTTON got %x\n", style); else ok(style == button[i].style, "expected style %x got %x\n", button[i].style, style); dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0); ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); SetFocus(0); flush_events(); SetFocus(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); todo = button[i].style != BS_OWNERDRAW; ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus()); SetFocus(hwnd); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setfocus, "SetFocus(hwnd) on a button", todo); todo = button[i].style == BS_OWNERDRAW; SetFocus(0); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].killfocus, "SetFocus(0) on a button", todo); ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus()); SendMessageA(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", TRUE); style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_VISIBLE | WS_CHILD | BS_NOTIFY); /* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */ ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style); state = SendMessageA(hwnd, BM_GETSTATE, 0, 0); ok(state == 0, "expected state 0, got %04x\n", state); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, BM_SETSTATE, TRUE, 0); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstate, "BM_SETSTATE/TRUE on a button", TRUE); state = SendMessageA(hwnd, BM_GETSTATE, 0, 0); ok(state == BST_PUSHED, "expected state 0x0004, got %04x\n", state); style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE); ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, BM_SETSTATE, FALSE, 0); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].clearstate, "BM_SETSTATE/FALSE on a button", TRUE); state = SendMessageA(hwnd, BM_GETSTATE, 0, 0); ok(state == 0, "expected state 0, got %04x\n", state); style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE); ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style); state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state); flush_sequences(sequences, NUM_MSG_SEQUENCES); if (button[i].style == BS_RADIOBUTTON || button[i].style == BS_AUTORADIOBUTTON) { seq = setcheck_radio_seq; todo = TRUE; } else { seq = setcheck_ignored_seq; todo = FALSE; } SendMessageA(hwnd, BM_SETCHECK, BST_UNCHECKED, 0); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", todo); state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state); style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE); ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, BM_SETCHECK, BST_CHECKED, 0); SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); if (button[i].style == BS_PUSHBUTTON || button[i].style == BS_DEFPUSHBUTTON || button[i].style == BS_GROUPBOX || button[i].style == BS_USERBUTTON || button[i].style == BS_OWNERDRAW) { ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", FALSE); state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); ok(state == BST_UNCHECKED, "expected check BST_UNCHECKED, got %04x\n", state); } else { ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", TRUE); state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); ok(state == BST_CHECKED, "expected check BST_CHECKED, got %04x\n", state); } style = GetWindowLongA(hwnd, GWL_STYLE); style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE); if (button[i].style == BS_RADIOBUTTON || button[i].style == BS_AUTORADIOBUTTON) ok(style == (button[i].style | WS_TABSTOP), "expected style %04x | WS_TABSTOP got %04x\n", button[i].style, style); else ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style); DestroyWindow(hwnd); } DestroyWindow(parent); hwnd = create_button(BS_PUSHBUTTON, NULL); SetForegroundWindow(hwnd); flush_events(); SetActiveWindow(hwnd); SetFocus(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, WM_LBUTTONDOWN, 0, 0); ok_sequence(sequences, COMBINED_SEQ_INDEX, lbuttondown_seq, "WM_LBUTTONDOWN on a button", FALSE); SendMessageA(hwnd, WM_LBUTTONUP, 0, 0); ok_sequence(sequences, COMBINED_SEQ_INDEX, lbuttonup_seq, "WM_LBUTTONUP on a button", TRUE); flush_sequences(sequences, NUM_MSG_SEQUENCES); zfont = GetStockObject(SYSTEM_FONT); SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE); UpdateWindow(hwnd); ok_sequence(sequences, COMBINED_SEQ_INDEX, setfont_seq, "WM_SETFONT on a button", FALSE); DestroyWindow(hwnd); }
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); }
static void test_insert_focus(HWND parent_wnd) { HWND hTab; INT nTabsRetrieved; INT r; TCITEM tcNewTab; DWORD mask = TCIF_TEXT|TCIF_IMAGE; static char tabName[] = "TAB"; tcNewTab.mask = mask; tcNewTab.pszText = tabName; ok(parent_wnd != NULL, "no parent window!\n"); hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, mask, 0); ok(hTab != NULL, "Failed to create tab control\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); expect(0, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(-1, r); tcNewTab.iImage = 1; r = SendMessage(hTab, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab); expect(0, r); nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); expect(1, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(0, r); tcNewTab.iImage = 2; r = SendMessage(hTab, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab); expect(1, r); nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); expect(2, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(0, r); r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0); expect(0, r); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(-1, r); tcNewTab.iImage = 3; r = SendMessage(hTab, TCM_INSERTITEM, 3, (LPARAM) &tcNewTab); expect(2, r); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); expect(2, r); ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", FALSE); DestroyWindow(hTab); }
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); }
static void test_tic_settings(HWND hWndTrackbar){ int r; /* testing TBM_SETTIC */ /* Set tics at 5 and 10 */ /* 0 and 20 are out of range and should not be set */ r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0, 0); expect(10, r); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0, 0); expect(5, r); flush_sequences(sequences, NUM_MSG_SEQUENCE); r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 0); ok(r == FALSE, "Expected FALSE, got %d\n", r); r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 5); ok(r == TRUE, "Expected TRUE, got %d\n", r); r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 10); ok(r == TRUE, "Expected TRUE, got %d\n", r); r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 20); ok(r == FALSE, "Expected False, got %d\n", r); /* test TBM_SETTICFREQ */ SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10)); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 2, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(6, r); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 5, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(3, r); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 15, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(2, r); /* test TBM_GETNUMTICS */ /* since TIC FREQ is 15, there should be only 2 tics now */ r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(2, r); ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_settings_test_seq, "tic settings test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_tic_settings_test_seq, "parent tic settings test sequence", TRUE); /* range [0,0], freq = 1 */ SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 0); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(2, r); /* range [0,1], freq = 1 */ SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 1); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(2, r); /* range [0,2], freq = 1 */ SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 2); SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(3, r); }
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); }