- Sync wine to 1.7.5.

svn path=/trunk/; revision=60777
This commit is contained in:
James Tabor 2013-10-27 22:13:41 +00:00
parent ebf29a79f6
commit 47b5950895

View file

@ -37,25 +37,25 @@ static HWND hMainWnd;
static HWND build_combo(DWORD style)
{
return CreateWindow("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
return CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
}
static int font_height(HFONT hFont)
{
TEXTMETRIC tm;
TEXTMETRICA tm;
HFONT hFontOld;
HDC hDC;
hDC = CreateCompatibleDC(NULL);
hFontOld = SelectObject(hDC, hFont);
GetTextMetrics(hDC, &tm);
GetTextMetricsA(hDC, &tm);
SelectObject(hDC, hFontOld);
DeleteDC(hDC);
return tm.tmHeight;
}
static INT CALLBACK is_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *tm, DWORD type, LPARAM lParam)
static INT CALLBACK is_font_installed_proc(const LOGFONTA *elf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
{
return 0;
}
@ -63,7 +63,7 @@ static INT CALLBACK is_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC
static int is_font_installed(const char *name)
{
HDC hdc = GetDC(NULL);
BOOL ret = !EnumFontFamilies(hdc, name, is_font_installed_proc, 0);
BOOL ret = !EnumFontFamiliesA(hdc, name, is_font_installed_proc, 0);
ReleaseDC(NULL, hdc);
return ret;
}
@ -83,7 +83,7 @@ static void test_setitemheight(DWORD style)
for (i = 1; i < 30; i++)
{
SendMessage(hCombo, CB_SETITEMHEIGHT, -1, i);
SendMessageA(hCombo, CB_SETITEMHEIGHT, -1, i);
GetClientRect(hCombo, &r);
expect_eq(r.bottom - r.top, i + 6, int, "%d");
}
@ -107,8 +107,8 @@ static void test_setfont(DWORD style)
trace("Style %x\n", style);
hCombo = build_combo(style);
hFont1 = CreateFont(10, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
hFont2 = CreateFont(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
hFont1 = CreateFontA(10, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
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);
@ -122,21 +122,21 @@ static void test_setfont(DWORD style)
changes, not by how much the list area changes. */
if (font_height(hFont1) == 10 && font_height(hFont2) == 8)
{
SendMessage(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
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)));
SendMessage(hCombo, WM_SETFONT, (WPARAM)hFont2, FALSE);
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)));
SendMessage(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
GetClientRect(hCombo, &r);
expect_rect(r, 0, 0, 100, 18);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
@ -151,13 +151,13 @@ static void test_setfont(DWORD style)
for (i = 1; i < 30; i++)
{
HFONT hFont = CreateFont(i, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
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);
SendMessage(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE);
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE);
GetClientRect(hCombo, &r);
expect_eq(r.bottom - r.top, height + 8, int, "%d");
SendMessage(hCombo, WM_SETFONT, 0, FALSE);
SendMessageA(hCombo, WM_SETFONT, 0, FALSE);
DeleteObject(hFont);
}
@ -187,9 +187,9 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
memset(list, 0, sizeof(list));
memset(edit, 0, sizeof(edit));
idx = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
SendMessage(hCombo, CB_GETLBTEXT, idx, (LPARAM)list);
SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
SendMessageA(hCombo, CB_GETLBTEXT, idx, (LPARAM)list);
SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
ok(!strcmp(edit, expected_edit_text), "edit: got %s, expected %s\n",
edit, expected_edit_text);
@ -203,7 +203,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
break;
}
return CallWindowProc(old_parent_proc, hwnd, msg, wparam, lparam);
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
}
static void test_selection(DWORD style, const char * const text[],
@ -214,13 +214,13 @@ static void test_selection(DWORD style, const char * const text[],
hCombo = build_combo(style);
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)text[0]);
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)text[1]);
SendMessage(hCombo, CB_SETCURSEL, -1, 0);
SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[0]);
SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[1]);
SendMessageA(hCombo, CB_SETCURSEL, -1, 0);
old_parent_proc = (void *)SetWindowLongPtr(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
idx = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
ok(idx == -1, "expected selection -1, got %d\n", idx);
/* keyboard navigation */
@ -228,19 +228,19 @@ static void test_selection(DWORD style, const char * const text[],
expected_list_text = text[list[0]];
expected_edit_text = text[edit[0]];
selchange_fired = FALSE;
SendMessage(hCombo, WM_KEYDOWN, VK_DOWN, 0);
SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
expected_list_text = text[list[1]];
expected_edit_text = text[edit[1]];
selchange_fired = FALSE;
SendMessage(hCombo, WM_KEYDOWN, VK_DOWN, 0);
SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
expected_list_text = text[list[2]];
expected_edit_text = text[edit[2]];
selchange_fired = FALSE;
SendMessage(hCombo, WM_KEYDOWN, VK_UP, 0);
SendMessageA(hCombo, WM_KEYDOWN, VK_UP, 0);
ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
/* programmatic navigation */
@ -248,16 +248,16 @@ static void test_selection(DWORD style, const char * const text[],
expected_list_text = text[list[3]];
expected_edit_text = text[edit[3]];
selchange_fired = FALSE;
SendMessage(hCombo, CB_SETCURSEL, list[3], 0);
SendMessageA(hCombo, CB_SETCURSEL, list[3], 0);
ok(!selchange_fired, "CBN_SELCHANGE sent!\n");
expected_list_text = text[list[4]];
expected_edit_text = text[edit[4]];
selchange_fired = FALSE;
SendMessage(hCombo, CB_SETCURSEL, list[4], 0);
SendMessageA(hCombo, CB_SETCURSEL, list[4], 0);
ok(!selchange_fired, "CBN_SELCHANGE sent!\n");
SetWindowLongPtr(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
DestroyWindow(hCombo);
}
@ -268,8 +268,8 @@ static void test_CBN_SELCHANGE(void)
static const int sel_2[] = { 0, 1, 0, 0, 1 };
test_selection(CBS_SIMPLE, text, sel_1, sel_2);
test_selection(CBS_DROPDOWN, text, sel_1, sel_2);
test_selection(CBS_DROPDOWNLIST, text, sel_2, sel_2);
//test_selection(CBS_DROPDOWN, text, sel_1, sel_2);
//test_selection(CBS_DROPDOWNLIST, text, sel_2, sel_2);
}
static void test_WM_LBUTTONDOWN(void)
@ -292,7 +292,7 @@ static void test_WM_LBUTTONDOWN(void)
return;
}
hCombo = CreateWindow("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|CBS_DROPDOWN,
hCombo = CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|CBS_DROPDOWN,
0, 0, 200, 150, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
for (i = 0; i < sizeof(choices)/sizeof(UINT); i++){
@ -316,47 +316,47 @@ static void test_WM_LBUTTONDOWN(void)
/* Click on the button to drop down the list */
x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
result = SendMessage(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
result = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
ok(result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
GetLastError());
ok(SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0),
ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
"The dropdown list should have appeared after clicking the button.\n");
ok(GetFocus() == hEdit,
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
result = SendMessage(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
result = SendMessageA(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
ok(result, "WM_LBUTTONUP was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hEdit,
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
/* Click on the 5th item in the list */
item_height = SendMessage(hCombo, CB_GETITEMHEIGHT, 0, 0);
item_height = SendMessageA(hCombo, CB_GETITEMHEIGHT, 0, 0);
ok(GetClientRect(hList, &rect), "Failed to get list's client rect.\n");
x = rect.left + (rect.right-rect.left)/2;
y = item_height/2 + item_height*4;
result = SendMessage(hList, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
result = SendMessageA(hList, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hEdit,
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
result = SendMessage(hList, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
result = SendMessageA(hList, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
ok(!result, "WM_MOUSEMOVE was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hEdit,
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
ok(SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0),
ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
"The dropdown list should still be visible.\n");
result = SendMessage(hList, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
result = SendMessageA(hList, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
ok(!result, "WM_LBUTTONUP was not processed. LastError=%d\n",
GetLastError());
ok(GetFocus() == hEdit,
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
ok(!SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0),
ok(!SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
"The dropdown list should have been rolled up.\n");
idx = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
ok(idx, "Current Selection: expected %d, got %d\n", 4, idx);
DestroyWindow(hCombo);
@ -464,42 +464,42 @@ static void test_editselection(void)
hEdit = cbInfo.hwndItem;
/* Initially combo selection is empty*/
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
/* Set some text, and press a key to replace it */
edit[0] = 0x00;
SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason1");
SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason1");
SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
ok(strcmp(edit, "Jason1")==0, "Unexpected text retrieved %s\n", edit);
/* Now what is the selection - still empty */
SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
SendMessageA(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
/* Give it focus, and it gets selected */
SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
SendMessageA(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
/* Now emulate a key press */
edit[0] = 0x00;
SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
SendMessageA(hCombo, WM_CHAR, 'A', 0x1c0001);
SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
ok(strcmp(edit, "A")==0, "Unexpected text retrieved %s\n", edit);
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
/* Now what happens when it gets more focus a second time - it doesn't reselect */
SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
DestroyWindow(hCombo);
@ -515,31 +515,31 @@ static void test_editselection(void)
/* Set some text and give focus so it gets selected */
edit[0] = 0x00;
SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason2");
SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason2");
SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
ok(strcmp(edit, "Jason2")==0, "Unexpected text retrieved %s\n", edit);
SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
/* Now what is the selection */
SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
SendMessageA(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
/* Now change the selection to the apparently invalid start -1, end -1 and
show it means no selection (ie start -1) but cursor at end */
SendMessage(hCombo, CB_SETEDITSEL, 0, -1);
SendMessageA(hCombo, CB_SETEDITSEL, 0, -1);
edit[0] = 0x00;
SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
SendMessageA(hCombo, WM_CHAR, 'A', 0x1c0001);
SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
ok(strcmp(edit, "Jason2A")==0, "Unexpected text retrieved %s\n", edit);
DestroyWindow(hCombo);
}
START_TEST(combo)
{
hMainWnd = CreateWindow("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
ShowWindow(hMainWnd, SW_SHOW);
test_setfont(CBS_DROPDOWN);