25#define WIN32_LEAN_AND_MEAN
35#define COMBO_YBORDERSIZE() 2
39#define expect_eq(expr, value, type, fmt); { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }
40#define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \
41 r.bottom == _bottom && r.right == _right, "Invalid rect %s vs (%d,%d)-(%d,%d)\n", \
42 wine_dbgstr_rect(&r), _left, _top, _right, _bottom);
46 return CreateWindowA(
"ComboBox",
"Combo",
WS_VISIBLE|
WS_CHILD|
style, 5, 5, 100, 100,
hMainWnd, (
HMENU)
COMBO_ID,
NULL, 0);
91 for (
i = 1;
i < 30;
i++)
108 ok(
height == font_height / 2,
"Unexpected item height %d, expected %d.\n",
height, font_height / 2);
112 ok(
height > font_height,
"Unexpected item height %d, font height %d.\n",
height, font_height);
120 HFONT hFont1, hFont2;
126 skip(
"Marlett font not available\n");
133 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");
134 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");
171 ok(0,
"Expected Marlett font heights 10/8, got %d/%d\n",
175 for (
i = 1;
i < 30;
i++)
177 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");
210 char list[20], edit[20];
213 memset(edit, 0,
sizeof(edit));
249 const int *edit,
const int *
list)
263 ok(
idx == -1,
"expected selection -1, got %d\n",
idx);
305 static const char *
const text[] = {
"alpha",
"beta",
"" };
306 static const int sel_1[] = { 2, 0, 1, 0, 1 };
307 static const int sel_2[] = { 0, 1, 0, 0, 1 };
323 static const UINT choices[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
334 "Failed to add item %d\n",
i);
340 ok(
ret,
"Failed to get combobox info structure. LastError=%ld\n",
352 ok(
result,
"WM_LBUTTONDOWN was not processed. LastError=%ld\n",
355 "The dropdown list should have appeared after clicking the button.\n");
358 "Focus not on ComboBox's Edit Control, instead on %p\n",
GetFocus());
360 ok(
result,
"WM_LBUTTONUP was not processed. LastError=%ld\n",
363 "Focus not on ComboBox's Edit Control, instead on %p\n",
GetFocus());
369 y = item_height/2 + item_height*4;
371 ok(!
result,
"WM_LBUTTONDOWN was not processed. LastError=%ld\n",
374 "Focus not on ComboBox's Edit Control, instead on %p\n",
GetFocus());
377 ok(!
result,
"WM_MOUSEMOVE was not processed. LastError=%ld\n",
380 "Focus not on ComboBox's Edit Control, instead on %p\n",
GetFocus());
382 "The dropdown list should still be visible.\n");
385 ok(!
result,
"WM_LBUTTONUP was not processed. LastError=%ld\n",
388 "Focus not on ComboBox's Edit Control, instead on %p\n",
GetFocus());
390 "The dropdown list should have been rolled up.\n");
392 ok(
idx,
"Current Selection: expected %d, got %d\n", 4,
idx);
401 INT ddheight, clheight, ddwidth, clwidth;
413 ok( rc.
right - rc.
left == clwidth - 2,
"clientrect width is %ld vs %d\n",
415 ok( rc.
bottom - rc.
top == clheight,
"clientrect height is %ld vs %d\n",
418 ok( rc.
right - rc.
left == clwidth - 2,
"drop-down rect width is %ld vs %d\n",
420 ok( rc.
bottom - rc.
top == ddheight,
"drop-down rect height is %ld vs %d\n",
422 ok( rc.
right - rc.
left == ddwidth -2,
"drop-down rect width is %ld vs %d\n",
427 ok( rc.
right - rc.
left == clwidth + 2,
"clientrect width is %ld vs %d\n",
429 ok( rc.
bottom - rc.
top == clheight,
"clientrect height is %ld vs %d\n",
432 ok( rc.
right - rc.
left == clwidth + 2,
"drop-down rect width is %ld vs %d\n",
435 ok( rc.
bottom - rc.
top == clheight + 2,
"drop-down rect height is %ld vs %d\n",
440 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
442 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
445 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
447 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
450 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
452 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
455 ok( ddwidth == (clwidth << 1),
"drop-width is %d vs %d\n", ddwidth, clwidth << 1);
457 ok( ddwidth == (clwidth << 1),
"drop-width is %d vs %d\n", ddwidth, clwidth << 1);
460 ok( ddwidth == (clwidth << 1),
"drop-width is %d vs %d\n", ddwidth, clwidth << 1);
462 ok( ddwidth == (clwidth << 1),
"drop-width is %d vs %d\n", ddwidth, clwidth << 1);
465 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
467 ok( ddwidth == clwidth + 2,
"drop-width is %d vs %d\n", ddwidth, clwidth + 2);
487 ok(
ret,
"Failed to get combobox info structure. LastError=%ld\n",
500 ok(
strcmp(edit,
"Jason1")==0,
"Unexpected text retrieved %s\n", edit);
504 ok(
start==0,
"Unexpected start position for selection %d\n",
start);
505 ok(
end==0,
"Unexpected end position for selection %d\n",
end);
513 ok(
start==0,
"Unexpected start position for selection %d\n",
start);
514 ok(
end==6,
"Unexpected end position for selection %d\n",
end);
523 ok(
strcmp(edit,
"A")==0,
"Unexpected text retrieved %s\n", edit);
541 ok(
ret,
"Failed to get combobox info structure. LastError=%ld\n",
549 ok(
strcmp(edit,
"Jason2")==0,
"Unexpected text retrieved %s\n", edit);
555 ok(
start==0,
"Unexpected start position for selection %d\n",
start);
556 ok(
end==6,
"Unexpected end position for selection %d\n",
end);
567 ok(
strcmp(edit,
"Jason2A")==0,
"Unexpected text retrieved %s\n", edit);
620 ok(
ret,
"Failed to get COMBOBOXINFO structure; LastError: %lu\n",
GetLastError());
640 ok(
GetFocus() == hButton,
"hButton should have keyboard focus\n");
655 ok(
GetFocus() == hButton,
"hButton should have keyboard focus\n");
687 ok(
ret,
"Failed to get combobox info structure.\n");
692 ok(exstyle == expect_exstyle,
"%08lx: got %08lx\n", cb_style, exstyle);
701 ok(exstyle == expect_exstyle,
"%08lx: got %08lx\n", cb_style, exstyle);
707 ok(exstyle == expect_exstyle,
"%08lx: got %08lx\n", cb_style, exstyle);
721 static const struct list_size_info
750 const struct list_size_info *info_test = &info_height[
test];
753 int expected_count_list;
754 int expected_height_list;
755 int list_height_nonclient;
756 int list_height_calculated;
757 RECT rect_list_client, rect_list_complete;
765 ok(
ret,
"Failed to get COMBOBOXINFO structure; LastError: %lu\n",
GetLastError());
768 for (
i = 0;
i < info_test->num_items;
i++)
775 ok(
ret,
"WM_LBUTTONDOWN was not processed. LastError=%ld\n",
778 "The dropdown list should have appeared after clicking the button.\n");
782 height_list = rect_list_client.
bottom - rect_list_client.
top;
785 list_height_nonclient = (rect_list_complete.
bottom - rect_list_complete.
top)
786 - (rect_list_client.
bottom - rect_list_client.
top);
789 list_height_calculated = info_test->height_combo
791 - list_height_nonclient
794 expected_count_list = list_height_calculated / height_item;
795 if(expected_count_list < 0)
796 expected_count_list = 0;
797 expected_count_list =
min(expected_count_list, info_test->num_items);
798 expected_height_list = expected_count_list * height_item;
801 ok(expected_height_list == height_list,
802 "Test %d, expected list height to be %d, got %d\n",
test, expected_height_list, height_list);
821 ok(
ret,
"Failed to get COMBOBOXINFO structure; LastError: %lu\n",
GetLastError());
824 for(
i = 0;
i < 3;
i++)
857 HBRUSH brush, global_brush;
863 ok(!!combo,
"Failed to create combo window.\n");
869 ok(
ret,
"Failed to get combobox info structure.\n");
887 ok(!brush,
"%u: unexpected brush %p.\n",
i, brush);
898 ok(!!brush && brush !=
brush_red,
"%u: unexpected brush %p.\n",
i, brush);
905 combo =
CreateWindowA(
"ComboBox",
"Combo",
CBS_DROPDOWN, 5, 5, 100, 100,
NULL,
NULL,
NULL, 0);
906 ok(!!combo,
"Failed to create combo window.\n");
910 ok(
ret,
"Failed to get combobox info structure.\n");
915 ok(!!brush && brush !=
brush_red,
"%u: unexpected brush %p.\n",
i, brush);
924 hMainWnd =
CreateWindowA(
"static",
"Test",
WS_OVERLAPPEDWINDOW, 10, 10, 300, 300,
NULL,
NULL,
NULL, 0);
static const WCHAR stringFormat[]
#define COMBO_YBORDERSIZE()
_ACRTIMP int __cdecl strcmp(const char *, const char *)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define todo_wine_if(is_todo)
static HWND lparam_for_WM_CTLCOLOR
static void test_combo_ctlcolor(void)
static BOOL selchange_fired
static LRESULT CALLBACK combobox_subclass_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
static HWND hCBN_KillFocus
#define expect_rect(r, _left, _top, _right, _bottom)
static LPCSTR expected_edit_text
static UINT WPARAM wparam
static UINT WPARAM LPARAM lparam
static int get_font_height(HFONT hFont)
static LRESULT CALLBACK test_window_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
static WNDPROC edit_window_proc
static HWND hCBN_SetFocus
static LPCSTR expected_list_text
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
static void test_selection(void)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
static void test_editselection(void)
static INT CALLBACK is_font_installed_proc(const LOGFONTA *elf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
static void test_listbox_styles(DWORD cb_style)
static void test_setitemheight(DWORD style)
static void test_setfont(DWORD style)
#define expect_eq(expr, value, type, fmt)
static void test_listbox_size(DWORD style)
static void test_editselection_focus(DWORD style)
static void test_changesize(DWORD style)
static HWND build_combo(DWORD style)
static void test_WS_VSCROLL(void)
static void test_WM_LBUTTONDOWN(void)
static BOOL is_font_installed(const char *name)
static void test_CBN_SELCHANGE(void)
#define expect_style(window, style)
#define WS_OVERLAPPEDWINDOW
DWORD WINAPI GetLastError(void)
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
#define OUT_DEFAULT_PRECIS
#define CLIP_DEFAULT_PRECIS
HFONT WINAPI CreateFontA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCSTR)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
HWND WINAPI GetFocus(void)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SetWindowLongPtrA
#define WM_CTLCOLORSTATIC
#define CB_SETDROPPEDWIDTH
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GetWindowLongPtrA
#define WM_CTLCOLORSCROLLBAR
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define CB_GETDROPPEDWIDTH
#define WM_CTLCOLORMSGBOX
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CB_GETDROPPEDCONTROLRECT
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
struct tagCOMBOBOXINFO COMBOBOXINFO
HDC WINAPI GetDC(_In_opt_ HWND)
#define CB_GETDROPPEDSTATE
#define WM_CTLCOLORLISTBOX
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)