ReactOS  0.4.13-dev-650-g34bf247
combo.c File Reference
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>
#include "wine/test.h"
Include dependency graph for combo.c:

Go to the source code of this file.

Macros

#define STRICT
 
#define WIN32_LEAN_AND_MEAN
 
#define COMBO_ID   1995
 
#define COMBO_YBORDERSIZE()   2
 
#define expect_eq(expr, value, type, fmt)   ; { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }
 
#define expect_rect(r, _left, _top, _right, _bottom)
 

Functions

static HWND build_combo (DWORD style)
 
static int font_height (HFONT hFont)
 
static INT CALLBACK is_font_installed_proc (const LOGFONTA *elf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
 
static BOOL is_font_installed (const char *name)
 
static void test_setitemheight (DWORD style)
 
static void test_setfont (DWORD style)
 
static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd
 
static LRESULT CALLBACK parent_wnd_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_selection (DWORD style, const char *const text[], const int *edit, const int *list)
 
static void test_CBN_SELCHANGE (void)
 
static void test_WM_LBUTTONDOWN (void)
 
static void test_changesize (DWORD style)
 
static void test_editselection (void)
 
static LRESULT CALLBACK combobox_subclass_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK test_window_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_editselection_focus (DWORD style)
 
static void test_listbox_styles (DWORD cb_style)
 
static void test_listbox_size (DWORD style)
 
static void test_WS_VSCROLL (void)
 
 START_TEST (combo)
 

Variables

static HWND hMainWnd
 
static UINT msg
 
static UINT WPARAM wparam
 
static UINT WPARAM LPARAM lparam
 
static LPCSTR expected_edit_text
 
static LPCSTR expected_list_text
 
static BOOL selchange_fired
 
static WNDPROC edit_window_proc
 
static long setsel_start = 1
 
static long setsel_end = 1
 
static HWND hCBN_SetFocus
 
static HWND hCBN_KillFocus
 

Macro Definition Documentation

◆ COMBO_ID

#define COMBO_ID   1995

Definition at line 30 of file combo.c.

◆ COMBO_YBORDERSIZE

#define COMBO_YBORDERSIZE ( )    2

Definition at line 32 of file combo.c.

◆ expect_eq

#define expect_eq (   expr,
  value,
  type,
  fmt 
)    ; { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }

Definition at line 36 of file combo.c.

◆ expect_rect

#define expect_rect (   r,
  _left,
  _top,
  _right,
  _bottom 
)
Value:
ok(r.left == _left && r.top == _top && \
r.bottom == _bottom && r.right == _right, "Invalid rect %s vs (%d,%d)-(%d,%d)\n", \
wine_dbgstr_rect(&r), _left, _top, _right, _bottom);
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
const char * wine_dbgstr_rect(const RECT *rect)

Definition at line 37 of file combo.c.

◆ STRICT

#define STRICT

Definition at line 24 of file combo.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 25 of file combo.c.

Function Documentation

◆ build_combo()

static HWND build_combo ( DWORD  style)
static

Definition at line 41 of file combo.c.

42 {
43  return CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
44 }
static HWND hMainWnd
Definition: combo.c:34
#define WS_CHILD
Definition: pedump.c:617
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
#define COMBO_ID
Definition: combo.c:30
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by test_changesize(), test_editselection(), test_editselection_focus(), test_listbox_styles(), test_selection(), test_setfont(), test_setitemheight(), and test_WS_VSCROLL().

◆ combobox_subclass_proc()

static LRESULT CALLBACK combobox_subclass_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 539 of file combo.c.

