ReactOS 0.4.16-dev-2332-g4cba65d
dragdrop.c
Go to the documentation of this file.
1/*
2 * Drag and Drop Tests
3 *
4 * Copyright 2007 Robert Shearman
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define _WIN32_DCOM
22#define COBJMACROS
23#define CONST_VTABLE
24
25#include <stdarg.h>
26#include <stdio.h>
27
28#include "windef.h"
29#include "winbase.h"
30#include "objbase.h"
31
32#include "wine/test.h"
33
34
35#define METHOD_LIST \
36 METHOD(DO_EnumFormatEtc), \
37 METHOD(DO_QueryGetData), \
38 METHOD(EnumFMT_Next), \
39 METHOD(EnumFMT_Reset), \
40 METHOD(EnumFMT_Skip), \
41 METHOD(DS_QueryContinueDrag), \
42 METHOD(DS_GiveFeedback), \
43 METHOD(DT_DragEnter), \
44 METHOD(DT_Drop), \
45 METHOD(DT_DragLeave), \
46 METHOD(DT_DragOver), \
47 METHOD(DoDragDrop_effect_in), \
48 METHOD(DoDragDrop_ret), \
49 METHOD(DoDragDrop_effect_out), \
50 METHOD(end_seq)
51
52#define METHOD(x) x
54{
56};
57#undef METHOD
58
59#define METHOD(x) #x
60static const char *method_names[] =
61{
63};
64#undef METHOD
65#undef METHOD_LIST
66
68{
71
74
76};
77
78const struct method_call *call_ptr;
79
81{
82 HRESULT hr;
83
84 do
85 {
86 todo_wine_if(call_ptr->called_todo)
87 ok_( file, line )( func == call_ptr->method, "unexpected call %s instead of %s\n",
89 if (call_ptr->method == func) break;
90 } while ((++call_ptr)->method != end_seq);
91
92 ok_( file, line )( expect_param == call_ptr->expect_param, "%s: unexpected param %08lx expected %08lx\n",
93 method_names[func], expect_param, call_ptr->expect_param );
94 if (set_param) *set_param = call_ptr->set_param;
95 hr = call_ptr->set_ret;
96 if (call_ptr->method != end_seq) call_ptr++;
97 return hr;
98}
99
100#define check_expect(func, expect_param, set_param) \
101 check_expect_((func), (expect_param), (set_param), __FILE__, __LINE__)
102
103
105{
106 { /* First QueryContinueDrag rets DRAGDROP_S_DROP */
107 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY, 0 },
108 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
109 { EnumFMT_Next, 0, S_OK, 0, 1 },
110 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
111 { EnumFMT_Reset, 0, S_OK, 0, 1 },
112 { EnumFMT_Next, 0, S_OK, 0, 1 },
113 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
114 { DO_QueryGetData, 0, S_OK, 0, 1 },
115
116 { DS_QueryContinueDrag, 0, DRAGDROP_S_DROP, 0, 0 },
117 { DT_DragEnter, DROPEFFECT_COPY, S_OK, DROPEFFECT_COPY, 0 },
118 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
119 { DT_Drop, DROPEFFECT_COPY, 0xbeefbeef, DROPEFFECT_COPY, 0 },
120
121 { DoDragDrop_ret, 0xbeefbeef, 0, 0, 0, },
122 { DoDragDrop_effect_out, DROPEFFECT_COPY, 0, 0, 0 },
123 { end_seq, 0, 0, 0, 0 }
124 },
125 { /* As above, but initial effects == 0 */
126 { DoDragDrop_effect_in, 0, 0, 0, 0 },
127 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
128 { EnumFMT_Next, 0, S_OK, 0, 1 },
129 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
130 { EnumFMT_Reset, 0, S_OK, 0, 1 },
131 { EnumFMT_Next, 0, S_OK, 0, 1 },
132 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
133 { DO_QueryGetData, 0, S_OK, 0, 1 },
134
135 { DS_QueryContinueDrag, 0, DRAGDROP_S_DROP, 0, 0 },
136 { DT_DragEnter, 0, S_OK, DROPEFFECT_COPY, 0 },
137 { DS_GiveFeedback, 0, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
138 { DT_DragLeave, 0, 0, 0, 0 },
139
140 { DoDragDrop_ret, DRAGDROP_S_DROP, 0, 0, 0 },
141 { DoDragDrop_effect_out, 0, 0, 0, 0 },
142 { end_seq, 0, 0, 0, 0 }
143 },
144 { /* Multiple initial effects */
145 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0 },
146 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
147 { EnumFMT_Next, 0, S_OK, 0, 1 },
148 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
149 { EnumFMT_Reset, 0, S_OK, 0, 1 },
150 { EnumFMT_Next, 0, S_OK, 0, 1 },
151 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
152 { DO_QueryGetData, 0, S_OK, 0, 1 },
153
154 { DS_QueryContinueDrag, 0, DRAGDROP_S_DROP, 0, 0 },
155 { DT_DragEnter, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
156 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
157 { DT_Drop, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0, 0, 0 },
158
159 { DoDragDrop_ret, DRAGDROP_S_DROP, 0, 0, 0 },
160 { DoDragDrop_effect_out, 0, 0, 0, 0 },
161 { end_seq, 0, 0, 0, 0 }
162 },
163 { /* First couple of QueryContinueDrag return S_OK followed by a drop */
164 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0 },
165 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
166 { EnumFMT_Next, 0, S_OK, 0, 1 },
167 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
168 { EnumFMT_Reset, 0, S_OK, 0, 1 },
169 { EnumFMT_Next, 0, S_OK, 0, 1 },
170 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
171 { DO_QueryGetData, 0, S_OK, 0, 1 },
172
173 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
174 { DT_DragEnter, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
175 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
176 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
177 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
178
179 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
180 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
181 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
182
183 { DS_QueryContinueDrag, 0, DRAGDROP_S_DROP, 0, 0 },
184 { DT_Drop, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0, 0, 0 },
185
186 { DoDragDrop_ret, DRAGDROP_S_DROP, 0, 0, 0 },
187 { DoDragDrop_effect_out, 0, 0, 0, 0 },
188 { end_seq, 0, 0, 0, 0 }
189 },
190 { /* First QueryContinueDrag cancels */
191 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0 },
192 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
193 { EnumFMT_Next, 0, S_OK, 0, 1 },
194 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
195 { EnumFMT_Reset, 0, S_OK, 0, 1 },
196 { EnumFMT_Next, 0, S_OK, 0, 1 },
197 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
198 { DO_QueryGetData, 0, S_OK, 0, 1 },
199
200 { DS_QueryContinueDrag, 0, DRAGDROP_S_CANCEL, 0, 0 },
201
202 { DoDragDrop_ret, DRAGDROP_S_CANCEL, 0, 0, 0 },
203 { DoDragDrop_effect_out, 0, 0, 0, 0 },
204 { end_seq, 0, 0, 0, 0 }
205 },
206 { /* First couple of QueryContinueDrag return S_OK followed by a cancel */
207 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0 },
208 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
209 { EnumFMT_Next, 0, S_OK, 0, 1 },
210 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
211 { EnumFMT_Reset, 0, S_OK, 0, 1 },
212 { EnumFMT_Next, 0, S_OK, 0, 1 },
213 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
214 { DO_QueryGetData, 0, S_OK, 0, 1 },
215
216 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
217 { DT_DragEnter, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
218 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
219 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
220 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
221
222 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
223 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
224 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
225
226 { DS_QueryContinueDrag, 0, DRAGDROP_S_CANCEL, 0, 0 },
227 { DT_DragLeave, 0, 0, 0, 0 },
228
229 { DoDragDrop_ret, DRAGDROP_S_CANCEL, 0, 0, 0 },
230 { DoDragDrop_effect_out, 0, 0, 0, 0 },
231 { end_seq, 0, 0, 0, 0 }
232 },
233 { /* First couple of QueryContinueDrag return S_OK followed by a E_FAIL */
234 { DoDragDrop_effect_in, 0, 0, DROPEFFECT_COPY | DROPEFFECT_MOVE, 0 },
235 { DO_EnumFormatEtc, 0, S_OK, 0, 1 },
236 { EnumFMT_Next, 0, S_OK, 0, 1 },
237 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
238 { EnumFMT_Reset, 0, S_OK, 0, 1 },
239 { EnumFMT_Next, 0, S_OK, 0, 1 },
240 { EnumFMT_Next, 0, S_FALSE, 0, 1 },
241 { DO_QueryGetData, 0, S_OK, 0, 1 },
242
243 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
244 { DT_DragEnter, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
245 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
246 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
247 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
248
249 { DS_QueryContinueDrag, 0, S_OK, 0, 0 },
250 { DT_DragOver, DROPEFFECT_COPY | DROPEFFECT_MOVE, S_OK, DROPEFFECT_COPY, 0 },
251 { DS_GiveFeedback, DROPEFFECT_COPY, DRAGDROP_S_USEDEFAULTCURSORS, 0, 0 },
252
253 { DS_QueryContinueDrag, 0, E_FAIL, 0, 0 },
254 { DT_DragLeave, 0, 0, 0, 0 },
255
256 { DoDragDrop_ret, E_FAIL, 0, 0, 0 },
257 { DoDragDrop_effect_out, 0, 0, 0, 0 },
258 { end_seq, 0, 0, 0, 0 }
259 },
260};
261
264
265/* helper macros to make tests a bit leaner */
266#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
267
269 void** ppvObject)
270{
271 ok(0, "DropTarget_QueryInterface() shouldn't be called\n");
273 IsEqualIID(riid, &IID_IDropTarget))
274 {
275 IDropTarget_AddRef(iface);
276 *ppvObject = iface;
277 return S_OK;
278 }
279 *ppvObject = NULL;
280 return E_NOINTERFACE;
281}
282
284{
286 return droptarget_refs;
287}
288
290{
292 return droptarget_refs;
293}
294
296 IDataObject* pDataObj,
297 DWORD grfKeyState, POINTL pt,
298 DWORD* pdwEffect)
299{
300 return check_expect(DT_DragEnter, *pdwEffect, pdwEffect);
301}
302
304 DWORD grfKeyState,
305 POINTL pt,
306 DWORD* pdwEffect)
307{
308 return check_expect(DT_DragOver, *pdwEffect, pdwEffect);
309}
310
312{
313 return check_expect(DT_DragLeave, 0, NULL);
314}
315
317 IDataObject* pDataObj, DWORD grfKeyState,
318 POINTL pt, DWORD* pdwEffect)
319{
320 return check_expect(DT_Drop, *pdwEffect, pdwEffect);
321}
322
323static const IDropTargetVtbl DropTarget_VTbl =
324{
332};
333
335
337{
339 IsEqualIID(riid, &IID_IDropSource))
340 {
341 *ppObj = iface;
342 IDropSource_AddRef(iface);
343 return S_OK;
344 }
345 return E_NOINTERFACE;
346}
347
349{
350 return 2;
351}
352
354{
355 return 1;
356}
357
359 IDropSource *iface,
360 BOOL fEscapePressed,
361 DWORD grfKeyState)
362{
363 HRESULT hr = check_expect(DS_QueryContinueDrag, 0, NULL);
364 if (test_reentrance)
365 {
366 MSG msg;
367 BOOL r;
368 int num = 0;
369
370 HWND hwnd = GetCapture();
371 ok(hwnd != 0, "Expected capture window\n");
372
373 /* send some fake events that should be ignored */
376 r &= PostMessageA(hwnd, WM_LBUTTONUP, 0, 0);
378 ok(r, "Unable to post messages\n");
379
380 /* run the message loop for this thread */
381 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
382 {
385 num++;
386 }
387
388 ok(num >= 4, "Expected at least 4 messages but %d were processed\n", num);
389 }
390 return hr;
391}
392
394 IDropSource *iface,
395 DWORD dwEffect)
396{
397 return check_expect(DS_GiveFeedback, dwEffect, NULL);
398}
399
400static const IDropSourceVtbl dropsource_vtbl = {
406};
407
409
411 REFIID riid, void **ppvObj)
412{
413 ok(0, "unexpected call\n");
414 return E_NOTIMPL;
415}
416
418{
419 return 2;
420}
421
423{
424 return 1;
425}
426
428 ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
429{
430 static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
431 HRESULT hr = check_expect(EnumFMT_Next, 0, NULL);
432
433 ok(celt == 1, "celt = %ld\n", celt);
434 ok(rgelt != NULL, "rgelt == NULL\n");
435 ok(pceltFetched == NULL, "pceltFetched != NULL\n");
436
437 *rgelt = format;
438 return hr;
439}
440
442{
443 return check_expect(EnumFMT_Skip, 0, NULL);
444}
445
447{
448 return check_expect(EnumFMT_Reset, 0, NULL);
449}
450
452 IEnumFORMATETC **ppenum)
453{
454 ok(0, "unexpected call\n");
455 return E_NOTIMPL;
456}
457
458static const IEnumFORMATETCVtbl enumformatetc_vtbl = {
466};
467
469
471 IDataObject *iface,
472 REFIID riid,
473 void **pObj)
474{
477 {
478 *pObj = iface;
479 IDataObject_AddRef(iface);
480 return S_OK;
481 }
482
483 trace("DataObject_QueryInterface: %s\n", wine_dbgstr_guid(riid));
484 return E_NOINTERFACE;
485}
486
488{
489 return 2;
490}
491
493{
494 return 1;
495}
496
498 IDataObject *iface,
499 FORMATETC *pformatetcIn,
500 STGMEDIUM *pmedium)
501{
502 ok(0, "unexpected call\n");
503 return E_NOTIMPL;
504}
505
507 IDataObject *iface,
508 FORMATETC *pformatetc,
509 STGMEDIUM *pmedium)
510{
511 ok(0, "unexpected call\n");
512 return E_NOTIMPL;
513}
514
516 IDataObject *iface,
517 FORMATETC *pformatetc)
518{
519 return check_expect(DO_QueryGetData, 0, NULL);
520}
521
523 IDataObject *iface,
524 FORMATETC *pformatectIn,
525 FORMATETC *pformatetcOut)
526{
527 ok(0, "unexpected call\n");
528 return E_NOTIMPL;
529}
530
532 IDataObject *iface,
533 FORMATETC *pformatetc,
534 STGMEDIUM *pmedium,
535 BOOL fRelease)
536{
537 ok(0, "unexpected call\n");
538 return E_NOTIMPL;
539}
540
542 IDataObject *iface,
543 DWORD dwDirection,
544 IEnumFORMATETC **ppenumFormatEtc)
545{
546 HRESULT hr = check_expect(DO_EnumFormatEtc, 0, NULL);
547 *ppenumFormatEtc = &EnumFORMATETC;
548 return hr;
549}
550
552 IDataObject *iface,
553 FORMATETC *pformatetc,
554 DWORD advf,
555 IAdviseSink *pAdvSink,
556 DWORD *pdwConnection)
557{
558 ok(0, "unexpected call\n");
559 return E_NOTIMPL;
560}
561
563 IDataObject *iface,
564 DWORD dwConnection)
565{
566 ok(0, "unexpected call\n");
567 return E_NOTIMPL;
568}
569
571 IDataObject *iface,
572 IEnumSTATDATA **ppenumAdvise)
573{
574 ok(0, "unexpected call\n");
575 return E_NOTIMPL;
576}
577
578static const IDataObjectVtbl dataobject_vtbl = {
591};
592
594
596{
597 WNDCLASSA wc =
598 {
599 0,
601 0,
602 0,
604 NULL,
606 (HBRUSH)(COLOR_BTNFACE+1),
607 NULL,
608 "WineOleTestClass",
609 };
610
611 return RegisterClassA(&wc);
612}
613
614static void test_Register_Revoke(void)
615{
616 HANDLE prop;
617 HRESULT hr;
618 HWND hwnd;
619
620 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
622 NULL, NULL, NULL);
623
625 ok(hr == E_OUTOFMEMORY ||
626 broken(hr == CO_E_NOTINITIALIZED), /* NT4 */
627 "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08lx\n", hr);
628
630
632 ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08lx\n", hr);
633
635 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
636
637 hr = RegisterDragDrop((HWND)0xdeadbeef, &DropTarget);
638 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
639
640 ok(droptarget_refs == 0, "DropTarget refs should be zero not %d\n", droptarget_refs);
642 ok_ole_success(hr, "RegisterDragDrop");
643 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
644
645 prop = GetPropA(hwnd, "OleDropTargetInterface");
646 ok(prop == &DropTarget, "expected IDropTarget pointer %p, got %p\n", &DropTarget, prop);
647
649 ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08lx\n", hr);
650
651 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
653
654 /* Win 8 releases the ref in OleUninitialize() */
655 if (droptarget_refs >= 1)
656 {
658 ok_ole_success(hr, "RevokeDragDrop");
659 ok(droptarget_refs == 0 ||
660 broken(droptarget_refs == 1), /* NT4 */
661 "DropTarget refs should be zero not %d\n", droptarget_refs);
662 }
663
665 ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
666
668
669 /* try to revoke with already destroyed window */
671
672 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
674 NULL, NULL, NULL);
675
677 ok(hr == S_OK, "got 0x%08lx\n", hr);
678
680
682 ok(hr == DRAGDROP_E_INVALIDHWND, "got 0x%08lx\n", hr);
683
685}
686
687static void test_DoDragDrop(void)
688{
689 DWORD effect;
690 HRESULT hr;
691 HWND hwnd;
692 RECT rect;
693 int seq;
694
695 hwnd = CreateWindowExA(WS_EX_TOPMOST, "WineOleTestClass", "Test", 0,
696 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL,
697 NULL, NULL, NULL);
698 ok(IsWindow(hwnd), "failed to create window\n");
699
701 ok(hr == S_OK, "got 0x%08lx\n", hr);
702
704 ok(hr == S_OK, "got 0x%08lx\n", hr);
705
706 /* incomplete arguments set */
707 hr = DoDragDrop(NULL, NULL, 0, NULL);
708 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
709
711 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
712
714 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
715
716 hr = DoDragDrop(NULL, NULL, 0, &effect);
717 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
718
720 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
721
722 hr = DoDragDrop(NULL, &DropSource, 0, &effect);
723 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
724
725 hr = DoDragDrop(&DataObject, NULL, 0, &effect);
726 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
727
730 ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");
731
733 {
734 for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++)
735 {
736 DWORD effect_in;
737 trace("%d\n", seq);
738 call_ptr = call_lists[seq];
739 effect_in = call_ptr->set_param;
740 call_ptr++;
741
742 hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect);
743 check_expect(DoDragDrop_ret, hr, NULL);
744 check_expect(DoDragDrop_effect_out, effect, NULL);
745 }
746 }
747
749
751}
752
753START_TEST(dragdrop)
754{
756
758#ifdef __REACTOS__
760 !strcmp(winetest_platform, "windows"))
761 {
762 skip("ROSTESTS-182: Skipping ole32_winetest:dragdrop test_DoDragDrop because it hangs on WHS-Testbot. Set winetest_interactive to run it anyway.\n");
763 return;
764 }
765#endif
767}
#define CO_E_NOTINITIALIZED
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
#define CF_TEXT
Definition: constants.h:396
#define ARRAY_SIZE(A)
Definition: main.h:20
const GUID IID_IUnknown
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:547
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:737
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:629
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: dragdrop.c:522
static HRESULT WINAPI DataObject_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: dragdrop.c:506
static ATOM register_dummy_class(void)
Definition: dragdrop.c:595
static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface)
Definition: dragdrop.c:422
static void test_Register_Revoke(void)
Definition: dragdrop.c:614
static HRESULT WINAPI DropSource_QueryInterface(IDropSource *iface, REFIID riid, void **ppObj)
Definition: dragdrop.c:336
static HRESULT WINAPI DataObject_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: dragdrop.c:551
static HRESULT WINAPI DropTarget_DragLeave(IDropTarget *iface)
Definition: dragdrop.c:311
struct method_call call_lists[][30]
Definition: dragdrop.c:104
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: dragdrop.c:427
static HRESULT WINAPI DropSource_GiveFeedback(IDropSource *iface, DWORD dwEffect)
Definition: dragdrop.c:393
#define ok_ole_success(hr, func)
Definition: dragdrop.c:266
static ULONG WINAPI DataObject_AddRef(IDataObject *iface)
Definition: dragdrop.c:487
static ULONG WINAPI DataObject_Release(IDataObject *iface)
Definition: dragdrop.c:492
static HRESULT WINAPI DropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:303
static const IDropSourceVtbl dropsource_vtbl
Definition: dragdrop.c:400
static int test_reentrance
Definition: dragdrop.c:263
static HRESULT WINAPI DropTarget_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:316
static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, REFIID riid, void **ppvObj)
Definition: dragdrop.c:410
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: dragdrop.c:441
static HRESULT WINAPI DropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:295
static HRESULT WINAPI DropSource_QueryContinueDrag(IDropSource *iface, BOOL fEscapePressed, DWORD grfKeyState)
Definition: dragdrop.c:358
static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface)
Definition: dragdrop.c:417
static IEnumFORMATETC EnumFORMATETC
Definition: dragdrop.c:468
static ULONG WINAPI DropSource_Release(IDropSource *iface)
Definition: dragdrop.c:353
static HRESULT WINAPI DataObject_QueryInterface(IDataObject *iface, REFIID riid, void **pObj)
Definition: dragdrop.c:470
static ULONG WINAPI DropTarget_AddRef(IDropTarget *iface)
Definition: dragdrop.c:283
static const IEnumFORMATETCVtbl enumformatetc_vtbl
Definition: dragdrop.c:458
static HRESULT WINAPI DataObject_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: dragdrop.c:562
static IDataObject DataObject
Definition: dragdrop.c:593
static HRESULT check_expect_(enum method func, DWORD expect_param, DWORD *set_param, const char *file, int line)
Definition: dragdrop.c:80
static void test_DoDragDrop(void)
Definition: dragdrop.c:687
static HRESULT WINAPI DataObject_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: dragdrop.c:515
static HRESULT WINAPI DataObject_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: dragdrop.c:570
static ULONG WINAPI DropSource_AddRef(IDropSource *iface)
Definition: dragdrop.c:348
method
Definition: dragdrop.c:54
static int droptarget_refs
Definition: dragdrop.c:262
static IDropTarget DropTarget
Definition: dragdrop.c:334
#define METHOD_LIST
Definition: dragdrop.c:35
static HRESULT WINAPI DataObject_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: dragdrop.c:531
const struct method_call * call_ptr
Definition: dragdrop.c:78
static IDropSource DropSource
Definition: dragdrop.c:408
static ULONG WINAPI DropTarget_Release(IDropTarget *iface)
Definition: dragdrop.c:289
static HRESULT WINAPI EnumFORMATETC_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: dragdrop.c:451
static HRESULT WINAPI DataObject_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: dragdrop.c:541
static const char * method_names[]
Definition: dragdrop.c:60
static const IDataObjectVtbl dataobject_vtbl
Definition: dragdrop.c:578
static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObject)
Definition: dragdrop.c:268
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
Definition: dragdrop.c:446
static const IDropTargetVtbl DropTarget_VTbl
Definition: dragdrop.c:323
static HRESULT WINAPI DataObject_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: dragdrop.c:497
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum func
Definition: glext.h:6028
GLuint GLuint num
Definition: glext.h:9618
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
const char * winetest_platform
int winetest_interactive
#define todo_wine_if(is_todo)
Definition: minitest.h:81
const GUID IID_IDataObject
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206
HRESULT hr
Definition: shlfolder.c:183
& rect
Definition: startmenu.cpp:1413
Definition: fci.c:127
Definition: format.c:58
Definition: parser.c:49
enum method method
Definition: dragdrop.c:69
HRESULT set_ret
Definition: dragdrop.c:72
DWORD set_param
Definition: dragdrop.c:73
DWORD expect_param
Definition: dragdrop.c:70
BOOL called_todo
Definition: dragdrop.c:75
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t ULONG
Definition: typedefs.h:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:3762
#define S_FALSE
Definition: winerror.h:3451
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:3763
#define DRAGDROP_S_DROP
Definition: winerror.h:3758
#define E_NOINTERFACE
Definition: winerror.h:3479
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:3764
#define DRAGDROP_S_CANCEL
Definition: winerror.h:3761
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4417
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define IDC_ARROW
Definition: winuser.h:695
#define WM_MOUSEMOVE
Definition: winuser.h:1803
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:3056
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define PM_REMOVE
Definition: winuser.h:1207
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:786
#define WM_KEYDOWN
Definition: winuser.h:1743
#define VK_ESCAPE
Definition: winuser.h:2250
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
#define COLOR_BTNFACE
Definition: winuser.h:939
char * LPSTR
Definition: xmlstorage.h:182