update comctl32 winetest

svn path=/trunk/; revision=38829
This commit is contained in:
Ged Murphy 2009-01-17 17:42:01 +00:00
parent 5b30cdcd87
commit 4786fa151f
17 changed files with 832 additions and 249 deletions

View file

@ -183,6 +183,13 @@ static void test_WM_LBUTTONDOWN(void)
WCHAR buffer[3];
static const UINT choices[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
static const WCHAR stringFormat[] = {'%','2','d','\0'};
BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO);
pGetComboBoxInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo");
if (!pGetComboBoxInfo){
skip("GetComboBoxInfo is not available\n");
return;
}
hComboEx = CreateWindowExA(0, WC_COMBOBOXEXA, NULL,
WS_VISIBLE|WS_CHILD|CBS_DROPDOWN, 0, 0, 200, 150,
@ -205,7 +212,7 @@ static void test_WM_LBUTTONDOWN(void)
hEdit = (HWND)SendMessage(hComboEx, CBEM_GETEDITCONTROL, 0, 0);
cbInfo.cbSize = sizeof(COMBOBOXINFO);
result = SendMessage(hCombo, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbInfo);
result = pGetComboBoxInfo(hCombo, &cbInfo);
ok(result, "Failed to get combobox info structure. LastError=%d\n",
GetLastError());
hList = cbInfo.hwndList;
@ -221,7 +228,8 @@ static void test_WM_LBUTTONDOWN(void)
result = SendMessage(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
ok(result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hCombo,
ok(GetFocus() == hCombo ||
broken(GetFocus() != hCombo), /* win98 */
"Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
GetFocus());
ok(SendMessage(hComboEx, CB_GETDROPPEDSTATE, 0, 0),
@ -232,7 +240,8 @@ static void test_WM_LBUTTONDOWN(void)
result = SendMessage(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
ok(result, "WM_LBUTTONUP was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hCombo,
ok(GetFocus() == hCombo ||
broken(GetFocus() != hCombo), /* win98 */
"Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
GetFocus());
@ -244,14 +253,16 @@ static void test_WM_LBUTTONDOWN(void)
result = SendMessage(hList, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
ok(!result, "WM_MOUSEMOVE was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hCombo,
ok(GetFocus() == hCombo ||
broken(GetFocus() != hCombo), /* win98 */
"Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
GetFocus());
result = SendMessage(hList, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hCombo,
ok(GetFocus() == hCombo ||
broken(GetFocus() != hCombo), /* win98 */
"Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
GetFocus());
ok(SendMessage(hComboEx, CB_GETDROPPEDSTATE, 0, 0),
@ -260,13 +271,19 @@ static void test_WM_LBUTTONDOWN(void)
result = SendMessage(hList, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
ok(!result, "WM_LBUTTONUP was not processed. LastError=%d\n",
GetLastError());
todo_wine ok(GetFocus() == hEdit,
todo_wine ok(GetFocus() == hEdit ||
broken(GetFocus() == hCombo), /* win98 */
"Focus not on ComboBoxEx's Edit Control, instead on %p\n",
GetFocus());
ok(!SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0),
result = SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0);
ok(!result ||
broken(result != 0), /* win98 */
"The dropdown list should have been rolled up.\n");
idx = SendMessage(hComboEx, CB_GETCURSEL, 0, 0);
ok(idx == 4, "Current Selection: expected %d, got %d\n", 4, idx);
ok(idx == 4 ||
broken(idx == -1), /* win98 */
"Current Selection: expected %d, got %d\n", 4, idx);
DestroyWindow(hComboEx);
}
@ -334,6 +351,7 @@ static void cleanup(void)
DispatchMessageA(&msg);
}
DestroyWindow(hComboExParentWnd);
UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL));
}

View file

@ -197,7 +197,7 @@ static void test_dtm_set_format(HWND hWndDateTime)
SYSTEMTIME systime;
LRESULT r;
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, (LPARAM)NULL);
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, 0);
expect(1, r);
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0,
@ -256,7 +256,7 @@ static void test_dtm_set_and_get_mcfont(HWND hWndDateTime)
{
HFONT hFontOrig, hFontNew;
hFontOrig = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
hFontOrig = GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hWndDateTime, DTM_SETMCFONT, (WPARAM)hFontOrig, TRUE);
hFontNew = (HFONT)SendMessage(hWndDateTime, DTM_GETMCFONT, 0, 0);
ok(hFontOrig == hFontNew, "Expected hFontOrig==hFontNew, hFontOrig=%p, hFontNew=%p\n", hFontOrig, hFontNew);
@ -271,7 +271,7 @@ static void test_dtm_get_monthcal(HWND hWndDateTime)
todo_wine {
r = SendMessage(hWndDateTime, DTM_GETMONTHCAL, 0, 0);
ok(r == (LPARAM)NULL, "Expected NULL(no child month calendar control), got %ld\n", r);
ok(r == 0, "Expected NULL(no child month calendar control), got %ld\n", r);
}
ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_get_monthcal_seq, "test_dtm_get_monthcal", FALSE);

View file

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "objidl.h"
@ -183,7 +182,7 @@ static BOOL CheckDPA(HDPA dpa, DWORD dwIn, PDWORD pdwOut)
do
{
pDPA_InsertPtr(dpa, 0, (PVOID)(dwIn & 0xf));
pDPA_InsertPtr(dpa, 0, (PVOID)(ULONG_PTR)(dwIn & 0xf));
dwIn >>= 4;
}
while(dwIn);
@ -243,9 +242,9 @@ static void test_dpa(void)
for(i = 1; i <= 6; i++)
{
INT j, k;
k = pDPA_GetPtrIndex(dpa, (PVOID)i);
k = pDPA_GetPtrIndex(dpa, (PVOID)(INT_PTR)i);
/* Linear searches should work on unsorted DPAs */
j = pDPA_Search(dpa, (PVOID)i, 0, CB_CmpLT, 0xdeadbeef, 0);
j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, 0, CB_CmpLT, 0xdeadbeef, 0);
ok(j == k, "j=%d k=%d\n", j, k);
}
@ -280,16 +279,16 @@ static void test_dpa(void)
INT j;
/* The array is in order so ptr == index+1 */
j = pDPA_GetPtrIndex(dpa, (PVOID)i);
j = pDPA_GetPtrIndex(dpa, (PVOID)(INT_PTR)i);
ok(j+1 == i, "j=%d i=%d\n", j, i);
j = pDPA_Search(dpa, (PVOID)i, 0, CB_CmpLT, 0xdeadbeef, DPAS_SORTED);
j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, 0, CB_CmpLT, 0xdeadbeef, DPAS_SORTED);
ok(j+1 == i, "j=%d i=%d\n", j, i);
/* Linear searches respect iStart ... */
j = pDPA_Search(dpa, (PVOID)i, i+1, CB_CmpLT, 0xdeadbeef, 0);
j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, i+1, CB_CmpLT, 0xdeadbeef, 0);
ok(j == DPA_ERR, "j=%d\n", j);
/* ... but for a binary search it's ignored */
j = pDPA_Search(dpa, (PVOID)i, i+1, CB_CmpLT, 0xdeadbeef, DPAS_SORTED);
j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, i+1, CB_CmpLT, 0xdeadbeef, DPAS_SORTED);
todo_wine ok(j+1 == i, "j=%d i=%d\n", j, i);
}
@ -332,7 +331,7 @@ static void test_dpa(void)
* should be bogus */
for(i = 0; i < 6; i++)
{
INT j = pDPA_Search(dpa, (PVOID)i, 0, CB_CmpGT, 0xdeadbeef,
INT j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, 0, CB_CmpGT, 0xdeadbeef,
DPAS_SORTED|DPAS_INSERTBEFORE);
ok(j != i, "i=%d\n", i);
}
@ -364,7 +363,9 @@ static void test_dpa(void)
rc=CheckDPA(dpa, 0x123456, &dw);
ok(rc, "dw=0x%x\n", dw);
rc=CheckDPA(dpa2, 0x123456, &dw2);
ok(rc, "dw2=0x%x\n", dw2);
ok(rc ||
broken(!rc), /* win98 */
"dw2=0x%x\n", dw2);
rc=CheckDPA(dpa3, 0x123456, &dw3);
ok(rc, "dw3=0x%x\n", dw3);
}
@ -453,5 +454,5 @@ START_TEST(dpa)
if(InitFunctionPtrs(hcomctl32))
test_dpa();
else
trace("skipping tests\n");
win_skip("Needed functions are not available\n");
}

View file