540 {
541  if (msg == EM_SETSEL)
542  {
544  setsel_end = lParam;
545  }
547 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static WNDPROC edit_window_proc
Definition: combo.c:535
static UINT msg
Definition: combo.c:716
#define EM_SETSEL
Definition: winuser.h:2000
static long setsel_start
Definition: combo.c:536
static long setsel_end
Definition: combo.c:536
LPARAM lParam
Definition: combotst.c:139

Referenced by test_editselection_focus().

◆ font_height()

static int font_height ( HFONT  hFont)
static

Definition at line 46 of file combo.c.

47 {
49  HFONT hFontOld;
50  HDC hDC;
51 
53  hFontOld = SelectObject(hDC, hFont);
55  SelectObject(hDC, hFontOld);
56  DeleteDC(hDC);
57 
58  return tm.tmHeight;
59 }
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HFONT hFont
Definition: main.c:53
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
Definition: time.h:76
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

Referenced by test_setfont(), and test_setitemheight().

◆ is_font_installed()

static BOOL is_font_installed ( const char name)
static

Definition at line 66 of file combo.c.

67 {
68  HDC hdc = GetDC(NULL);
70  ReleaseDC(NULL, hdc);
71  return ret;
72 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
static INT CALLBACK is_font_installed_proc(const LOGFONTA *elf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
Definition: combo.c:61
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
int ret
HDC hdc
Definition: main.c:9
Definition: name.c:36

Referenced by test_setfont().

◆ is_font_installed_proc()

static INT CALLBACK is_font_installed_proc ( const LOGFONTA elf,
const TEXTMETRICA tm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 61 of file combo.c.

62 {
63  return 0;
64 }

Referenced by is_font_installed().

◆ LRESULT()

static LRESULT ( CALLBACK old_parent_proc)
static

◆ parent_wnd_proc()

static LRESULT CALLBACK parent_wnd_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 177 of file combo.c.

178 {
179  switch (msg)
180  {
181  case WM_COMMAND:
182  switch (wparam)
183  {
185  {
186  HWND hCombo = (HWND)lparam;
187  int idx;
188  char list[20], edit[20];
189 
190  memset(list, 0, sizeof(list));
191  memset(edit, 0, sizeof(edit));
192 
193  idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
195  SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
196 
197  ok(!strcmp(edit, expected_edit_text), "edit: got %s, expected %s\n",
198  edit, expected_edit_text);
199  ok(!strcmp(list, expected_list_text), "list: got %s, expected %s\n",
201 
203  }
204  break;
205  }
206  break;
207  }
208 
209  return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
210 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define CB_GETLBTEXT
Definition: winuser.h:1934
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
HANDLE HWND
Definition: compat.h:13
static LPCSTR expected_list_text
Definition: combo.c:174
static LPCSTR expected_edit_text
Definition: combo.c:173
#define CB_GETCURSEL
Definition: winuser.h:1925
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL selchange_fired
Definition: combo.c:175
static UINT msg
Definition: combo.c:716
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define ok(value,...)
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
#define COMBO_ID
Definition: combo.c:30
Definition: _list.h:228
#define WM_COMMAND
Definition: winuser.h:1722
#define CBN_SELCHANGE
Definition: winuser.h:1961
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_selection().

◆ START_TEST()

START_TEST ( combo  )

Definition at line 807 of file combo.c.

808 {
809  hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
811 
812  test_WS_VSCROLL();
828 
830 }
static void test_listbox_size(DWORD style)
Definition: combo.c:676
static HWND hMainWnd
Definition: combo.c:34
static void test_setitemheight(DWORD style)
Definition: combo.c:74
static void test_WS_VSCROLL(void)
Definition: combo.c:772
static void test_editselection(void)
Definition: combo.c:436
static void test_changesize(DWORD style)
Definition: combo.c:361
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CBS_SIMPLE
Definition: winuser.h:291
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
static void test_editselection_focus(DWORD style)
Definition: combo.c:571
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
#define SW_SHOW
Definition: winuser.h:769
static void test_listbox_styles(DWORD cb_style)
Definition: combo.c:628
static void test_WM_LBUTTONDOWN(void)
Definition: combo.c:278
#define CBS_DROPDOWN
Definition: winuser.h:283
static void test_CBN_SELCHANGE(void)
Definition: combo.c:267
static void test_setfont(DWORD style)
Definition: combo.c:97
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637

◆ test_CBN_SELCHANGE()

static void test_CBN_SELCHANGE ( void  )
static

Definition at line 267 of file combo.c.

268 {
269  static const char * const text[] = { "alpha", "beta", "" };
270  static const int sel_1[] = { 2, 0, 1, 0, 1 };
271  static const int sel_2[] = { 0, 1, 0, 0, 1 };
272 
273  test_selection(CBS_SIMPLE, text, sel_1, sel_2);
274  test_selection(CBS_DROPDOWN, text, sel_1, sel_2);
275  test_selection(CBS_DROPDOWNLIST, text, sel_2, sel_2);
276 }
const WCHAR * text
Definition: package.c:1827
static void test_selection(DWORD style, const char *const text[], const int *edit, const int *list)
Definition: combo.c:212
#define CBS_SIMPLE
Definition: winuser.h:291
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
#define CBS_DROPDOWN
Definition: winuser.h:283

Referenced by START_TEST().

◆ test_changesize()

static void test_changesize ( DWORD  style)
static

Definition at line 361 of file combo.c.

362 {
363  HWND hCombo = build_combo(style);
364  RECT rc;
365  INT ddheight, clheight, ddwidth, clwidth;
366  /* get initial measurements */
367  GetClientRect( hCombo, &rc);
368  clheight = rc.bottom - rc.top;
369  clwidth = rc.right - rc.left;
370  SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
371  ddheight = rc.bottom - rc.top;
372  ddwidth = rc.right - rc.left;
373  /* use MoveWindow to move & resize the combo */
374  /* first make it slightly smaller */
375  MoveWindow( hCombo, 10, 10, clwidth - 2, clheight - 2, TRUE);
376  GetClientRect( hCombo, &rc);
377  ok( rc.right - rc.left == clwidth - 2, "clientrect width is %d vs %d\n",
378  rc.right - rc.left, clwidth - 2);
379  ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
380  rc.bottom - rc.top, clheight);
381  SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
382  ok( rc.right - rc.left == clwidth - 2, "drop-down rect width is %d vs %d\n",
383  rc.right - rc.left, clwidth - 2);
384  ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %d vs %d\n",
385  rc.bottom - rc.top, ddheight);
386  ok( rc.right - rc.left == ddwidth -2, "drop-down rect width is %d vs %d\n",
387  rc.right - rc.left, ddwidth - 2);
388  /* new cx, cy is slightly bigger than the initial values */
389  MoveWindow( hCombo, 10, 10, clwidth + 2, clheight + 2, TRUE);
390  GetClientRect( hCombo, &rc);
391  ok( rc.right - rc.left == clwidth + 2, "clientrect width is %d vs %d\n",
392  rc.right - rc.left, clwidth + 2);
393  ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
394  rc.bottom - rc.top, clheight);
395  SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
396  ok( rc.right - rc.left == clwidth + 2, "drop-down rect width is %d vs %d\n",
397  rc.right - rc.left, clwidth + 2);
398  todo_wine {
399  ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %d vs %d\n",
400  rc.bottom - rc.top, clheight + 2);
401  }
402 
403  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, -1, 0);
404  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
405  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
406  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
407 
408  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0);
409  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
410  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
411  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
412 
413  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth - 1, 0);
414  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
415  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
416  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
417 
418  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth << 1, 0);
419  ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
420  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
421  ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
422 
423  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0);
424  ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
425  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
426  ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
427 
428  ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 1, 0);
429  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
430  ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
431  ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
432 
433  DestroyWindow(hCombo);
434 }
#define TRUE
Definition: types.h:120
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1944
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
#define CB_GETDROPPEDWIDTH
Definition: winuser.h:1928
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1926
static HWND build_combo(DWORD style)
Definition: combo.c:41
#define todo_wine
Definition: test.h:154
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LONG bottom
Definition: windef.h:294
Arabic default style
Definition: afstyles.h:93

