1 /* Unit test suite for comboex control.
3 * Copyright 2005 Jason Edmeades
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/test.h"
27 #define EDITBOX_SEQ_INDEX 0
28 #define NUM_MSG_SEQUENCES 1
32 #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
34 static struct msg_sequence
*sequences
[NUM_MSG_SEQUENCES
];
36 static HWND hComboExParentWnd
;
37 static HINSTANCE hMainHinst
;
38 static const char ComboExTestClass
[] = "ComboExTestClass";
40 static BOOL (WINAPI
*pSetWindowSubclass
)(HWND
, SUBCLASSPROC
, UINT_PTR
, DWORD_PTR
);
43 static char *textBuffer
= NULL
;
45 static BOOL received_end_edit
= FALSE
;
47 static HWND
createComboEx(DWORD style
) {
48 return CreateWindowExA(0, WC_COMBOBOXEXA
, NULL
, style
, 0, 0, 300, 300,
49 hComboExParentWnd
, NULL
, hMainHinst
, NULL
);
52 static LONG
addItem(HWND cbex
, int idx
, LPTSTR text
) {
53 COMBOBOXEXITEM cbexItem
;
54 memset(&cbexItem
, 0x00, sizeof(cbexItem
));
55 cbexItem
.mask
= CBEIF_TEXT
;
57 cbexItem
.pszText
= text
;
58 cbexItem
.cchTextMax
= 0;
59 return SendMessage(cbex
, CBEM_INSERTITEM
, 0, (LPARAM
)&cbexItem
);
62 static LONG
setItem(HWND cbex
, int idx
, LPTSTR text
) {
63 COMBOBOXEXITEM cbexItem
;
64 memset(&cbexItem
, 0x00, sizeof(cbexItem
));
65 cbexItem
.mask
= CBEIF_TEXT
;
67 cbexItem
.pszText
= text
;
68 cbexItem
.cchTextMax
= 0;
69 return SendMessage(cbex
, CBEM_SETITEM
, 0, (LPARAM
)&cbexItem
);
72 static LONG
delItem(HWND cbex
, int idx
) {
73 return SendMessage(cbex
, CBEM_DELETEITEM
, idx
, 0);
76 static LONG
getItem(HWND cbex
, int idx
, COMBOBOXEXITEM
*cbItem
) {
77 memset(cbItem
, 0x00, sizeof(COMBOBOXEXITEM
));
78 cbItem
->mask
= CBEIF_TEXT
;
79 cbItem
->pszText
= textBuffer
;
81 cbItem
->cchTextMax
= 100;
82 return SendMessage(cbex
, CBEM_GETITEM
, 0, (LPARAM
)cbItem
);
85 static LRESULT WINAPI
editbox_subclass_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
87 WNDPROC oldproc
= (WNDPROC
)GetWindowLongPtrA(hwnd
, GWLP_USERDATA
);
88 static LONG defwndproc_counter
= 0;
92 msg
.message
= message
;
93 msg
.flags
= sent
|wparam
|lparam
;
94 if (defwndproc_counter
) msg
.flags
|= defwinproc
;
99 if (message
!= WM_PAINT
&&
100 message
!= WM_ERASEBKGND
&&
101 message
!= WM_NCPAINT
&&
102 message
!= WM_NCHITTEST
&&
103 message
!= WM_GETTEXT
&&
104 message
!= WM_GETICON
&&
105 message
!= WM_DEVICECHANGE
)
107 add_message(sequences
, EDITBOX_SEQ_INDEX
, &msg
);
110 defwndproc_counter
++;
111 ret
= CallWindowProcA(oldproc
, hwnd
, message
, wParam
, lParam
);
112 defwndproc_counter
--;
116 static HWND
subclass_editbox(HWND hwndComboEx
)
121 hwnd
= (HWND
)SendMessage(hwndComboEx
, CBEM_GETEDITCONTROL
, 0, 0);
122 oldproc
= (WNDPROC
)SetWindowLongPtrA(hwnd
, GWLP_WNDPROC
,
123 (LONG_PTR
)editbox_subclass_proc
);
124 SetWindowLongPtrA(hwnd
, GWLP_USERDATA
, (LONG_PTR
)oldproc
);
129 static void test_comboboxex(void) {
132 COMBOBOXEXITEM cbexItem
;
133 static TCHAR first_item
[] = {'F','i','r','s','t',' ','I','t','e','m',0},
134 second_item
[] = {'S','e','c','o','n','d',' ','I','t','e','m',0},
135 third_item
[] = {'T','h','i','r','d',' ','I','t','e','m',0},
136 middle_item
[] = {'B','e','t','w','e','e','n',' ','F','i','r','s','t',' ','a','n','d',' ',
137 'S','e','c','o','n','d',' ','I','t','e','m','s',0},
138 replacement_item
[] = {'B','e','t','w','e','e','n',' ','F','i','r','s','t',' ','a','n','d',' ',
139 'S','e','c','o','n','d',' ','I','t','e','m','s',0},
140 out_of_range_item
[] = {'O','u','t',' ','o','f',' ','R','a','n','g','e',' ','I','t','e','m',0};
142 /* Allocate space for result */
143 textBuffer
= HeapAlloc(GetProcessHeap(), 0, MAX_CHARS
);
145 /* Basic comboboxex test */
146 myHwnd
= createComboEx(WS_BORDER
| WS_VISIBLE
| WS_CHILD
| CBS_DROPDOWN
);
148 /* Add items onto the end of the combobox */
149 res
= addItem(myHwnd
, -1, first_item
);
150 ok(res
== 0, "Adding simple item failed (%d)\n", res
);
151 res
= addItem(myHwnd
, -1, second_item
);
152 ok(res
== 1, "Adding simple item failed (%d)\n", res
);
153 res
= addItem(myHwnd
, 2, third_item
);
154 ok(res
== 2, "Adding simple item failed (%d)\n", res
);
155 res
= addItem(myHwnd
, 1, middle_item
);
156 ok(res
== 1, "Inserting simple item failed (%d)\n", res
);
158 /* Add an item completely out of range */
159 res
= addItem(myHwnd
, 99, out_of_range_item
);
160 ok(res
== -1, "Adding using out of range index worked unexpectedly (%d)\n", res
);
161 res
= addItem(myHwnd
, 5, out_of_range_item
);
162 ok(res
== -1, "Adding using out of range index worked unexpectedly (%d)\n", res
);
163 /* Removed: Causes traps on Windows XP
164 res = addItem(myHwnd, -2, "Out Of Range Item");
165 ok(res == -1, "Adding out of range worked unexpectedly (%ld)\n", res);
168 /* Get an item completely out of range */
169 res
= getItem(myHwnd
, 99, &cbexItem
);
170 ok(res
== 0, "Getting item using out of range index worked unexpectedly (%d, %s)\n", res
, cbexItem
.pszText
);
171 res
= getItem(myHwnd
, 4, &cbexItem
);
172 ok(res
== 0, "Getting item using out of range index worked unexpectedly (%d, %s)\n", res
, cbexItem
.pszText
);
173 res
= getItem(myHwnd
, -2, &cbexItem
);
174 ok(res
== 0, "Getting item using out of range index worked unexpectedly (%d, %s)\n", res
, cbexItem
.pszText
);
176 /* Get an item in range */
177 res
= getItem(myHwnd
, 0, &cbexItem
);
178 ok(res
!= 0, "Getting item using valid index failed unexpectedly (%d)\n", res
);
179 ok(strcmp(first_item
, cbexItem
.pszText
) == 0, "Getting item returned wrong string (%s)\n", cbexItem
.pszText
);
181 res
= getItem(myHwnd
, 1, &cbexItem
);
182 ok(res
!= 0, "Getting item using valid index failed unexpectedly (%d)\n", res
);
183 ok(strcmp(middle_item
, cbexItem
.pszText
) == 0, "Getting item returned wrong string (%s)\n", cbexItem
.pszText
);
185 res
= getItem(myHwnd
, 2, &cbexItem
);
186 ok(res
!= 0, "Getting item using valid index failed unexpectedly (%d)\n", res
);
187 ok(strcmp(second_item
, cbexItem
.pszText
) == 0, "Getting item returned wrong string (%s)\n", cbexItem
.pszText
);
189 res
= getItem(myHwnd
, 3, &cbexItem
);
190 ok(res
!= 0, "Getting item using valid index failed unexpectedly (%d)\n", res
);
191 ok(strcmp(third_item
, cbexItem
.pszText
) == 0, "Getting item returned wrong string (%s)\n", cbexItem
.pszText
);
193 /* Set an item completely out of range */
194 res
= setItem(myHwnd
, 99, replacement_item
);
195 ok(res
== 0, "Setting item using out of range index worked unexpectedly (%d)\n", res
);
196 res
= setItem(myHwnd
, 4, replacement_item
);
197 ok(res
== 0, "Setting item using out of range index worked unexpectedly (%d)\n", res
);
198 res
= setItem(myHwnd
, -2, replacement_item
);
199 ok(res
== 0, "Setting item using out of range index worked unexpectedly (%d)\n", res
);
201 /* Set an item in range */
202 res
= setItem(myHwnd
, 0, replacement_item
);
203 ok(res
!= 0, "Setting first item failed (%d)\n", res
);
204 res
= setItem(myHwnd
, 3, replacement_item
);
205 ok(res
!= 0, "Setting last item failed (%d)\n", res
);
207 /* Remove items completely out of range (4 items in control at this point) */
208 res
= delItem(myHwnd
, -1);
209 ok(res
== CB_ERR
, "Deleting using out of range index worked unexpectedly (%d)\n", res
);
210 res
= delItem(myHwnd
, 4);
211 ok(res
== CB_ERR
, "Deleting using out of range index worked unexpectedly (%d)\n", res
);
213 /* Remove items in range (4 items in control at this point) */
214 res
= delItem(myHwnd
, 3);
215 ok(res
== 3, "Deleting using out of range index failed (%d)\n", res
);
216 res
= delItem(myHwnd
, 0);
217 ok(res
== 2, "Deleting using out of range index failed (%d)\n", res
);
218 res
= delItem(myHwnd
, 0);
219 ok(res
== 1, "Deleting using out of range index failed (%d)\n", res
);
220 res
= delItem(myHwnd
, 0);
221 ok(res
== 0, "Deleting using out of range index failed (%d)\n", res
);
223 /* Remove from an empty box */
224 res
= delItem(myHwnd
, 0);
225 ok(res
== CB_ERR
, "Deleting using out of range index worked unexpectedly (%d)\n", res
);
229 HeapFree(GetProcessHeap(), 0, textBuffer
);
230 DestroyWindow(myHwnd
);
233 static void test_WM_LBUTTONDOWN(void)
235 HWND hComboEx
, hCombo
, hEdit
, hList
;
237 UINT x
, y
, item_height
;
243 static const UINT choices
[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
244 static const WCHAR stringFormat
[] = {'%','2','d','\0'};
245 BOOL (WINAPI
*pGetComboBoxInfo
)(HWND
, PCOMBOBOXINFO
);
247 pGetComboBoxInfo
= (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo");
248 if (!pGetComboBoxInfo
){
249 win_skip("GetComboBoxInfo is not available\n");
253 hComboEx
= CreateWindowExA(0, WC_COMBOBOXEXA
, NULL
,
254 WS_VISIBLE
|WS_CHILD
|CBS_DROPDOWN
, 0, 0, 200, 150,
255 hComboExParentWnd
, NULL
, hMainHinst
, NULL
);
257 for (i
= 0; i
< sizeof(choices
)/sizeof(UINT
); i
++){
258 COMBOBOXEXITEMW cbexItem
;
259 wsprintfW(buffer
, stringFormat
, choices
[i
]);
261 memset(&cbexItem
, 0x00, sizeof(cbexItem
));
262 cbexItem
.mask
= CBEIF_TEXT
;
264 cbexItem
.pszText
= buffer
;
265 cbexItem
.cchTextMax
= 0;
266 ok(SendMessageW(hComboEx
, CBEM_INSERTITEMW
, 0, (LPARAM
)&cbexItem
) >= 0,
267 "Failed to add item %d\n", i
);
270 hCombo
= (HWND
)SendMessage(hComboEx
, CBEM_GETCOMBOCONTROL
, 0, 0);
271 hEdit
= (HWND
)SendMessage(hComboEx
, CBEM_GETEDITCONTROL
, 0, 0);
273 cbInfo
.cbSize
= sizeof(COMBOBOXINFO
);
274 result
= pGetComboBoxInfo(hCombo
, &cbInfo
);
275 ok(result
, "Failed to get combobox info structure. LastError=%d\n",
277 hList
= cbInfo
.hwndList
;
279 trace("hWnd=%p, hComboEx=%p, hCombo=%p, hList=%p, hEdit=%p\n",
280 hComboExParentWnd
, hComboEx
, hCombo
, hList
, hEdit
);
281 ok(GetFocus() == hComboExParentWnd
,
282 "Focus not on Main Window, instead on %p\n", GetFocus());
284 /* Click on the button to drop down the list */
285 x
= cbInfo
.rcButton
.left
+ (cbInfo
.rcButton
.right
-cbInfo
.rcButton
.left
)/2;
286 y
= cbInfo
.rcButton
.top
+ (cbInfo
.rcButton
.bottom
-cbInfo
.rcButton
.top
)/2;
287 result
= SendMessage(hCombo
, WM_LBUTTONDOWN
, 0, MAKELPARAM(x
, y
));
288 ok(result
, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
290 ok(GetFocus() == hCombo
||
291 broken(GetFocus() != hCombo
), /* win98 */
292 "Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
294 ok(SendMessage(hComboEx
, CB_GETDROPPEDSTATE
, 0, 0),
295 "The dropdown list should have appeared after clicking the button.\n");
296 idx
= SendMessage(hCombo
, CB_GETTOPINDEX
, 0, 0);
297 ok(idx
== 0, "For TopIndex expected %d, got %d\n", 0, idx
);
299 result
= SendMessage(hCombo
, WM_LBUTTONUP
, 0, MAKELPARAM(x
, y
));
300 ok(result
, "WM_LBUTTONUP was not processed. LastError=%d\n",
302 ok(GetFocus() == hCombo
||
303 broken(GetFocus() != hCombo
), /* win98 */
304 "Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
307 /* Click on the 5th item in the list */
308 item_height
= SendMessage(hCombo
, CB_GETITEMHEIGHT
, 0, 0);
309 ok(GetClientRect(hList
, &rect
), "Failed to get list's client rect.\n");
310 x
= rect
.left
+ (rect
.right
-rect
.left
)/2;
311 y
= item_height
/2 + item_height
*4;
312 result
= SendMessage(hList
, WM_MOUSEMOVE
, 0, MAKELPARAM(x
, y
));
313 ok(!result
, "WM_MOUSEMOVE was not processed. LastError=%d\n",
315 ok(GetFocus() == hCombo
||
316 broken(GetFocus() != hCombo
), /* win98 */
317 "Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
320 result
= SendMessage(hList
, WM_LBUTTONDOWN
, 0, MAKELPARAM(x
, y
));
321 ok(!result
, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
323 ok(GetFocus() == hCombo
||
324 broken(GetFocus() != hCombo
), /* win98 */
325 "Focus not on ComboBoxEx's ComboBox Control, instead on %p\n",
327 ok(SendMessage(hComboEx
, CB_GETDROPPEDSTATE
, 0, 0),
328 "The dropdown list should still be visible.\n");
330 result
= SendMessage(hList
, WM_LBUTTONUP
, 0, MAKELPARAM(x
, y
));
331 ok(!result
, "WM_LBUTTONUP was not processed. LastError=%d\n",
333 todo_wine
ok(GetFocus() == hEdit
||
334 broken(GetFocus() == hCombo
), /* win98 */
335 "Focus not on ComboBoxEx's Edit Control, instead on %p\n",
338 result
= SendMessage(hCombo
, CB_GETDROPPEDSTATE
, 0, 0);
340 broken(result
!= 0), /* win98 */
341 "The dropdown list should have been rolled up.\n");
342 idx
= SendMessage(hComboEx
, CB_GETCURSEL
, 0, 0);
344 broken(idx
== -1), /* win98 */
345 "Current Selection: expected %d, got %d\n", 4, idx
);
346 ok(received_end_edit
, "Expected to receive a CBEN_ENDEDIT message\n");
348 DestroyWindow(hComboEx
);
351 static void test_CB_GETLBTEXT(void)
355 COMBOBOXEXITEMA item
;
358 hCombo
= createComboEx(WS_BORDER
| WS_VISIBLE
| WS_CHILD
| CBS_DROPDOWN
);
360 /* set text to null */
361 addItem(hCombo
, 0, NULL
);
364 item
.mask
= CBEIF_TEXT
;
368 ret
= SendMessage(hCombo
, CBEM_GETITEMA
, 0, (LPARAM
)&item
);
369 ok(ret
!= 0, "CBEM_GETITEM failed\n");
370 ok(buff
[0] == 0, "\n");
372 ret
= SendMessage(hCombo
, CB_GETLBTEXTLEN
, 0, 0);
373 ok(ret
== 0, "Expected zero length\n");
375 ret
= SendMessage(hCombo
, CB_GETLBTEXTLEN
, 0, 0);
376 ok(ret
== 0, "Expected zero length\n");
379 ret
= SendMessage(hCombo
, CB_GETLBTEXT
, 0, (LPARAM
)buff
);
380 ok(ret
== 0, "Expected zero length\n");
381 ok(buff
[0] == 0, "Expected null terminator as a string, got %s\n", buff
);
383 DestroyWindow(hCombo
);
386 static void test_WM_WINDOWPOSCHANGING(void)
394 hCombo
= createComboEx(WS_BORDER
| WS_VISIBLE
| WS_CHILD
| CBS_DROPDOWN
);
395 ok(hCombo
!= NULL
, "createComboEx failed\n");
396 ret
= GetWindowRect(hCombo
, &rect
);
397 ok(ret
, "GetWindowRect failed\n");
398 combo_height
= rect
.bottom
- rect
.top
;
399 ok(combo_height
> 0, "wrong combo height\n");
401 /* Test height > combo_height */
404 wp
.cx
= (rect
.right
- rect
.left
);
405 wp
.cy
= combo_height
* 2;
408 wp
.hwndInsertAfter
= NULL
;
410 ret
= SendMessageA(hCombo
, WM_WINDOWPOSCHANGING
, 0, (LPARAM
)&wp
);
411 ok(ret
== 0, "expected 0, got %x\n", ret
);
412 ok(wp
.cy
== combo_height
,
413 "Expected height %d, got %d\n", combo_height
, wp
.cy
);
415 /* Test height < combo_height */
418 wp
.cx
= (rect
.right
- rect
.left
);
419 wp
.cy
= combo_height
/ 2;
422 wp
.hwndInsertAfter
= NULL
;
424 ret
= SendMessageA(hCombo
, WM_WINDOWPOSCHANGING
, 0, (LPARAM
)&wp
);
425 ok(ret
== 0, "expected 0, got %x\n", ret
);
426 ok(wp
.cy
== combo_height
,
427 "Expected height %d, got %d\n", combo_height
, wp
.cy
);
429 ret
= DestroyWindow(hCombo
);
430 ok(ret
, "DestroyWindow failed\n");
433 static LRESULT
ComboExTestOnNotify(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
435 NMHDR
*hdr
= (NMHDR
*)lParam
;
439 NMCBEENDEDITA
*edit_info
= (NMCBEENDEDITA
*)hdr
;
440 if(edit_info
->iWhy
==CBENF_DROPDOWN
){
441 received_end_edit
= TRUE
;
447 NMCBEENDEDITW
*edit_info
= (NMCBEENDEDITW
*)hdr
;
448 if(edit_info
->iWhy
==CBENF_DROPDOWN
){
449 received_end_edit
= TRUE
;
457 static LRESULT CALLBACK
ComboExTestWndProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
465 return ComboExTestOnNotify(hWnd
,msg
,wParam
,lParam
);
467 return DefWindowProcA(hWnd
, msg
, wParam
, lParam
);
473 static int init(void)
476 BOOL (WINAPI
*pInitCommonControlsEx
)(const INITCOMMONCONTROLSEX
*);
478 INITCOMMONCONTROLSEX iccex
;
480 hComctl32
= GetModuleHandleA("comctl32.dll");
481 pInitCommonControlsEx
= (void*)GetProcAddress(hComctl32
, "InitCommonControlsEx");
482 if (!pInitCommonControlsEx
)
484 win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
487 iccex
.dwSize
= sizeof(iccex
);
488 iccex
.dwICC
= ICC_USEREX_CLASSES
;
489 pInitCommonControlsEx(&iccex
);
491 pSetWindowSubclass
= (void*)GetProcAddress(hComctl32
, (LPSTR
)410);
493 wc
.style
= CS_HREDRAW
| CS_VREDRAW
;
496 wc
.hInstance
= GetModuleHandleA(NULL
);
498 wc
.hCursor
= LoadCursorA(NULL
, IDC_ARROW
);
499 wc
.hbrBackground
= GetSysColorBrush(COLOR_WINDOW
);
500 wc
.lpszMenuName
= NULL
;
501 wc
.lpszClassName
= ComboExTestClass
;
502 wc
.lpfnWndProc
= ComboExTestWndProc
;
505 hComboExParentWnd
= CreateWindowExA(0, ComboExTestClass
, "ComboEx test", WS_OVERLAPPEDWINDOW
|WS_VISIBLE
,
506 CW_USEDEFAULT
, CW_USEDEFAULT
, 680, 260, NULL
, NULL
, GetModuleHandleA(NULL
), 0);
507 assert(hComboExParentWnd
!= NULL
);
509 hMainHinst
= GetModuleHandleA(NULL
);
513 static void cleanup(void)
517 PostMessageA(hComboExParentWnd
, WM_CLOSE
, 0, 0);
518 while (GetMessageA(&msg
,0,0,0)) {
519 TranslateMessage(&msg
);
520 DispatchMessageA(&msg
);
523 DestroyWindow(hComboExParentWnd
);
524 UnregisterClassA(ComboExTestClass
, GetModuleHandleA(NULL
));
527 static void test_comboboxex_subclass(void)
529 HWND hComboEx
, hCombo
, hEdit
;
531 hComboEx
= createComboEx(WS_BORDER
| WS_VISIBLE
| WS_CHILD
| CBS_DROPDOWN
);
533 hCombo
= (HWND
)SendMessage(hComboEx
, CBEM_GETCOMBOCONTROL
, 0, 0);
534 ok(hCombo
!= NULL
, "Failed to get internal combo\n");
535 hEdit
= (HWND
)SendMessage(hComboEx
, CBEM_GETEDITCONTROL
, 0, 0);
536 ok(hEdit
!= NULL
, "Failed to get internal edit\n");
538 if (pSetWindowSubclass
)
540 ok(GetPropA(hCombo
, "CC32SubclassInfo") != NULL
, "Expected CC32SubclassInfo property\n");
541 ok(GetPropA(hEdit
, "CC32SubclassInfo") != NULL
, "Expected CC32SubclassInfo property\n");
544 DestroyWindow(hComboEx
);
547 static const struct message test_setitem_edit_seq
[] = {
548 { WM_SETTEXT
, sent
|id
, 0, 0, EDITBOX_ID
},
549 { EM_SETSEL
, sent
|id
|wparam
|lparam
, 0, 0, EDITBOX_ID
},
550 { EM_SETSEL
, sent
|id
|wparam
|lparam
, 0, -1, EDITBOX_ID
},
554 static void test_get_set_item(void)
556 char textA
[] = "test";
558 COMBOBOXEXITEMA item
;
561 hComboEx
= createComboEx(WS_BORDER
| WS_VISIBLE
| WS_CHILD
| CBS_DROPDOWN
);
563 subclass_editbox(hComboEx
);
565 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
567 memset(&item
, 0, sizeof(item
));
568 item
.mask
= CBEIF_TEXT
;
569 item
.pszText
= textA
;
571 ret
= SendMessage(hComboEx
, CBEM_SETITEMA
, 0, (LPARAM
)&item
);
574 ok_sequence(sequences
, EDITBOX_SEQ_INDEX
, test_setitem_edit_seq
, "set item data for edit", FALSE
);
577 item
.mask
= CBEIF_LPARAM
;
579 item
.lParam
= 0xdeadbeef;
580 ret
= SendMessage(hComboEx
, CBEM_GETITEMA
, 0, (LPARAM
)&item
);
582 ok(item
.lParam
== 0, "Expected zero, got %lx\n", item
.lParam
);
584 item
.lParam
= 0x1abe11ed;
585 ret
= SendMessage(hComboEx
, CBEM_SETITEMA
, 0, (LPARAM
)&item
);
589 ret
= SendMessage(hComboEx
, CBEM_GETITEMA
, 0, (LPARAM
)&item
);
591 ok(item
.lParam
== 0x1abe11ed, "Expected 0x1abe11ed, got %lx\n", item
.lParam
);
593 DestroyWindow(hComboEx
);
601 init_msg_sequences(sequences
, NUM_MSG_SEQUENCES
);
604 test_WM_LBUTTONDOWN();
606 test_WM_WINDOWPOSCHANGING();
607 test_comboboxex_subclass();