@ -39,6 +39,7 @@ static CUSTOMDRAWPROC g_CustomDrawProc;
static int g_CustomDrawCount;
static DRAWITEMSTRUCT g_DrawItem;
static BOOL g_DrawItemReceived;
static DWORD g_customheight;
static EXPECTEDNOTIFY expectedNotify[10];
static INT nExpectedNotify = 0;
@ -89,7 +90,7 @@ static const struct message add_header_to_parent_seq_interactive[] = {
static const struct message add_header_to_parent_seq[] = {
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
{ WM_QUERYUISTATE, sent },
{ WM_QUERYUISTATE, sent|optional },
{ WM_PARENTNOTIFY, sent },
{ 0 }
};
@ -196,8 +197,8 @@ static const struct message filterMessages_seq_noninteractive[] = {
{ HDM_SETFILTERCHANGETIMEOUT, sent|wparam|lparam, 1, 100 },
{ HDM_CLEARFILTER, sent|wparam|lparam, 0, 1 },
{ HDM_EDITFILTER, sent|wparam|lparam, 1, 0 },
{ WM_PARENTNOTIFY, sent|wparam|defwinproc, WM_CREATE },
{ WM_COMMAND, sent|defwinproc },
{ WM_PARENTNOTIFY, sent|wparam|defwinproc|optional, WM_CREATE },
{ WM_COMMAND, sent|defwinproc|optional },
{ 0 }
};
@ -304,11 +305,11 @@ static LONG getItem(HWND hdex, int idx, LPSTR textBuffer)
static void addReadDelItem(HWND hdex, HDITEMA *phdiCreate, int maskRead, HDITEMA *phdiRead)
{
ok(SendMessage(hdex, HDM_INSERTITEMA, (WPARAM)0, (LPARAM)phdiCreate)!=-1, "Adding item failed\n");
ok(SendMessage(hdex, HDM_INSERTITEMA, 0, (LPARAM)phdiCreate)!=-1, "Adding item failed\n");
ZeroMemory(phdiRead, sizeof(HDITEMA));
phdiRead->mask = maskRead;
ok(SendMessage(hdex, HDM_GETITEMA, (WPARAM)0, (LPARAM)phdiRead)!=0, "Getting item data failed\n");
ok(SendMessage(hdex, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0)!=0, "Deleting item failed\n");
ok(SendMessage(hdex, HDM_GETITEMA, 0, (LPARAM)phdiRead)!=0, "Getting item data failed\n");
ok(SendMessage(hdex, HDM_DELETEITEM, 0, 0)!=0, "Deleting item failed\n");
}
static HWND create_header_control (void)
@ -465,7 +466,7 @@ static BOOL register_parent_wnd_class(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Header test parent class";
@ -661,24 +662,24 @@ static void check_mask(void)
hdi.iOrder = 0;
hdi.lParam = 17;
hdi.cchTextMax = 260;
ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
ret = SendMessage(hWndHeader, HDM_INSERTITEM, 0, (LPARAM)&hdi);
ok(ret == -1, "Creating an item with a zero mask should have failed\n");
if (ret != -1) SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
if (ret != -1) SendMessage(hWndHeader, HDM_DELETEITEM, 0, 0);
/* with a non-zero mask creation will succeed */
ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = HDI_LPARAM;
ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
ret = SendMessage(hWndHeader, HDM_INSERTITEM, 0, (LPARAM)&hdi);
ok(ret != -1, "Adding item with non-zero mask failed\n");
if (ret != -1)
SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
SendMessage(hWndHeader, HDM_DELETEITEM, 0, 0);
/* in SETITEM if the mask contains a unknown bit, it is ignored */
ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
hdi.lParam = 133;
hdi.iImage = 17;
ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
ret = SendMessage(hWndHeader, HDM_INSERTITEM, 0, (LPARAM)&hdi);
ok(ret != -1, "Adding item failed\n");
if (ret != -1)
@ -686,18 +687,18 @@ static void check_mask(void)
/* check result */
ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = HDI_LPARAM | HDI_IMAGE;
SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
SendMessage(hWndHeader, HDM_GETITEM, 0, (LPARAM)&hdi);
ok(hdi.lParam == 133, "comctl32 4.0 field not set\n");
ok(hdi.iImage == 17, "comctl32 >4.0 field not set\n");
/* but in GETITEM if an unknown bit is set, comctl32 uses only version 4.0 fields */
ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
SendMessage(hWndHeader, HDM_GETITEM, 0, (LPARAM)&hdi);
ok(hdi.lParam == 133, "comctl32 4.0 field not read\n");
ok(hdi.iImage == 0, "comctl32 >4.0 field shouldn't be read\n");
SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
SendMessage(hWndHeader, HDM_DELETEITEM, 0, 0);
}
}
@ -811,7 +812,7 @@ static void test_hdm_getitemrect(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
retVal = SendMessage(hChild, HDM_GETITEMRECT, 1, (LPARAM) &rect);
ok(retVal == TRUE, "Getting item rect should TRUE, got %d\n", retVal);
@ -821,7 +822,7 @@ static void test_hdm_getitemrect(HWND hParent)
expect(160, rect.right);
todo_wine
{
expect(18, rect.bottom);
expect(g_customheight, rect.bottom);
}
retVal = SendMessage(hChild, HDM_GETITEMRECT, 0, (LPARAM) &rect);
@ -833,7 +834,7 @@ static void test_hdm_getitemrect(HWND hParent)
expect(80, rect.right);
todo_wine
{
expect(18, rect.bottom);
expect(g_customheight, rect.bottom);
}
retVal = SendMessage(hChild, HDM_GETITEMRECT, 10, (LPARAM) &rect);
ok(retVal == 0, "Getting rect of nonexistent item should return 0, got %d\n", retVal);
@ -855,7 +856,7 @@ static void test_hdm_layout(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
retVal = SendMessage(hChild, HDM_LAYOUT, 0, (LPARAM) &hdLayout);
@ -874,7 +875,7 @@ static void test_hdm_ordertoindex(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
retVal = SendMessage(hChild, HDM_ORDERTOINDEX, 1, 0);
@ -892,7 +893,7 @@ static void test_hdm_hittest(HWND hParent)
HDHITTESTINFO hdHitTestInfo;
const int firstItemRightBoundary = 80;
const int secondItemRightBoundary = 160;
const int bottomBoundary = 18;
const int bottomBoundary = g_customheight;
pt.x = firstItemRightBoundary - 1;
pt.y = bottomBoundary - 1;
@ -902,7 +903,7 @@ static void test_hdm_hittest(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
retVal = SendMessage(hChild, HDM_HITTEST, 0, (LPARAM) &hdHitTestInfo);
@ -947,12 +948,12 @@ static void test_hdm_sethotdivider(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
todo_wine
{
retVal = SendMessage(hChild, HDM_SETHOTDIVIDER, TRUE, (LPARAM) 0X00050005);
retVal = SendMessage(hChild, HDM_SETHOTDIVIDER, TRUE, 0X00050005);
expect(0, retVal);
}
retVal = SendMessage(hChild, HDM_SETHOTDIVIDER, FALSE, 100);
@ -978,18 +979,18 @@ static void test_hdm_imageMessages(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hImageListRetVal = (HIMAGELIST) SendMessage(hChild, HDM_SETIMAGELIST, 0, (LPARAM) hImageList);
ok(hImageListRetVal == NULL, "Expected NULL, got %d\n", (int) hImageListRetVal);
ok(hImageListRetVal == NULL, "Expected NULL, got %p\n", hImageListRetVal);
hImageListRetVal = (HIMAGELIST) SendMessage(hChild, HDM_GETIMAGELIST, 0, 0);
ok(hImageListRetVal != NULL, "Expected non-NULL handle, got %d\n", (int) hImageListRetVal);
ok(hImageListRetVal != NULL, "Expected non-NULL handle, got %p\n", hImageListRetVal);
hImageListRetVal = (HIMAGELIST) SendMessage(hChild, HDM_CREATEDRAGIMAGE, 0, 0);
ok(hImageListRetVal != NULL, "Expected non-NULL handle, got %d\n", (int) hImageListRetVal);
ok(hImageListRetVal != NULL, "Expected non-NULL handle, got %p\n", hImageListRetVal);
ok_sequence(sequences, HEADER_SEQ_INDEX, imageMessages_seq, "imageMessages sequence testing", FALSE);
@ -999,35 +1000,45 @@ static void test_hdm_imageMessages(HWND hParent)
static void test_hdm_filterMessages(HWND hParent)
{
HWND hChild;
int retVal;
int retVal, timeout;
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
assert(hChild);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
timeout = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, timeout);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* msdn incorrectly states that return value
* is the index of the filter control being
* modified. The sendMessage here should
* return previous filter timeout value
*/
retVal = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
expect(timeout, retVal);
todo_wine
{
/* msdn incorrectly states that return value
* is the index of the filter control being
* modified. The sendMessage here should
* return previous filter timeout value
*/
retVal = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
expect(1000, retVal);
retVal = SendMessage(hChild, HDM_CLEARFILTER, 0, 1);
expect(1, retVal);
retVal = SendMessage(hChild, HDM_EDITFILTER, 1, 0);
expect(1, retVal);
}
}
if (winetest_interactive)
ok_sequence(sequences, HEADER_SEQ_INDEX, filterMessages_seq_interactive,
"filterMessages sequence testing", TRUE);
else
ok_sequence(sequences, HEADER_SEQ_INDEX, filterMessages_seq_noninteractive,
"filterMessages sequence testing", TRUE);
"filterMessages sequence testing", FALSE);
/* Some Win9x versions don't send a WM_KILLFOCUS.
* Set the focus explicitly to the parent to avoid a crash.
*/
SetFocus(hParent);
DestroyWindow(hChild);
}
@ -1040,7 +1051,7 @@ static void test_hdm_unicodeformatMessages(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
retVal = SendMessage(hChild, HDM_SETUNICODEFORMAT, TRUE, 0);
@ -1061,7 +1072,7 @@ static void test_hdm_bitmapmarginMessages(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
retVal = SendMessage(hChild, HDM_GETBITMAPMARGIN, 0, 0);
@ -1100,7 +1111,7 @@ static void test_hdm_index_messages(HWND hParent)
"adder header control to parent", TRUE);
else
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", TRUE);
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
for ( loopcnt = 0 ; loopcnt < 4 ; loopcnt++ )
{
@ -1196,7 +1207,7 @@ static LRESULT customdraw_1(int n, NMCUSTOMDRAW *nm)
{
case 0:
/* don't test dwItemSpec - it's 0 no comctl5 but 1308756 on comctl6 */
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, g_customheight);
return 0;
}
@ -1214,16 +1225,16 @@ static LRESULT customdraw_2(int n, NMCUSTOMDRAW *nm)
switch (n)
{
case 0:
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, g_customheight);
return CDRF_NOTIFYITEMDRAW;
case 1:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, g_customheight);
return 0;
case 2:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 1, 5, 50, 0, 150, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 1, 5, 50, 0, 150, g_customheight);
return 0;
case 3:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, g_customheight);
return 0;
}
@ -1241,19 +1252,19 @@ static LRESULT customdraw_3(int n, NMCUSTOMDRAW *nm)
switch (n)
{
case 0:
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, g_customheight);
return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTERASE|CDRF_NOTIFYPOSTPAINT|CDRF_SKIPDEFAULT;
case 1:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, g_customheight);
return 0;
case 2:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 1, 5, 50, 0, 150, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 1, 5, 50, 0, 150, g_customheight);
return 0;
case 3:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, g_customheight);
return 0;
case 4:
TEST_NMCUSTOMDRAW(CDDS_POSTPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_POSTPAINT, -1, 0, 0, 0, 670, g_customheight);
return 0;
}
@ -1272,16 +1283,16 @@ static LRESULT customdraw_4(int n, NMCUSTOMDRAW *nm)
switch (n)
{
case 0:
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_PREPAINT, -1, 0, 0, 0, 670, g_customheight);
return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT;
case 1:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 0, 0, 0, 0, 50, g_customheight);
return 0;
case 2:
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, 18);
TEST_NMCUSTOMDRAW(CDDS_ITEMPREPAINT, 2, 10, 150, 0, 300, g_customheight);
return 0;
case 3:
TEST_NMCUSTOMDRAW(CDDS_POSTPAINT, -1, 0, 0, 0, 670, 18);
TEST_NMCUSTOMDRAW(CDDS_POSTPAINT, -1, 0, 0, 0, 670, g_customheight);
return 0;
}
@ -1307,9 +1318,9 @@ static void test_customdraw(void)
CHAR name[] = "Test";
hWndHeader = create_header_control();
GetClientRect(hWndHeader, &rect);
ok(rect.right - rect.left == 670 && rect.bottom - rect.top == 18,
"Tests will fail as header size is %dx%d instead of 670x18\n",
rect.right - rect.left, rect.bottom - rect.top);
ok(rect.right - rect.left == 670 && rect.bottom - rect.top == g_customheight,
"Tests will fail as header size is %dx%d instead of 670x%d\n",
rect.right - rect.left, rect.bottom - rect.top, g_customheight);
for (i = 0; i < 3; i++)
{
@ -1486,6 +1497,9 @@ static int init(void)
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
TEXTMETRICA tm;
HFONT hOldFont;
HDC hdc;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
@ -1511,6 +1525,17 @@ static int init(void)
wc.lpfnWndProc = HeaderTestWndProc;
RegisterClassA(&wc);
/* The height of the header control depends on the height of the system font.
The height of the system font is dpi dependent */
hdc = GetDC(0);
hOldFont = SelectObject(hdc, GetStockObject(SYSTEM_FONT));
GetTextMetricsA(hdc, &tm);
/* 2 dot extra space are needed for the border */
g_customheight = tm.tmHeight + 2;
trace("customdraw height: %d (dpi: %d)\n", g_customheight, GetDeviceCaps(hdc, LOGPIXELSY));
SelectObject(hdc, hOldFont);
ReleaseDC(0, hdc);
hHeaderParentWnd = CreateWindowExA(0, "HeaderTestClass", "Header test", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),

View file

@ -136,9 +136,9 @@ static HWND create_a_window(void)
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = 0;
cls.hIcon = LoadIconA (0, (LPSTR)IDI_APPLICATION);
cls.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
cls.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
cls.hIcon = LoadIconA (0, IDI_APPLICATION);
cls.hCursor = LoadCursorA (0, IDC_ARROW);
cls.hbrBackground = GetStockObject (WHITE_BRUSH);
cls.lpszMenuName = 0;
cls.lpszClassName = className;
@ -433,7 +433,7 @@ static BOOL DoTest3(void)
if (!pImageList_DrawIndirect)
{
trace("ImageList_DrawIndirect not available, skipping test\n");
win_skip("ImageList_DrawIndirect not available, skipping test\n");
return TRUE;
}
@ -835,10 +835,18 @@ static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT
ok(ilh->cy == cy, "wrong cy %d (expected %d)\n", ilh->cy, cy);
ok(ilh->bkcolor == CLR_NONE, "wrong bkcolor %x\n", ilh->bkcolor);
ok(ilh->flags == ILC_COLOR24, "wrong flags %04x\n", ilh->flags);
ok(ilh->ovls[0] == -1, "wrong ovls[0] %04x\n", ilh->ovls[0]);
ok(ilh->ovls[1] == -1, "wrong ovls[1] %04x\n", ilh->ovls[1]);
ok(ilh->ovls[2] == -1, "wrong ovls[2] %04x\n", ilh->ovls[2]);
ok(ilh->ovls[3] == -1, "wrong ovls[3] %04x\n", ilh->ovls[3]);
ok(ilh->ovls[0] == -1 ||
ilh->ovls[0] == 0, /* win95 */
"wrong ovls[0] %04x\n", ilh->ovls[0]);
ok(ilh->ovls[1] == -1 ||
ilh->ovls[1] == 0, /* win95 */
"wrong ovls[1] %04x\n", ilh->ovls[1]);
ok(ilh->ovls[2] == -1 ||
ilh->ovls[2] == 0, /* win95 */
"wrong ovls[2] %04x\n", ilh->ovls[2]);
ok(ilh->ovls[3] == -1 ||
ilh->ovls[3] == 0, /* win95 */
"wrong ovls[3] %04x\n", ilh->ovls[3]);
}
static HBITMAP create_bitmap(INT cx, INT cy, COLORREF color, const char *comment)