Referenced by START_TEST().

◆ test_editselection()

static void test_editselection ( void  )
static

Definition at line 436 of file combo.c.

437 {
438  HWND hCombo;
439  INT start,end;
440  HWND hEdit;
441  COMBOBOXINFO cbInfo;
442  BOOL ret;
443  DWORD len;
444  char edit[20];
445 
446  /* Build a combo */
447  hCombo = build_combo(CBS_SIMPLE);
448  cbInfo.cbSize = sizeof(COMBOBOXINFO);
449  SetLastError(0xdeadbeef);
450  ret = GetComboBoxInfo(hCombo, &cbInfo);
451  ok(ret, "Failed to get combobox info structure. LastError=%d\n",
452  GetLastError());
453  hEdit = cbInfo.hwndItem;
454 
455  /* Initially combo selection is empty*/
456  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
457  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
458  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
459 
460  /* Set some text, and press a key to replace it */
461  edit[0] = 0x00;
462  SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason1");
463  SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
464  ok(strcmp(edit, "Jason1")==0, "Unexpected text retrieved %s\n", edit);
465 
466  /* Now what is the selection - still empty */
468  ok(start==0, "Unexpected start position for selection %d\n", start);
469  ok(end==0, "Unexpected end position for selection %d\n", end);
470  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
471  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
472  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
473 
474  /* Give it focus, and it gets selected */
475  SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
477  ok(start==0, "Unexpected start position for selection %d\n", start);
478  ok(end==6, "Unexpected end position for selection %d\n", end);
479  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
480  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
481  ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
482 
483  /* Now emulate a key press */
484  edit[0] = 0x00;
485  SendMessageA(hCombo, WM_CHAR, 'A', 0x1c0001);
486  SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
487  ok(strcmp(edit, "A")==0, "Unexpected text retrieved %s\n", edit);
488 
489  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
490  ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
491  ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
492 
493  /* Now what happens when it gets more focus a second time - it doesn't reselect */
494  SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
495  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
496  ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
497  ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
498  DestroyWindow(hCombo);
499 
500  /* Start again - Build a combo */
501  hCombo = build_combo(CBS_SIMPLE);
502  cbInfo.cbSize = sizeof(COMBOBOXINFO);
503  SetLastError(0xdeadbeef);
504  ret = GetComboBoxInfo(hCombo, &cbInfo);
505  ok(ret, "Failed to get combobox info structure. LastError=%d\n",
506  GetLastError());
507  hEdit = cbInfo.hwndItem;
508 
509  /* Set some text and give focus so it gets selected */
510  edit[0] = 0x00;
511  SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason2");
512  SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
513  ok(strcmp(edit, "Jason2")==0, "Unexpected text retrieved %s\n", edit);
514 
515  SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
516 
517  /* Now what is the selection */
519  ok(start==0, "Unexpected start position for selection %d\n", start);
520  ok(end==6, "Unexpected end position for selection %d\n", end);
521  len = SendMessageA(hCombo, CB_GETEDITSEL, 0,0);
522  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
523  ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
524 
525  /* Now change the selection to the apparently invalid start -1, end -1 and
526  show it means no selection (ie start -1) but cursor at end */
527  SendMessageA(hCombo, CB_SETEDITSEL, 0, -1);
528  edit[0] = 0x00;
529  SendMessageA(hCombo, WM_CHAR, 'A', 0x1c0001);
530  SendMessageA(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
531  ok(strcmp(edit, "Jason2A")==0, "Unexpected text retrieved %s\n", edit);
532  DestroyWindow(hCombo);
533 }
#define WM_CHAR
Definition: winuser.h:1699
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
#define CB_GETEDITSEL
Definition: winuser.h:1929
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define CBS_SIMPLE
Definition: winuser.h:291
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
static HWND build_combo(DWORD style)
Definition: combo.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
static HWND hEdit
Definition: autocomplete.c:34
#define CB_SETEDITSEL
Definition: winuser.h:1945
GLuint start
Definition: gl.h:1545
#define HIWORD(l)
Definition: typedefs.h:246
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WM_SETFOCUS
Definition: winuser.h:1595
struct tagCOMBOBOXINFO COMBOBOXINFO
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ test_editselection_focus()

static void test_editselection_focus ( DWORD  style)
static

Definition at line 571 of file combo.c.

572 {
573  HWND hCombo, hEdit, hButton;
574  COMBOBOXINFO cbInfo;
575  BOOL ret;
576  const char wine_test[] = "Wine Test";
577  char buffer[16] = {0};
578  DWORD len;
579 
580  hCombo = build_combo(style);
581  cbInfo.cbSize = sizeof(COMBOBOXINFO);
582  SetLastError(0xdeadbeef);
583  ret = GetComboBoxInfo(hCombo, &cbInfo);
584  ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
585  hEdit = cbInfo.hwndItem;
586 
587  hButton = CreateWindowA("Button", "OK", WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON,
588  5, 50, 100, 20, hMainWnd, NULL,
590 
593 
594  SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
595  ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start);
596  todo_wine ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end);
597  ok(hCBN_SetFocus == hCombo, "Wrong handle set by CBN_SETFOCUS; got %p\n", hCBN_SetFocus);
598  ok(GetFocus() == hEdit, "hEdit should have keyboard focus\n");
599 
601  ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start);
602  todo_wine ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end);
603  ok(hCBN_KillFocus == hCombo, "Wrong handle set by CBN_KILLFOCUS; got %p\n", hCBN_KillFocus);
604  ok(GetFocus() == hButton, "hButton should have keyboard focus\n");
605 
606  SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)wine_test);
608  ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start);
609  todo_wine ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end);
610  ok(hCBN_SetFocus == hCombo, "Wrong handle set by CBN_SETFOCUS; got %p\n", hCBN_SetFocus);
611  ok(GetFocus() == hEdit, "hEdit should have keyboard focus\n");
612  SendMessageA(hCombo, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
613  ok(!strcmp(buffer, wine_test), "Unexpected text in edit control; got '%s'\n", buffer);
614 
616  ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start);
617  todo_wine ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end);
618  ok(hCBN_KillFocus == hCombo, "Wrong handle set by CBN_KILLFOCUS; got %p\n", hCBN_KillFocus);
619  ok(GetFocus() == hButton, "hButton should have keyboard focus\n");
620  len = SendMessageA(hCombo, CB_GETEDITSEL, 0, 0);
621  ok(len == 0, "Unexpected text selection; start: %u, end: %u\n", LOWORD(len), HIWORD(len));
622 
623  SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
624  DestroyWindow(hButton);
625  DestroyWindow(hCombo);
626 }
Definition: main.c:44
static HWND hMainWnd
Definition: combo.c:34
#define TRUE
Definition: types.h:120
#define INT_MAX
Definition: limits.h:40
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define CB_GETEDITSEL
Definition: winuser.h:1929
static WNDPROC edit_window_proc
Definition: combo.c:535
unsigned int BOOL
Definition: ntddk_ex.h:94
static HWND hCBN_KillFocus
Definition: combo.c:537
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetWindowLongPtrA
Definition: winuser.h:4729
static HWND build_combo(DWORD style)
Definition: combo.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
static long setsel_start
Definition: combo.c:536
int ret
static HWND hCBN_SetFocus
Definition: combo.c:537
#define todo_wine
Definition: test.h:154
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5246
static HWND hEdit
Definition: autocomplete.c:34
static long setsel_end
Definition: combo.c:536
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
static LRESULT CALLBACK test_window_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: combo.c:549
HWND WINAPI GetFocus(void)
Definition: window.c:1875
#define GWLP_HINSTANCE
Definition: winuser.h:850
#define HIWORD(l)
Definition: typedefs.h:246
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WM_SETFOCUS
Definition: winuser.h:1595
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
struct tagCOMBOBOXINFO COMBOBOXINFO
#define LOWORD(l)
Definition: pedump.c:82
static LRESULT CALLBACK combobox_subclass_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: combo.c:539

