Author: akhaldi Date: Tue Mar 1 19:02:49 2016 New Revision: 70847
URL: http://svn.reactos.org/svn/reactos?rev=70847&view=rev Log: [COMCTL32_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
Modified: trunk/rostests/winetests/comctl32/button.c trunk/rostests/winetests/comctl32/header.c trunk/rostests/winetests/comctl32/imagelist.c trunk/rostests/winetests/comctl32/listview.c trunk/rostests/winetests/comctl32/misc.c trunk/rostests/winetests/comctl32/monthcal.c trunk/rostests/winetests/comctl32/propsheet.c trunk/rostests/winetests/comctl32/tooltips.c trunk/rostests/winetests/comctl32/trackbar.c trunk/rostests/winetests/comctl32/treeview.c
Modified: trunk/rostests/winetests/comctl32/button.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/button.... ============================================================================== --- trunk/rostests/winetests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/button.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -210,6 +210,7 @@ { { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, + { BM_GETSTATE, sent|optional }, /* when touchscreen is present */ { WM_SETFOCUS, sent|wparam }, { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, { WM_APP, sent|wparam|lparam }, @@ -232,6 +233,7 @@ { { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, + { BM_GETSTATE, sent|optional }, /* when touchscreen is present */ { WM_SETFOCUS, sent|wparam, 0 }, { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, { WM_COMMAND, sent|wparam|parent|optional, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, /* radio button */ @@ -244,6 +246,7 @@ { { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, + { BM_GETSTATE, sent|optional }, /* when touchscreen is present */ { WM_SETFOCUS, sent|wparam, 0 }, { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, { WM_COMMAND, sent|wparam|parent|optional, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, /* radio button */ @@ -267,6 +270,7 @@ { { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, + { BM_GETSTATE, sent|optional }, /* when touchscreen is present */ { WM_SETFOCUS, sent|wparam, 0 }, { WM_DRAWITEM, sent|wparam|parent, ID_BUTTON }, { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, @@ -292,6 +296,7 @@ { WM_LBUTTONDOWN, sent|wparam|lparam, 0, 0 }, { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, + { BM_GETSTATE, sent|defwinproc|optional }, /* when touchscreen is present */ { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, { BM_SETSTATE, sent|wparam|defwinproc, TRUE }, { 0 }
Modified: trunk/rostests/winetests/comctl32/header.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/header.... ============================================================================== --- trunk/rostests/winetests/comctl32/header.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/header.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -1732,11 +1732,7 @@ for(i = 1; i<=count; i++) array |= order[i-1]<<(4*(count-i));
- if (todo) { - todo_wine - ok_(__FILE__, line)(array == expected, "Expected %x, got %x\n", expected, array); - } - else + todo_wine_if(todo) ok_(__FILE__, line)(array == expected, "Expected %x, got %x\n", expected, array); }
Modified: trunk/rostests/winetests/comctl32/imagelist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/imageli... ============================================================================== --- trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -44,16 +44,6 @@ #include <wine/test.h> #include "v6util.h"
-#undef VISIBLE - -#ifdef VISIBLE -#define WAIT Sleep (1000) -#define REDRAW(hwnd) RedrawWindow (hwnd, NULL, 0, RDW_UPDATENOW) -#else -#define WAIT -#define REDRAW(hwnd) -#endif - #define IMAGELIST_MAGIC (('L' << 8) | 'I')
#include "pshpack2.h" @@ -82,6 +72,16 @@ static HRESULT (WINAPI *pHIMAGELIST_QueryInterface)(HIMAGELIST,REFIID,void **);
static HINSTANCE hinst; + +/* only used in interactive mode */ +static void force_redraw(HWND hwnd) +{ + if (!winetest_interactive) + return; + + RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW); + Sleep(1000); +}
/* These macros build cursor/bitmap data in 4x4 pixel blocks */ #define B(x,y) ((x?0xf0:0)|(y?0xf:0)) @@ -165,11 +165,11 @@ CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0, 0, hinst, 0);
-#ifdef VISIBLE - ShowWindow (hWnd, SW_SHOW); -#endif - REDRAW(hWnd); - WAIT; + if (winetest_interactive) + { + ShowWindow (hWnd, SW_SHOW); + force_redraw (hWnd); + }
return hWnd; } @@ -177,16 +177,15 @@ static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size, LPCSTR loc, BOOL clear) { - HDC hdc = NULL; -#ifdef VISIBLE - if (!himl) return NULL; - - SetWindowText(hwnd, loc); + HDC hdc; + + if (!winetest_interactive || !himl) return NULL; + + SetWindowTextA(hwnd, loc); hdc = GetDC(hwnd); ImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
- REDRAW(hwnd); - WAIT; + force_redraw(hwnd);
if (clear) { @@ -194,12 +193,11 @@ ReleaseDC(hwnd, hdc); hdc = NULL; } -#endif /* VISIBLE */ + return hdc; }
/* Useful for checking differences */ -#if 0 static void dump_bits(const BYTE *p, const BYTE *q, int size) { int i, j; @@ -220,18 +218,16 @@ } printf("\n"); } -#endif
static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int size, const BYTE *checkbits, LPCSTR loc) { -#ifdef VISIBLE BYTE bits[100*100/8]; COLORREF c; HDC hdc; int x, y, i = -1;
- if (!himl) return; + if (!winetest_interactive || !himl) return;
memset(bits, 0, sizeof(bits)); hdc = show_image(hwnd, himl, idx, size, loc, FALSE); @@ -254,7 +250,6 @@ "%s: bits different\n", loc); if (memcmp(bits, checkbits, (size * size)/8)) dump_bits(bits, checkbits, size); -#endif /* VISIBLE */ }
static void test_begindrag(void) @@ -507,8 +502,7 @@ ok(!pImageList_DrawIndirect(&imldp),"bad himl succeeded!\n"); imldp.himl = himl;
- REDRAW(hwndfortest); - WAIT; + force_redraw(hwndfortest);
imldp.fStyle = SRCCOPY; imldp.rgbBk = CLR_DEFAULT; @@ -1825,8 +1819,7 @@ imldp.hdcDst = hdc; imldp.himl = himl;
- REDRAW(hwndfortest); - WAIT; + force_redraw(hwndfortest);
imldp.fStyle = SRCCOPY; imldp.rgbBk = CLR_DEFAULT; @@ -1975,7 +1968,11 @@ static void test_create_destroy(void) { HIMAGELIST himl; + IImageList *imgl; + INT cx, cy; BOOL rc; + HRESULT hr; + INT ret;
/* list with zero or negative image dimensions */ himl = ImageList_Create(0, 0, ILC_COLOR16, 0, 3); @@ -1995,6 +1992,46 @@
rc = ImageList_Destroy((HIMAGELIST)0xdeadbeef); ok(rc == FALSE, "ImageList_Destroy(0xdeadbeef) should fail and not crash\n"); + + /* DDB image lists */ + himl = ImageList_Create(0, 14, ILC_COLORDDB, 4, 4); + ok(himl != NULL, "got %p\n", himl); + imgl = (IImageList*)himl; + IImageList_GetIconSize(imgl, &cx, &cy); + ok (cx == 0, "Wrong cx (%i)\n", cx); + ok (cy == 14, "Wrong cy (%i)\n", cy); + ImageList_Destroy(himl); + + himl = ImageList_Create(0, 0, ILC_COLORDDB, 4, 4); + ok(himl != NULL, "got %p\n", himl); + imgl = (IImageList*)himl; + IImageList_GetIconSize(imgl, &cx, &cy); + ok (cx == 0, "Wrong cx (%i)\n", cx); + ok (cy == 0, "Wrong cy (%i)\n", cy); + ImageList_Destroy(himl); + + himl = ImageList_Create(0, 0, ILC_COLORDDB, 0, 4); + ok(himl != NULL, "got %p\n", himl); + imgl = (IImageList*)himl; + IImageList_GetIconSize(imgl, &cx, &cy); + ok (cx == 0, "Wrong cx (%i)\n", cx); + ok (cy == 0, "Wrong cy (%i)\n", cy); + + hr = IImageList_SetImageCount(imgl, 3); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IImageList_GetImageCount(imgl, &ret); + ok(hr == S_OK && ret == 3, "invalid image count after increase\n"); + + /* Trying to actually add an image causes a crash on Windows */ + ImageList_Destroy(himl); + + /* Negative values fail */ + himl = ImageList_Create(-1, -1, ILC_COLORDDB, 4, 4); + ok(himl == NULL, "got %p\n", himl); + himl = ImageList_Create(-1, 1, ILC_COLORDDB, 4, 4); + ok(himl == NULL, "got %p\n", himl); + himl = ImageList_Create(1, -1, ILC_COLORDDB, 4, 4); + ok(himl == NULL, "got %p\n", himl); }
static void test_IImageList_Clone(void)
Modified: trunk/rostests/winetests/comctl32/listview.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/listvie... ============================================================================== --- trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -201,7 +201,7 @@ { 0 } };
-static const struct message ownderdata_select_focus_parent_seq[] = { +static const struct message ownerdata_select_focus_parent_seq[] = { { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED }, { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA }, { WM_NOTIFY, sent|id|optional, 0, 0, LVN_GETDISPINFOA }, /* version 4.7x */ @@ -793,16 +793,7 @@
ret = SendMessageA(hwnd, LVM_HITTEST, 0, (LPARAM)&lpht);
- if (todo_item) - { - todo_wine - { - ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret); - ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem); - ok_(__FILE__, line)(lpht.iSubItem == 10, "Expected subitem not overwrited\n"); - } - } - else + todo_wine_if(todo_item) { ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret); ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem); @@ -835,34 +826,16 @@
ret = SendMessageA(hwnd, LVM_SUBITEMHITTEST, 0, (LPARAM)&lpht);
- if (todo_item) - { - todo_wine - { - ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret); - ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem); - } - } - else + todo_wine_if(todo_item) { ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret); ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem); }
- if (todo_subitem) - { - todo_wine - ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem); - } - else + todo_wine_if(todo_subitem) ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem);
- if (todo_flags) - { - todo_wine - ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags); - } - else + todo_wine_if(todo_flags) ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags); }
@@ -3149,7 +3122,7 @@ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item); expect(TRUE, res);
- ok_sequence(sequences, PARENT_SEQ_INDEX, ownderdata_select_focus_parent_seq, + ok_sequence(sequences, PARENT_SEQ_INDEX, ownerdata_select_focus_parent_seq, "ownerdata select notification", TRUE);
flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -3160,7 +3133,7 @@ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item); expect(TRUE, res);
- ok_sequence(sequences, PARENT_SEQ_INDEX, ownderdata_select_focus_parent_seq, + ok_sequence(sequences, PARENT_SEQ_INDEX, ownerdata_select_focus_parent_seq, "ownerdata focus notification", TRUE);
/* select all, check notifications */ @@ -3420,6 +3393,28 @@ SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_SORTDESCENDING); style = GetWindowLongPtrA(hwnd, GWL_STYLE); ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n"); + DestroyWindow(hwnd); + + /* The focused item is updated after the invalidation */ + hwnd = create_listview_control(LVS_OWNERDATA | LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n"); + res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 3, 0); + expect(TRUE, res); + + memset(&item, 0, sizeof(item)); + item.stateMask = LVIS_FOCUSED; + item.state = LVIS_FOCUSED; + res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item); + expect(TRUE, res); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 0, 0); + expect(TRUE, res); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "ownerdata setitemcount", FALSE); + + res = SendMessageA(hwnd, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); + expect(-1, res); DestroyWindow(hwnd); }
Modified: trunk/rostests/winetests/comctl32/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/misc.c?... ============================================================================== --- trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -368,6 +368,36 @@ FreeLibrary(hinst); }
+static void check_class( const char *name, int must_exist, UINT style, UINT ignore ) +{ + WNDCLASSA wc; + + if (GetClassInfoA( 0, name, &wc )) + { +todo_wine + ok( !(~wc.style & style & ~ignore), "System class %s is missing bits %x (%08x/%08x)\n", + name, ~wc.style & style, wc.style, style ); + ok( !(wc.style & ~style), "System class %s has extra bits %x (%08x/%08x)\n", + name, wc.style & ~style, wc.style, style ); + ok( !wc.hInstance, "System class %s has hInstance %p\n", name, wc.hInstance ); + } + else + ok( !must_exist, "System class %s does not exist\n", name ); +} + +/* test styles of system classes */ +static void test_builtin_classes(void) +{ + /* check style bits */ + check_class( "Button", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS, 0 ); + check_class( "ComboBox", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS, 0 ); + check_class( "Edit", 1, CS_PARENTDC | CS_DBLCLKS | CS_GLOBALCLASS, 0 ); + check_class( "ListBox", 1, CS_PARENTDC | CS_DBLCLKS | CS_GLOBALCLASS, 0 ); + check_class( "ScrollBar", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS, 0 ); + check_class( "Static", 1, CS_PARENTDC | CS_DBLCLKS | CS_GLOBALCLASS, 0 ); + check_class( "ComboLBox", 1, CS_SAVEBITS | CS_DBLCLKS | CS_DROPSHADOW | CS_GLOBALCLASS, CS_DROPSHADOW ); +} + START_TEST(misc) { ULONG_PTR ctx_cookie; @@ -382,6 +412,7 @@ if (!load_v6_module(&ctx_cookie, &hCtx)) return;
+ test_builtin_classes(); test_TaskDialogIndirect(); test_LoadIconWithScaleDown();
Modified: trunk/rostests/winetests/comctl32/monthcal.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/monthca... ============================================================================== --- trunk/rostests/winetests/comctl32/monthcal.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/monthcal.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -1185,14 +1185,9 @@ if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index) break;
- if (title_hits[title_index].todo) { - todo_wine + todo_wine_if(title_hits[title_index].todo) ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n", title_hits[title_index].ht, res, x); - } else { - ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n", - title_hits[title_index].ht, res, x); - } } old_res = res; }
Modified: trunk/rostests/winetests/comctl32/propsheet.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/propshe... ============================================================================== --- trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -935,7 +935,7 @@ ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)INVALID_HANDLE_VALUE); }
- ret = SendMessageA(hdlg, PSM_INSERTPAGE, (LPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]); + ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]); ok(ret == FALSE, "got %d\n", ret);
/* check item count */
Modified: trunk/rostests/winetests/comctl32/tooltips.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/tooltip... ============================================================================== --- trunk/rostests/winetests/comctl32/tooltips.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/tooltips.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -449,6 +449,33 @@ GetClientRect(hwnd, &toolinfoW.rect); r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW); ok(!r, "Adding the tool to the tooltip succeeded!\n"); + + /* lpszText with an invalid address */ + toolinfoW.cbSize = sizeof(TTTOOLINFOW); + toolinfoW.hwnd = notify; + toolinfoW.hinst = GetModuleHandleA(NULL); + toolinfoW.uFlags = 0; + toolinfoW.uId = 0; + toolinfoW.lpszText = (LPWSTR)0xdeadbeef; + toolinfoW.lParam = 0; + GetClientRect(hwnd, &toolinfoW.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW); + ok(!r, "Adding the tool to the tooltip succeeded!\n"); + + /* lpszText with an invalid address. Crashes using TTTOOLINFOA message */ + if(0) + { + toolinfoA.cbSize = sizeof(TTTOOLINFOA); + toolinfoA.hwnd = notify; + toolinfoA.hinst = GetModuleHandleA(NULL); + toolinfoA.uFlags = 0; + toolinfoA.uId = 0; + toolinfoA.lpszText = (LPSTR)0xdeadbeef; + toolinfoA.lParam = 0; + GetClientRect(hwnd, &toolinfoA.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); + ok(!r, "Adding the tool to the tooltip succeeded!\n"); + }
if (0) /* crashes on NT4 */ {
Modified: trunk/rostests/winetests/comctl32/trackbar.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/trackba... ============================================================================== --- trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -32,7 +32,18 @@ #define PARENT_SEQ_INDEX 0 #define TRACKBAR_SEQ_INDEX 1
+static const DWORD defaultstyle = WS_VISIBLE | TBS_TOOLTIPS | TBS_ENABLESELRANGE | TBS_FIXEDLENGTH | TBS_AUTOTICKS; static HWND hWndParent; + +static LRESULT WINAPI trackbar_no_wmpaint_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + + if (message == WM_PAINT) + return 0; + + return CallWindowProcA(oldproc, hwnd, message, wParam, lParam); +}
static struct msg_sequence *sequences[NUM_MSG_SEQUENCE];
@@ -467,13 +478,26 @@ return hWndTrack; }
+static HWND create_trackbar2(DWORD style, HWND parent) +{ + RECT rect; + GetClientRect(parent, &rect); + return CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", style, + rect.right, rect.bottom, 100, 50, + parent, NULL, GetModuleHandleA(NULL), NULL); +} + /* test functions for setters, getters, and sequences */
-static void test_trackbar_buddy(HWND hWndTrackbar){ - HWND hWndLeftBuddy; +static void test_trackbar_buddy(void) +{ + HWND hWndLeftBuddy, hWndTrackbar; HWND hWndRightBuddy; HWND hWndCurrentBuddy; HWND rTest; + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n");
flush_sequences(sequences, NUM_MSG_SEQUENCE);
@@ -518,10 +542,16 @@ ok_sequence(sequences, TRACKBAR_SEQ_INDEX, buddy_window_test_seq, "buddy test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_buddy_window_test_seq, "parent buddy test seq", TRUE);
-} - -static void test_line_size(HWND hWndTrackbar){ + DestroyWindow(hWndTrackbar); +} + +static void test_line_size(void) +{ + HWND hWndTrackbar; int r; + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n");
flush_sequences(sequences, NUM_MSG_SEQUENCE);
@@ -537,11 +567,18 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, line_size_test_seq, "linesize test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent line test sequence", FALSE); -} - - -static void test_page_size(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + + +static void test_page_size(void) +{ + HWND hWndTrackbar; int r; + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n");
flush_sequences(sequences, NUM_MSG_SEQUENCE);
@@ -573,12 +610,22 @@ expect(20, r); r = SendMessageA(hWndTrackbar, TBM_GETPAGESIZE, 0, 0); expect(-2, r); -} - -static void test_position(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_position(void) +{ + HWND hWndTrackbar; + RECT rect, rect2; + WNDPROC oldproc; int r;
- flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* test TBM_SETPOS */ SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, -1); r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0); @@ -601,12 +648,55 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, position_test_seq, "position test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_position_test_seq, "parent position test sequence", TRUE); -} - -static void test_range(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); + + hWndTrackbar = create_trackbar2(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + /* subclassing procedure blocks WM_PAINT */ + oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)trackbar_no_wmpaint_proc); + SetWindowLongPtrA(hWndTrackbar, GWLP_USERDATA, (LONG_PTR)oldproc); + + memset(&rect, 0, sizeof(rect)); + memset(&rect2, 0, sizeof(rect2)); + + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + + /* without repaint */ + SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 25); + r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0); + ok(r == 25, "got %d\n", r); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2); + ok(rect.left == rect2.left, "got %d\n", rect.left); + + /* with repaint */ + SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 30); + r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0); + ok(r == 30, "got %d\n", r); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2); + ok(rect.left != rect2.left, "got %d, expected %d\n", rect2.left, rect.left); + + /* now move it with keys */ + SendMessageA(hWndTrackbar, WM_KEYDOWN, VK_END, 0); + r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0); + ok(r == 100, "got %d\n", r); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + ok(rect.left != rect2.left, "got %d, expected %d\n", rect.left, rect2.left); + + DestroyWindow(hWndTrackbar); +} + +static void test_range(void) +{ + HWND hWndTrackbar; int r;
- flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* test TBM_SETRANGE */ SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10)); r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0); @@ -664,12 +754,23 @@
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_selection(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_selection(void) +{ + HWND hWndTrackbar; int r;
- flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5); + SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* test TBM_SETSEL */ SendMessageA(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10)); r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0); @@ -725,12 +826,20 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, selection_test_seq, "selection test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_selection_test_seq, "parent selection test sequence", TRUE); -} - -static void test_thumb_length(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_thumb_length(void) +{ + HWND hWndTrackbar; int r;
- flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* testing TBM_SETTHUMBLENGTH */ SendMessageA(hWndTrackbar, TBM_SETTHUMBLENGTH, 15, 0); r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0); @@ -754,10 +863,20 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, thumb_length_test_seq, "thumb length test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_thumb_length_test_seq, "parent thumb length test sequence", TRUE); -} - -static void test_tic_settings(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_tic_settings(void) +{ + HWND hWndTrackbar; int r; + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5); + SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
/* testing TBM_SETTIC */ /* Set tics at 5 and 10 */ @@ -818,10 +937,15 @@ expect(3, r); }
-static void test_tic_placement(HWND hWndTrackbar){ +static void test_tic_placement(void) +{ + HWND hWndTrackbar; int r; DWORD *rPTics; DWORD numtics; + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n");
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(1, 6)); SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); @@ -853,15 +977,21 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_placement_test_seq, "get tic placement test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent get tic placement test sequence", FALSE); -} - - -static void test_tool_tips(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_tool_tips(void) +{ + HWND hWndTooltip, hWndTrackbar; + HWND rTest; int r; - HWND hWndTooltip; - HWND rTest; - - flush_sequences(sequences, NUM_MSG_SEQUENCE); + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* testing TBM_SETTIPSIDE */ r = SendMessageA(hWndTrackbar, TBM_SETTIPSIDE, TBTS_TOP, 0); expect(TBTS_TOP, r); @@ -897,13 +1027,21 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tool_tips_test_seq, "tool tips test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent tool tips test sequence", FALSE); -} - - -static void test_unicode(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + + +static void test_unicode(void) +{ + HWND hWndTrackbar; int r;
- flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + /* testing TBM_SETUNICODEFORMAT */ r = SendMessageA(hWndTrackbar, TBM_SETUNICODEFORMAT, TRUE, 0); ok(r == FALSE, "Expected FALSE, got %d\n",r); @@ -916,10 +1054,17 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, unicode_test_seq, "unicode test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent unicode test sequence", FALSE); -} - -static void test_ignore_selection(HWND hWndTrackbar){ + + DestroyWindow(hWndTrackbar); +} + +static void test_ignore_selection(void) +{ + HWND hWndTrackbar; int r; + + hWndTrackbar = create_trackbar(0, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n");
flush_sequences(sequences, NUM_MSG_SEQUENCE); /* test TBM_SETSEL ensure that it is ignored */ @@ -958,6 +1103,8 @@
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, ignore_selection_test_seq, "ignore selection setting test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent ignore selection setting test sequence", FALSE); + + DestroyWindow(hWndTrackbar); }
static void test_initial_state(void) @@ -1037,11 +1184,29 @@ DestroyWindow(hWnd); }
+static void test_create(void) +{ + HWND hWndTrackbar; + + flush_sequences(sequences, NUM_MSG_SEQUENCE); + + hWndTrackbar = create_trackbar(defaultstyle, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + ok_sequence(sequences, TRACKBAR_SEQ_INDEX, empty_seq, "create Trackbar Window", FALSE); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_trackbar_wnd_seq, "parent trackbar window", TRUE); + + DestroyWindow(hWndTrackbar); + + /* no style bits */ + flush_sequences(sequences, NUM_MSG_SEQUENCE); + hWndTrackbar = create_trackbar(0, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_new_window_test_seq, "new trackbar window test sequence", TRUE); + DestroyWindow(hWndTrackbar); +} + START_TEST(trackbar) { - DWORD style = WS_VISIBLE | TBS_TOOLTIPS | TBS_ENABLESELRANGE | TBS_FIXEDLENGTH | TBS_AUTOTICKS; - HWND hWndTrackbar; - init_msg_sequences(sequences, NUM_MSG_SEQUENCE); InitCommonControls();
@@ -1054,55 +1219,20 @@ return; }
- flush_sequences(sequences, NUM_MSG_SEQUENCE); - - /* create trackbar with set styles */ - hWndTrackbar = create_trackbar(style, hWndParent); - - ok(hWndTrackbar != NULL, "Expected non NULL value\n"); - - if (!hWndTrackbar){ - skip("trackbar control not present?\n"); - return; - } - - ok_sequence(sequences, TRACKBAR_SEQ_INDEX, empty_seq, "create Trackbar Window", FALSE); - ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_trackbar_wnd_seq, "parent trackbar window", TRUE); - flush_sequences(sequences, NUM_MSG_SEQUENCE); - - /* TEST OF ALL SETTER and GETTER MESSAGES with required styles turned on*/ - test_trackbar_buddy(hWndTrackbar); - test_line_size(hWndTrackbar); - test_page_size(hWndTrackbar); - test_position(hWndTrackbar); - test_range(hWndTrackbar); - test_selection(hWndTrackbar); - test_thumb_length(hWndTrackbar); - test_tic_settings(hWndTrackbar); - test_tic_placement(hWndTrackbar); - test_tool_tips(hWndTrackbar); - test_unicode(hWndTrackbar); + test_create(); + test_trackbar_buddy(); + test_line_size(); + test_page_size(); + test_position(); + test_range(); + test_selection(); + test_thumb_length(); + test_tic_settings(); + test_tic_placement(); + test_tool_tips(); + test_unicode(); test_TBS_AUTOTICKS(); - - flush_sequences(sequences, NUM_MSG_SEQUENCE); - DestroyWindow(hWndTrackbar); - - /* test getters and setters without styles set */ - hWndTrackbar = create_trackbar(0, hWndParent); - - ok(hWndTrackbar != NULL, "Expected non NULL value\n"); - - if (!hWndTrackbar){ - skip("trackbar control not present?\n"); - return; - } - - ok_sequence(sequences, PARENT_SEQ_INDEX, parent_new_window_test_seq, "new trackbar window test sequence", TRUE); - - test_ignore_selection(hWndTrackbar); - - DestroyWindow(hWndTrackbar); - + test_ignore_selection(); test_initial_state();
DestroyWindow(hWndParent);
Modified: trunk/rostests/winetests/comctl32/treeview.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/treevie... ============================================================================== --- trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] Tue Mar 1 19:02:49 2016 @@ -1193,7 +1193,9 @@
case TVN_ENDLABELEDITA: return TRUE; case TVN_ITEMEXPANDINGA: - ok(pTreeView->itemNew.mask == + { + UINT newmask = pTreeView->itemNew.mask & ~TVIF_CHILDREN; + ok(newmask == (TVIF_HANDLE | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_PARAM | TVIF_STATE), "got wrong mask %x\n", pTreeView->itemNew.mask); ok(pTreeView->itemOld.mask == 0, @@ -1207,6 +1209,7 @@ ok(ret == TRUE, "got %lu\n", ret); } break; + } case TVN_ITEMEXPANDEDA: ok(pTreeView->itemNew.mask & TVIF_STATE, "got wrong mask %x\n", pTreeView->itemNew.mask); ok(pTreeView->itemNew.state & (TVIS_EXPANDED|TVIS_EXPANDEDONCE), @@ -1529,6 +1532,7 @@
static void test_expandnotify(void) { + HTREEITEM hitem; HWND hTree; BOOL ret; TVITEMA item; @@ -1678,6 +1682,22 @@ ret = SendMessageA(hTree, WM_KEYDOWN, VK_ADD, 0); expect(FALSE, ret); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_empty_kb_seq, "expand node with no children", FALSE); + + /* stay on current selection and set non-zero children count */ + hitem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CARET, 0); + ok(hitem != NULL, "got %p\n", hitem); + + item.hItem = hitem; + item.mask = TVIF_CHILDREN; + item.cChildren = 0x80000000; + + ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item); + expect(TRUE, ret); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + ret = SendMessageA(hTree, WM_KEYDOWN, VK_ADD, 0); + expect(FALSE, ret); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_collapse_2nd_kb_seq, "expand node with children", FALSE);
DestroyWindow(hTree); } @@ -1858,7 +1878,12 @@ { const struct message *msg; HWND hTree; + HTREEITEM hItem1, hItem2; + TVINSERTSTRUCTA ins; INT ret; + + static CHAR item1[] = "Item 1"; + static CHAR item2[] = "Item 2";
hTree = create_treeview_control(0); fill_tree(hTree); @@ -1878,6 +1903,34 @@ }
ret = SendMessageA(hTree, TVM_GETCOUNT, 0, 0); + ok(ret == 0, "got %d\n", ret); + + DestroyWindow(hTree); + + /* Regression test for a crash when deleting the first visible item while bRedraw == false. */ + hTree = create_treeview_control(0); + + ret = SendMessageA(hTree, WM_SETREDRAW, FALSE, 0); + ok(ret == 0, "got %d\n", ret); + + ins.hParent = TVI_ROOT; + ins.hInsertAfter = TVI_ROOT; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = item1; + hItem1 = TreeView_InsertItemA(hTree, &ins); + ok(hItem1 != NULL, "InsertItem failed\n"); + + ins.hParent = TVI_ROOT; + ins.hInsertAfter = hItem1; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = item2; + hItem2 = TreeView_InsertItemA(hTree, &ins); + ok(hItem2 != NULL, "InsertItem failed\n"); + + ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hItem1); + ok(ret == TRUE, "got %d\n", ret); + + ret = SendMessageA(hTree, WM_SETREDRAW, TRUE, 0); ok(ret == 0, "got %d\n", ret);
DestroyWindow(hTree);