[COMCTL32][MEDIA] Sync comctl32 to wine 5.0 (#6789)

For SOME reason comctl32 has been synched manually multiple times to different versions and different pots
This PR aims to fix that

With the exception of button.c which all in all is a massive fork over wines code entirely.
and datetime.c which is at wine 6.0

Comctl32 is now at wine-5.0
This commit is contained in:
Justin Miller 2024-09-03 21:54:05 -07:00 committed by GitHub
parent 13b9c2a6d6
commit 0707475f69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 3335 additions and 1429 deletions

View file

@ -27,6 +27,10 @@
#include "v6util.h"
#include "msg.h"
#ifdef __REACTOS__
#define WM_CTLCOLOR 0x0019
#endif
#define EDITBOX_SEQ_INDEX 0
#define NUM_MSG_SEQUENCES 1
@ -46,6 +50,8 @@ static HWND hComboExParentWnd, hMainWnd;
static HINSTANCE hMainHinst;
static const char ComboExTestClass[] = "ComboExTestClass";
static HBRUSH brush_red;
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
#define MAX_CHARS 100
@ -507,6 +513,8 @@ static BOOL init(void)
wc.lpfnWndProc = ComboExTestWndProc;
RegisterClassA(&wc);
brush_red = CreateSolidBrush(RGB(255, 0, 0));
hMainWnd = CreateWindowA(WC_STATICA, "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
ShowWindow(hMainWnd, SW_SHOW);
@ -533,6 +541,7 @@ static void cleanup(void)
UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL));
DestroyWindow(hMainWnd);
DeleteObject(brush_red);
}
static void test_comboex_subclass(void)
@ -609,7 +618,7 @@ static HWND create_combobox(DWORD style)
return CreateWindowA(WC_COMBOBOXA, "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
}
static int font_height(HFONT hFont)
static int get_font_height(HFONT hFont)
{
TEXTMETRICA tm;
HFONT hFontOld;
@ -627,11 +636,12 @@ static int font_height(HFONT hFont)
static void test_combo_setitemheight(DWORD style)
{
HWND hCombo = create_combobox(style);
int i, font_height, height;
HFONT hFont;
RECT r;
int i;
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, font_height(GetStockObject(SYSTEM_FONT)) + 8);
expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
todo_wine expect_rect(r, 5, 5, 105, 105);
@ -644,6 +654,22 @@ static void test_combo_setitemheight(DWORD style)
}
DestroyWindow(hCombo);
/* Set item height below text height, force resize. */
hCombo = create_combobox(style);
hFont = (HFONT)SendMessageA(hCombo, WM_GETFONT, 0, 0);
font_height = get_font_height(hFont);
SendMessageA(hCombo, CB_SETITEMHEIGHT, -1, font_height / 2);
height = SendMessageA(hCombo, CB_GETITEMHEIGHT, -1, 0);
todo_wine
ok(height == font_height / 2, "Unexpected item height %d, expected %d.\n", height, font_height / 2);
SetWindowPos(hCombo, NULL, 10, 10, 150, 5 * font_height, SWP_SHOWWINDOW);
height = SendMessageA(hCombo, CB_GETITEMHEIGHT, -1, 0);
ok(height > font_height, "Unexpected item height %d, font height %d.\n", height, font_height);
DestroyWindow(hCombo);
}
static void test_combo_setfont(DWORD style)
@ -658,7 +684,7 @@ static void test_combo_setfont(DWORD style)
hFont2 = CreateFontA(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, font_height(GetStockObject(SYSTEM_FONT)) + 8);
expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
todo_wine expect_rect(r, 5, 5, 105, 105);
@ -667,39 +693,39 @@ static void test_combo_setfont(DWORD style)
of the window when it was created. The size of the calculated
dropped area changes only by how much the selection area
changes, not by how much the list area changes. */
if (font_height(hFont1) == 10 && font_height(hFont2) == 8)
if (get_font_height(hFont1) == 10 && get_font_height(hFont2) == 8)
{
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, 18);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1)));
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont2, FALSE);
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, 16);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont2)));
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont2)));
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, 18);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1)));
}
else
{
ok(0, "Expected Marlett font heights 10/8, got %d/%d\n",
font_height(hFont1), font_height(hFont2));
get_font_height(hFont1), get_font_height(hFont2));
}
for (i = 1; i < 30; i++)
{
HFONT hFont = CreateFontA(i, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
int height = font_height(hFont);
int height = get_font_height(hFont);
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE);
GetClientRect(hCombo, &r);
@ -717,6 +743,7 @@ static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, L
static LPCSTR expected_edit_text;
static LPCSTR expected_list_text;
static BOOL selchange_fired;
static HWND lparam_for_WM_CTLCOLOR;
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
@ -748,6 +775,20 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
break;
}
break;
case WM_CTLCOLOR:
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
if (lparam_for_WM_CTLCOLOR)
{
ok(lparam_for_WM_CTLCOLOR == (HWND)lparam, "Expected %p, got %p\n", lparam_for_WM_CTLCOLOR, (HWND)lparam);
return (LRESULT) brush_red;
}
break;
}
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
@ -1254,6 +1295,80 @@ static void test_combo_dropdown_size(DWORD style)
}
}
static void test_combo_ctlcolor(void)
{
static const int messages[] =
{
WM_CTLCOLOR,
WM_CTLCOLORMSGBOX,
WM_CTLCOLOREDIT,
WM_CTLCOLORLISTBOX,
WM_CTLCOLORBTN,
WM_CTLCOLORDLG,
WM_CTLCOLORSCROLLBAR,
WM_CTLCOLORSTATIC,
};
HBRUSH brush, global_brush;
COMBOBOXINFO info;
unsigned int i;
HWND combo;
combo = create_combobox(CBS_DROPDOWN);
ok(!!combo, "Failed to create combo window.\n");
old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
get_combobox_info(combo, &info);
lparam_for_WM_CTLCOLOR = info.hwndItem;
/* Parent returns valid brush handle. */
for (i = 0; i < ARRAY_SIZE(messages); ++i)
{
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red);
}
/* Parent returns NULL brush. */
global_brush = brush_red;
brush_red = NULL;
for (i = 0; i < ARRAY_SIZE(messages); ++i)
{
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
ok(!brush, "%u: unexpected brush %p.\n", i, brush);
}
brush_red = global_brush;
lparam_for_WM_CTLCOLOR = 0;
/* Parent does default processing. */
for (i = 0; i < ARRAY_SIZE(messages); ++i)
{
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush);
}
SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
DestroyWindow(combo);
/* Combo without a parent. */
combo = CreateWindowA(WC_COMBOBOXA, "Combo", CBS_DROPDOWN, 5, 5, 100, 100, NULL, NULL, NULL, 0);
ok(!!combo, "Failed to create combo window.\n");
get_combobox_info(combo, &info);
for (i = 0; i < ARRAY_SIZE(messages); ++i)
{
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
ok(!brush, "%u: unexpected brush %p.\n", i, brush);
}
DestroyWindow(combo);
}
START_TEST(combo)
{
ULONG_PTR ctx_cookie;
@ -1297,6 +1412,7 @@ START_TEST(combo)
test_combo_listbox_styles(CBS_DROPDOWNLIST);
test_combo_dropdown_size(0);
test_combo_dropdown_size(CBS_NOINTEGRALHEIGHT);
test_combo_ctlcolor();
cleanup();
unload_v6_module(ctx_cookie, hCtx);

View file

@ -1189,6 +1189,8 @@ static void test_char_from_pos(void)
{
int lo, hi, mid, ret, i;
HWND hwEdit;
HDC dc;
SIZE size;
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
@ -1321,6 +1323,24 @@ static void test_char_from_pos(void)
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
ok(-1 == ret, "expected -1 got %d\n", ret);
DestroyWindow(hwEdit);
/* Scrolled to the right with partially visible line, position on next line. */
hwEdit = create_editcontrol(ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
dc = GetDC(hwEdit);
GetTextExtentPoint32A(dc, "w", 1, &size);
ReleaseDC(hwEdit, dc);
SetWindowPos(hwEdit, NULL, 0, 0, size.cx * 15, size.cy * 5, SWP_NOMOVE | SWP_NOZORDER);
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"wwwwwwwwwwwwwwwwwwww\r\n\r\n");
SendMessageA(hwEdit, EM_SETSEL, 40, 40);
lo = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 22, 0);
ret = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 20, 0);
ret -= 20 * size.cx; /* Calculate expected position, 20 characters back. */
ok(ret == lo, "Unexpected position %d vs %d.\n", lo, ret);
DestroyWindow(hwEdit);
}
/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL
@ -3240,18 +3260,17 @@ static void test_cue_banner(void)
static WCHAR getcuetestW[5] = {'T',0};
static const WCHAR testcmp1W[] = {'T','e','s','t',0};
static const WCHAR testcmp2W[] = {'T','e','s',0};
static const WCHAR emptyW[] = {0};
hwnd_edit = create_editcontrolW(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
if (lstrcmpW(getcuetestW, emptyW) != 0)
if (getcuetestW[0])
{
win_skip("skipping for Win XP and 2003 Server.\n");
DestroyWindow(hwnd_edit);
return;
}
ok(lstrcmpW(getcuetestW, emptyW) == 0, "First char is %c\n", getcuetestW[0]);
ok(!getcuetestW[0], "First char is %c\n", getcuetestW[0]);
ok(ret == FALSE, "EM_GETCUEBANNER should have returned FALSE.\n");
lstrcpyW(getcuetestW, testcmp1W);
@ -3279,12 +3298,12 @@ static void test_cue_banner(void)
ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
ok(lstrcmpW(getcuetestW, testcmp1W) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)emptyW);
ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)L"");
ok(ret == TRUE, "EM_SETCUEBANNER should have returned TRUE.\n");
ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
ok(lstrcmpW(getcuetestW, emptyW) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
ok(!getcuetestW[0], "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
/* EM_GETCUEBANNER's buffer size includes null char */
ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)testcmp1W);