Referenced by START_TEST().

◆ test_listbox_size()

static void test_listbox_size ( DWORD  style)
static

Definition at line 676 of file combo.c.

677 {
678  HWND hCombo, hList;
679  COMBOBOXINFO cbInfo;
680  UINT x, y;
681  BOOL ret;
682  int i, test;
683  const char wine_test[] = "Wine Test";
684 
685  static const struct list_size_info
686  {
687  int num_items;
688  int height_combo;
689  BOOL todo;
690  } info_height[] = {
691  {2, 24, TRUE},
692  {2, 41, TRUE},
693  {2, 42, TRUE},
694  {2, 50, TRUE},
695  {2, 60},
696  {2, 80},
697  {2, 89},
698  {2, 90},
699  {2, 100},
700 
701  {10, 24, TRUE},
702  {10, 41, TRUE},
703  {10, 42, TRUE},
704  {10, 50, TRUE},
705  {10, 60, TRUE},
706  {10, 80, TRUE},
707  {10, 89, TRUE},
708  {10, 90, TRUE},
709  {10, 100, TRUE},
710  };
711 
712  for(test = 0; test < sizeof(info_height) / sizeof(info_height[0]); test++)
713  {
714  const struct list_size_info *info_test = &info_height[test];
715  int height_item; /* Height of a list item */
716  int height_list; /* Height of the list we got */
717  int expected_count_list;
718  int expected_height_list;
719  int list_height_nonclient;
720  int list_height_calculated;
721  RECT rect_list_client, rect_list_complete;
722 
723  hCombo = CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100,
724  info_test->height_combo, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
725 
726  cbInfo.cbSize = sizeof(COMBOBOXINFO);
727  SetLastError(0xdeadbeef);
728  ret = GetComboBoxInfo(hCombo, &cbInfo);
729  ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
730 
731  hList = cbInfo.hwndList;
732  for (i = 0; i < info_test->num_items; i++)
733  SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM) wine_test);
734 
735  /* Click on the button to drop down the list */
736  x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
737  y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
738  ret = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
739  ok(ret, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
740  GetLastError());
741  ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
742  "The dropdown list should have appeared after clicking the button.\n");
743 
744  GetClientRect(hList, &rect_list_client);
745  GetWindowRect(hList, &rect_list_complete);
746  height_list = rect_list_client.bottom - rect_list_client.top;
747  height_item = (int)SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0);
748 
749  list_height_nonclient = (rect_list_complete.bottom - rect_list_complete.top)
750  - (rect_list_client.bottom - rect_list_client.top);
751 
752  /* Calculate the expected client size of the listbox popup from the size of the combobox. */
753  list_height_calculated = info_test->height_combo
754  - (cbInfo.rcItem.bottom + COMBO_YBORDERSIZE())
755  - list_height_nonclient
756  - 1;
757 
758  expected_count_list = list_height_calculated / height_item;
759  if(expected_count_list < 0)
760  expected_count_list = 0;
761  expected_count_list = min(expected_count_list, info_test->num_items);
762  expected_height_list = expected_count_list * height_item;
763 
764  todo_wine_if(info_test->todo)
765  ok(expected_height_list == height_list,
766  "Test %d, expected list height to be %d, got %d\n", test, expected_height_list, height_list);
767 
768  DestroyWindow(hCombo);
769  }
770 }
#define COMBO_YBORDERSIZE()
Definition: combo.c:32
Definition: main.c:44
static HWND hMainWnd
Definition: combo.c:34
#define TRUE
Definition: types.h:120
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1927
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
BOOL todo
Definition: filedlg.c:313
GLdouble n
Definition: glext.h:7729
LONG top
Definition: windef.h:292
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define test
Definition: rosglue.h:37
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
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
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:155
#define d
Definition: ke_i.h:81
#define COMBO_ID
Definition: combo.c:30
#define SetLastError(x)
Definition: compat.h:409
int ret
Definition: _list.h:228
#define LB_GETITEMHEIGHT
Definition: winuser.h:2024
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HWND hList
Definition: livecd.c:10
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
struct tagCOMBOBOXINFO COMBOBOXINFO
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL expected
Definition: store.c:2063
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by START_TEST().