View file

@ -48,7 +48,10 @@ static const struct message create_parent_wnd_seq[] = {
{ WM_CREATE, sent },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_WINDOWPOSCHANGED, sent|optional },
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_ACTIVATE, sent|wparam, 1 },
@ -75,9 +78,9 @@ static const struct message redraw_listview_seq[] = {
};
static const struct message listview_icon_spacing_seq[] = {
{ LVM_SETICONSPACING, sent|lparam, 0, (LPARAM) MAKELONG(20, 30) },
{ LVM_SETICONSPACING, sent|lparam, 0, (LPARAM) MAKELONG(25, 35) },
{ LVM_SETICONSPACING, sent|lparam, 0, (LPARAM) MAKELONG(-1, -1) },
{ LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(20, 30) },
{ LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(25, 35) },
{ LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(-1, -1) },
{ 0 }
};
@ -154,8 +157,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
LRESULT ret;
struct message msg;
/* do not log painting messages */
if (message != WM_PAINT &&
/* log system messages, except for painting */
if (message < WM_USER &&
message != WM_PAINT &&
message != WM_ERASEBKGND &&
message != WM_NCPAINT &&
message != WM_NCHITTEST &&
@ -190,7 +194,7 @@ static BOOL register_parent_wnd_class(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Listview test parent class";
@ -732,7 +736,9 @@ static void test_columns(void)
/* Check its width */
rc = ListView_GetColumnWidth(hwnd, 0);
ok(rc==10, "Inserting column with no mask failed to set width to 10 with %d\n", rc);
ok(rc==10 ||
broken(rc==0), /* win9x */
"Inserting column with no mask failed to set width to 10 with %d\n", rc);
DestroyWindow(hwnd);
}
@ -859,21 +865,27 @@ static void test_icon_spacing(void)
r = SendMessage(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwndparent, (LPARAM)NF_REQUERY);
expect(NFR_ANSI, r);
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, (LPARAM) MAKELONG(-1, -1));
/* reset the icon spacing to defaults */
SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(-1, -1));
/* now we can request what the defaults are */
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(-1, -1));
w = LOWORD(r);
h = LOWORD(r);
h = HIWORD(r);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
trace("test icon spacing\n");
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, (LPARAM) MAKELONG(20, 30));
expect(MAKELONG(w,h), r);
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(20, 30));
ok(r == MAKELONG(w, h) ||
broken(r == MAKELONG(w, w)), /* win98 */
"Expected %d, got %d\n", MAKELONG(w, h), r);
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, (LPARAM) MAKELONG(25, 35));
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(25, 35));
expect(MAKELONG(20,30), r);
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, (LPARAM) MAKELONG(-1,-1));
r = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(-1,-1));
expect(MAKELONG(25,35), r);
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_icon_spacing_seq, "test icon spacing seq", FALSE);
@ -977,7 +989,7 @@ static void test_item_count(void)
expect(3, r);
/* [item0, item1] */
r = SendMessage(hwnd, LVM_DELETEITEM, (WPARAM) 2, 0);
r = SendMessage(hwnd, LVM_DELETEITEM, 2, 0);
expect(TRUE, r);
r = SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0);

View file