View file

@ -41,10 +41,6 @@
#include "v6util.h"
#include "resources.h"
#ifdef __REACTOS__
#include <ole2.h>
#endif
#define IMAGELIST_MAGIC (('L' << 8) | 'I')
#include "pshpack2.h"
@ -2064,7 +2060,7 @@ static void check_color_table(const char *name, HDC hdc, HIMAGELIST himl, UINT i
static void get_default_color_table(HDC hdc, int bpp, RGBQUAD *table)
{
#ifdef __REACTOS__
char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
#else
char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
#endif

View file

@ -707,16 +707,22 @@ static void test_LB_SETSEL(void)
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
DestroyWindow(list);
@ -731,16 +737,22 @@ static void test_LB_SETSEL(void)
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
DestroyWindow(list);
}
@ -769,11 +781,27 @@ static void test_listbox_height(void)
r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
ok( r == 20, "height wrong\n");
/* Before Windows 10 1709 (or 1703?) the item height was limited to 255.
* Since then, with comctl32 V6 the limit is 65535.
*/
r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 256, 0 ));
ok( r == -1, "Failed to set item height, %d.\n", r);
ok(r == 0 || broken(r == -1), "Failed to set item height, %d.\n", r);
if (r == -1)
{
r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
ok( r == 20, "Unexpected item height %d.\n", r);
}
else
{
r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
ok( r == 256, "Unexpected item height %d.\n", r);
r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
ok( r == 20, "Unexpected item height %d.\n", r);
r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 65535, 0 ));
ok(r == 0, "Failed to set item height, %d.\n", r);
r = SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0 );
ok( r == 65535, "Unexpected item height %d.\n", r);
}
r = SendMessageA( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 0xff, 0 ));
ok( r == 0, "send message failed\n");
@ -1803,7 +1831,7 @@ static void test_listbox_dlgdir(void)
ok (res == 0, "DlgDirSelectEx() with no selection returned %d, expected 0\n", res);
/* WinXP-SP2 leaves pathBuffer untouched, but Win98 fills it with garbage. */
/*
ok (strlen(pathBuffer) == 0, "DlgDirSelectEx() with no selection filled buffer with %s\n", pathBuffer);
ok (!*pathBuffer, "DlgDirSelectEx() with no selection filled buffer with %s\n", pathBuffer);
*/
/* Test proper drive/dir/file recognition */
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);