◆ test_listbox_styles()

static void test_listbox_styles ( DWORD  cb_style)
static

Definition at line 628 of file combo.c.

629 {
630  HWND combo;
632  DWORD style, exstyle, expect_style, expect_exstyle;
633  BOOL ret;
634 
636  if (cb_style == CBS_SIMPLE)
637  {
639  expect_exstyle = WS_EX_CLIENTEDGE;
640  }
641  else
642  {
644  expect_exstyle = WS_EX_TOOLWINDOW;
645  }
646 
647  combo = build_combo(cb_style);
648  info.cbSize = sizeof(COMBOBOXINFO);
649  SetLastError(0xdeadbeef);
650  ret = GetComboBoxInfo(combo, &info);
651  ok(ret, "Failed to get combobox info structure.\n");
652 
653  style = GetWindowLongW( info.hwndList, GWL_STYLE );
654  exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
655  ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
656  ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
657 
658  if (cb_style != CBS_SIMPLE)
659  expect_exstyle |= WS_EX_TOPMOST;
660 
661  SendMessageW(combo, CB_SHOWDROPDOWN, TRUE, 0 );
662  style = GetWindowLongW( info.hwndList, GWL_STYLE );
663  exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
664  ok(style == (expect_style | WS_VISIBLE), "%08x: got %08x\n", cb_style, style);
665  ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
666 
667  SendMessageW(combo, CB_SHOWDROPDOWN, FALSE, 0 );
668  style = GetWindowLongW( info.hwndList, GWL_STYLE );
669  exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
670  ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
671  ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
672 
673  DestroyWindow(combo);
674 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define TRUE
Definition: types.h:120
#define LBS_HASSTRINGS
Definition: pedump.c:684
#define GWL_EXSTYLE
Definition: winuser.h:845
#define LBS_COMBOBOX
Definition: winuser.h:324
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_SHOWDROPDOWN
Definition: winuser.h:1952
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define CBS_SIMPLE
Definition: winuser.h:291
#define ok(value,...)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
static HWND build_combo(DWORD style)
Definition: combo.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define expect_style(window, style)
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
#define LBS_NOTIFY
Definition: pedump.c:678
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
struct tagCOMBOBOXINFO COMBOBOXINFO

Referenced by START_TEST().

◆ test_selection()

static void test_selection ( DWORD  style,
const char *const  text[],
const int edit,
const int list 
)
static

Definition at line 212 of file combo.c.

214 {
215  INT idx;
216  HWND hCombo;
217 
218  hCombo = build_combo(style);
219 
220  SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[0]);
221  SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[1]);
222  SendMessageA(hCombo, CB_SETCURSEL, -1, 0);
223 
224  old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
225 
226  idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
227  ok(idx == -1, "expected selection -1, got %d\n", idx);
228 
229  /* keyboard navigation */
230 
232  expected_edit_text = text[edit[0]];
234  SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
235  ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
236 
238  expected_edit_text = text[edit[1]];
240  SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
241  ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
242 
244  expected_edit_text = text[edit[2]];
246  SendMessageA(hCombo, WM_KEYDOWN, VK_UP, 0);
247  ok(selchange_fired, "CBN_SELCHANGE not sent!\n");
248 
249  /* programmatic navigation */
250 
252  expected_edit_text = text[edit[3]];
254  SendMessageA(hCombo, CB_SETCURSEL, list[3], 0);
255  ok(!selchange_fired, "CBN_SELCHANGE sent!\n");
256 
258  expected_edit_text = text[edit[4]];
260  SendMessageA(hCombo, CB_SETCURSEL, list[4], 0);
261  ok(!selchange_fired, "CBN_SELCHANGE sent!\n");
262 
263  SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
264  DestroyWindow(hCombo);
265 }
static HWND hMainWnd
Definition: combo.c:34
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const WCHAR * text
Definition: package.c:1827
static LPCSTR expected_list_text
Definition: combo.c:174
static LPCSTR expected_edit_text
Definition: combo.c:173
#define VK_DOWN
Definition: winuser.h:2202
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1925
uint32_t ULONG_PTR
Definition: typedefs.h:63
static BOOL selchange_fired
Definition: combo.c:175
#define VK_UP
Definition: winuser.h:2200
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: combo.c:177
#define ok(value,...)
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
static HWND build_combo(DWORD style)
Definition: combo.c:41
#define SetWindowLongPtrA
Definition: winuser.h:5246
Definition: _list.h:228
#define CB_SETCURSEL
Definition: winuser.h:1943
#define GWLP_WNDPROC
Definition: treelist.c:66
Arabic default style
Definition: afstyles.h:93