@ -23,7 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
@ -53,6 +52,7 @@ static const struct message create_parent_window_seq[] = {
{ WM_CREATE, sent },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
@ -70,7 +70,7 @@ static const struct message create_parent_window_seq[] = {
static const struct message create_monthcal_control_seq[] = {
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
{ WM_QUERYUISTATE, sent },
{ WM_QUERYUISTATE, sent|optional },
{ WM_GETFONT, sent },
{ WM_PARENTNOTIFY, sent|wparam, WM_CREATE},
{ 0 }
@ -78,7 +78,7 @@ static const struct message create_monthcal_control_seq[] = {
static const struct message create_monthcal_multi_sel_style_seq[] = {
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
{ WM_QUERYUISTATE, sent },
{ WM_QUERYUISTATE, sent|optional },
{ WM_GETFONT, sent },
{ 0 }
};
@ -215,10 +215,6 @@ static const struct message monthcal_hit_test_seq[] = {
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ MCM_HITTEST, sent|wparam, 0},
{ 0 }
};
@ -302,8 +298,10 @@ static const struct message destroy_parent_seq[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_WINDOWPOSCHANGING, sent|wparam, 0},
{ WM_WINDOWPOSCHANGED, sent|wparam, 0},
{ WM_NCACTIVATE, sent|wparam|lparam, 0, 0},
{ WM_ACTIVATE, sent|wparam|lparam, 0, 0},
{ WM_NCACTIVATE, sent|wparam, 0},
{ WM_ACTIVATE, sent|wparam, 0},
{ WM_NCACTIVATE, sent|wparam|lparam|optional, 0, 0},
{ WM_ACTIVATE, sent|wparam|lparam|optional, 0, 0},
{ WM_ACTIVATEAPP, sent|wparam, 0},
{ WM_KILLFOCUS, sent|wparam|lparam, 0, 0},
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0},
@ -383,8 +381,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
LRESULT ret;
struct message msg;
/* do not log painting messages */
if (message != WM_PAINT &&
/* log system messages, except for painting */
if (message < WM_USER &&
message != WM_PAINT &&
message != WM_ERASEBKGND &&
message != WM_NCPAINT &&
message != WM_NCHITTEST &&
@ -419,7 +418,7 @@ static BOOL register_parent_wnd_class(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Month-Cal test parent class";
@ -460,8 +459,6 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
LRESULT ret;
struct message msg;
trace("monthcal: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
msg.message = message;
msg.flags = sent|wparam|lparam;
if (defwndproc_counter) msg.flags |= defwinproc;
@ -636,7 +633,7 @@ static void test_monthcal_currDate(HWND hwnd)
expect(st_original.wSecond, st_new.wSecond);
/* lparam cannot be NULL */
res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM) NULL);
res = SendMessage(hwnd, MCM_GETCURSEL, 0, 0);
expect(0, res);
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE);
@ -654,6 +651,7 @@ static void test_monthcal_firstDay(HWND hwnd)
/* check for locale first day */
if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){
fday = atoi(b);
trace("fday: %d\n", fday);
res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
expect(fday, res);
prev = fday;
@ -669,7 +667,8 @@ static void test_monthcal_firstDay(HWND hwnd)
if (i == -1){
expect(MAKELONG(fday, FALSE), res);
}else if (i >= 7){
expect(MAKELONG(fday, TRUE), res);
/* out of range sets max first day of week, locale is ignored */
expect(MAKELONG(6, TRUE), res);
}else{
expect(MAKELONG(i, TRUE), res);
}
@ -722,6 +721,12 @@ static void test_monthcal_HitTest(HWND hwnd)
MCHITTESTINFO mchit;
UINT res;
SYSTEMTIME st;
LONG x;
UINT title_index;
static const UINT title_hits[] =
{ MCHT_NOWHERE, MCHT_TITLEBK, MCHT_TITLEBTNPREV, MCHT_TITLEBK,
MCHT_TITLEMONTH, MCHT_TITLEBK, MCHT_TITLEYEAR, MCHT_TITLEBK,
MCHT_TITLEBTNNEXT, MCHT_TITLEBK, MCHT_NOWHERE };
memset(&mchit, 0, sizeof(MCHITTESTINFO));
@ -776,42 +781,6 @@ static void test_monthcal_HitTest(HWND hwnd)
expect(mchit.uHit, res);
expect(MCHT_CALENDARBK, res);
/* (50, 40) is in active area - previous month button */
mchit.pt.x = 50;
mchit.pt.y = 40;
res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
expect(50, mchit.pt.x);
expect(40, mchit.pt.y);
expect(mchit.uHit, res);
todo_wine {expect(MCHT_TITLEBTNPREV, res);}
/* (90, 40) is in active area - background section of the title */
mchit.pt.x = 90;
mchit.pt.y = 40;
res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
expect(90, mchit.pt.x);
expect(40, mchit.pt.y);
expect(mchit.uHit, res);
todo_wine {expect(MCHT_TITLE, res);}
/* (140, 40) is in active area - month section of the title */
mchit.pt.x = 140;
mchit.pt.y = 40;
res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
expect(140, mchit.pt.x);
expect(40, mchit.pt.y);
expect(mchit.uHit, res);
todo_wine {expect(MCHT_TITLEMONTH, res);}
/* (250, 40) is in active area - next month button */
mchit.pt.x = 250;
mchit.pt.y = 40;
res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
expect(250, mchit.pt.x);
expect(40, mchit.pt.y);
expect(mchit.uHit, res);
todo_wine {expect(MCHT_TITLEBTNNEXT, res);}
/* (70, 70) is in active area - day of the week */
mchit.pt.x = 70;
mchit.pt.y = 70;
@ -905,6 +874,27 @@ static void test_monthcal_HitTest(HWND hwnd)
todo_wine {expect(MCHT_TODAYLINK, res);}
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE);
/* The horizontal position of title bar elements depends on locale (y pos
is constant), so we sample across a horizontal line and make sure we
find all elements. */
mchit.pt.y = 40;
title_index = 0;
for (x = 0; x < 300; x++){
mchit.pt.x = x;
res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
expect(x, mchit.pt.x);
expect(40, mchit.pt.y);
expect(mchit.uHit, res);
if (res != title_hits[title_index]){
title_index++;
if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index)
break;
todo_wine {expect(title_hits[title_index], res);}
}
}
todo_wine {ok(300 <= x && title_index + 1 == sizeof(title_hits) / sizeof(title_hits[0]),
"Wrong title layout\n");}
}
static void test_monthcal_todaylink(HWND hwnd)
@ -1107,6 +1097,34 @@ static void test_monthcal_MaxSelDay(HWND hwnd)
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_max_sel_day_seq, "monthcal MaxSelDay", FALSE);
}
static void test_monthcal_size(HWND hwnd)
{
int res;
RECT r1, r2;
HFONT hFont1, hFont2;
LOGFONTA logfont;
lstrcpyA(logfont.lfFaceName, "Arial");
memset(&logfont, 0, sizeof(logfont));
logfont.lfHeight = 12;
hFont1 = CreateFontIndirectA(&logfont);
logfont.lfHeight = 24;
hFont2 = CreateFontIndirectA(&logfont);
/* initialize to a font we can compare against */
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont1, 0);
res = SendMessage(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r1);
/* check that setting a larger font results in an larger rect */
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont2, 0);
res = SendMessage(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r2);
OffsetRect(&r1, -r1.left, -r1.top);
OffsetRect(&r2, -r2.left, -r2.top);
ok(r1.bottom < r2.bottom, "Failed to get larger rect with larger font\n");
}
START_TEST(monthcal)
{
@ -1148,6 +1166,7 @@ START_TEST(monthcal)
test_monthcal_monthrange(hwnd);
test_monthcal_HitTest(hwnd);
test_monthcal_todaylink(hwnd);
test_monthcal_size(hwnd);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);

View file

@ -75,7 +75,7 @@ static INT (WINAPI *pFindMRUStringA)(HANDLE,LPCSTR,LPINT);
/* Based on RegDeleteTreeW from dlls/advapi32/registry.c */
static LONG mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
{
LONG ret;
DWORD dwMaxSubkeyLen, dwMaxValueLen;
@ -353,15 +353,15 @@ static void test_MRUListA(void)
/* NULL buffer = get list size */
iRet = pEnumMRUList(hMRU, 0, NULL, 0);
ok(iRet == 3, "EnumMRUList expected %d, got %d\n", LIST_SIZE, iRet);
ok(iRet == 3 || iRet == -1 /* Vista */, "EnumMRUList expected %d or -1, got %d\n", LIST_SIZE, iRet);
/* negative item pos = get list size */
iRet = pEnumMRUList(hMRU, -1, NULL, 0);
ok(iRet == 3, "EnumMRUList expected %d, got %d\n", LIST_SIZE, iRet);
ok(iRet == 3 || iRet == -1 /* Vista */, "EnumMRUList expected %d or -1, got %d\n", LIST_SIZE, iRet);
/* negative item pos = get list size */
iRet = pEnumMRUList(hMRU, -5, NULL, 0);
ok(iRet == 3, "EnumMRUList expected %d, got %d\n", LIST_SIZE, iRet);
ok(iRet == 3 || iRet == -1 /* Vista */, "EnumMRUList expected %d or -1, got %d\n", LIST_SIZE, iRet);
/* negative item pos = get list size */
iRet = pEnumMRUList(hMRU, -1, buffer, 255);
@ -410,8 +410,7 @@ static void test_MRUListA(void)
pFreeMRUList(hMRU);
}
/* Free (NULL list) - Doesn't crash */
pFreeMRUList(NULL);
/* FreeMRUList(NULL) crashes on Win98 OSR0 */
}
START_TEST(mru)

View file

@ -22,6 +22,8 @@
#include "wine/test.h"
static HWND parent;
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
{
switch(msg)
@ -132,8 +134,74 @@ static void test_nopage(void)
DestroyWindow(hdlg);
}
static int CALLBACK disableowner_callback(HWND hwnd, UINT msg, LPARAM lparam)
{
switch(msg)
{
case PSCB_INITIALIZED:
{
ok(IsWindowEnabled(parent) == 0, "parent window should be disabled\n");
PostQuitMessage(0);
return FALSE;
}
}
return FALSE;
}
static void register_parent_wnd_class(void)
{
WNDCLASSA cls;
cls.style = 0;
cls.lpfnWndProc = DefWindowProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "parent class";
RegisterClassA(&cls);
}
static void test_disableowner(void)
{
HPROPSHEETPAGE hpsp[1];
PROPSHEETPAGEA psp;
PROPSHEETHEADERA psh;
register_parent_wnd_class();
parent = CreateWindowA("parent class", "", WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 100, 100, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), 0);
memset(&psp, 0, sizeof(psp));
psp.dwSize = sizeof(psp);
psp.dwFlags = 0;
psp.hInstance = GetModuleHandleW(NULL);
U(psp).pszTemplate = "prop_page1";
U2(psp).pszIcon = NULL;
psp.pfnDlgProc = NULL;
psp.lParam = 0;
hpsp[0] = CreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = sizeof(psh);
psh.dwFlags = PSH_USECALLBACK;
psh.pszCaption = "test caption";
psh.nPages = 1;
psh.hwndParent = parent;
U3(psh).phpage = hpsp;
psh.pfnCallback = disableowner_callback;
PropertySheetA(&psh);
ok(IsWindowEnabled(parent) != 0, "parent window should be enabled\n");
DestroyWindow(parent);
}
START_TEST(propsheet)
{
test_title();
test_nopage();
test_disableowner();
}

View file