View file

@ -956,6 +956,37 @@ static void test_images(void)
ok(EqualRect(&r1, &r2), "rectangle should be the same\n");
DestroyWindow(hwnd);
/* I_IMAGECALLBACK set for item, try to get image with invalid subitem. */
hwnd = create_listview_control(LVS_REPORT);
ok(hwnd != NULL, "Failed to create listview.\n");
memset(&item, 0, sizeof(item));
item.mask = LVIF_IMAGE;
item.iImage = I_IMAGECALLBACK;
r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
ok(!r, "Failed to insert item.\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.mask = LVIF_IMAGE;
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(r, "Failed to get item.\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq, "get image dispinfo 1", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.mask = LVIF_IMAGE;
item.iSubItem = 1;
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(r, "Failed to get item.\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "get image dispinfo 2", FALSE);
DestroyWindow(hwnd);
}
static void test_checkboxes(void)
@ -1546,6 +1577,19 @@ static void test_columns(void)
"get subitem text after column added", FALSE);
DestroyWindow(hwnd);
/* Columns are not created right away. */
hwnd = create_listview_control(LVS_REPORT);
ok(hwnd != NULL, "Failed to create a listview window.\n");
insert_item(hwnd, 0);
header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
ok(IsWindow(header), "Expected header handle.\n");
rc = SendMessageA(header, HDM_GETITEMCOUNT, 0, 0);
ok(!rc, "Unexpected column count.\n");
DestroyWindow(hwnd);
}
/* test setting imagelist between WM_NCCREATE and WM_CREATE */
@ -1872,6 +1916,8 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
NMHDR *nmhdr = (NMHDR*)lParam;
if(nmhdr->code == NM_CUSTOMDRAW) {
NMLVCUSTOMDRAW *nmlvcd = (NMLVCUSTOMDRAW*)nmhdr;
BOOL showsel_always = !!(GetWindowLongA(nmlvcd->nmcd.hdr.hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS);
BOOL is_selected = !!(nmlvcd->nmcd.uItemState & CDIS_SELECTED);
struct message msg;
msg.message = message;
@ -1887,25 +1933,40 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
SetBkColor(nmlvcd->nmcd.hdc, c0ffee);
return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPREPAINT:
clr = GetBkColor(nmlvcd->nmcd.hdc);
todo_wine_if(nmlvcd->iSubItem)
ok(clr == c0ffee, "Unexpected background color %#x.\n", clr);
nmlvcd->clrTextBk = CLR_DEFAULT;
nmlvcd->clrText = RGB(0, 255, 0);
return CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
clr = GetBkColor(nmlvcd->nmcd.hdc);
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS))
todo_wine_if(showsel_always && is_selected && nmlvcd->iSubItem)
{
todo_wine_if(nmlvcd->iSubItem)
ok(clr == c0ffee, "clr=%.8x\n", clr);
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background %#x.\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "Unexpected text color %#x.\n", nmlvcd->clrText);
}
if (showsel_always && is_selected && nmlvcd->iSubItem)
ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
else
todo_wine_if(nmlvcd->iSubItem)
ok(clr == c0ffee, "clr=%.8x\n", clr);
return CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM:
clr = GetBkColor(nmlvcd->nmcd.hdc);
if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS))
todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr);
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
if (showsel_always && is_selected)
ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
else
{
todo_wine
ok(clr == c0ffee, "Unexpected background color %#x.\n", clr);
}
todo_wine_if(showsel_always)
{
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background color %#x.\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
}
return CDRF_DODEFAULT;
}
return CDRF_DODEFAULT;
@ -1939,8 +2000,7 @@ static void test_customdraw(void)
UpdateWindow(hwnd);
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT", FALSE);
/* check colors when item is selected */
SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | LVS_SHOWSELALWAYS);
/* Check colors when item is selected. */
item.mask = LVIF_STATE;
item.stateMask = LVIS_SELECTED;
item.state = LVIS_SELECTED;
@ -1949,7 +2009,15 @@ static void test_customdraw(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT, selection", FALSE);
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq,
"parent customdraw, item selected, LVS_REPORT, selection", FALSE);
SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | LVS_SHOWSELALWAYS);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq,
"parent customdraw, item selected, LVS_SHOWSELALWAYS, LVS_REPORT", FALSE);
DestroyWindow(hwnd);
@ -3956,25 +4024,6 @@ static void test_getitemposition(void)
DestroyWindow(hwnd);
}
static void test_columnscreation(void)
{
HWND hwnd, header;
DWORD r;
hwnd = create_listview_control(LVS_REPORT);
ok(hwnd != NULL, "failed to create a listview window\n");
insert_item(hwnd, 0);
/* headers columns aren't created automatically */
header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
ok(IsWindow(header), "Expected header handle\n");
r = SendMessageA(header, HDM_GETITEMCOUNT, 0, 0);
expect(0, r);
DestroyWindow(hwnd);
}
static void test_getitemrect(void)
{
HWND hwnd;
@ -4574,6 +4623,17 @@ static void test_indentation(void)
ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq,
"get indent dispinfo", FALSE);
/* Ask for iIndent with invalid subitem. */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.mask = LVIF_INDENT;
item.iSubItem = 1;
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(r, "Failed to get item.\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "get indent dispinfo 2", FALSE);
DestroyWindow(hwnd);
}
@ -6081,6 +6141,44 @@ static void test_callback_mask(void)
mask = SendMessageA(hwnd, LVM_GETCALLBACKMASK, 0, 0);
ok(mask == ~0u, "got 0x%08x\n", mask);
/* Ask for state, invalid subitem. */
insert_item(hwnd, 0);
ret = SendMessageA(hwnd, LVM_SETCALLBACKMASK, LVIS_FOCUSED, 0);
ok(ret, "Failed to set callback mask.\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.iSubItem = 1;
item.mask = LVIF_STATE;
item.stateMask = LVIS_SELECTED;
ret = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(ret, "Failed to get item data.\n");
memset(&item, 0, sizeof(item));
item.mask = LVIF_STATE;
item.stateMask = LVIS_SELECTED;
ret = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(ret, "Failed to get item data.\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, callback mask/invalid subitem 1", TRUE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
memset(&g_itema, 0, sizeof(g_itema));
item.iSubItem = 1;
item.mask = LVIF_STATE;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
ret = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(ret, "Failed to get item data.\n");
ok(g_itema.iSubItem == 1, "Unexpected LVN_DISPINFO subitem %d.\n", g_itema.iSubItem);
ok(g_itema.stateMask == LVIS_FOCUSED, "Unexpected state mask %#x.\n", g_itema.stateMask);
ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq,
"parent seq, callback mask/invalid subitem 2", FALSE);
DestroyWindow(hwnd);
/* LVS_OWNERDATA, mask LVIS_FOCUSED */
@ -6294,7 +6392,6 @@ static void test_state_image(void)
item.iSubItem = 2;
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
ok(r, "Failed to get subitem state.\n");
todo_wine
ok(item.state == 0, "Unexpected state %#x.\n", item.state);
item.mask = LVIF_TEXT;
@ -6594,7 +6691,6 @@ START_TEST(listview)
test_hittest();
test_getviewrect();
test_getitemposition();
test_columnscreation();
test_editbox();
test_notifyformat();
test_indentation();
@ -6649,7 +6745,6 @@ START_TEST(listview)
test_ownerdata();
test_norecompute();
test_nosortheader();
test_columnscreation();
test_indentation();
test_finditem();
test_hover();

View file

@ -224,11 +224,7 @@ static void test_LoadIconWithScaleDown(void)
pLoadIconWithScaleDown = (void *)GetProcAddress(hinst, "LoadIconWithScaleDown");
if (!pLoadIconMetric || !pLoadIconWithScaleDown)
{
#ifdef __REACTOS__
skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n");
#else
win_skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n");
#endif
FreeLibrary(hinst);
return;
}

View file

@ -18,7 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef __REACTOS__
#pragma once
#endif
#include <assert.h>
#include <windows.h>
@ -164,7 +166,7 @@ static void dump_sequence( struct msg_sequence **seq, int sequence_index,
}
}
static inline void ok_sequence_(struct msg_sequence **seq, int sequence_index,
static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
const struct message *expected_list, const char *context, BOOL todo,
const char *file, int line)
{
@ -388,7 +390,7 @@ done:
ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)
static inline void init_msg_sequences(struct msg_sequence **seq, int n)
static void init_msg_sequences(struct msg_sequence **seq, int n)
{
int i;

View file

@ -30,33 +30,18 @@
static HWND parent_wnd, child1_wnd, child2_wnd;
static INT notify_format;
static BOOL notify_query_received;
static WCHAR test_w[] = {'t', 'e', 's', 't', 0};
static CHAR test_a[] = {'t', 'e', 's', 't', 0};
static const CHAR test_a[] = "test";
static const WCHAR test_w[] = L"test";
/* Double zero so that it's safe to cast it to WCHAR * */
static CHAR te_a[] = {'t', 'e', 0, 0};
static WCHAR empty_w[] = {0};
static CHAR empty_a[] = {0};
static CHAR large_a[] = "You should have received a copy of the GNU Lesser General Public License along with this ...";
static WCHAR large_w[] =
{
'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e', 'i', 'v', 'e',
'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G', 'N', 'U', ' ', 'L', 'e', 's',
's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u', 'b', 'l', 'i', 'c', ' ', 'L', 'i', 'c', 'e',
'n', 's', 'e', ' ', 'a', 'l', 'o', 'n', 'g', ' ', 'w', 'i', 't', 'h', ' ', 't', 'h', 'i', 's', ' ', '.', '.', '.', 0
};
static WCHAR large_truncated_65_w[65] =
{
'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e', 'i', 'v',
'e', 'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G', 'N', 'U', ' ', 'L',
'e', 's', 's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u', 'b', 'l', 'i', 'c', 0
};
static WCHAR large_truncated_80_w[80] =
{
'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e',
'i', 'v', 'e', 'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G',
'N', 'U', ' ', 'L', 'e', 's', 's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u',
'b', 'l', 'i', 'c', ' ', 'L', 'i', 'c', 'e', 'n', 's', 'e', ' ', 'a', 'l', 'o', 'n', 'g', ' ', 'w'
};
static const CHAR te_a[] = {'t', 'e', 0, 0};
static const CHAR large_a[] =
"You should have received a copy of the GNU Lesser General Public License along with this ...";
static const WCHAR large_w[] =
L"You should have received a copy of the GNU Lesser General Public License along with this ...";
static const WCHAR large_truncated_65_w[65] =
L"You should have received a copy of the GNU Lesser General Public";
static const WCHAR large_truncated_80_w[80] =
L"You should have received a copy of the GNU Lesser General Public License along w";
static WCHAR buffer[64];
/* Text field conversion test behavior flags. */
@ -96,26 +81,26 @@ static struct notify_test_info
struct notify_test_send
{
/* Data sent to pager */
WCHAR *send_text;
const WCHAR *send_text;
INT send_text_size;
INT send_text_max;
/* Data expected by parent of pager */
void *expect_text;
const void *expect_text;
};
struct notify_test_receive
{
/* Data sent to pager */
WCHAR *send_text;
const WCHAR *send_text;
INT send_text_size;
INT send_text_max;
/* Data for parent to write */
CHAR *write_pointer;
CHAR *write_text;
const CHAR *write_pointer;
const CHAR *write_text;
INT write_text_size;
INT write_text_max;
/* Data when message returned */
void *return_text;
const void *return_text;
INT return_text_max;
};
@ -145,69 +130,69 @@ static const struct notify_test_send test_dont_convert_send_data[] =
static const struct notify_test_receive test_convert_receive_data[] =
{
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_w, ARRAY_SIZE(buffer)},
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_w, ARRAY_SIZE(buffer)},
{NULL, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, NULL, ARRAY_SIZE(buffer)},
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), large_a, NULL, 0, -1, large_truncated_65_w, ARRAY_SIZE(buffer)},
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), empty_a, 0, 0, 1, empty_w, 1},
{L"", sizeof(L""), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_w, ARRAY_SIZE(buffer)},
{L"", sizeof(L""), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_w, ARRAY_SIZE(buffer)},
{NULL, sizeof(L""), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, NULL, ARRAY_SIZE(buffer)},
{L"", sizeof(L""), ARRAY_SIZE(buffer), large_a, NULL, 0, -1, large_truncated_65_w, ARRAY_SIZE(buffer)},
{L"", sizeof(L""), ARRAY_SIZE(buffer), "", 0, 0, 1, L"", 1},
};
static const struct notify_test_receive test_dont_convert_receive_data[] =
{
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_a, ARRAY_SIZE(buffer)},
{empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_a, ARRAY_SIZE(buffer)},
{L"", sizeof(L""), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_a, ARRAY_SIZE(buffer)},
{L"", sizeof(L""), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_a, ARRAY_SIZE(buffer)},
};
static const struct notify_test_tooltip
{
/* Data for parent to write */
CHAR *write_sztext;
const CHAR *write_sztext;
INT write_sztext_size;
CHAR *write_lpsztext;
const CHAR *write_lpsztext;
HMODULE write_hinst;
/* Data when message returned */
WCHAR *return_sztext;
const WCHAR *return_sztext;
INT return_sztext_size;
WCHAR *return_lpsztext;
const WCHAR *return_lpsztext;
HMODULE return_hinst;
/* Data expected by parent */
CHAR *expect_sztext;
const CHAR *expect_sztext;
/* Data send to parent */
WCHAR *send_sztext;
const WCHAR *send_sztext;
INT send_sztext_size;
WCHAR *send_lpsztext;
const WCHAR *send_lpsztext;
} test_tooltip_data[] =
{
{NULL, 0, NULL, NULL, empty_w, -1, empty_w},
{NULL, 0, NULL, NULL, L"", -1, L""},
{test_a, sizeof(test_a), NULL, NULL, test_w, -1, test_w},
{test_a, sizeof(test_a), test_a, NULL, test_w, -1, test_w},
{test_a, sizeof(test_a), (CHAR *)1, (HMODULE)0xdeadbeef, empty_w, -1, (WCHAR *)1, (HMODULE)0xdeadbeef},
{test_a, sizeof(test_a), (CHAR *)1, (HMODULE)0xdeadbeef, L"", -1, (WCHAR *)1, (HMODULE)0xdeadbeef},
{test_a, sizeof(test_a), test_a, (HMODULE)0xdeadbeef, test_w, -1, test_w, (HMODULE)0xdeadbeef},
{NULL, 0, test_a, NULL, test_w, -1, test_w},
{test_a, 2, test_a, NULL, test_w, -1, test_w},
{NULL, 0, NULL, NULL, test_w, -1, test_w, NULL, test_a, test_w, sizeof(test_w)},
{NULL, 0, NULL, NULL, empty_w, -1, empty_w, NULL, empty_a, NULL, 0, test_w},
{NULL, 0, NULL, NULL, L"", -1, L"", NULL, "", NULL, 0, test_w},
{NULL, 0, large_a, NULL, large_truncated_80_w, sizeof(large_truncated_80_w), large_w}
};
static const struct notify_test_datetime_format
{
/* Data send to parent */
WCHAR *send_pszformat;
const WCHAR *send_pszformat;
/* Data expected by parent */
CHAR *expect_pszformat;
const CHAR *expect_pszformat;
/* Data for parent to write */
CHAR *write_szdisplay;
const CHAR *write_szdisplay;
INT write_szdisplay_size;
CHAR *write_pszdisplay;
const CHAR *write_pszdisplay;
/* Data when message returned */
WCHAR *return_szdisplay;
const WCHAR *return_szdisplay;
INT return_szdisplay_size;
WCHAR *return_pszdisplay;
const WCHAR *return_pszdisplay;
} test_datetime_format_data[] =
{
{test_w, test_a},
{NULL, NULL, NULL, 0, test_a, empty_w, -1, test_w},
{NULL, NULL, NULL, 0, test_a, L"", -1, test_w},
{NULL, NULL, test_a, sizeof(test_a), NULL, test_w, -1, test_w},
{NULL, NULL, test_a, 2, test_a, (WCHAR *)te_a, -1, test_w},
{NULL, NULL, NULL, 0, large_a, NULL, 0, large_w}
@ -624,7 +609,7 @@ static void notify_generic_text_handler(CHAR **text, INT *text_max)
send_data = (notify_test_info.test_id == CONVERT_SEND ? test_convert_send_data : test_dont_convert_send_data)
+ notify_test_info.sub_test_id;
if (notify_test_info.flags & ZERO_SEND)
ok(!lstrcmpA(*text, empty_a), "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
ok(!*text[0], "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id, *text);
else if (notify_test_info.flags & CONVERT_SEND)
ok(!lstrcmpA(send_data->expect_text, *text), "Code 0x%08x test 0x%08x sub test %d expect %s, got %s\n",
@ -658,12 +643,12 @@ static void notify_generic_text_handler(CHAR **text, INT *text_max)
else if(notify_test_info.unicode == HDN_GETDISPINFOW)
*text = heap_strdup(receive_data->write_pointer);
else
*text = receive_data->write_pointer;
*text = (char *)receive_data->write_pointer;
if (text_max && receive_data->write_text_max != -1) *text_max = receive_data->write_text_max;
break;
}
case SEND_EMPTY_IF_NULL:
ok(!lstrcmpA(*text, empty_a), "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
ok(!*text[0], "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id, *text);
break;
case DONT_SEND_EMPTY_IF_NULL:
@ -682,7 +667,7 @@ static void notify_tooltip_handler(NMTTDISPINFOA *nm)
ok(!lstrcmpA(data->expect_sztext, nm->szText), "Sub test %d expect %s, got %s\n", notify_test_info.sub_test_id,
data->expect_sztext, nm->szText);
if (data->write_sztext) memcpy(nm->szText, data->write_sztext, data->write_sztext_size);
if (data->write_lpsztext) nm->lpszText = data->write_lpsztext;
if (data->write_lpsztext) nm->lpszText = (char *)data->write_lpsztext;
if (data->write_hinst) nm->hinst = data->write_hinst;
}
@ -1025,8 +1010,9 @@ static void test_notify_generic_text_helper(HWND pager, const struct generic_tex
if (data->return_text)
{
if (para->flags & CONVERT_RECEIVE)
ok(!lstrcmpW(data->return_text, *para->text), "Code 0x%08x sub test %d expect %s, got %s\n",
para->code_unicode, i, wine_dbgstr_w((WCHAR *)data->return_text), wine_dbgstr_w(*para->text));
ok(!wcsncmp(data->return_text, *para->text, *para->text_max),
"Code 0x%08x sub test %d expect %s, got %s\n", para->code_unicode, i,
wine_dbgstr_w((WCHAR *)data->return_text), wine_dbgstr_w(*para->text));
else
ok(!lstrcmpA(data->return_text, (CHAR *)*para->text), "Code 0x%08x sub test %d expect %s, got %s\n",
para->code_unicode, i, (CHAR *)data->return_text, (CHAR *)*para->text);
@ -1106,8 +1092,8 @@ static void test_wm_notify_header(HWND pager)
HD_TEXTFILTERW hdtf = {0};
hdi.mask = HDI_TEXT | HDI_FILTER;
hdi.pszText = test_w;
hdtf.pszText = test_w;
hdi.pszText = (WCHAR *)test_w;
hdtf.pszText = (WCHAR *)test_w;
nmh.pitem = &hdi;
nmh.pitem->pvFilter = &hdtf;
send_notify(pager, HDN_BEGINDRAG, HDN_BEGINDRAG, (LPARAM)&nmh, TRUE);
@ -1142,7 +1128,7 @@ static void test_wm_notify_tooltip(HWND pager)
memset(&nmttdi, 0, sizeof(nmttdi));
if (data->send_sztext) memcpy(nmttdi.szText, data->send_sztext, data->send_sztext_size);
if (data->send_lpsztext) nmttdi.lpszText = data->send_lpsztext;
if (data->send_lpsztext) nmttdi.lpszText = (WCHAR *)data->send_lpsztext;
send_notify(pager, TTN_GETDISPINFOW, TTN_GETDISPINFOA, (LPARAM)&nmttdi, FALSE);
if (data->return_sztext)
{

View file

@ -23,4 +23,13 @@
#include "resources.h"
#include "v6util.h"
#ifdef __REACTOS__
#include <ole2.h>
#define WM_KEYF1 0x004d
#define WM_CTLCOLOR 0x0019
#define WC_DIALOG (MAKEINTATOM(0x8002))
#endif
#endif /* !_COMCTL32_WINETEST_PRECOMP_H_ */

View file

@ -23,11 +23,11 @@
#include "msg.h"
#include "resources.h"
#include "wine/test.h"
#ifdef __REACTOS__
#include <reactos/undocuser.h>
#undef WC_DIALOG
#define WC_DIALOG (MAKEINTATOM(0x8002))
#endif
static HWND parenthwnd;
@ -1168,10 +1168,8 @@ static void test_bad_control_class(void)
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = &hpsp;
#ifndef __REACTOS__ /* FIXME: Inspect why this causes a hang */
ret = pPropertySheetA(&psh);
ok(ret == 0, "got %ld\n", ret);
#endif
/* Need to recreate hpsp otherwise the test fails under Windows */
hpsp = pCreatePropertySheetPageA(&psp);

View file

@ -17,6 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* make sure the structures work with a comctl32 v5.x */
#define _WIN32_WINNT 0x500
#define _WIN32_IE 0x500
#include <assert.h>
#include <stdarg.h>
@ -495,6 +499,7 @@ static void test_layout(void)
REBARBANDINFOA rbi;
HIMAGELIST himl;
REBARINFO ri;
int count;
rbsize_results_init();
@ -656,9 +661,27 @@ static void test_layout(void)
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
check_sizes();
rbsize_results_free();
DestroyWindow(hRebar);
pImageList_Destroy(himl);
/* One hidden band. */
hRebar = create_rebar_control();
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
rbi.fMask = RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
rbi.fStyle = RBBS_HIDDEN;
rbi.cx = 200;
rbi.cxMinChild = 100;
rbi.cyMinChild = 30;
rbi.hwndChild = NULL;
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
count = SendMessageA(hRebar, RB_GETROWCOUNT, 0, 0);
ok(!count, "Unexpected row count %d.\n", count);
DestroyWindow(hRebar);
rbsize_results_free();
}
#if 0 /* use this to generate more tests */

View file

@ -49,4 +49,5 @@
#define IDC_PS_COMBO1 1020
#define IDC_PS_PUSHBUTTON1 1021
#endif /* __WINE_COMCTL32_TEST_RESOURCES_H */

View file

@ -20,9 +20,7 @@
#include <stdarg.h>
#include <stdio.h>
#ifndef __REACTOS__
#define STRICT
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "commctrl.h"

View file

@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define _WIN32_WINNT 0x0501 /* For SetWindowSubclass/etc */
#include <assert.h>
#include <stdarg.h>

View file

@ -30,6 +30,7 @@
#include "msg.h"
#ifdef __REACTOS__
#undef WM_KEYF1
#define WM_KEYF1 0x004d
#endif

View file

@ -159,6 +159,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
break;
case TBN_GETINFOTIPA:
case TBN_GETINFOTIPW:
{
NMTBGETINFOTIPA *tbgit = (NMTBGETINFOTIPA*)lParam;
@ -2029,6 +2030,9 @@ static void test_tooltip(void)
g_ResetDispTextPtr = TRUE;
SendMessageA(hToolbar, WM_NOTIFY, 0, (LPARAM)&nmtti);
/* Same for TBN_GETINFOTIPW */
SendMessageA(hToolbar, TB_SETUNICODEFORMAT, TRUE, 0);
SendMessageA(hToolbar, WM_NOTIFY, 0, (LPARAM)&nmtti);
g_ResetDispTextPtr = FALSE;
DestroyWindow(hToolbar);

View file

@ -197,7 +197,7 @@ static void test_customdraw(void) {
50, 50,
300, 300,
NULL, NULL, NULL, 0);
ok(parent != NULL, "Creation of main window failed\n");
ok(parent != NULL, "%d: Creation of main window failed\n", iterationNumber);
/* Make it show */
ShowWindow(parent, SW_SHOWNORMAL);
@ -209,7 +209,7 @@ static void test_customdraw(void) {
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
parent, NULL, GetModuleHandleA(NULL), 0);
ok(hwndTip != NULL, "Creation of tooltip window failed\n");
ok(hwndTip != NULL, "%d: Creation of tooltip window failed\n", iterationNumber);
/* Set up parms for the wndproc to handle */
CD_Stages = 0;
@ -230,7 +230,7 @@ static void test_customdraw(void) {
toolInfo.lParam = 0xdeadbeef;
GetClientRect (parent, &toolInfo.rect);
ret = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
ok(ret, "Failed to add the tool.\n");
ok(ret, "%d: Failed to add the tool.\n", iterationNumber);
/* Make tooltip appear quickly */
SendMessageA(hwndTip, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELPARAM(1,0));
@ -245,23 +245,23 @@ static void test_customdraw(void) {
/* Check CustomDraw results */
ok(CD_Stages == expectedResults[iterationNumber].ExpectedCalls ||
broken(CD_Stages == (expectedResults[iterationNumber].ExpectedCalls & ~TEST_CDDS_POSTPAINT)), /* nt4 */
"CustomDraw run %d stages %x, expected %x\n", iterationNumber, CD_Stages,
"%d: CustomDraw stages %x, expected %x\n", iterationNumber, CD_Stages,
expectedResults[iterationNumber].ExpectedCalls);
}
ret = SendMessageA(hwndTip, TTM_GETCURRENTTOOLA, 0, 0);
ok(ret, "Failed to get current tool %#lx.\n", ret);
ok(ret, "%d: Failed to get current tool %#lx.\n", iterationNumber, ret);
memset(&toolInfo, 0xcc, sizeof(toolInfo));
toolInfo.cbSize = sizeof(toolInfo);
toolInfo.lpszText = NULL;
toolInfo.lpReserved = (void *)0xdeadbeef;
SendMessageA(hwndTip, TTM_GETCURRENTTOOLA, 0, (LPARAM)&toolInfo);
ok(toolInfo.hwnd == parent, "Unexpected hwnd %p.\n", toolInfo.hwnd);
ok(toolInfo.hinst == GetModuleHandleA(NULL), "Unexpected hinst %p.\n", toolInfo.hinst);
ok(toolInfo.uId == 0x1234abcd, "Unexpected uId %lx.\n", toolInfo.uId);
ok(toolInfo.lParam == 0, "Unexpected lParam %lx.\n", toolInfo.lParam);
ok(toolInfo.lpReserved == (void *)0xdeadbeef, "Unexpected lpReserved %p.\n", toolInfo.lpReserved);
ok(toolInfo.hwnd == parent, "%d: Unexpected hwnd %p.\n", iterationNumber, toolInfo.hwnd);
ok(toolInfo.hinst == GetModuleHandleA(NULL), "%d: Unexpected hinst %p.\n", iterationNumber, toolInfo.hinst);
ok(toolInfo.uId == 0x1234abcd, "%d: Unexpected uId %lx.\n", iterationNumber, toolInfo.uId);
ok(toolInfo.lParam == 0, "%d: Unexpected lParam %lx.\n", iterationNumber, toolInfo.lParam);
ok(toolInfo.lpReserved == (void *)0xdeadbeef, "%d: Unexpected lpReserved %p.\n", iterationNumber, toolInfo.lpReserved);
/* Clean up */
DestroyWindow(hwndTip);

View file

@ -42,6 +42,8 @@ static BOOL g_get_rect_in_expand;
static BOOL g_disp_A_to_W;
static BOOL g_disp_set_stateimage;
static BOOL g_beginedit_alter_text;
static const char *g_endedit_overwrite_contents;
static char *g_endedit_overwrite_ptr;
static HFONT g_customdraw_font;
static BOOL g_v6;
@ -1320,7 +1322,19 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case TVN_ENDLABELEDITA: return TRUE;
case TVN_ENDLABELEDITA:
{
NMTVDISPINFOA *disp = (NMTVDISPINFOA *)lParam;
if (disp->item.mask & TVIF_TEXT)
{
ok(disp->item.cchTextMax == MAX_PATH, "cchTextMax is %d\n", disp->item.cchTextMax);
if (g_endedit_overwrite_contents)
strcpy(disp->item.pszText, g_endedit_overwrite_contents);
if (g_endedit_overwrite_ptr)
disp->item.pszText = g_endedit_overwrite_ptr;
}
return TRUE;
}
case TVN_ITEMEXPANDINGA:
{
UINT newmask = pTreeView->itemNew.mask & ~TVIF_CHILDREN;
@ -1576,7 +1590,7 @@ static void test_itemedit(void)
DWORD r;
HWND edit;
TVITEMA item;
CHAR buffA[20];
CHAR buffA[500];
HWND hTree;
hTree = create_treeview_control(0);
@ -1667,6 +1681,84 @@ static void test_itemedit(void)
GetWindowTextA(edit, buffA, ARRAY_SIZE(buffA));
ok(!strcmp(buffA, "<edittextaltered>"), "got string %s\n", buffA);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
/* How much text can be typed? */
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
r = SendMessageA(edit, EM_GETLIMITTEXT, 0, 0);
expect(MAX_PATH - 1, r);
/* WM_SETTEXT can set more... */
memset(buffA, 'a', ARRAY_SIZE(buffA));
buffA[ARRAY_SIZE(buffA)-1] = 0;
r = SetWindowTextA(edit, buffA);
expect(TRUE, r);
r = GetWindowTextA(edit, buffA, ARRAY_SIZE(buffA));
ok( r == ARRAY_SIZE(buffA) - 1, "got %d\n", r );
/* ...but it's trimmed to MAX_PATH chars when editing ends */
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
item.mask = TVIF_TEXT;
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = ARRAY_SIZE(buffA);
r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
expect(MAX_PATH - 1, lstrlenA(item.pszText));
/* We can't get around that MAX_PATH limit by increasing EM_SETLIMITTEXT */
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
SendMessageA(edit, EM_SETLIMITTEXT, ARRAY_SIZE(buffA)-1, 0);
memset(buffA, 'a', ARRAY_SIZE(buffA));
buffA[ARRAY_SIZE(buffA)-1] = 0;
r = SetWindowTextA(edit, buffA);
expect(TRUE, r);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
item.mask = TVIF_TEXT;
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = ARRAY_SIZE(buffA);
r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
expect(MAX_PATH - 1, lstrlenA(item.pszText));
/* Overwriting of pszText contents in TVN_ENDLABELEDIT */
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
r = SetWindowTextA(edit, "old");
expect(TRUE, r);
g_endedit_overwrite_contents = "<new_contents>";
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
g_endedit_overwrite_contents = NULL;
item.mask = TVIF_TEXT;
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = ARRAY_SIZE(buffA);
r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
expect(0, strcmp(item.pszText, "<new_contents>"));
/* Overwriting of pszText pointer in TVN_ENDLABELEDIT */
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
r = SetWindowTextA(edit, "old");
expect(TRUE, r);
g_endedit_overwrite_ptr = (char*) "<new_ptr>";
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
g_endedit_overwrite_ptr = NULL;
item.mask = TVIF_TEXT;
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = ARRAY_SIZE(buffA);
r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
expect(0, strcmp(item.pszText, "<new_ptr>"));
DestroyWindow(hTree);
}

View file

@ -791,7 +791,7 @@ static void test_updown_create(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
GetWindowTextA(g_edit, text, MAX_PATH);
ok(lstrlenA(text) == 0, "Expected empty string\n");
ok(!*text, "Expected empty string\n");
ok_sequence(sequences, EDIT_SEQ_INDEX, get_edit_text_seq, "get edit text", FALSE);
DestroyWindow(updown);
@ -865,7 +865,7 @@ static void test_UDS_SETBUDDYINT(void)
ok(style & UDS_SETBUDDYINT, "Expected UDS_SETBUDDY to be set\n");
SendMessageA(updown, UDM_SETPOS, 0, 20);
GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
ok(lstrlenA(text) == 0, "Expected empty string\n");
ok(!*text, "Expected empty string\n");
DestroyWindow(updown);
/* creating with UDS_SETBUDDYINT */

View file

@ -20,7 +20,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef __REACTOS__
#pragma once
#endif
#ifdef __i386__
#define ARCH "x86"
@ -60,7 +62,7 @@ static const CHAR manifest[] =
"</dependency>\n"
"</assembly>\n";
static inline void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
{
DeactivateActCtx(0, cookie);
ReleaseActCtx(hCtx);
@ -68,7 +70,7 @@ static inline void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
DeleteFileA(manifest_name);
}
static inline BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
{
ACTCTX_SECTION_KEYED_DATA data;
DWORD written;