Referenced by test_CBN_SELCHANGE().

◆ test_setfont()

static void test_setfont ( DWORD  style)
static

Definition at line 97 of file combo.c.

98 {
99  HWND hCombo;
100  HFONT hFont1, hFont2;
101  RECT r;
102  int i;
103 
104  if (!is_font_installed("Marlett"))
105  {
106  skip("Marlett font not available\n");
107  return;
108  }
109 
110  trace("Style %x\n", style);
111 
112  hCombo = build_combo(style);
115 
116  GetClientRect(hCombo, &r);
120  todo_wine expect_rect(r, 5, 5, 105, 105);
121 
122  /* The size of the dropped control is initially equal to the size
123  of the window when it was created. The size of the calculated
124  dropped area changes only by how much the selection area
125  changes, not by how much the list area changes. */
126  if (font_height(hFont1) == 10 && font_height(hFont2) == 8)
127  {
128  SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
129  GetClientRect(hCombo, &r);
130  expect_rect(r, 0, 0, 100, 18);
133  todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
134 
135  SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont2, FALSE);
136  GetClientRect(hCombo, &r);
137  expect_rect(r, 0, 0, 100, 16);
140  todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont2)));
141 
142  SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
143  GetClientRect(hCombo, &r);
144  expect_rect(r, 0, 0, 100, 18);
147  todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
148  }
149  else
150  {
151  ok(0, "Expected Marlett font heights 10/8, got %d/%d\n",
152  font_height(hFont1), font_height(hFont2));
153  }
154 
155  for (i = 1; i < 30; i++)
156  {
158  int height = font_height(hFont);
159 
161  GetClientRect(hCombo, &r);
162  expect_eq(r.bottom - r.top, height + 8, int, "%d");
163  SendMessageA(hCombo, WM_SETFONT, 0, FALSE);
165  }
166 
167  DestroyWindow(hCombo);
168  DeleteObject(hFont1);
169  DeleteObject(hFont2);
170 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define trace(...)
Definition: kmt_test.h:217
static HWND hMainWnd
Definition: combo.c:34
#define DEFAULT_QUALITY
Definition: wingdi.h:435
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
static int font_height(HFONT hFont)
Definition: combo.c:46
#define FF_DONTCARE
Definition: wingdi.h:447
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define SYMBOL_CHARSET
Definition: wingdi.h:384
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define expect_eq(expr, value, type, fmt)
Definition: combo.c:36
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI DestroyWindow(_In_ HWND)
HFONT hFont
Definition: main.c:53
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
Definition: glfuncs.h:248
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
#define ok(value,...)
#define SYSTEM_FONT
Definition: wingdi.h:910
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1926
#define DEFAULT_PITCH
Definition: wingdi.h:442
static HWND build_combo(DWORD style)
Definition: combo.c:41
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:414
#define expect_rect(r, _left, _top, _right, _bottom)
Definition: combo.c:37
#define todo_wine
Definition: test.h:154
static BOOL is_font_installed(const char *name)
Definition: combo.c:66
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
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 GetClientRect(_In_ HWND, _Out_ LPRECT)
#define FW_DONTCARE
Definition: wingdi.h:367
#define HWND_DESKTOP
Definition: winuser.h:1195
#define WM_SETFONT
Definition: winuser.h:1632
#define skip(...)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Arabic default style
Definition: afstyles.h:93

