From: Amine Khaldi Date: Sun, 5 Jun 2016 18:56:37 +0000 (+0000) Subject: [COMCTL32_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 X-Git-Tag: ReactOS-0.4.2~423 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=1cb962832366232ccb7327ec8e5d4b508da9fe6e [COMCTL32_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 svn path=/trunk/; revision=71541 --- diff --git a/rostests/winetests/comctl32/CMakeLists.txt b/rostests/winetests/comctl32/CMakeLists.txt index 9b0e6e88b17..2920bf559c5 100644 --- a/rostests/winetests/comctl32/CMakeLists.txt +++ b/rostests/winetests/comctl32/CMakeLists.txt @@ -4,6 +4,7 @@ remove_definitions(-D_WIN32_WINNT=0x502 -D_WIN32_IE=0x600) add_definitions(-DUSE_WINE_TODOS) list(APPEND SOURCE + animate.c button.c comboex.c datetime.c diff --git a/rostests/winetests/comctl32/animate.c b/rostests/winetests/comctl32/animate.c new file mode 100644 index 00000000000..0bb90a412f7 --- /dev/null +++ b/rostests/winetests/comctl32/animate.c @@ -0,0 +1,182 @@ +/* Unit tests for the animate control. + * + * Copyright 2016 Bruno Jesus + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "commctrl.h" + +#include "wine/test.h" + +#define SEARCHING_AVI_INDEX 151 /* From shell32 resource library */ +#define INVALID_AVI_INDEX 0xffff + +static HWND hAnimateParentWnd, hAnimateWnd; +static const char animateTestClass[] = "AnimateTestClass"; +static WNDPROC animate_wndproc; +static HANDLE shell32; + +/* try to make sure pending X events have been processed before continuing */ +static void flush_events(void) +{ + MSG msg; + int diff = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(10,diff), QS_ALLINPUT ) == WAIT_TIMEOUT) break; + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + diff = time - GetTickCount(); + } +} + +static LRESULT CALLBACK animate_test_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProcA(hWnd, msg, wParam, lParam); + } + return 0L; +} + +static void update_window(HWND hWnd) +{ + UpdateWindow(hWnd); + ok(!GetUpdateRect(hWnd, NULL, FALSE), "GetUpdateRect must return zero after UpdateWindow\n"); +} + +static void create_animate(DWORD parent_style, DWORD animate_style) +{ + WNDCLASSA wc; + RECT rect; + BOOL ret; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandleA(NULL); + wc.hIcon = NULL; + wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW); + wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW); + wc.lpszMenuName = NULL; + wc.lpszClassName = animateTestClass; + wc.lpfnWndProc = animate_test_wnd_proc; + RegisterClassA(&wc); + + SetRect(&rect, 0, 0, 200, 200); + ret = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); + ok(ret, "got %d\n", ret); + + hAnimateParentWnd = CreateWindowExA(0, animateTestClass, "Animate Test", WS_OVERLAPPEDWINDOW | parent_style, + CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0); + ok(hAnimateParentWnd != NULL, "failed to create parent wnd\n"); + + GetClientRect(hAnimateParentWnd, &rect); + hAnimateWnd = CreateWindowExA(0, ANIMATE_CLASSA, NULL, WS_CHILD | WS_VISIBLE | animate_style, + 0, 0, rect.right, rect.bottom, hAnimateParentWnd, NULL, shell32, 0); + ok(hAnimateWnd != NULL, "failed to create parent wnd\n"); + animate_wndproc = (WNDPROC)SetWindowLongPtrA(hAnimateWnd, GWLP_WNDPROC, 0); + + ShowWindow(hAnimateParentWnd, SW_SHOWNORMAL); + ok(GetUpdateRect(hAnimateParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n"); + flush_events(); + update_window(hAnimateParentWnd); +} + +static void init(void) +{ + HMODULE hComctl32; + BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*); + + hComctl32 = GetModuleHandleA("comctl32.dll"); + pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); + if (pInitCommonControlsEx) + { + INITCOMMONCONTROLSEX iccex; + iccex.dwSize = sizeof(iccex); + iccex.dwICC = ICC_ANIMATE_CLASS; + pInitCommonControlsEx(&iccex); + } + else + InitCommonControls(); + + shell32 = LoadLibraryA("Shell32.dll"); +} + +static void destroy_animate(void) +{ + MSG msg; + + PostMessageA(hAnimateParentWnd, WM_CLOSE, 0, 0); + while (GetMessageA(&msg,0,0,0)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + hAnimateParentWnd = NULL; +} + +static void cleanup(void) +{ + UnregisterClassA(animateTestClass, GetModuleHandleA(NULL)); +} + +static void test_play(void) +{ + LONG res; + DWORD err; + + create_animate(0, 0); + SetLastError(0xdeadbeef); + res = SendMessageA(hAnimateWnd, ACM_OPENA,(WPARAM)shell32, (LPARAM)MAKEINTRESOURCE(INVALID_AVI_INDEX)); + err = GetLastError(); + ok(res == 0, "Invalid video should have failed\n"); + ok(err == ERROR_RESOURCE_NAME_NOT_FOUND, "Expected 1814, got %u\n", err); + + SetLastError(0xdeadbeef); + res = SendMessageA(hAnimateWnd, ACM_PLAY, (WPARAM) -1, MAKELONG(0, -1)); + ok(res == 0, "Play should have failed\n"); + ok(err == ERROR_RESOURCE_NAME_NOT_FOUND, "Expected 1814, got %u\n", err); + destroy_animate(); + + create_animate(0, 0); + res = SendMessageA(hAnimateWnd, ACM_OPENA,(WPARAM)shell32, (LPARAM)MAKEINTRESOURCE(SEARCHING_AVI_INDEX)); + ok(res != 0, "Load AVI resource failed\n"); + res = SendMessageA(hAnimateWnd, ACM_PLAY, (WPARAM) -1, MAKELONG(0, -1)); + ok(res != 0, "Play should have worked\n"); + destroy_animate(); +} + +START_TEST(animate) +{ + init(); + + test_play(); + + cleanup(); +} diff --git a/rostests/winetests/comctl32/datetime.c b/rostests/winetests/comctl32/datetime.c index 415e72fa122..60623609315 100644 --- a/rostests/winetests/comctl32/datetime.c +++ b/rostests/winetests/comctl32/datetime.c @@ -365,9 +365,7 @@ static void test_dtm_set_and_get_range(void) r = SendMessageA(hWnd, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); expect(1, r); r = SendMessageA(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); - todo_wine { - 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); - } + 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); @@ -411,6 +409,13 @@ static void test_dtm_set_and_get_range(void) 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); } diff --git a/rostests/winetests/comctl32/header.c b/rostests/winetests/comctl32/header.c index 976d49368f9..c646c29119f 100644 --- a/rostests/winetests/comctl32/header.c +++ b/rostests/winetests/comctl32/header.c @@ -1005,8 +1005,19 @@ static void test_hdm_filterMessages(HWND hParent) ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq, "adder header control to parent", FALSE); + timeout = SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 0, 0); + ok(timeout == 1000, "got %d\n", timeout); + + timeout = SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 0, 0); + ok(timeout == 1000, "got %d\n", timeout); + + timeout = SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 0, -100); + ok(timeout == 1000, "got %d\n", timeout); + timeout = SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100); - SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, timeout); + ok(timeout == -100, "got %d\n", timeout); + retVal = SendMessageA(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, timeout); + ok(retVal == 100, "got %d\n", retVal); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -1089,23 +1100,15 @@ static void test_hdm_bitmapmarginMessages(HWND hParent) static void test_hdm_index_messages(HWND hParent) { HWND hChild; - int retVal; - int loopcnt; - int strcmpResult; - int iSize; + int retVal, i, iSize; static const int lpiarray[2] = {1, 0}; - static int lpiarrayReceived[2]; - static char firstHeaderItem[] = "Name"; - static char secondHeaderItem[] = "Size"; - static char thirdHeaderItem[] = "Type"; - static char fourthHeaderItem[] = "Date Modified"; - static char *items[] = {firstHeaderItem, secondHeaderItem, thirdHeaderItem, fourthHeaderItem}; + static const char *item_texts[] = { + "Name", "Size", "Type", "Date Modified" + }; RECT rect; HDITEMA hdItem; - hdItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT; - hdItem.fmt = HDF_LEFT; - hdItem.cxy = 80; - hdItem.cchTextMax = 260; + char buffA[32]; + int array[2]; flush_sequences(sequences, NUM_MSG_SEQUENCES); hChild = create_custom_header_control(hParent, FALSE); @@ -1116,11 +1119,15 @@ static void test_hdm_index_messages(HWND hParent) ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq, "adder header control to parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); - for ( loopcnt = 0 ; loopcnt < 4 ; loopcnt++ ) + for (i = 0; i < sizeof(item_texts)/sizeof(item_texts[0]); i++) { - hdItem.pszText = items[loopcnt]; - retVal = SendMessageA(hChild, HDM_INSERTITEMA, loopcnt, (LPARAM) &hdItem); - ok(retVal == loopcnt, "Adding item %d failed with return value %d\n", ( loopcnt + 1 ), retVal); + hdItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT; + hdItem.pszText = (char*)item_texts[i]; + hdItem.fmt = HDF_LEFT; + hdItem.cxy = 80; + + retVal = SendMessageA(hChild, HDM_INSERTITEMA, i, (LPARAM) &hdItem); + ok(retVal == i, "Adding item %d failed with return value %d\n", i, retVal); } ok_sequence(sequences, HEADER_SEQ_INDEX, insertItem_seq, "insertItem sequence testing", FALSE); @@ -1146,17 +1153,21 @@ static void test_hdm_index_messages(HWND hParent) flush_sequences(sequences, NUM_MSG_SEQUENCES); + hdItem.mask = HDI_WIDTH; retVal = SendMessageA(hChild, HDM_GETITEMA, 3, (LPARAM) &hdItem); ok(retVal == FALSE, "Getting already-deleted item should return FALSE, got %d\n", retVal); + hdItem.mask = HDI_TEXT | HDI_WIDTH; + hdItem.pszText = buffA; + hdItem.cchTextMax = sizeof(buffA)/sizeof(buffA[0]); retVal = SendMessageA(hChild, HDM_GETITEMA, 0, (LPARAM) &hdItem); ok(retVal == TRUE, "Getting the 1st header item should return TRUE, got %d\n", retVal); ok_sequence(sequences, HEADER_SEQ_INDEX, getItem_seq, "getItem sequence testing", FALSE); /* check if the item is the right one */ - strcmpResult = strcmp(hdItem.pszText, firstHeaderItem); - expect(0, strcmpResult); + ok(!strcmp(hdItem.pszText, item_texts[0]), "got wrong item %s, expected %s\n", + hdItem.pszText, item_texts[0]); expect(80, hdItem.cxy); iSize = SendMessageA(hChild, HDM_GETITEMCOUNT, 0, 0); @@ -1175,15 +1186,15 @@ static void test_hdm_index_messages(HWND hParent) retVal = SendMessageA(hChild, HDM_SETORDERARRAY, iSize, (LPARAM) lpiarray); ok(retVal == TRUE, "Setting header items order should return TRUE, got %d\n", retVal); - retVal = SendMessageA(hChild, HDM_GETORDERARRAY, iSize, (LPARAM) lpiarrayReceived); + retVal = SendMessageA(hChild, HDM_GETORDERARRAY, 2, (LPARAM) array); ok(retVal == TRUE, "Getting header items order should return TRUE, got %d\n", retVal); ok_sequence(sequences, HEADER_SEQ_INDEX, orderArray_seq, "set_get_orderArray sequence testing", FALSE); /* check if the array order is set correctly and the size of the array is correct. */ expect(2, iSize); - expect(lpiarray[0], lpiarrayReceived[0]); - expect(lpiarray[1], lpiarrayReceived[1]); + ok(lpiarray[0] == array[0], "got %d, expected %d\n", array[0], lpiarray[0]); + ok(lpiarray[1] == array[1], "got %d, expected %d\n", array[1], lpiarray[1]); hdItem.mask = HDI_FORMAT; hdItem.fmt = HDF_CENTER | HDF_STRING; @@ -1718,17 +1729,17 @@ static void check_orderarray(HWND hwnd, DWORD start, DWORD set, DWORD expected, order[i-1] = start>>(4*(count-i)) & 0xf; ret = SendMessageA(hwnd, HDM_SETORDERARRAY, count, (LPARAM)order); - ok_(__FILE__, line)(ret, "Expected HDM_SETORDERARAY to succeed, got %d\n", ret); + ok_(__FILE__, line)(ret, "Expected HDM_SETORDERARRAY to succeed, got %d\n", ret); /* new order */ for(i = 1; i<=count; i++) order[i-1] = set>>(4*(count-i)) & 0xf; ret = SendMessageA(hwnd, HDM_SETORDERARRAY, count, (LPARAM)order); - ok_(__FILE__, line)(ret, "Expected HDM_SETORDERARAY to succeed, got %d\n", ret); + ok_(__FILE__, line)(ret, "Expected HDM_SETORDERARRAY to succeed, got %d\n", ret); /* check actual order */ ret = SendMessageA(hwnd, HDM_GETORDERARRAY, count, (LPARAM)order); - ok_(__FILE__, line)(ret, "Expected HDM_GETORDERARAY to succeed, got %d\n", ret); + ok_(__FILE__, line)(ret, "Expected HDM_GETORDERARRAY to succeed, got %d\n", ret); for(i = 1; i<=count; i++) array |= order[i-1]<<(4*(count-i)); diff --git a/rostests/winetests/comctl32/listview.c b/rostests/winetests/comctl32/listview.c index 67c40c78336..13c934351d9 100644 --- a/rostests/winetests/comctl32/listview.c +++ b/rostests/winetests/comctl32/listview.c @@ -1710,9 +1710,7 @@ static void test_create(void) ok(!IsWindow(hHeader), "Header shouldn't be created\n"); ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n"); - rect.left = LVIR_BOUNDS; - rect.top = 1; - rect.right = rect.bottom = -10; + SetRect(&rect, LVIR_BOUNDS, 1, -10, -10); r = SendMessageA(hList, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect); /* right value contains garbage, probably because header columns are not set up */ expect(0, rect.bottom); @@ -2241,8 +2239,9 @@ static void test_multiselect(void) HWND hwnd; INT r; - int i,j,item_count,selected_count; + int i, j; static const int items=5; + DWORD item_count; BYTE kstate[256]; select_task task; LONG_PTR style; @@ -2260,10 +2259,11 @@ static void test_multiselect(void) for (i = 0; i < items; i++) insert_item(hwnd, 0); - item_count = (int)SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0); + item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0); expect(items, item_count); for (i = 0; i < 4; i++) { + DWORD selected_count; LVITEMA item; task = task_list[i]; @@ -2296,9 +2296,11 @@ static void test_multiselect(void) expect(0,r); } - selected_count = (int)SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); - ok((task.result == -1 ? item_count : task.result) == selected_count, "Failed multiple selection %s. There should be %d selected items (is %d)\n", task.descr, item_count, selected_count); + ok((task.result == -1 ? item_count : task.result) == selected_count, + "Failed multiple selection %s. There should be %d selected items (is %d)\n", + task.descr, item_count, selected_count); /* Set SHIFT key released */ GetKeyboardState(kstate); @@ -2312,7 +2314,7 @@ static void test_multiselect(void) for (i=0;i column width */ @@ -4082,16 +4037,14 @@ todo_wine expect(TRUE, r); /* icon bounds */ - rect.left = LVIR_ICON; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_ICON, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding, icon width */ expect(2, rect.left); expect(18, rect.right); /* label bounds */ - rect.left = LVIR_LABEL; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_LABEL, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding + icon width -> column width */ @@ -4099,8 +4052,7 @@ todo_wine expect(50, rect.right); /* select bounds */ - rect.left = LVIR_SELECTBOUNDS; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding, column width */ @@ -4116,8 +4068,7 @@ todo_wine expect(TRUE, r); /* bounds */ - rect.left = LVIR_BOUNDS; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_BOUNDS, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding + 1 icon width, column width */ @@ -4125,8 +4076,7 @@ todo_wine expect(150, rect.right); /* select bounds */ - rect.left = LVIR_SELECTBOUNDS; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding + 1 icon width, column width */ @@ -4134,8 +4084,7 @@ todo_wine expect(50, rect.right); /* label bounds */ - rect.left = LVIR_LABEL; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_LABEL, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding + 2 icon widths, column width */ @@ -4143,8 +4092,7 @@ todo_wine expect(50, rect.right); /* icon bounds */ - rect.left = LVIR_ICON; - rect.right = rect.top = rect.bottom = -1; + SetRect(&rect, LVIR_ICON, -1, -1, -1); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect); expect(TRUE, r); /* padding + 1 icon width indentation, icon width */ diff --git a/rostests/winetests/comctl32/monthcal.c b/rostests/winetests/comctl32/monthcal.c index 5367af177eb..281bb64a513 100644 --- a/rostests/winetests/comctl32/monthcal.c +++ b/rostests/winetests/comctl32/monthcal.c @@ -265,6 +265,7 @@ static void test_monthcal(void) SYSTEMTIME st[2], st1[2], today; int res, month_range; DWORD limits; + BOOL r; hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, 0, 300, 300, 0, 0, NULL, NULL); @@ -307,6 +308,9 @@ static void test_monthcal(void) expect(0, st[1].wSecond); expect(0, st[1].wMilliseconds); + limits = SendMessageA(hwnd, MCM_GETRANGE, 0, 0); + ok(limits == 0, "got %u\n", limits); + GetSystemTime(&st[0]); st[1] = st[0]; @@ -453,6 +457,40 @@ static void test_monthcal(void) expect(0, st1[1].wSecond); expect(0, st1[1].wMilliseconds); + /* 0 limit flags */ + limits = SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1); + ok(limits == GDTR_MIN, "got 0x%08x\n", limits); + + GetSystemTime(st); + st[1] = st[0]; + st[1].wYear++; + r = SendMessageA(hwnd, MCM_SETRANGE, 0, (LPARAM)st); + ok(r, "got %d\n", r); + + limits = SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st); + ok(limits == 0, "got 0x%08x\n", limits); + ok(st[0].wYear == 0 && st[1].wYear == 0, "got %u, %u\n", st[0].wYear, st[1].wYear); + + /* flags are 0, set min limit */ + GetSystemTime(st); + st[1] = st[0]; + st[1].wYear++; + + r = SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN, (LPARAM)st); + ok(r, "got %d\n", r); + + limits = SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1); + ok(limits == GDTR_MIN, "got 0x%08x\n", limits); + ok(st1[1].wYear == 0, "got %u\n", st1[1].wYear); + + /* now set max limit, check flags */ + r = SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st); + ok(r, "got %d\n", r); + + limits = SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1); + ok(limits == GDTR_MAX, "got 0x%08x\n", limits); + ok(st1[0].wYear == 0, "got %u\n", st1[0].wYear); + DestroyWindow(hwnd); } @@ -1860,7 +1898,7 @@ static void test_MCM_SIZERECTTOMIN(void) ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, 0); ok(ret == 0, "got %d\n", ret); - r.left = r.right = r.top = r.bottom = 0; + SetRectEmpty(&r); ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, (LPARAM)&r); if (ret == 0) { diff --git a/rostests/winetests/comctl32/progress.c b/rostests/winetests/comctl32/progress.c index 19e84cd0fb8..f7ae328e5e9 100644 --- a/rostests/winetests/comctl32/progress.c +++ b/rostests/winetests/comctl32/progress.c @@ -123,11 +123,8 @@ static void init(void) wc.lpszClassName = progressTestClass; wc.lpfnWndProc = progress_test_wnd_proc; RegisterClassA(&wc); - - rect.left = 0; - rect.top = 0; - rect.right = 400; - rect.bottom = 20; + + SetRect(&rect, 0, 0, 400, 20); ret = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); ok(ret, "got %d\n", ret); diff --git a/rostests/winetests/comctl32/testlist.c b/rostests/winetests/comctl32/testlist.c index dd1c5ce8f23..d1c564d8f8a 100644 --- a/rostests/winetests/comctl32/testlist.c +++ b/rostests/winetests/comctl32/testlist.c @@ -3,6 +3,7 @@ #define STANDALONE #include +extern void func_animate(void); extern void func_button(void); extern void func_comboex(void); extern void func_datetime(void); @@ -30,6 +31,7 @@ extern void func_updown(void); const struct test winetest_testlist[] = { + { "button", func_animate }, { "button", func_button }, { "comboex", func_comboex }, { "datetime", func_datetime }, diff --git a/rostests/winetests/comctl32/toolbar.c b/rostests/winetests/comctl32/toolbar.c index bab746bf194..5e18126f56b 100644 --- a/rostests/winetests/comctl32/toolbar.c +++ b/rostests/winetests/comctl32/toolbar.c @@ -399,7 +399,7 @@ static void basic_test(void) ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 pressed\n"); ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1004, 0), "A5 not pressed anymore\n"); - /* test for inter-group crosstalk, ie. two radio groups interfering with each other */ + /* test for inter-group crosstalk, i.e. two radio groups interfering with each other */ SendMessageA(hToolbar, TB_CHECKBUTTON, 1007, 1); /* press B2 */ ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 still pressed, no inter-group crosstalk\n"); ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 still not pressed\n"); diff --git a/rostests/winetests/comctl32/tooltips.c b/rostests/winetests/comctl32/tooltips.c index 886f501b6b3..4bc1ddd7277 100644 --- a/rostests/winetests/comctl32/tooltips.c +++ b/rostests/winetests/comctl32/tooltips.c @@ -292,13 +292,15 @@ static HWND create_parent_window(void) static void test_gettext(void) { + static const CHAR testtip2A[] = "testtip\ttest2"; + static const CHAR testtipA[] = "testtip"; HWND hwnd, notify; TTTOOLINFOA toolinfoA; TTTOOLINFOW toolinfoW; LRESULT r; CHAR bufA[10] = ""; WCHAR bufW[10] = { 0 }; - static const CHAR testtipA[] = "testtip"; + DWORD length, style; notify = create_parent_window(); ok(notify != NULL, "Expected notification window to be created\n"); @@ -320,49 +322,48 @@ static void test_gettext(void) toolinfoA.lParam = 0xdeadbeef; GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); - if (r) - { - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1234ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n"); + ok(r, "got %ld\n", r); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.lpszText == NULL, - "expected NULL, got %p\n", toolinfoA.lpszText); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1234abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!*toolinfoA.lpszText, "lpszText should be empty, got %s\n", toolinfoA.lpszText); - /* NULL hinst, valid resource id for text */ - toolinfoA.cbSize = sizeof(TTTOOLINFOA); - toolinfoA.hwnd = NULL; - toolinfoA.hinst = NULL; - toolinfoA.uFlags = 0; - toolinfoA.uId = 0x1233ABCD; - toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1); - toolinfoA.lParam = 0xdeadbeef; - GetClientRect(hwnd, &toolinfoA.rect); - r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); - ok(r, "failed to add a tool\n"); + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.lpszText == NULL, "expected NULL, got %p\n", toolinfoA.lpszText); - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1233ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, "abc") == 0, "lpszText should be an empty string\n"); + /* NULL hinst, valid resource id for text */ + toolinfoA.cbSize = sizeof(TTTOOLINFOA); + toolinfoA.hwnd = NULL; + toolinfoA.hinst = NULL; + toolinfoA.uFlags = 0; + toolinfoA.uId = 0x1233abcd; + toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1); + toolinfoA.lParam = 0xdeadbeef; + GetClientRect(hwnd, &toolinfoA.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); + ok(r, "failed to add a tool\n"); - toolinfoA.hinst = (HINSTANCE)0xdeadbee; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1233abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, "abc"), "got wrong text, %s\n", toolinfoA.lpszText); - SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA); - } - else - { - win_skip( "Old comctl32, not testing NULL text\n" ); - DestroyWindow( hwnd ); - return; - } + toolinfoA.hinst = (HINSTANCE)0xdeadbee; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst); + + r = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); /* add another tool with text */ toolinfoA.cbSize = sizeof(TTTOOLINFOA); @@ -376,28 +377,26 @@ static void test_gettext(void) GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); ok(r, "Adding the tool to the tooltip failed\n"); - if (r) - { - DWORD length; - length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); - ok(length == 0, "Expected 0, got %d\n", length); + length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); + ok(length == 0, "Expected 0, got %d\n", length); - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1235ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testtipA) == 0, "lpszText should be an empty string\n"); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText); - memset(bufA, 0x1f, sizeof(bufA)); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testtipA) == 0, - "expected %s, got %p\n", testtipA, toolinfoA.lpszText); + memset(bufA, 0x1f, sizeof(bufA)); + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText); - length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); - ok(length == 0, "Expected 0, got %d\n", length); - } + length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); + ok(length == 0, "Expected 0, got %d\n", length); /* add another with callback text */ toolinfoA.cbSize = sizeof(TTTOOLINFOA); @@ -410,33 +409,26 @@ static void test_gettext(void) GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); ok(r, "Adding the tool to the tooltip failed\n"); - if (r) - { - toolinfoA.hwnd = notify; - toolinfoA.uId = 0x1236ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testcallbackA) == 0, - "lpszText should be an (%s) string\n", testcallbackA); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, - "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText); - } + toolinfoA.hwnd = notify; + toolinfoA.uId = 0x1236abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testcallbackA), "lpszText should be an (%s) string\n", testcallbackA); + + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText); DestroyWindow(hwnd); DestroyWindow(notify); - SetLastError(0xdeadbeef); hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0, 10, 10, 300, 100, NULL, NULL, NULL, 0); - - if (!hwnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { - win_skip("CreateWindowExW is not implemented\n"); - return; - } ok(hwnd != NULL, "failed to create tooltip wnd\n"); toolinfoW.cbSize = sizeof(TTTOOLINFOW); @@ -486,6 +478,37 @@ static void test_gettext(void) ok(toolinfoW.lpszText[0] == 0, "lpszText should be an empty string\n"); } + /* text with embedded tabs */ + toolinfoA.cbSize = sizeof(TTTOOLINFOA); + toolinfoA.hwnd = NULL; + toolinfoA.hinst = GetModuleHandleA(NULL); + toolinfoA.uFlags = 0; + toolinfoA.uId = 0x1235abce; + strcpy(bufA, testtip2A); + toolinfoA.lpszText = bufA; + toolinfoA.lParam = 0xdeadbeef; + GetClientRect(hwnd, &toolinfoA.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); + ok(r, "got %ld\n", r); + + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abce; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %s\n", testtipA, toolinfoA.lpszText); + + /* enable TTS_NOPREFIX, original text is retained */ + style = GetWindowLongA(hwnd, GWL_STYLE); + SetWindowLongA(hwnd, GWL_STYLE, style | TTS_NOPREFIX); + + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abce; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtip2A), "expected %s, got %s\n", testtip2A, toolinfoA.lpszText); + DestroyWindow(hwnd); }