@ -24,9 +24,22 @@
#include "wine/test.h"
#define expect(expected,got) ok (expected == got,"Expected %d, got %d\n",expected,got);
#define SUBCLASS_NAME "MyStatusBar"
#define expect(expected,got) ok (expected == got,"Expected %d, got %d\n",expected,got)
#define expect_rect(_left,_top,_right,_bottom,got) do { \
RECT exp = {abs(got.left - _left), abs(got.top - _top), \
abs(got.right - _right), abs(got.bottom - _bottom)}; \
ok(exp.left <= 2 && exp.top <= 2 && exp.right <= 2 && exp.bottom <= 2, \
"Expected rect {%d,%d, %d,%d}, got {%d,%d, %d,%d}\n", \
_left, _top, _right, _bottom, \
(got).left, (got).top, (got).right, (got).bottom); } while (0)
static HINSTANCE hinst;
static WNDPROC g_status_wndproc;
static RECT g_rcCreated;
static HWND g_hMainWnd;
static int g_wmsize_count = 0;
static HWND create_status_control(DWORD style, DWORD exstyle)
{
@ -42,6 +55,173 @@ static HWND create_status_control(DWORD style, DWORD exstyle)
return hWndStatus;
}
static LRESULT WINAPI create_test_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT ret;
if (msg == WM_CREATE)
{
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
GetWindowRect(hwnd, &g_rcCreated);
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&g_rcCreated, 2);
ok(cs->x == g_rcCreated.left, "CREATESTRUCT.x modified\n");
ok(cs->y == g_rcCreated.top, "CREATESTRUCT.y modified\n");
} else if (msg == WM_SIZE)
{
g_wmsize_count++;
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
}
else
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
return ret;
}
static void register_subclass()
{
WNDCLASSEX cls;
cls.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(NULL, STATUSCLASSNAME, &cls);
g_status_wndproc = cls.lpfnWndProc;
cls.lpfnWndProc = create_test_wndproc;
cls.lpszClassName = SUBCLASS_NAME;
cls.hInstance = NULL;
ok(RegisterClassEx(&cls), "RegisterClassEx failed\n");
}
static void test_create()
{
RECT rc;
HWND hwnd;
ok((hwnd = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, 0, 0, 100, 100,
g_hMainWnd, NULL, NULL, 0)) != NULL, "CreateWindowA failed\n");
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&rc, 2);
GetWindowRect(hwnd, &rc);
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&rc, 2);
expect_rect(0, 0, 100, 100, g_rcCreated);
expect(0, rc.left);
expect(672, rc.right);
expect(226, rc.bottom);
/* we don't check rc.top as this may depend on user font settings */
DestroyWindow(hwnd);
}
static int CALLBACK check_height_font_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMETRICEX *ntm, DWORD type, LPARAM lParam)
{
HWND hwndStatus = (HWND)lParam;
HDC hdc = GetDC(NULL);
static const int sizes[] = {8, 9, 10, 12, 16, 22, 28, 36, 48, 72};
int i;
trace("Font %s\n", enumlf->elfFullName);
for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
{
HFONT hFont;
TEXTMETRIC tm;
HFONT hCtrlFont;
HFONT hOldFont;
RECT rcCtrl;
enumlf->elfLogFont.lfHeight = sizes[i];
hFont = CreateFontIndirect(&enumlf->elfLogFont);
hCtrlFont = (HFONT)SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
hOldFont = SelectObject(hdc, hFont);
GetClientRect(hwndStatus, &rcCtrl);
GetTextMetrics(hdc, &tm);
expect(max(tm.tmHeight + (tm.tmInternalLeading ? tm.tmInternalLeading : 2) + 4, 20), rcCtrl.bottom);
SelectObject(hdc, hOldFont);
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hCtrlFont, TRUE);
DeleteObject(hFont);
}
ReleaseDC(NULL, hdc);
return 1;
}
static int CALLBACK check_height_family_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMETRICEX *ntm, DWORD type, LPARAM lParam)
{
HDC hdc = GetDC(NULL);
enumlf->elfLogFont.lfHeight = 0;
EnumFontFamiliesEx(hdc, &enumlf->elfLogFont, (FONTENUMPROC)check_height_font_enumproc, lParam, 0);
ReleaseDC(NULL, hdc);
return 1;
}
static void test_height(void)
{
LOGFONT lf;
HFONT hFont, hFontSm;
RECT rc1, rc2;
HWND hwndStatus = CreateWindow(SUBCLASS_NAME, NULL, WS_CHILD|WS_VISIBLE,
0, 0, 300, 20, g_hMainWnd, NULL, NULL, NULL);
HDC hdc;
GetClientRect(hwndStatus, &rc1);
hFont = CreateFont(32, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Tahoma");
g_wmsize_count = 0;
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
if (!g_wmsize_count)
{
skip("Status control not resized in win95, skipping broken tests.\n");
return;
}
ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 42, rc2); /* GetTextMetrics returns invalid tmInternalLeading for this font */
g_wmsize_count = 0;
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 42, rc2);
/* minheight < fontsize - no effects*/
SendMessage(hwndStatus, SB_SETMINHEIGHT, 12, 0);
SendMessage(hwndStatus, WM_SIZE, 0, 0);
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 42, rc2);
/* minheight > fontsize - has an effect after WM_SIZE */
SendMessage(hwndStatus, SB_SETMINHEIGHT, 60, 0);
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 42, rc2);
SendMessage(hwndStatus, WM_SIZE, 0, 0);
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 62, rc2);
/* font changed to smaller than minheight - has an effect */
SendMessage(hwndStatus, SB_SETMINHEIGHT, 30, 0);
expect_rect(0, 0, 672, 62, rc2);
SendMessage(hwndStatus, WM_SIZE, 0, 0);
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 42, rc2);
hFontSm = CreateFont(9, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Tahoma");
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFontSm, TRUE);
GetClientRect(hwndStatus, &rc2);
expect_rect(0, 0, 672, 32, rc2);
/* test the height formula */
ZeroMemory(&lf, sizeof(lf));
SendMessage(hwndStatus, SB_SETMINHEIGHT, 0, 0);
hdc = GetDC(NULL);
trace("dpi=%d\n", GetDeviceCaps(hdc, LOGPIXELSY));
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)check_height_family_enumproc, (LPARAM)hwndStatus, 0);
ReleaseDC(NULL, hdc);
DestroyWindow(hwndStatus);
DeleteObject(hFont);
DeleteObject(hFontSm);
}
static void test_status_control(void)
{
HWND hWndStatus;
@ -56,7 +236,7 @@ static void test_status_control(void)
hWndStatus = create_status_control(WS_VISIBLE, 0);
/* Divide into parts and set text */
r = SendMessage(hWndStatus, SB_SETPARTS, 3, (long)nParts);
r = SendMessage(hWndStatus, SB_SETPARTS, 3, (LPARAM)nParts);
expect(TRUE,r);
r = SendMessage(hWndStatus, SB_SETTEXT, 0, (LPARAM)"First");
expect(TRUE,r);
@ -87,12 +267,12 @@ static void test_status_control(void)
expect(0,HIWORD(r));
/* Get parts and borders */
r = SendMessage(hWndStatus, SB_GETPARTS, 3, (long)checkParts);
r = SendMessage(hWndStatus, SB_GETPARTS, 3, (LPARAM)checkParts);
ok(r == 3, "Expected 3, got %d\n", r);
expect(50,checkParts[0]);
expect(150,checkParts[1]);
expect(-1,checkParts[2]);
r = SendMessage(hWndStatus, SB_GETBORDERS, 0, (long)borders);
r = SendMessage(hWndStatus, SB_GETBORDERS, 0, (LPARAM)borders);
ok(r == TRUE, "Expected TRUE, got %d\n", r);
expect(0,borders[0]);
expect(2,borders[1]);
@ -128,18 +308,28 @@ static void test_status_control(void)
/* Set background color */
r = SendMessage(hWndStatus, SB_SETBKCOLOR , 0, RGB(255,0,0));
expect(CLR_DEFAULT,r);
ok(r == CLR_DEFAULT ||
broken(r == 0), /* win95 */
"Expected %d, got %d\n", CLR_DEFAULT, r);
r = SendMessage(hWndStatus, SB_SETBKCOLOR , 0, CLR_DEFAULT);
expect(RGB(255,0,0),r);
ok(r == RGB(255,0,0) ||
broken(r == 0), /* win95 */
"Expected %d, got %d\n", RGB(255,0,0), r);
/* Add an icon to the status bar */
hIcon = LoadIcon(NULL, IDI_QUESTION);
r = SendMessage(hWndStatus, SB_SETICON, 1, (LPARAM) NULL);
ok(r != 0, "Expected non-zero, got %d\n", r);
r = SendMessage(hWndStatus, SB_SETICON, 1, 0);
ok(r != 0 ||
broken(r == 0), /* win95 */
"Expected non-zero, got %d\n", r);
r = SendMessage(hWndStatus, SB_SETICON, 1, (LPARAM) hIcon);
ok(r != 0, "Expected non-zero, got %d\n", r);
r = SendMessage(hWndStatus, SB_SETICON, 1, (LPARAM) NULL);
ok(r != 0, "Expected non-zero, got %d\n", r);
ok(r != 0 ||
broken(r == 0), /* win95 */
"Expected non-zero, got %d\n", r);
r = SendMessage(hWndStatus, SB_SETICON, 1, 0);
ok(r != 0 ||
broken(r == 0), /* win95 */
"Expected non-zero, got %d\n", r);
/* Set the Unicode format */
r = SendMessage(hWndStatus, SB_SETUNICODEFORMAT, FALSE, 0);
@ -148,15 +338,17 @@ static void test_status_control(void)
r = SendMessage(hWndStatus, SB_SETUNICODEFORMAT, TRUE, 0);
expect(FALSE,r);
r = SendMessage(hWndStatus, SB_GETUNICODEFORMAT, 0, 0);
expect(TRUE,r);
ok(r == TRUE ||
broken(r == FALSE), /* win95 */
"Expected TRUE, got %d\n", r);
/* Reset number of parts */
r = SendMessage(hWndStatus, SB_SETPARTS, 2, (long)nParts);
r = SendMessage(hWndStatus, SB_SETPARTS, 2, (LPARAM)nParts);
expect(TRUE,r);
/* Set the minimum height and get rectangle information again */
SendMessage(hWndStatus, SB_SETMINHEIGHT, 50, (LPARAM) 0);
r = SendMessage(hWndStatus, WM_SIZE, 0, (LPARAM) 0);
SendMessage(hWndStatus, SB_SETMINHEIGHT, 50, 0);
r = SendMessage(hWndStatus, WM_SIZE, 0, 0);
expect(0,r);
r = SendMessage(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
expect(TRUE,r);
@ -174,14 +366,19 @@ static void test_status_control(void)
todo_wine
{
SendMessage(hWndStatus, SB_SETTIPTEXT, 0,(LPARAM) "Tooltip Text");
lstrcpyA(charArray, "apple");
SendMessage(hWndStatus, SB_GETTIPTEXT, MAKEWPARAM (0, 20),(LPARAM) charArray);
ok(strcmp(charArray,"Tooltip Text") == 0, "Expected Tooltip Text, got %s\n", charArray);
ok(strcmp(charArray,"Tooltip Text") == 0 ||
broken(!strcmp(charArray, "apple")), /* win95 */
"Expected Tooltip Text, got %s\n", charArray);
}
/* Make simple */
SendMessage(hWndStatus, SB_SIMPLE, TRUE, 0);
r = SendMessage(hWndStatus, SB_ISSIMPLE, 0, 0);
expect(TRUE,r);
ok(r == TRUE ||
broken(r == FALSE), /* win95 */
"Expected TRUE, got %d\n", r);
DestroyWindow(hWndStatus);
}
@ -190,7 +387,16 @@ START_TEST(status)
{
hinst = GetModuleHandleA(NULL);
g_hMainWnd = CreateWindowExA(0, "static", "", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
NULL, NULL, GetModuleHandleA(NULL), 0);
InitCommonControls();
register_subclass();
test_status_control();
test_create();
test_height();
}

View file

@ -17,11 +17,11 @@
* 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>
#define _WIN32_WINNT 0x0501 /* For SetWindowSubclass/etc */
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
@ -234,7 +234,7 @@ static void test_subclass(void)
ok_sequence(Sub_AfterDeletedTest, "After Deleted");
pSetWindowSubclass(hwnd, WndProcSub, 2, 0);
origProc3 = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG)WndProc3);
origProc3 = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc3);
SendMessage(hwnd, WM_USER, 1, 0);
SendMessage(hwnd, WM_USER, 2, 0);
ok_sequence(Sub_OldAfterNewTest, "Old after New");

