1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetNextDlgTabItem, GetNextDlgGroupItem
5 * PROGRAMMERS: Katayama Hirofumi MZ
6 */
7
8 #include "precomp.h"
9
10 #include <windowsx.h>
11 #include <dlgs.h>
12
13 #define IDC_TEST1 1
14 #define IDC_TEST2 2
15 #define IDC_TEST3 3
16 #define IDC_END 9
17
18 static BOOL
OnInitDialog(HWND hwnd,HWND hwndFocus,LPARAM lParam)19 OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
20 {
21 PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_TEST1, 0), 0);
22 return TRUE;
23 }
24
25 static const char *
GetNameFromID(INT ID)26 GetNameFromID(INT ID)
27 {
28 switch (ID)
29 {
30 case rad1: return "rad1";
31 case rad2: return "rad2";
32 case rad3: return "rad3";
33 case psh1: return "psh1";
34 case rad5: return "rad5";
35 case rad6: return "rad6";
36 case rad7: return "rad7";
37 case IDOK: return "OK button";
38 case IDCANCEL: return "Cancel button";
39 default: return "(unknown)";
40 }
41 }
42
43 static const char *
GetNameFromHWND(HWND hwnd)44 GetNameFromHWND(HWND hwnd)
45 {
46 return GetNameFromID(GetDlgCtrlID(hwnd));
47 }
48
49 static void
DoTest1(HWND hwnd)50 DoTest1(HWND hwnd)
51 {
52 HWND hCtrl;
53 HWND hRad1, hRad2, hRad3, hPsh1, hRad5, hRad6, hRad7, hOK, hCancel;
54
55 // check control IDs
56 hCtrl = GetDlgItem(hwnd, rad1);
57 ok(GetDlgCtrlID(hCtrl) == rad1, "\n");
58 hCtrl = GetDlgItem(hwnd, rad2);
59 ok(GetDlgCtrlID(hCtrl) == rad2, "\n");
60 hCtrl = GetDlgItem(hwnd, rad3);
61 ok(GetDlgCtrlID(hCtrl) == rad3, "\n");
62 hCtrl = GetDlgItem(hwnd, psh1);
63 ok(GetDlgCtrlID(hCtrl) == psh1, "\n");
64 hCtrl = GetDlgItem(hwnd, rad5);
65 ok(GetDlgCtrlID(hCtrl) == rad5, "\n");
66 hCtrl = GetDlgItem(hwnd, rad6);
67 ok(GetDlgCtrlID(hCtrl) == rad6, "\n");
68 hCtrl = GetDlgItem(hwnd, rad7);
69 ok(GetDlgCtrlID(hCtrl) == rad7, "\n");
70 hCtrl = GetDlgItem(hwnd, IDOK);
71 ok(GetDlgCtrlID(hCtrl) == IDOK, "\n");
72 hCtrl = GetDlgItem(hwnd, IDCANCEL);
73 ok(GetDlgCtrlID(hCtrl) == IDCANCEL, "\n");
74
75 // get dialog items
76 hRad1 = GetDlgItem(hwnd, rad1);
77 hRad2 = GetDlgItem(hwnd, rad2);
78 hRad3 = GetDlgItem(hwnd, rad3);
79 hPsh1 = GetDlgItem(hwnd, psh1);
80 hRad5 = GetDlgItem(hwnd, rad5);
81 hRad6 = GetDlgItem(hwnd, rad6);
82 hRad7 = GetDlgItem(hwnd, rad7);
83 hOK = GetDlgItem(hwnd, IDOK);
84 hCancel = GetDlgItem(hwnd, IDCANCEL);
85
86 // next
87 hCtrl = GetNextDlgTabItem(hwnd, hRad1, FALSE);
88 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
89 hCtrl = GetNextDlgTabItem(hwnd, hRad2, FALSE);
90 ok(hCtrl == hRad3, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
91 hCtrl = GetNextDlgTabItem(hwnd, hRad3, FALSE);
92 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
93 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, FALSE);
94 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
95 hCtrl = GetNextDlgTabItem(hwnd, hRad5, FALSE);
96 ok(hCtrl == hRad6, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
97 hCtrl = GetNextDlgTabItem(hwnd, hRad6, FALSE);
98 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
99 hCtrl = GetNextDlgTabItem(hwnd, hRad7, FALSE);
100 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
101 hCtrl = GetNextDlgTabItem(hwnd, hOK, FALSE);
102 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
103 hCtrl = GetNextDlgTabItem(hwnd, hCancel, FALSE);
104 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
105
106 // prev
107 hCtrl = GetNextDlgTabItem(hwnd, hRad1, TRUE);
108 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
109 hCtrl = GetNextDlgTabItem(hwnd, hRad2, TRUE);
110 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
111 hCtrl = GetNextDlgTabItem(hwnd, hRad3, TRUE);
112 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
113 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, TRUE);
114 ok(hCtrl == hRad3, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
115 hCtrl = GetNextDlgTabItem(hwnd, hRad5, TRUE);
116 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
117 hCtrl = GetNextDlgTabItem(hwnd, hRad6, TRUE);
118 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
119 hCtrl = GetNextDlgTabItem(hwnd, hRad7, TRUE);
120 ok(hCtrl == hRad6, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
121 hCtrl = GetNextDlgTabItem(hwnd, hOK, TRUE);
122 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
123 hCtrl = GetNextDlgTabItem(hwnd, hCancel, TRUE);
124 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
125
126 // hide
127 ok(ShowWindow(hRad3, SW_HIDE) != 0, "\n");
128 ok(ShowWindow(hRad6, SW_HIDE) != 0, "\n");
129
130 // next with hidden
131 hCtrl = GetNextDlgTabItem(hwnd, hRad1, FALSE);
132 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
133 hCtrl = GetNextDlgTabItem(hwnd, hRad2, FALSE);
134 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
135 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, FALSE);
136 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
137 hCtrl = GetNextDlgTabItem(hwnd, hRad5, FALSE);
138 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
139 hCtrl = GetNextDlgTabItem(hwnd, hRad7, FALSE);
140 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
141 hCtrl = GetNextDlgTabItem(hwnd, hOK, FALSE);
142 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
143 hCtrl = GetNextDlgTabItem(hwnd, hCancel, FALSE);
144 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
145
146 // prev with hidden
147 hCtrl = GetNextDlgTabItem(hwnd, hRad1, TRUE);
148 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
149 hCtrl = GetNextDlgTabItem(hwnd, hRad2, TRUE);
150 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
151 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, TRUE);
152 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
153 hCtrl = GetNextDlgTabItem(hwnd, hRad5, TRUE);
154 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
155 hCtrl = GetNextDlgTabItem(hwnd, hRad7, TRUE);
156 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
157 hCtrl = GetNextDlgTabItem(hwnd, hOK, TRUE);
158 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
159 hCtrl = GetNextDlgTabItem(hwnd, hCancel, TRUE);
160 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
161
162 // show
163 ShowWindow(hRad3, SW_SHOWNOACTIVATE);
164 ShowWindow(hRad6, SW_SHOWNOACTIVATE);
165
166 // next again
167 hCtrl = GetNextDlgTabItem(hwnd, hRad1, FALSE);
168 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
169 hCtrl = GetNextDlgTabItem(hwnd, hRad2, FALSE);
170 ok(hCtrl == hRad3, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
171 hCtrl = GetNextDlgTabItem(hwnd, hRad3, FALSE);
172 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
173 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, FALSE);
174 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
175 hCtrl = GetNextDlgTabItem(hwnd, hRad5, FALSE);
176 ok(hCtrl == hRad6, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
177 hCtrl = GetNextDlgTabItem(hwnd, hRad6, FALSE);
178 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
179 hCtrl = GetNextDlgTabItem(hwnd, hRad7, FALSE);
180 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
181 hCtrl = GetNextDlgTabItem(hwnd, hOK, FALSE);
182 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
183 hCtrl = GetNextDlgTabItem(hwnd, hCancel, FALSE);
184 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
185
186 // prev again
187 hCtrl = GetNextDlgTabItem(hwnd, hRad1, TRUE);
188 ok(hCtrl == hCancel, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
189 hCtrl = GetNextDlgTabItem(hwnd, hRad2, TRUE);
190 ok(hCtrl == hRad1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
191 hCtrl = GetNextDlgTabItem(hwnd, hRad3, TRUE);
192 ok(hCtrl == hRad2, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
193 hCtrl = GetNextDlgTabItem(hwnd, hPsh1, TRUE);
194 ok(hCtrl == hRad3, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
195 hCtrl = GetNextDlgTabItem(hwnd, hRad5, TRUE);
196 ok(hCtrl == hPsh1, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
197 hCtrl = GetNextDlgTabItem(hwnd, hRad6, TRUE);
198 ok(hCtrl == hRad5, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
199 hCtrl = GetNextDlgTabItem(hwnd, hRad7, TRUE);
200 ok(hCtrl == hRad6, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
201 hCtrl = GetNextDlgTabItem(hwnd, hOK, TRUE);
202 ok(hCtrl == hRad7, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
203 hCtrl = GetNextDlgTabItem(hwnd, hCancel, TRUE);
204 ok(hCtrl == hOK, "hCtrl was %s\n", GetNameFromHWND(hCtrl));
205 }
206
207 static void
DoTest2(HWND hwnd)208 DoTest2(HWND hwnd)
209 {
210 HWND hCtrl;
211 HWND hRad1, hRad2, hRad3, hPsh1, hRad5, hRad6, hRad7, hOK, hCancel;
212
213 // check control IDs
214 hCtrl = GetDlgItem(hwnd, rad1);
215 ok(GetDlgCtrlID(hCtrl) == rad1, "\n");
216 hCtrl = GetDlgItem(hwnd, rad2);
217 ok(GetDlgCtrlID(hCtrl) == rad2, "\n");
218 hCtrl = GetDlgItem(hwnd, rad3);
219 ok(GetDlgCtrlID(hCtrl) == rad3, "\n");
220 hCtrl = GetDlgItem(hwnd, psh1);
221 ok(GetDlgCtrlID(hCtrl) == psh1, "\n");
222 hCtrl = GetDlgItem(hwnd, rad5);
223 ok(GetDlgCtrlID(hCtrl) == rad5, "\n");
224 hCtrl = GetDlgItem(hwnd, rad6);
225 ok(GetDlgCtrlID(hCtrl) == rad6, "\n");
226 hCtrl = GetDlgItem(hwnd, rad7);
227 ok(GetDlgCtrlID(hCtrl) == rad7, "\n");
228 hCtrl = GetDlgItem(hwnd, IDOK);
229 ok(GetDlgCtrlID(hCtrl) == IDOK, "\n");
230 hCtrl = GetDlgItem(hwnd, IDCANCEL);
231 ok(GetDlgCtrlID(hCtrl) == IDCANCEL, "\n");
232
233 // get dialog items
234 hRad1 = GetDlgItem(hwnd, rad1);
235 hRad2 = GetDlgItem(hwnd, rad2);
236 hRad3 = GetDlgItem(hwnd, rad3);
237 hPsh1 = GetDlgItem(hwnd, psh1);
238 hRad5 = GetDlgItem(hwnd, rad5);
239 hRad6 = GetDlgItem(hwnd, rad6);
240 hRad7 = GetDlgItem(hwnd, rad7);
241 hOK = GetDlgItem(hwnd, IDOK);
242 hCancel = GetDlgItem(hwnd, IDCANCEL);
243
244 // group next
245 hCtrl = GetNextDlgGroupItem(hwnd, hRad1, FALSE);
246 ok(hCtrl == hRad2, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
247 hCtrl = GetNextDlgGroupItem(hwnd, hRad2, FALSE);
248 ok(hCtrl == hRad3, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
249 hCtrl = GetNextDlgGroupItem(hwnd, hRad3, FALSE);
250 ok(hCtrl == hPsh1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
251 hCtrl = GetNextDlgGroupItem(hwnd, hPsh1, FALSE);
252 ok(hCtrl == hRad5, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
253 hCtrl = GetNextDlgGroupItem(hwnd, hRad5, FALSE);
254 ok(hCtrl == hRad6, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
255 hCtrl = GetNextDlgGroupItem(hwnd, hRad6, FALSE);
256 ok(hCtrl == hRad7, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
257 hCtrl = GetNextDlgGroupItem(hwnd, hRad7, FALSE);
258 ok(hCtrl == hOK, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
259 hCtrl = GetNextDlgGroupItem(hwnd, hOK, FALSE);
260 ok(hCtrl == hCancel, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
261 hCtrl = GetNextDlgGroupItem(hwnd, hCancel, FALSE);
262 ok(hCtrl == hRad1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
263
264 // group prev
265 hCtrl = GetNextDlgGroupItem(hwnd, hRad1, TRUE);
266 ok(hCtrl == hCancel, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
267 hCtrl = GetNextDlgGroupItem(hwnd, hRad2, TRUE);
268 ok(hCtrl == hRad1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
269 hCtrl = GetNextDlgGroupItem(hwnd, hRad3, TRUE);
270 ok(hCtrl == hRad2, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
271 hCtrl = GetNextDlgGroupItem(hwnd, hPsh1, TRUE);
272 ok(hCtrl == hRad3, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
273 hCtrl = GetNextDlgGroupItem(hwnd, hRad5, TRUE);
274 ok(hCtrl == hPsh1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
275 hCtrl = GetNextDlgGroupItem(hwnd, hRad6, TRUE);
276 ok(hCtrl == hRad5, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
277 hCtrl = GetNextDlgGroupItem(hwnd, hRad7, TRUE);
278 ok(hCtrl == hRad6, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
279 hCtrl = GetNextDlgGroupItem(hwnd, hOK, TRUE);
280 ok(hCtrl == hRad7, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
281 hCtrl = GetNextDlgGroupItem(hwnd, hCancel, TRUE);
282 ok(hCtrl == hOK, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
283
284 // hide
285 ok(ShowWindow(hRad3, SW_HIDE) != 0, "\n");
286 ok(ShowWindow(hRad6, SW_HIDE) != 0, "\n");
287
288 // group next with hidden
289 hCtrl = GetNextDlgGroupItem(hwnd, hRad1, FALSE);
290 ok(hCtrl == hRad2, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
291 hCtrl = GetNextDlgGroupItem(hwnd, hRad2, FALSE);
292 ok(hCtrl == hPsh1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
293 hCtrl = GetNextDlgGroupItem(hwnd, hPsh1, FALSE);
294 ok(hCtrl == hRad5, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
295 hCtrl = GetNextDlgGroupItem(hwnd, hRad5, FALSE);
296 ok(hCtrl == hRad7, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
297 hCtrl = GetNextDlgGroupItem(hwnd, hRad7, FALSE);
298 ok(hCtrl == hOK, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
299 hCtrl = GetNextDlgGroupItem(hwnd, hOK, FALSE);
300 ok(hCtrl == hCancel, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
301 hCtrl = GetNextDlgGroupItem(hwnd, hCancel, FALSE);
302 ok(hCtrl == hRad1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
303
304 // group prev with hidden
305 hCtrl = GetNextDlgGroupItem(hwnd, hRad1, TRUE);
306 ok(hCtrl == hCancel, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
307 hCtrl = GetNextDlgGroupItem(hwnd, hRad2, TRUE);
308 ok(hCtrl == hRad1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
309 hCtrl = GetNextDlgGroupItem(hwnd, hPsh1, TRUE);
310 ok(hCtrl == hRad2, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
311 hCtrl = GetNextDlgGroupItem(hwnd, hRad5, TRUE);
312 ok(hCtrl == hPsh1, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
313 hCtrl = GetNextDlgGroupItem(hwnd, hRad7, TRUE);
314 ok(hCtrl == hRad5, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
315 hCtrl = GetNextDlgGroupItem(hwnd, hOK, TRUE);
316 ok(hCtrl == hRad7, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
317 hCtrl = GetNextDlgGroupItem(hwnd, hCancel, TRUE);
318 ok(hCtrl == hOK, "hCtrl is %s\n", GetNameFromHWND(hCtrl));
319
320 // show
321 ShowWindow(hRad3, SW_SHOWNOACTIVATE);
322 ShowWindow(hRad6, SW_SHOWNOACTIVATE);
323 }
324
325 static POINT
GetCtrlCenter(HWND hCtrl)326 GetCtrlCenter(HWND hCtrl)
327 {
328 RECT rc;
329 POINT pt;
330
331 GetClientRect(hCtrl, &rc);
332 pt.x = (rc.left + rc.right) / 2;
333 pt.y = (rc.top + rc.bottom) / 2;
334 return pt;
335 }
336
337 static void
DoTest3(HWND hwnd)338 DoTest3(HWND hwnd)
339 {
340 HWND hCtrl;
341 POINT pt;
342
343 CheckDlgButton(hwnd, rad1, BST_CHECKED);
344 CheckDlgButton(hwnd, rad5, BST_CHECKED);
345
346 ok(IsDlgButtonChecked(hwnd, rad1) == BST_CHECKED, "\n");
347 ok(IsDlgButtonChecked(hwnd, rad2) == BST_UNCHECKED, "\n");
348 ok(IsDlgButtonChecked(hwnd, rad3) == BST_UNCHECKED, "\n");
349 ok(IsDlgButtonChecked(hwnd, rad5) == BST_CHECKED, "\n");
350 ok(IsDlgButtonChecked(hwnd, rad6) == BST_UNCHECKED, "\n");
351 ok(IsDlgButtonChecked(hwnd, rad7) == BST_UNCHECKED, "\n");
352
353 hCtrl = GetDlgItem(hwnd, rad1);
354 pt = GetCtrlCenter(hCtrl);
355 SendMessage(hCtrl, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(pt.x, pt.y));
356 SendMessage(hCtrl, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(pt.x, pt.y));
357
358 ok(IsDlgButtonChecked(hwnd, rad1) == BST_CHECKED, "\n");
359 ok(IsDlgButtonChecked(hwnd, rad2) == BST_UNCHECKED, "\n");
360 ok(IsDlgButtonChecked(hwnd, rad3) == BST_UNCHECKED, "\n");
361 ok(IsDlgButtonChecked(hwnd, rad5) == BST_UNCHECKED, "\n");
362 ok(IsDlgButtonChecked(hwnd, rad6) == BST_UNCHECKED, "\n");
363 ok(IsDlgButtonChecked(hwnd, rad7) == BST_UNCHECKED, "\n");
364
365 hCtrl = GetDlgItem(hwnd, rad5);
366 pt = GetCtrlCenter(hCtrl);
367 SendMessage(hCtrl, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(pt.x, pt.y));
368 SendMessage(hCtrl, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(pt.x, pt.y));
369
370 ok(IsDlgButtonChecked(hwnd, rad1) == BST_UNCHECKED, "\n");
371 ok(IsDlgButtonChecked(hwnd, rad2) == BST_UNCHECKED, "\n");
372 ok(IsDlgButtonChecked(hwnd, rad3) == BST_UNCHECKED, "\n");
373 ok(IsDlgButtonChecked(hwnd, rad5) == BST_CHECKED, "\n");
374 ok(IsDlgButtonChecked(hwnd, rad6) == BST_UNCHECKED, "\n");
375 ok(IsDlgButtonChecked(hwnd, rad7) == BST_UNCHECKED, "\n");
376 }
377
378 static void
OnCommand(HWND hwnd,int id,HWND hwndCtl,UINT codeNotify)379 OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
380 {
381 switch (id)
382 {
383 case IDC_TEST1:
384 DoTest1(hwnd);
385 PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_TEST2, 0), 0);
386 break;
387 case IDC_TEST2:
388 DoTest2(hwnd);
389 PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_TEST3, 0), 0);
390 break;
391 case IDC_TEST3:
392 DoTest3(hwnd);
393 PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_END, 0), 0);
394 break;
395 case IDC_END:
396 EndDialog(hwnd, IDOK);
397 break;
398 }
399 }
400
401 INT_PTR CALLBACK
RadioButtonDialogProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)402 RadioButtonDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
403 {
404 switch (uMsg)
405 {
406 HANDLE_MSG(hwnd, WM_INITDIALOG, OnInitDialog);
407 HANDLE_MSG(hwnd, WM_COMMAND, OnCommand);
408 }
409 return 0;
410 }
411
START_TEST(NextDlgItem)412 START_TEST(NextDlgItem)
413 {
414 HMODULE hMod = GetModuleHandle(NULL);
415 ok(hMod != NULL, "\n");
416 DialogBox(hMod, TEXT("NEXTDLGITEM"), NULL, RadioButtonDialogProc);
417 }
418