Referenced by START_TEST().

◆ test_setitemheight()

static void test_setitemheight ( DWORD  style)
static

Definition at line 74 of file combo.c.

75 {
76  HWND hCombo = build_combo(style);
77  RECT r;
78  int i;
79 
80  trace("Style %x\n", style);
81  GetClientRect(hCombo, &r);
85  todo_wine expect_rect(r, 5, 5, 105, 105);
86 
87  for (i = 1; i < 30; i++)
88  {
89  SendMessageA(hCombo, CB_SETITEMHEIGHT, -1, i);
90  GetClientRect(hCombo, &r);
91  expect_eq(r.bottom - r.top, i + 6, int, "%d");
92  }
93 
94  DestroyWindow(hCombo);
95 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define trace(...)
Definition: kmt_test.h:217
static HWND hMainWnd
Definition: combo.c:34
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
static int font_height(HFONT hFont)
Definition: combo.c:46
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define expect_eq(expr, value, type, fmt)
Definition: combo.c:36
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
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
Definition: glfuncs.h:248
#define SYSTEM_FONT
Definition: wingdi.h:910
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1926
static HWND build_combo(DWORD style)
Definition: combo.c:41
#define expect_rect(r, _left, _top, _right, _bottom)
Definition: combo.c:37
#define todo_wine
Definition: test.h:154
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_DESKTOP
Definition: winuser.h:1195
Arabic default style
Definition: afstyles.h:93

Referenced by START_TEST().

◆ test_window_proc()

static LRESULT CALLBACK test_window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 549 of file combo.c.

550 {
551  switch (msg)
552  {
553  case WM_COMMAND:
554  switch (HIWORD(wParam))
555  {
556  case CBN_SETFOCUS:
558  break;
559  case CBN_KILLFOCUS:
561  break;
562  }
563  break;
564  case WM_NEXTDLGCTL:
565  SetFocus((HWND)wParam);
566  break;
567  }
568  return CallWindowProcA(old_parent_proc, hwnd, msg, wParam, lParam);
569 }
#define CBN_SETFOCUS
Definition: winuser.h:1964
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
HANDLE HWND
Definition: compat.h:13
HWND WINAPI SetFocus(_In_opt_ HWND)
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT msg
Definition: combo.c:716
#define CBN_KILLFOCUS
Definition: winuser.h:1960
static HWND hCBN_KillFocus
Definition: combo.c:537
static HWND hCBN_SetFocus
Definition: combo.c:537
#define WM_COMMAND
Definition: winuser.h:1722
#define HIWORD(l)
Definition: typedefs.h:246
LPARAM lParam
Definition: combotst.c:139

Referenced by test_editselection_focus().

◆ test_WM_LBUTTONDOWN()

static void test_WM_LBUTTONDOWN ( void  )
static

Definition at line 278 of file combo.c.

279 {
280  HWND hCombo, hEdit, hList;
281  COMBOBOXINFO cbInfo;
282  UINT x, y, item_height;
283  LRESULT result;
284  int i, idx;
285  RECT rect;
286  CHAR buffer[3];
287  static const UINT choices[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
288  static const CHAR stringFormat[] = "%2d";
289  BOOL ret;
290 
291  hCombo = CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|CBS_DROPDOWN,
292  0, 0, 200, 150, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
293 
294  for (i = 0; i < sizeof(choices)/sizeof(UINT); i++){
295  sprintf(buffer, stringFormat, choices[i]);
296  result = SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)buffer);
297  ok(result == i,
298  "Failed to add item %d\n", i);
299  }
300 
301  cbInfo.cbSize = sizeof(COMBOBOXINFO);
302  SetLastError(0xdeadbeef);
303  ret = GetComboBoxInfo(hCombo, &cbInfo);
304  ok(ret, "Failed to get combobox info structure. LastError=%d\n",
305  GetLastError());
306  hEdit = cbInfo.hwndItem;
307  hList = cbInfo.hwndList;
308 
309  trace("hMainWnd=%p, hCombo=%p, hList=%p, hEdit=%p\n", hMainWnd, hCombo, hList, hEdit);
310  ok(GetFocus() == hMainWnd, "Focus not on Main Window, instead on %p\n", GetFocus());
311 
312  /* Click on the button to drop down the list */
313  x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
314  y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
315  result = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
316  ok(result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
317  GetLastError());
318  ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
319  "The dropdown list should have appeared after clicking the button.\n");
320 
321  ok(GetFocus() == hEdit,
322  "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
323  result = SendMessageA(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
324  ok(result, "WM_LBUTTONUP was not processed. LastError=%d\n",
325  GetLastError());
326  ok(GetFocus() == hEdit,
327  "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
328 
329  /* Click on the 5th item in the list */
330  item_height = SendMessageA(hCombo, CB_GETITEMHEIGHT, 0, 0);
331  ok(GetClientRect(hList, &rect), "Failed to get list's client rect.\n");
332  x = rect.left + (rect.right-rect.left)/2;
333  y = item_height/2 + item_height*4;
335  ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
336  GetLastError());
337  ok(GetFocus() == hEdit,
338  "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
339 
341  ok(!result, "WM_MOUSEMOVE was not processed. LastError=%d\n",
342  GetLastError());
343  ok(GetFocus() == hEdit,
344  "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
345  ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
346  "The dropdown list should still be visible.\n");
347 
349  ok(!result, "WM_LBUTTONUP was not processed. LastError=%d\n",
350  GetLastError());
351  ok(GetFocus() == hEdit,
352  "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
353  ok(!SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
354  "The dropdown list should have been rolled up.\n");
355  idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
356  ok(idx, "Current Selection: expected %d, got %d\n", 4, idx);
357 
358  DestroyWindow(hCombo);
359 }
#define trace(...)
Definition: kmt_test.h:217
static HWND hMainWnd
Definition: combo.c:34
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1927
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
LONG top
Definition: windef.h:292
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CB_GETCURSEL
Definition: winuser.h:1925
& rect
Definition: startmenu.cpp:1413
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define COMBO_ID
Definition: combo.c:30
#define SetLastError(x)
Definition: compat.h:409
static const WCHAR stringFormat[]
Definition: wordpad.c:54
int ret
static HWND hEdit
Definition: autocomplete.c:34
HWND hList
Definition: livecd.c:10
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CBS_DROPDOWN
Definition: winuser.h:283
#define WM_LBUTTONUP
Definition: winuser.h:1759
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1757
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HWND WINAPI GetFocus(void)
Definition: window.c:1875
#define CB_GETITEMHEIGHT
Definition: winuser.h:1933
LONG bottom
Definition: windef.h:294
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
GLuint64EXT * result
Definition: glext.h:11304
struct tagCOMBOBOXINFO COMBOBOXINFO
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by START_TEST().

◆ test_WS_VSCROLL()

static void test_WS_VSCROLL ( void  )
static

Definition at line 772 of file combo.c.

773 {
774  HWND hCombo, hList;
776  DWORD style;
777  BOOL ret;
778  int i;
779 
780  info.cbSize = sizeof(info);
781  hCombo = build_combo(CBS_DROPDOWNLIST);
782 
783  SetLastError(0xdeadbeef);
784  ret = GetComboBoxInfo(hCombo, &info);
785  ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
786  hList = info.hwndList;
787 
788  for(i = 0; i < 3; i++)
789  {
790  char buffer[2];
791  sprintf(buffer, "%d", i);
792  SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)buffer);
793  }
794 
795  style = GetWindowLongA(info.hwndList, GWL_STYLE);
797 
798  SendMessageA(hCombo, CB_SHOWDROPDOWN, TRUE, 0);
799  SendMessageA(hCombo, CB_SHOWDROPDOWN, FALSE, 0);
800 
802  ok((style & WS_VSCROLL) != 0, "Style does not include WS_VSCROLL\n");
803 
804  DestroyWindow(hCombo);
805 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI DestroyWindow(_In_ HWND)
struct _test_info info[]
Definition: SetCursorPos.c:19
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
Definition: glfuncs.h:248
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_SHOWDROPDOWN
Definition: winuser.h:1952
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
Definition: combo.c:2313
#define ok(value,...)
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
static HWND build_combo(DWORD style)
Definition: combo.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define GWL_STYLE
Definition: winuser.h:846
HWND hList
Definition: livecd.c:10
#define WS_VSCROLL
Definition: pedump.c:627
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
Arabic default style
Definition: afstyles.h:93

Referenced by START_TEST().

Variable Documentation

◆ edit_window_proc

WNDPROC edit_window_proc
static

Definition at line 535 of file combo.c.

Referenced by combobox_subclass_proc(), and test_editselection_focus().

◆ expected_edit_text

LPCSTR expected_edit_text
static

Definition at line 173 of file combo.c.

Referenced by parent_wnd_proc(), and test_selection().

◆ expected_list_text

LPCSTR expected_list_text
static

Definition at line 174 of file combo.c.

Referenced by parent_wnd_proc(), and test_selection().

◆ hCBN_KillFocus

HWND hCBN_KillFocus
static

Definition at line 537 of file combo.c.

Referenced by test_editselection_focus(), and test_window_proc().

◆ hCBN_SetFocus

HWND hCBN_SetFocus
static

Definition at line 537 of file combo.c.

Referenced by test_editselection_focus(), and test_window_proc().

◆ hMainWnd

◆ lparam

UINT WPARAM LPARAM lparam

Definition at line 172 of file combo.c.

◆ msg

UINT msg

Definition at line 172 of file combo.c.

◆ selchange_fired

BOOL selchange_fired
static

Definition at line 175 of file combo.c.

Referenced by parent_wnd_proc(), and test_selection().

◆ setsel_end

long setsel_end = 1
static

Definition at line 536 of file combo.c.

Referenced by combobox_subclass_proc(), and test_editselection_focus().

◆ setsel_start

long setsel_start = 1
static

Definition at line 536 of file combo.c.

Referenced by combobox_subclass_proc(), and test_editselection_focus().

◆ wparam

UINT WPARAM wparam

Definition at line 172 of file combo.c.