View file

@ -27,7 +27,6 @@
#include "msg.h"
#define DEFAULT_MIN_TAB_WIDTH 54
#define TAB_DEFAULT_WIDTH 96
#define TAB_PADDING_X 6
#define EXTRA_ICON_PADDING 3
#define MAX_TABLEN 32
@ -92,7 +91,7 @@ static const struct message add_tab_to_parent[] = {
{ TCM_INSERTITEMA, sent },
{ TCM_INSERTITEMA, sent },
{ WM_NOTIFYFORMAT, sent|defwinproc },
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc, 0, 0 },
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc|optional, 0, 0 },
{ WM_PARENTNOTIFY, sent|defwinproc },
{ TCM_INSERTITEMA, sent },
{ TCM_INSERTITEMA, sent },
@ -125,7 +124,7 @@ static const struct message add_tab_to_parent_interactive[] = {
static const struct message add_tab_control_parent_seq[] = {
{ WM_NOTIFYFORMAT, sent },
{ WM_QUERYUISTATE, sent|wparam|lparam, 0, 0 },
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
{ 0 }
};
@ -217,10 +216,10 @@ static const struct message getset_item_seq[] = {
};
static const struct message getset_tooltip_seq[] = {
{ WM_NOTIFYFORMAT, sent },
{ WM_QUERYUISTATE, sent|wparam|lparam, 0, 0 },
{ WM_NOTIFYFORMAT, sent|optional },
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_NOTIFYFORMAT, sent },
{ WM_NOTIFYFORMAT, sent|optional },
{ TCM_SETTOOLTIPS, sent|lparam, 0 },
{ TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
{ TCM_SETTOOLTIPS, sent|lparam, 0 },
@ -241,7 +240,7 @@ static const struct message insert_focus_seq[] = {
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
{ TCM_INSERTITEM, sent|wparam, 2 },
{ WM_NOTIFYFORMAT, sent|defwinproc, },
{ WM_QUERYUISTATE, sent|defwinproc, },
{ WM_QUERYUISTATE, sent|defwinproc|optional, },
{ WM_PARENTNOTIFY, sent|defwinproc, },
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
@ -351,7 +350,7 @@ static BOOL registerParentWindowClass(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Tab test parent class";
@ -506,12 +505,16 @@ static void test_tab(INT nMinTabWidth)
SIZE size;
HDC hdc;
HFONT hOldFont;
INT i;
INT i, dpi;
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
/* Get System default MinTabWidth */
if (nMinTabWidth < 0)
nMinTabWidth = SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
hdc = GetDC(hwTab);
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
hOldFont = SelectObject(hdc, (HFONT)SendMessage(hwTab, WM_GETFONT, 0, 0));
GetTextExtentPoint32A(hdc, "Tab 1", strlen("Tab 1"), &size);
trace("Tab1 text size: size.cx=%d size.cy=%d\n", size.cx, size.cy);
@ -519,7 +522,7 @@ static void test_tab(INT nMinTabWidth)
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH tabs no icon...\n");
CheckSize(hwTab, TAB_DEFAULT_WIDTH, -1, "default width");
CheckSize(hwTab, dpi, -1, "default width");
TabCheckSetSize(hwTab, 50, 20, 50, 20, "set size");
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
@ -535,8 +538,11 @@ static void test_tab(INT nMinTabWidth)
hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BUTTONS, TCIF_TEXT|TCIF_IMAGE);
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
hdc = GetDC(hwTab);
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH buttons no icon...\n");
CheckSize(hwTab, TAB_DEFAULT_WIDTH, -1, "default width");
CheckSize(hwTab, dpi, -1, "default width");
TabCheckSetSize(hwTab, 20, 20, 20, 20, "set size 1");
TabCheckSetSize(hwTab, 10, 50, 10, 50, "set size 2");
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
@ -555,8 +561,11 @@ static void test_tab(INT nMinTabWidth)
hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BOTTOM, TCIF_TEXT|TCIF_IMAGE);
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
hdc = GetDC(hwTab);
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...\n");
CheckSize(hwTab, TAB_DEFAULT_WIDTH, -1, "no icon, default width");
CheckSize(hwTab, dpi, -1, "no icon, default width");
TabCheckSetSize(hwTab, 20, 20, 20, 20, "no icon, set size 1");
TabCheckSetSize(hwTab, 10, 50, 10, 50, "no icon, set size 2");
@ -633,6 +642,8 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
RECT rTab;
INT nTabsRetrieved;
INT rowCount;
INT dpi;
HDC hdc;
ok(parent_wnd != NULL, "no parent window!\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@ -655,10 +666,7 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
"Parent after sequence, adding tab control to parent", TRUE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
todo_wine{
expect(DEFAULT_MIN_TAB_WIDTH, (int)SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1));
}
ok_sequence(sequences, TAB_SEQ_INDEX, set_min_tab_width_seq, "Set minTabWidth test sequence", FALSE);
ok(SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0,"TCM_SETMINTABWIDTH returned < 0\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE);
/* Testing GetItemCount */
@ -678,7 +686,11 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
/* Testing GetItemRect */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
ok(SendMessage(hTab, TCM_GETITEMRECT, 0, (LPARAM) &rTab), "GetItemRect failed.\n");
CheckSize(hTab, TAB_DEFAULT_WIDTH, -1 , "Default Width");
hdc = GetDC(hTab);
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hTab, hdc);
CheckSize(hTab, dpi, -1 , "Default Width");
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE);
@ -834,7 +846,7 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
SendMessage(hTab, TCM_SETTOOLTIPS, (LPARAM) toolTip, 0);
ok (toolTip == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
SendMessage(hTab, TCM_SETTOOLTIPS, (LPARAM) NULL, 0);
SendMessage(hTab, TCM_SETTOOLTIPS, 0, 0);
ok (NULL == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE);
@ -844,6 +856,22 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
DestroyWindow(hTab);
}
static void test_adjustrect(HWND parent_wnd)
{
HWND hTab;
INT r;
ok(parent_wnd != NULL, "no parent window!\n");
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, 0, 0);
ok(hTab != NULL, "Failed to create tab control\n");
r = SendMessage(hTab, TCM_ADJUSTRECT, FALSE, 0);
expect(-1, r);
r = SendMessage(hTab, TCM_ADJUSTRECT, TRUE, 0);
expect(-1, r);
}
static void test_insert_focus(HWND parent_wnd)
{
HWND hTab;
@ -989,6 +1017,8 @@ START_TEST(tab)
/* Testing getters and setters with 5 tabs */
test_getters_setters(parent_wnd, 5);
test_adjustrect(parent_wnd);
test_insert_focus(parent_wnd);
test_delete_focus(parent_wnd);

View file

@ -1,4 +1,4 @@
/* Unit tests for treeview.
/* Unit tests for toolbar.
*
* Copyright 2005 Krzysztof Foltman
* Copyright 2007 Mikolaj Zalewski
@ -114,7 +114,7 @@ static void basic_test(void)
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
WS_CHILD | TBSTYLE_LIST,
100,
0, NULL, (UINT)0,
0, NULL, 0,
buttons, sizeof(buttons)/sizeof(buttons[0]),
0, 0, 20, 16, sizeof(TBBUTTON));
ok(hToolbar != NULL, "Toolbar creation\n");
@ -168,7 +168,7 @@ static void rebuild_toolbar(HWND *hToolbar)
*hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
hMainWnd, (HMENU)5, GetModuleHandle(NULL), NULL);
ok(*hToolbar != NULL, "Toolbar creation problem\n");
ok(SendMessage(*hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0) == 0, "TB_BUTTONSTRUCTSIZE failed\n");
ok(SendMessage(*hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0) == 0, "TB_BUTTONSTRUCTSIZE failed\n");
ok(SendMessage(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
ok(SendMessage(*hToolbar, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0)==1, "WM_SETFONT\n");
}
@ -203,6 +203,13 @@ static void rebuild_toolbar_with_buttons(HWND *hToolbar)
ok(SendMessage(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
}
static void add_128x15_bitmap(HWND hToolbar, int nCmds)
{
TBADDBITMAP bmp128;
bmp128.hInst = GetModuleHandle(NULL);
bmp128.nID = IDB_BITMAP_128x15;
ok(SendMessageA(hToolbar, TB_ADDBITMAP, nCmds, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
}
#define CHECK_IMAGELIST(count, dx, dy) { \
int cx, cy; \
@ -711,6 +718,18 @@ static tbsize_result_t tbsize_results[] =
{ 0, 0, 163, 38}, {163, 0, 326, 38}, {326, 0, 489, 38},
{489, 0, 652, 38}, {652, 0, 819, 38}, {819, 0, 850, 38},
}, },
{ {0, 0, 672, 100}, {239, 102}, 3, {
{ 0, 2, 100, 102}, {100, 2, 139, 102}, {139, 2, 239, 102},
}, },
{ {0, 0, 672, 42}, {185, 40}, 3, {
{ 0, 2, 75, 40}, {75, 2, 118, 40}, {118, 2, 185, 40},
}, },
{ {0, 0, 672, 42}, {67, 40}, 1, {
{ 0, 2, 67, 40},
}, },
{ {0, 0, 672, 42}, {67, 41}, 2, {
{ 0, 2, 672, 41}, { 0, 41, 672, 80},
}, },
};
static int tbsize_numtests = 0;
@ -759,6 +778,7 @@ static void test_sizes(void)
{
HWND hToolbar = NULL;
HIMAGELIST himl;
TBBUTTONINFO tbinfo;
int style;
int i;
@ -854,6 +874,18 @@ static void test_sizes(void)
ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 22), "Unexpected button size\n");
SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(16, 15));
ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 21), "Unexpected button size\n");
/* -1 in TB_SETBITMAPSIZE is a special code meaning that the coordinate shouldn't be changed */
add_128x15_bitmap(hToolbar, 16);
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(14, -1)), "TB_SETBITMAPSIZE failed\n");
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(21, 21), "%x");
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(-1, 12)), "TB_SETBITMAPSIZE failed\n");
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(21, 18), "%x");
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(-1, -1)), "TB_SETBITMAPSIZE failed\n");
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(21, 18), "%x");
/* check the imagelist */
InvalidateRect(hToolbar, NULL, TRUE);
UpdateWindow(hToolbar);
CHECK_IMAGELIST(16, 14, 12);
rebuild_toolbar(&hToolbar);
SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"A\0MMMMMMMMMMMMM\0");
@ -924,6 +956,46 @@ static void test_sizes(void)
SendMessageA(hToolbar, TB_DELETEBUTTON, 0, 0);
ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(27, 39), "Unexpected button size\n");
rebuild_toolbar(&hToolbar);
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(32, 32)) == 1, "TB_SETBITMAPSIZE failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(100, 100)) == 1, "TB_SETBUTTONSIZE failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons2[0]) == 1, "TB_ADDBUTTONS failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[2]) == 1, "TB_ADDBUTTONS failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[0]) == 1, "TB_ADDBUTTONS failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 );
check_sizes();
rebuild_toolbar(&hToolbar);
SetWindowLong(hToolbar, GWL_STYLE, TBSTYLE_LIST | GetWindowLong(hToolbar, GWL_STYLE));
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(32, 32)) == 1, "TB_SETBITMAPSIZE failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(100, 100)) == 1, "TB_SETBUTTONSIZE failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons2[0]) == 1, "TB_ADDBUTTONS failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[2]) == 1, "TB_ADDBUTTONS failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 );
check_sizes_todo(0xff);
rebuild_toolbar(&hToolbar);
SetWindowLong(hToolbar, GWL_STYLE, TBSTYLE_LIST | GetWindowLong(hToolbar, GWL_STYLE));
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(32, 32)) == 1, "TB_SETBITMAPSIZE failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(100, 100)) == 1, "TB_SETBUTTONSIZE failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 );
check_sizes();
rebuild_toolbar(&hToolbar);
SetWindowLong(hToolbar, GWL_STYLE, TBSTYLE_WRAPABLE | GetWindowLong(hToolbar, GWL_STYLE));
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n");
ok(SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n");
tbinfo.cx = 672;
tbinfo.cbSize = sizeof(TBBUTTONINFO);
tbinfo.dwMask = TBIF_SIZE | TBIF_BYINDEX;
ok(SendMessageA(hToolbar, TB_SETBUTTONINFO, 0, (LPARAM)&tbinfo) != 0, "TB_SETBUTTONINFO failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONINFO, 1, (LPARAM)&tbinfo) != 0, "TB_SETBUTTONINFO failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0);
check_sizes();
DestroyWindow(hToolbar);
}
@ -1065,7 +1137,7 @@ static void test_setrows(void)
WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD | CCS_NORESIZE | CCS_NOPARENTALIGN
| CCS_NOMOVEY | CCS_TOP,
0,
0, NULL, (UINT)0,
0, NULL, 0,
buttons, sizeof(buttons)/sizeof(buttons[0]),
20, 20, 0, 0, sizeof(TBBUTTON));
ok(hToolbar != NULL, "Toolbar creation\n");
@ -1079,7 +1151,7 @@ static void test_setrows(void)
memset(&rc, 0xCC, sizeof(rc));
SendMessageA(hToolbar, TB_SETROWS,
MAKELONG(tbrows_results[i].nRows, tbrows_results[i].bLarger),
(LONG) &rc);
(LPARAM) &rc);
rows = SendMessageA(hToolbar, TB_GETROWS, MAKELONG(0,0), MAKELONG(0,0));
ok(rows == tbrows_results[i].expectedRows,
@ -1102,15 +1174,15 @@ static void test_getstring(void)
hToolbar = CreateWindowExA(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hMainWnd, (HMENU)5, GetModuleHandle(NULL), NULL);
ok(hToolbar != NULL, "Toolbar creation problem\n");
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), (LPARAM)NULL);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), 0);
expect(-1, r);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), (LPARAM)NULL);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0);
expect(-1, r);
r = SendMessage(hToolbar, TB_ADDSTRING, 0, (LPARAM)answer);
expect(0, r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), (LPARAM)NULL);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), 0);
expect(lstrlenA(answer), r);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), (LPARAM)NULL);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0);
expect(lstrlenA(answer), r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(sizeof(str), 0), (LPARAM)str);
expect(lstrlenA(answer), r);

View file

@ -101,8 +101,8 @@ static LRESULT CALLBACK CustomDrawWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
case WM_NOTIFY:
if (((NMHDR *)lParam)->code == NM_CUSTOMDRAW) {
NMTTCUSTOMDRAW *ttcd = (NMTTCUSTOMDRAW*) lParam;
ok(ttcd->nmcd.hdr.hwndFrom == g_hwnd, "Unexpected hwnd source %x (%x)\n",
(int)ttcd->nmcd.hdr.hwndFrom, (int) g_hwnd);
ok(ttcd->nmcd.hdr.hwndFrom == g_hwnd, "Unexpected hwnd source %p (%p)\n",
ttcd->nmcd.hdr.hwndFrom, g_hwnd);
ok(ttcd->nmcd.hdr.idFrom == 0x1234ABCD, "Unexpected id %x\n", (int)ttcd->nmcd.hdr.idFrom);
switch (ttcd->nmcd.dwDrawStage) {
@ -205,7 +205,7 @@ static void test_customdraw(void) {
toolInfo.hwnd = parent;
toolInfo.hinst = GetModuleHandleA(NULL);
toolInfo.uFlags = TTF_SUBCLASS;
toolInfo.uId = (UINT_PTR)0x1234ABCD;
toolInfo.uId = 0x1234ABCD;
toolInfo.lpszText = (LPSTR)"This is a test tooltip";
toolInfo.lParam = 0xdeadbeef;
GetClientRect (parent, &toolInfo.rect);
@ -213,7 +213,7 @@ static void test_customdraw(void) {
ok(lResult, "Adding the tool to the tooltip failed\n");
/* Make tooltip appear quickly */
SendMessage(hwndTip, TTM_SETDELAYTIME, (WPARAM)TTDT_INITIAL, (LPARAM)MAKELONG(1,0));
SendMessage(hwndTip, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELPARAM(1,0));
/* Put cursor inside window, tooltip will appear immediately */
SetCursorPos(100, 100);
@ -232,10 +232,79 @@ static void test_customdraw(void) {
}
static void test_gettext(void)
{
HWND hwnd;
TTTOOLINFOA toolinfoA;
TTTOOLINFOW toolinfoW;
LRESULT r;
char bufA[10] = "";
WCHAR bufW[10] = { 0 };
/* For bug 14790 - lpszText is NULL */
hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
10, 10, 300, 100,
NULL, NULL, NULL, 0);
assert(hwnd);
toolinfoA.cbSize = sizeof(TTTOOLINFOA);
toolinfoA.hwnd = NULL;
toolinfoA.hinst = GetModuleHandleA(NULL);
toolinfoA.uFlags = 0;
toolinfoA.uId = 0x1234ABCD;
toolinfoA.lpszText = NULL;
toolinfoA.lParam = 0xdeadbeef;
GetClientRect(hwnd, &toolinfoA.rect);
r = SendMessageA(hwnd, TTM_ADDTOOL, 0, (LPARAM)&toolinfoA);
ok(r, "Adding the tool to the tooltip failed\n");
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");
}
DestroyWindow(hwnd);
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;
}
assert(hwnd);
toolinfoW.cbSize = sizeof(TTTOOLINFOW);
toolinfoW.hwnd = NULL;
toolinfoW.hinst = GetModuleHandleA(NULL);
toolinfoW.uFlags = 0;
toolinfoW.uId = 0x1234ABCD;
toolinfoW.lpszText = NULL;
toolinfoW.lParam = 0xdeadbeef;
GetClientRect(hwnd, &toolinfoW.rect);
r = SendMessageW(hwnd, TTM_ADDTOOL, 0, (LPARAM)&toolinfoW);
ok(r, "Adding the tool to the tooltip failed\n");
toolinfoW.hwnd = NULL;
toolinfoW.uId = 0x1234ABCD;
toolinfoW.lpszText = bufW;
SendMessageW(hwnd, TTM_GETTEXTW, 0, (LPARAM)&toolinfoW);
ok(toolinfoW.lpszText[0] == 0, "lpszText should be an empty string\n");
DestroyWindow(hwnd);
}
START_TEST(tooltips)
{
InitCommonControls();
test_create_tooltip();
test_customdraw();
test_gettext();
}

View file

@ -40,6 +40,7 @@ static const struct message create_parent_wnd_seq[] = {
{ WM_CREATE, sent },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
@ -65,7 +66,7 @@ static const struct message parent_empty_test_seq[] = {
static const struct message parent_create_trackbar_wnd_seq[] = {
{ WM_NOTIFYFORMAT, sent},
{ 0x0129, sent}, /* should be WM_QUERYUISTATE instead of 0x0129 */
{ WM_QUERYUISTATE, sent|optional},
{ WM_WINDOWPOSCHANGING, sent},
{ WM_NCACTIVATE, sent},
{ PBT_APMRESUMECRITICAL, sent},
@ -79,6 +80,7 @@ static const struct message parent_create_trackbar_wnd_seq[] = {
};
static const struct message parent_new_window_test_seq[] = {
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent},
{ WM_NCACTIVATE, sent},
{ PBT_APMRESUMECRITICAL, sent},
@ -86,7 +88,7 @@ static const struct message parent_new_window_test_seq[] = {
{ WM_IME_NOTIFY, sent|defwinproc|optional},
{ WM_SETFOCUS, sent|defwinproc},
{ WM_NOTIFYFORMAT, sent},
{ 0x0129, sent}, /* should be WM_QUERYUISTATE instead of 0x0129*/
{ WM_QUERYUISTATE, sent|optional},
{0}
};
@ -139,11 +141,13 @@ static const struct message position_test_seq[] = {
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
{ WM_PAINT, sent|defwinproc},
{ TBM_GETPOS, sent},
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 1000},
{ WM_PAINT, sent|defwinproc},
{ TBM_GETPOS, sent},
{ TBM_SETPOS, sent|wparam|lparam, FALSE, 20},
{ TBM_GETPOS, sent},
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 20},
{ TBM_GETPOS, sent},
{0}
};
@ -331,10 +335,10 @@ static const struct message parent_thumb_length_test_seq[] = {
static const struct message tic_placement_test_seq[] = {
{ TBM_GETPTICS, sent},
{ TBM_GETTIC, sent|wparam, 0},
{ TBM_GETTIC, sent|wparam, 2},
{ TBM_GETTIC, sent|wparam, 4},
{ TBM_GETTIC, sent|wparam, 11},
{ TBM_GETTICPOS, sent|wparam, 0},
{ TBM_GETTICPOS, sent|wparam, 4},
{ TBM_GETTICPOS, sent|wparam, 2},
{0}
};
@ -392,8 +396,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
LRESULT ret;
struct message msg;
/* do not log painting messages */
if (message != WM_PAINT &&
/* log system messages, except for painting */
if (message < WM_USER &&
message != WM_PAINT &&
message != WM_ERASEBKGND &&
message != WM_NCPAINT &&
message != WM_NCHITTEST &&
@ -401,6 +406,8 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
message != WM_GETICON &&
message != WM_DEVICECHANGE)
{
trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
msg.message = message;
msg.flags = sent|wparam|lparam;
if (defwndproc_counter) msg.flags |= defwinproc;
@ -425,7 +432,7 @@ static BOOL register_parent_wnd_class(void){
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Trackbar test parent class";
@ -450,6 +457,8 @@ static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
LRESULT ret;
struct message msg;
trace("trackbar: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
msg.message = message;
msg.flags = sent|wparam|lparam;
if (defwndproc_counter) msg.flags |= defwinproc;
@ -598,12 +607,14 @@ static void test_position(HWND hWndTrackbar){
SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 5);
r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
expect(5, r);
SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 5);
SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 1000);
r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
expect(100, r);
SendMessage(hWndTrackbar, TBM_SETPOS, FALSE, 20);
r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
expect(20, r);
SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 20);
/* test TBM_GETPOS */
r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
@ -799,34 +810,37 @@ static void test_tic_settings(HWND hWndTrackbar){
static void test_tic_placement(HWND hWndTrackbar){
int r;
DWORD *rPTics;
DWORD numtics;
SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(1, 6));
SendMessage(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
numtics = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
ok(numtics == 6, "Expected 6, got %d\n", numtics);
flush_sequences(sequences, NUM_MSG_SEQUENCE);
/* test TBM_GETPTICS */
rPTics = (DWORD *) SendMessage(hWndTrackbar, TBM_GETPTICS, 0,0);
todo_wine{
expect(1, rPTics[0]);
expect(2, rPTics[1]);
expect(3, rPTics[2]);
expect(4, rPTics[3]);
}
expect(2, rPTics[0]);
expect(3, rPTics[1]);
expect(4, rPTics[2]);
expect(5, rPTics[3]);
/* test TBM_GETTIC */
r = SendMessage(hWndTrackbar, TBM_GETTIC, 0,0);
expect(2, r);
r = SendMessage(hWndTrackbar, TBM_GETTIC, 2,0);
expect(4, r);
r = SendMessage(hWndTrackbar, TBM_GETTIC, 4,0);
todo_wine{
expect(1, r);
r = SendMessage(hWndTrackbar, TBM_GETTIC, 4,0);
expect(5, r);
expect(-1, r);
}
r = SendMessage(hWndTrackbar, TBM_GETTIC, 11,0);
expect(-1, r);
/* test TBM_GETTICPIC */
r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 0, 0);
todo_wine{
ok(r > 0, "Expected r > 0, got %d\n", r);
r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 4, 0);
ok(r > 0, "Expected r > 0, got %d\n", r);
}
ok(r > 0, "Expected r > 0, got %d\n", r);
r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 2, 0);
ok(r > 0, "Expected r > 0, got %d\n", r);
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_placement_test_seq, "get tic placement test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent get tic placement test sequence", FALSE);
@ -861,7 +875,7 @@ static void test_tool_tips(HWND hWndTrackbar){
SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 0);
rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
ok(rTest == hWndTooltip, "Expected hWndToolTip, got\n");
SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) NULL, 0);
SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, 0, 0);
rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
ok(rTest == NULL, "Expected NULL\n");
SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 5);

View file

@ -64,6 +64,13 @@ static const struct message DoTest2Seq[] = {
{ 0 }
};
static const struct message DoTest3Seq[] = {
{ TVM_INSERTITEM, sent },
{ TVM_GETITEM, sent },
{ TVM_DELETEITEM, sent },
{ 0 }
};
static const struct message DoFocusTestSeq[] = {
{ TVM_INSERTITEM, sent },
{ TVM_INSERTITEM, sent },
@ -75,10 +82,10 @@ static const struct message DoFocusTestSeq[] = {
{ WM_NCCALCSIZE, sent|wparam, 0x00000001 },
{ WM_WINDOWPOSCHANGED, sent },
{ WM_SIZE, sent|defwinproc },
{ WM_WINDOWPOSCHANGING, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam|defwinproc, 0x00000001 },
{ WM_WINDOWPOSCHANGED, sent|defwinproc },
{ WM_SIZE, sent|defwinproc },
{ WM_WINDOWPOSCHANGING, sent|defwinproc|optional },
{ WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 0x00000001 },
{ WM_WINDOWPOSCHANGED, sent|defwinproc|optional },
{ WM_SIZE, sent|defwinproc|optional },
{ TVM_SELECTITEM, sent|wparam, 0x00000009 },
/* The following end up out of order in wine */
{ WM_PAINT, sent|defwinproc },
@ -104,7 +111,7 @@ static const struct message TestGetSetBkColorSeq[] = {
{ TVM_GETBKCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETBKCOLOR, sent|wparam|lparam, 0x00000000, 0x00ffffff },
{ TVM_GETBKCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETBKCOLOR, sent|wparam|lparam, 0x00000000, 0xffffffff },
{ TVM_SETBKCOLOR, sent|wparam|lparam, 0x00000000, -1 },
{ 0 }
};
@ -139,11 +146,11 @@ static const struct message TestGetSetItemSeq[] = {
static const struct message TestGetSetItemHeightSeq[] = {
{ TVM_GETITEMHEIGHT, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETITEMHEIGHT, sent|wparam|lparam, 0xffffffff, 0x00000000 },
{ TVM_SETITEMHEIGHT, sent|wparam|lparam, -1, 0x00000000 },
{ TVM_GETITEMHEIGHT, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETITEMHEIGHT, sent|lparam, 0xcccccccc, 0x00000000 },
{ TVM_GETITEMHEIGHT, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETITEMHEIGHT, sent|wparam|lparam, 0x00000009, 0x00000000 },
{ TVM_GETITEMHEIGHT, sent|wparam|lparam|optional, 0x00000000, 0x00000000 },
{ TVM_SETITEMHEIGHT, sent|wparam|lparam|optional, 0x00000009, 0x00000000 },
{ WM_WINDOWPOSCHANGING, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam|defwinproc, 0x00000001 },
{ WM_WINDOWPOSCHANGED, sent|defwinproc },
@ -164,7 +171,7 @@ static const struct message TestGetSetTextColorSeq[] = {
{ TVM_GETTEXTCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETTEXTCOLOR, sent|wparam|lparam, 0x00000000, 0x00ffffff },
{ TVM_GETTEXTCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ TVM_SETTEXTCOLOR, sent|wparam|lparam, 0x00000000, 0xffffffff },
{ TVM_SETTEXTCOLOR, sent|wparam|lparam, 0x00000000, -1 },
{ 0 }
};
@ -295,6 +302,35 @@ static void DoTest2(void)
ok(!strcmp(sequence, "1(nR)nR23(RC)RC45(CR)CR."), "root-child select test\n");
}
static void DoTest3(void)
{
TVINSERTSTRUCTA ins;
HTREEITEM hChild;
TVITEM tvi;
int nBufferSize = 80;
CHAR szBuffer[80] = "Blah";
/* add an item without TVIF_TEXT mask and pszText == NULL */
ins.hParent = hRoot;
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = 0;
U(ins).item.pszText = NULL;
U(ins).item.cchTextMax = 0;
hChild = TreeView_InsertItem(hTree, &ins);
assert(hChild);
/* retrieve it with TVIF_TEXT mask */
tvi.hItem = hChild;
tvi.mask = TVIF_TEXT;
tvi.cchTextMax = nBufferSize;
tvi.pszText = szBuffer;
SendMessageA( hTree, TVM_GETITEM, 0, (LPARAM)&tvi );
ok(!strcmp(szBuffer, ""), "szBuffer=\"%s\", expected \"\"\n", szBuffer);
ok(SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild), "DeleteItem failed\n");
}
static void DoFocusTest(void)
{
TVINSERTSTRUCTA ins;
@ -699,6 +735,10 @@ START_TEST(treeview)
DoTest2();
ok_sequence(MsgSequences, LISTVIEW_SEQ_INDEX, DoTest2Seq, "DoTest2", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoTest3();
ok_sequence(MsgSequences, LISTVIEW_SEQ_INDEX, DoTest3Seq, "DoTest3", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoFocusTest();
ok_sequence(MsgSequences, LISTVIEW_SEQ_INDEX, DoFocusTestSeq, "DoFocusTest", TRUE);

View file

@ -70,6 +70,7 @@ static const struct message create_parent_wnd_seq[] = {
{ WM_CREATE, sent },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
@ -100,7 +101,7 @@ static const struct message add_updown_with_edit_seq[] = {
static const struct message add_updown_to_parent_seq[] = {
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
{ WM_QUERYUISTATE, sent },
{ WM_QUERYUISTATE, sent|optional },
{ WM_PARENTNOTIFY, sent|wparam, MAKELONG(WM_CREATE, WM_CREATE) },
{ 0 }
};
@ -196,8 +197,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
LRESULT ret;
struct message msg;
/* do not log painting messages */
if (message != WM_PAINT &&
/* log system messages, except for painting */
if (message < WM_USER &&
message != WM_PAINT &&
message != WM_ERASEBKGND &&
message != WM_NCPAINT &&
message != WM_NCHITTEST &&
@ -232,7 +234,7 @@ static BOOL register_parent_wnd_class(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "Up-Down test parent class";