ReactOS 0.4.15-dev-8428-g6910fa6
events.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-2011 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "precomp.h"
20
21#include <docobj.h>
22
23#define DEFINE_EXPECT(func) \
24 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
25
26#define SET_EXPECT(func) \
27 do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
28
29#define CHECK_EXPECT2(func) \
30 do { \
31 trace(#func "\n"); \
32 ok(expect_ ##func, "unexpected call " #func "\n"); \
33 called_ ## func = TRUE; \
34 }while(0)
35
36#define CHECK_EXPECT(func) \
37 do { \
38 CHECK_EXPECT2(func); \
39 expect_ ## func = FALSE; \
40 }while(0)
41
42#define CHECK_CALLED(func) \
43 do { \
44 ok(called_ ## func, "expected " #func "\n"); \
45 expect_ ## func = called_ ## func = FALSE; \
46 }while(0)
47
54DEFINE_EXPECT(doccp_onclick);
57DEFINE_EXPECT(invoke_onclick);
58DEFINE_EXPECT(iframe_onreadystatechange_loading);
59DEFINE_EXPECT(iframe_onreadystatechange_interactive);
60DEFINE_EXPECT(iframe_onreadystatechange_complete);
73DEFINE_EXPECT(elem2_cp_onclick);
75
80
81typedef struct {
86} xy_test_t;
87
88static const xy_test_t no_xy = {-10,-10,-10,-10};
89
90static const char empty_doc_str[] =
91 "<html></html>";
92
93static const char click_doc_str[] =
94 "<html><body>"
95 "<div id=\"clickdiv\" style=\"text-align: center; background: red; font-size: 32\">click here</div>"
96 "</body></html>";
97
98static const char readystate_doc_str[] =
99 "<html><body><iframe id=\"iframe\"></iframe></body></html>";
100
101static const char img_doc_str[] =
102 "<html><body><img id=\"imgid\"></img></body></html>";
103
104static const char input_doc_str[] =
105 "<html><body><input id=\"inputid\"></input></body></html>";
106
107static const char iframe_doc_str[] =
108 "<html><body><iframe id=\"ifr\">Testing</iframe></body></html>";
109
110static const char form_doc_str[] =
111 "<html><body><form id=\"formid\" method=\"post\" action=\"about:blank\">"
112 "<input type=\"text\" value=\"test\" name=\"i\"/>"
113 "<input type=\"submit\" id=\"submitid\" />"
114 "</form></body></html>";
115
116static int strcmp_wa(LPCWSTR strw, const char *stra)
117{
118 CHAR buf[512];
119 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
120 return lstrcmpA(stra, buf);
121}
122
123static BSTR a2bstr(const char *str)
124{
125 BSTR ret;
126 int len;
127
128 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
131
132 return ret;
133}
134
135static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
136{
137 IUnknown *unk1, *unk2;
138
139 if(iface1 == iface2)
140 return TRUE;
141
142 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
143 IUnknown_Release(unk1);
144 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk2);
145 IUnknown_Release(unk2);
146
147 return unk1 == unk2;
148}
149
150#define test_disp(u,id) _test_disp(__LINE__,u,id)
151static void _test_disp(unsigned line, IUnknown *unk, const IID *diid)
152{
153 IDispatchEx *dispex;
155 UINT ticnt;
157
158 hres = IUnknown_QueryInterface(unk, &IID_IDispatchEx, (void**)&dispex);
159 ok_(__FILE__,line) (hres == S_OK, "Could not get IDispatch: %08x\n", hres);
160 if(FAILED(hres))
161 return;
162
163 ticnt = 0xdeadbeef;
164 hres = IDispatchEx_GetTypeInfoCount(dispex, &ticnt);
165 ok_(__FILE__,line) (hres == S_OK, "GetTypeInfoCount failed: %08x\n", hres);
166 ok_(__FILE__,line) (ticnt == 1, "ticnt=%u\n", ticnt);
167
168 hres = IDispatchEx_GetTypeInfo(dispex, 0, 0, &typeinfo);
169 ok_(__FILE__,line) (hres == S_OK, "GetTypeInfo failed: %08x\n", hres);
170
171 if(SUCCEEDED(hres)) {
172 TYPEATTR *type_attr;
173
174 hres = ITypeInfo_GetTypeAttr(typeinfo, &type_attr);
175 ok_(__FILE__,line) (hres == S_OK, "GetTypeAttr failed: %08x\n", hres);
176 ok_(__FILE__,line) (IsEqualGUID(&type_attr->guid, diid), "unexpected guid %s\n",
177 wine_dbgstr_guid(&type_attr->guid));
178
179 ITypeInfo_ReleaseTypeAttr(typeinfo, type_attr);
180 ITypeInfo_Release(typeinfo);
181 }
182
183 IDispatchEx_Release(dispex);
184}
185
186#define get_doc3_iface(u) _get_doc3_iface(__LINE__,u)
187static IHTMLDocument3 *_get_doc3_iface(unsigned line, IUnknown *unk)
188{
189 IHTMLDocument3 *doc3;
191
192 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc3);
193 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
194
195 return doc3;
196}
197
198#define get_elem_iface(u) _get_elem_iface(__LINE__,u)
199static IHTMLElement *_get_elem_iface(unsigned line, IUnknown *unk)
200{
201 IHTMLElement *elem;
203
204 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement, (void**)&elem);
205 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement iface: %08x\n", hres);
206
207 return elem;
208}
209
210#define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
211static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
212{
213 IHTMLElement2 *elem2;
215
216 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem2);
217 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
218
219 return elem2;
220}
221
222#define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
223static IHTMLElement3 *_get_elem3_iface(unsigned line, IUnknown *unk)
224{
225 IHTMLElement3 *elem3;
227
228 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement3, (void**)&elem3);
229 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement3 iface: %08x\n", hres);
230
231 return elem3;
232}
233
234#define get_iframe_iface(u) _get_iframe_iface(__LINE__,u)
235static IHTMLIFrameElement *_get_iframe_iface(unsigned line, IUnknown *unk)
236{
237 IHTMLIFrameElement *iframe;
239
240 hres = IUnknown_QueryInterface(unk, &IID_IHTMLIFrameElement, (void**)&iframe);
241 ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLIFrameElement) failed: %08x\n", hres);
242
243 return iframe;
244}
245
246#define doc_get_body(d) _doc_get_body(__LINE__,d)
247static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc)
248{
249 IHTMLElement *body = NULL;
251
252 hres = IHTMLDocument2_get_body(doc, &body);
253 ok_(__FILE__,line) (hres == S_OK, "get_body failed: %08x\n", hres);
254 ok_(__FILE__,line) (body != NULL, "body == NULL\n");
255
256 return body;
257}
258
259#define get_elem_id(d,i) _get_elem_id(__LINE__,d,i)
260static IHTMLElement *_get_elem_id(unsigned line, IHTMLDocument2 *doc, const char *id)
261{
262 IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
263 IHTMLElement *elem;
264 BSTR str;
266
267 str = a2bstr(id);
268 hres = IHTMLDocument3_getElementById(doc3, str, &elem);
270 IHTMLDocument3_Release(doc3);
271 ok_(__FILE__,line) (hres == S_OK, "getElementById failed: %08x\n", hres);
272
273 return elem;
274}
275
276#define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n)
277static void _test_elem_tag(unsigned line, IUnknown *unk, const char *extag)
278{
279 IHTMLElement *elem = _get_elem_iface(line, unk);
280 BSTR tag;
282
283 hres = IHTMLElement_get_tagName(elem, &tag);
284 IHTMLElement_Release(elem);
285 ok_(__FILE__, line) (hres == S_OK, "get_tagName failed: %08x\n", hres);
286 ok_(__FILE__, line) (!strcmp_wa(tag, extag), "got tag: %s, expected %s\n", wine_dbgstr_w(tag), extag);
287
289}
290
291#define get_event_obj() _get_event_obj(__LINE__)
292static IHTMLEventObj *_get_event_obj(unsigned line)
293{
294 IHTMLEventObj *event = NULL;
296
297 hres = IHTMLWindow2_get_event(window, &event);
298 ok_(__FILE__,line) (hres == S_OK, "get_event failed: %08x\n", hres);
299 ok_(__FILE__,line) (event != NULL, "event = NULL\n");
300 _test_disp(line, (IUnknown*)event, &DIID_DispCEventObj);
301
302 return event;
303}
304
305#define elem_fire_event(a,b,c) _elem_fire_event(__LINE__,a,b,c)
306static void _elem_fire_event(unsigned line, IUnknown *unk, const char *event, VARIANT *evobj)
307{
308 IHTMLElement3 *elem3 = _get_elem3_iface(line, unk);
310 BSTR str;
312
313 b = 100;
314 str = a2bstr(event);
315 hres = IHTMLElement3_fireEvent(elem3, str, evobj, &b);
317 ok_(__FILE__,line)(hres == S_OK, "fireEvent failed: %08x\n", hres);
318 ok_(__FILE__,line)(b == VARIANT_TRUE, "fireEvent returned %x\n", b);
319}
320
321#define test_event_args(a,b,c,d,e,f,g) _test_event_args(__LINE__,a,b,c,d,e,f,g)
322static void _test_event_args(unsigned line, const IID *dispiid, DISPID id, WORD wFlags, DISPPARAMS *pdp,
323 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
324{
325 ok_(__FILE__,line) (id == DISPID_VALUE, "id = %d\n", id);
326 ok_(__FILE__,line) (wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
327 ok_(__FILE__,line) (pdp != NULL, "pdp == NULL\n");
328 ok_(__FILE__,line) (pdp->cArgs == 1, "pdp->cArgs = %d\n", pdp->cArgs);
329 ok_(__FILE__,line) (pdp->cNamedArgs == 1, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
330 ok_(__FILE__,line) (pdp->rgdispidNamedArgs[0] == DISPID_THIS, "pdp->rgdispidNamedArgs[0] = %d\n",
331 pdp->rgdispidNamedArgs[0]);
332 ok_(__FILE__,line) (V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(rgvarg) = %d\n", V_VT(pdp->rgvarg));
333 ok_(__FILE__,line) (pvarRes != NULL, "pvarRes == NULL\n");
334 ok_(__FILE__,line) (pei != NULL, "pei == NULL");
335 ok_(__FILE__,line) (!pspCaller, "pspCaller != NULL\n");
336
337 if(dispiid)
338 _test_disp(line, (IUnknown*)V_DISPATCH(pdp->rgvarg), dispiid);
339}
340
341#define test_attached_event_args(a,b,c,d,e) _test_attached_event_args(__LINE__,a,b,c,d,e)
342static void _test_attached_event_args(unsigned line, DISPID id, WORD wFlags, DISPPARAMS *pdp,
343 VARIANT *pvarRes, EXCEPINFO *pei)
344{
345 IHTMLEventObj *event;
346
347 ok(id == DISPID_VALUE, "id = %d\n", id);
348 ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
349 ok(pdp != NULL, "pDispParams == NULL\n");
350 ok(pdp->cArgs == 1, "pdp->cArgs = %d\n", pdp->cArgs);
351 ok(!pdp->cNamedArgs, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
352 ok(!pdp->rgdispidNamedArgs, "pdp->rgdispidNamedArgs = %p\n", pdp->rgdispidNamedArgs);
353 ok(pdp->rgvarg != NULL, "rgvarg = NULL\n");
354 ok(pvarRes != NULL, "pvarRes = NULL\n");
355 ok(pei != NULL, "pei = NULL\n");
356 ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pVarRes) = %d\n", V_VT(pvarRes));
357 ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
358 ok(V_DISPATCH(pdp->rgvarg) != NULL, "V_DISPATCH(pdp->rgvarg) = %p\n", V_DISPATCH(pdp->rgvarg));
359
360 event = _get_event_obj(line);
361 ok(iface_cmp((IUnknown*)event, (IUnknown*)V_DISPATCH(pdp->rgvarg)), "event != arg0\n");
362 IHTMLEventObj_Release(event);
363}
364
365#define get_event_src() _get_event_src(__LINE__)
366static IHTMLElement *_get_event_src(unsigned line)
367{
368 IHTMLEventObj *event = _get_event_obj(line);
369 IHTMLElement *src_elem = NULL;
371
372 hres = IHTMLEventObj_get_srcElement(event, &src_elem);
373 IHTMLEventObj_Release(event);
374 ok_(__FILE__,line) (hres == S_OK, "get_srcElement failed: %08x\n", hres);
375
376 return src_elem;
377}
378
379#define test_event_src(t) _test_event_src(__LINE__,t)
380static void _test_event_src(unsigned line, const char *src_tag)
381{
382 IHTMLElement *src_elem = _get_event_src(line);
383
384 if(src_tag) {
385 ok_(__FILE__,line) (src_elem != NULL, "src_elem = NULL\n");
386 _test_elem_tag(line, (IUnknown*)src_elem, src_tag);
387 IHTMLElement_Release(src_elem);
388 }else {
389 ok_(__FILE__,line) (!src_elem, "src_elem != NULL\n");
390 }
391}
392
393static void _test_event_altkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
394{
397
398 hres = IHTMLEventObj_get_altKey(event, &b);
399 ok_(__FILE__,line)(hres == S_OK, "get_altKey failed: %08x\n", hres);
400 ok_(__FILE__,line)(b == exval, "altKey = %x, expected %x\n", b, exval);
401}
402
403static void _test_event_ctrlkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
404{
407
408 hres = IHTMLEventObj_get_ctrlKey(event, &b);
409 ok_(__FILE__,line)(hres == S_OK, "get_ctrlKey failed: %08x\n", hres);
410 ok_(__FILE__,line)(b == exval, "ctrlKey = %x, expected %x\n", b, exval);
411}
412
413static void _test_event_shiftkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
414{
417
418 hres = IHTMLEventObj_get_shiftKey(event, &b);
419 ok_(__FILE__,line)(hres == S_OK, "get_shiftKey failed: %08x\n", hres);
420 ok_(__FILE__,line)(b == exval, "shiftKey = %x, expected %x\n", b, exval);
421}
422
423#define test_event_cancelbubble(a,b) _test_event_cancelbubble(__LINE__,a,b)
424static void _test_event_cancelbubble(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
425{
428
429 hres = IHTMLEventObj_get_cancelBubble(event, &b);
430 ok_(__FILE__,line)(hres == S_OK, "get_cancelBubble failed: %08x\n", hres);
431 ok_(__FILE__,line)(b == exval, "cancelBubble = %x, expected %x\n", b, exval);
432}
433
434static void _test_event_fromelem(unsigned line, IHTMLEventObj *event, const char *from_tag)
435{
436 IHTMLElement *elem;
438
439 hres = IHTMLEventObj_get_fromElement(event, &elem);
440 ok_(__FILE__,line)(hres == S_OK, "get_fromElement failed: %08x\n", hres);
441 if(from_tag)
442 _test_elem_tag(line, (IUnknown*)elem, from_tag);
443 else
444 ok_(__FILE__,line)(elem == NULL, "fromElement != NULL\n");
445 if(elem)
446 IHTMLElement_Release(elem);
447}
448
449static void _test_event_toelem(unsigned line, IHTMLEventObj *event, const char *to_tag)
450{
451 IHTMLElement *elem;
453
454 hres = IHTMLEventObj_get_toElement(event, &elem);
455 ok_(__FILE__,line)(hres == S_OK, "get_toElement failed: %08x\n", hres);
456 if(to_tag)
457 _test_elem_tag(line, (IUnknown*)elem, to_tag);
458 else
459 ok_(__FILE__,line)(elem == NULL, "toElement != NULL\n");
460 if(elem)
461 IHTMLElement_Release(elem);
462}
463
464static void _test_event_keycode(unsigned line, IHTMLEventObj *event, LONG exl)
465{
466 LONG l;
468
469 hres = IHTMLEventObj_get_keyCode(event, &l);
470 ok_(__FILE__,line)(hres == S_OK, "get_keyCode failed: %08x\n", hres);
471 ok_(__FILE__,line)(l == exl, "keyCode = %x, expected %x\n", l, exl);
472}
473
474static void _test_event_button(unsigned line, IHTMLEventObj *event, LONG exl)
475{
476 LONG l;
478
479 hres = IHTMLEventObj_get_button(event, &l);
480 ok_(__FILE__,line)(hres == S_OK, "get_button failed: %08x\n", hres);
481 ok_(__FILE__,line)(l == exl, "button = %x, expected %x\n", l, exl);
482}
483
484static void _test_event_reason(unsigned line, IHTMLEventObj *event, LONG exl)
485{
486 LONG l;
488
489 hres = IHTMLEventObj_get_reason(event, &l);
490 ok_(__FILE__,line)(hres == S_OK, "get_reason failed: %08x\n", hres);
491 ok_(__FILE__,line)(l == exl, "reason = %x, expected %x\n", l, exl);
492}
493
494static void _test_event_x(unsigned line, IHTMLEventObj *event, LONG exl)
495{
496 LONG l;
498
499 hres = IHTMLEventObj_get_x(event, &l);
500 ok_(__FILE__,line)(hres == S_OK, "get_x failed: %08x\n", hres);
501 if(exl != -10) /* don't test the exact value */
502 ok_(__FILE__,line)(l == exl, "x = %d, expected %d\n", l, exl);
503}
504
505static void _test_event_y(unsigned line, IHTMLEventObj *event, LONG exl)
506{
507 LONG l;
509
510 hres = IHTMLEventObj_get_y(event, &l);
511 ok_(__FILE__,line)(hres == S_OK, "get_y failed: %08x\n", hres);
512 if(exl != -10) /* don't test the exact value */
513 ok_(__FILE__,line)(l == exl, "y = %d, expected %d\n", l, exl);
514}
515
516static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
517{
518 LONG l;
520
521 hres = IHTMLEventObj_get_clientX(event, &l);
522 ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
523 if(exl != -10) /* don't test the exact value */
524 ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
525}
526
527static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
528{
529 LONG l;
531
532 hres = IHTMLEventObj_get_clientY(event, &l);
533 ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
534 if(exl != -10) /* don't test the exact value */
535 ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
536}
537
538static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
539{
540 LONG l;
542
543 hres = IHTMLEventObj_get_offsetX(event, &l);
544 ok_(__FILE__,line)(hres == S_OK, "get_offsetX failed: %08x\n", hres);
545 if(exl != -10) /* don't test the exact value */
546 ok_(__FILE__,line)(l == exl, "offsetX = %d, expected %d\n", l, exl);
547}
548
549static void _test_event_offsety(unsigned line, IHTMLEventObj *event, LONG exl)
550{
551 LONG l;
553
554 hres = IHTMLEventObj_get_offsetY(event, &l);
555 ok_(__FILE__,line)(hres == S_OK, "get_offsetY failed: %08x\n", hres);
556 if(exl != -10) /* don't test the exact value */
557 ok_(__FILE__,line)(l == exl, "offsetY = %d, expected %d\n", l, exl);
558}
559
560static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
561{
562 LONG l;
564
565 hres = IHTMLEventObj_get_screenX(event, &l);
566 ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
567 if(exl != -10) /* don't test the exact value */
568 ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
569}
570
571static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
572{
573 LONG l;
575
576 hres = IHTMLEventObj_get_screenY(event, &l);
577 ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
578 if(exl != -10) /* don't test the exact value for -10 */
579 ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
580}
581
582static void _test_event_type(unsigned line, IHTMLEventObj *event, const char *exstr)
583{
584 BSTR str;
586
587 hres = IHTMLEventObj_get_type(event, &str);
588 ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
589 ok_(__FILE__,line)(!strcmp_wa(str, exstr), "type = %s, expected %s\n", wine_dbgstr_w(str), exstr);
590}
591
592static void _test_event_qualifier(unsigned line, IHTMLEventObj *event, const char *exstr)
593{
594 BSTR str;
596
597 hres = IHTMLEventObj_get_qualifier(event, &str);
598 ok_(__FILE__,line)(hres == S_OK, "get_qualifier failed: %08x\n", hres);
599 if(exstr)
600 ok_(__FILE__,line)(!strcmp_wa(str, exstr), "qualifier = %s, expected %s\n", wine_dbgstr_w(str), exstr);
601 else
602 ok_(__FILE__,line)(!str, "qualifier != NULL\n");
603}
604
605static void _test_event_srcfilter(unsigned line, IHTMLEventObj *event)
606{
607 IDispatch *disp;
609
610 hres = IHTMLEventObj_get_srcFilter(event, &disp);
611 ok_(__FILE__,line)(hres == S_OK, "get_srcFilter failed: %08x\n", hres);
612 ok_(__FILE__,line)(!disp, "srcFilter != NULL\n");
613}
614
615#define test_event_obj(t,x) _test_event_obj(__LINE__,t,x)
616static void _test_event_obj(unsigned line, const char *type, const xy_test_t *xy)
617{
618 IHTMLEventObj *event = _get_event_obj(line);
619 VARIANT v;
621
622 _test_event_altkey(line, event, VARIANT_FALSE);
623 _test_event_ctrlkey(line, event, VARIANT_FALSE);
624 _test_event_shiftkey(line, event, VARIANT_FALSE);
625 _test_event_cancelbubble(line, event, VARIANT_FALSE);
634 _test_event_x(line, event, xy->x);
635 _test_event_y(line, event, xy->y);
642
643 V_VT(&v) = VT_NULL;
644 hres = IHTMLEventObj_get_returnValue(event, &v);
645 ok_(__FILE__,line)(hres == S_OK, "get_returnValue failed: %08x\n", hres);
646 ok_(__FILE__,line)(V_VT(&v) == VT_EMPTY, "V_VT(returnValue) = %d\n", V_VT(&v));
647
648 IHTMLEventObj_Release(event);
649}
650
651#define elem_attach_event(a,b,c) _elem_attach_event(__LINE__,a,b,c)
652static void _elem_attach_event(unsigned line, IUnknown *unk, const char *namea, IDispatch *disp)
653{
654 IHTMLElement2 *elem = _get_elem2_iface(line, unk);
656 BSTR name;
658
659 name = a2bstr(namea);
660 hres = IHTMLElement2_attachEvent(elem, name, disp, &res);
661 IHTMLElement2_Release(elem);
663 ok_(__FILE__,line)(hres == S_OK, "attachEvent failed: %08x\n", hres);
664 ok_(__FILE__,line)(res == VARIANT_TRUE, "attachEvent returned %x\n", res);
665}
666
667#define elem_detach_event(a,b,c) _elem_detach_event(__LINE__,a,b,c)
668static void _elem_detach_event(unsigned line, IUnknown *unk, const char *namea, IDispatch *disp)
669{
670 IHTMLElement2 *elem = _get_elem2_iface(line, unk);
671 BSTR name;
673
674 name = a2bstr(namea);
675 hres = IHTMLElement2_detachEvent(elem, name, disp);
676 IHTMLElement2_Release(elem);
678 ok_(__FILE__,line)(hres == S_OK, "detachEvent failed: %08x\n", hres);
679}
680
681#define doc_attach_event(a,b,c) _doc_attach_event(__LINE__,a,b,c)
682static void _doc_attach_event(unsigned line, IHTMLDocument2 *doc, const char *namea, IDispatch *disp)
683{
684 IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
686 BSTR name;
688
689 name = a2bstr(namea);
690 hres = IHTMLDocument3_attachEvent(doc3, name, disp, &res);
691 IHTMLDocument3_Release(doc3);
693 ok_(__FILE__,line)(hres == S_OK, "attachEvent failed: %08x\n", hres);
694 ok_(__FILE__,line)(res == VARIANT_TRUE, "attachEvent returned %x\n", res);
695}
696
697#define doc_detach_event(a,b,c) _doc_detach_event(__LINE__,a,b,c)
698static void _doc_detach_event(unsigned line, IHTMLDocument2 *doc, const char *namea, IDispatch *disp)
699{
700 IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
701 BSTR name;
703
704 name = a2bstr(namea);
705 hres = IHTMLDocument3_detachEvent(doc3, name, disp);
706 IHTMLDocument3_Release(doc3);
708 ok_(__FILE__,line)(hres == S_OK, "detachEvent failed: %08x\n", hres);
709}
710
712{
713 *ppv = NULL;
714
717 || IsEqualGUID(riid, &IID_IDispatchEx))
718 *ppv = iface;
719 else {
720 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
721 return E_NOINTERFACE;
722 }
723
724 return S_OK;
725}
726
728{
729 *ppv = NULL;
730
733 *ppv = iface;
734 }else if(IsEqualGUID(riid, &IID_IDispatchEx)) {
735 return E_NOINTERFACE;
736 }else {
737 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
738 return E_NOINTERFACE;
739 }
740
741 return S_OK;
742}
743
745{
746 return 2;
747}
748
750{
751 return 1;
752}
753
755{
756 ok(0, "unexpected call\n");
757 return E_NOTIMPL;
758}
759
761 LCID lcid, ITypeInfo **ppTInfo)
762{
763 ok(0, "unexpected call\n");
764 return E_NOTIMPL;
765}
766
768 LPOLESTR *rgszNames, UINT cNames,
769 LCID lcid, DISPID *rgDispId)
770{
771 ok(0, "unexpected call\n");
772 return E_NOTIMPL;
773}
774
776 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
777 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
778{
779 ok(0, "unexpected call\n");
780 return E_NOTIMPL;
781}
782
784{
785 ok(0, "unexpected call\n");
786 return E_NOTIMPL;
787}
788
789static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
790 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
791{
792 ok(0, "unexpected call\n");
793 return E_NOTIMPL;
794}
795
797{
798 ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
799 return E_NOTIMPL;
800}
801
803{
804 ok(0, "unexpected call\n");
805 return E_NOTIMPL;
806}
807
809{
810 ok(0, "unexpected call\n");
811 return E_NOTIMPL;
812}
813
815{
816 ok(0, "unexpected call\n");
817 return E_NOTIMPL;
818}
819
821{
822 ok(0, "unexpected call\n");
823 return E_NOTIMPL;
824}
825
827{
828 ok(0, "unexpected call\n");
829 return E_NOTIMPL;
830}
831
832#define EVENT_HANDLER_FUNC_OBJ(event) \
833 static IDispatchExVtbl event ## FuncVtbl = { \
834 DispatchEx_QueryInterface, \
835 DispatchEx_AddRef, \
836 DispatchEx_Release, \
837 DispatchEx_GetTypeInfoCount, \
838 DispatchEx_GetTypeInfo, \
839 DispatchEx_GetIDsOfNames, \
840 DispatchEx_Invoke, \
841 DispatchEx_GetDispID, \
842 event, \
843 DispatchEx_DeleteMemberByName, \
844 DispatchEx_DeleteMemberByDispID, \
845 DispatchEx_GetMemberProperties, \
846 DispatchEx_GetMemberName, \
847 DispatchEx_GetNextDispID, \
848 DispatchEx_GetNameSpaceParent \
849 }; \
850 static IDispatchEx event ## _obj = { &event ## FuncVtbl };
851
852static HRESULT WINAPI document_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
853 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
854{
855 IHTMLDocument3 *doc3;
857 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
858 doc3 = get_doc3_iface((IUnknown*)V_DISPATCH(pdp->rgvarg));
859 IHTMLDocument3_Release(doc3);
860 test_event_src("DIV");
861 test_event_obj("click", &no_xy);
862 return S_OK;
863}
864
866
867static HRESULT WINAPI div_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
868 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
869{
871 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
872 test_event_src("DIV");
873 return S_OK;
874}
875
877
878static HRESULT WINAPI div_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
879 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
880{
882
883 test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
884 test_event_src("DIV");
885 return S_OK;
886}
887
889
890static HRESULT WINAPI doc_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
891 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
892{
894
895 test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
896 test_event_src("DIV");
897 return S_OK;
898}
899
901
902static HRESULT WINAPI body_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
903 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
904{
906 test_event_args(&DIID_DispHTMLBody, id, wFlags, pdp, pvarRes, pei, pspCaller);
907 test_event_src("DIV");
908 return S_OK;
909}
910
912
913static HRESULT WINAPI img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
914 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
915{
917 test_event_args(&DIID_DispHTMLImg, id, wFlags, pdp, pvarRes, pei, pspCaller);
918 test_event_src("IMG");
919 return S_OK;
920}
921
923
924static HRESULT WINAPI img_onerror(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
925 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
926{
928 test_event_args(&DIID_DispHTMLImg, id, wFlags, pdp, pvarRes, pei, pspCaller);
929 test_event_src("IMG");
930 return S_OK;
931}
932
934
935static HRESULT WINAPI input_onfocus(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
936 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
937{
939 test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
940 test_event_src("INPUT");
941 return S_OK;
942}
943
945
946static HRESULT WINAPI input_onblur(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
947 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
948{
950 test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
951 test_event_src("INPUT");
952 return S_OK;
953}
954
956
957static HRESULT WINAPI form_onsubmit(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
958 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
959{
961 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
962 test_event_src("FORM");
963
964 V_VT(pvarRes) = VT_BOOL;
965 V_BOOL(pvarRes) = VARIANT_FALSE;
966 return S_OK;
967}
968
970
971static HRESULT WINAPI form_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
972 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
973{
975 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
976
977 return S_OK;
978}
979
981
982static HRESULT WINAPI submit_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
983 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
984{
986 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
987 test_event_src("INPUT");
988
989 V_VT(pvarRes) = VT_BOOL;
990 V_BOOL(pvarRes) = VARIANT_FALSE;
991 return S_OK;
992}
993
995
996static HRESULT WINAPI iframe_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
997 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
998{
1000 test_event_args(&DIID_DispHTMLIFrame, id, wFlags, pdp, pvarRes, pei, pspCaller);
1001 test_event_src("IFRAME");
1002 return S_OK;
1003}
1004
1006
1007static HRESULT WINAPI submit_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1008 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1009{
1011 test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
1012 test_event_src("INPUT");
1013
1014 V_VT(pvarRes) = VT_BOOL;
1015 V_BOOL(pvarRes) = VARIANT_FALSE;
1016 return S_OK;
1017}
1018
1020
1022 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1023{
1024 IHTMLEventObj *event;
1025 HRESULT hres;
1026
1028 test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
1029 test_event_src("INPUT");
1030
1031 event = NULL;
1032 hres = IHTMLWindow2_get_event(window, &event);
1033 ok(hres == S_OK, "get_event failed: %08x\n", hres);
1034 ok(event != NULL, "event == NULL\n");
1035
1036 test_event_cancelbubble(event, VARIANT_TRUE);
1037 return S_OK;
1038}
1039
1041
1043
1044static HRESULT WINAPI submit_onclick_setret(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1045 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1046{
1047 IHTMLEventObj *event;
1048 VARIANT v;
1049 HRESULT hres;
1050
1052 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
1053 test_event_src("INPUT");
1054
1055 event = NULL;
1056 hres = IHTMLWindow2_get_event(window, &event);
1057 ok(hres == S_OK, "get_event failed: %08x\n", hres);
1058 ok(event != NULL, "event == NULL\n");
1059
1060 V_VT(&v) = VT_ERROR;
1061 hres = IHTMLEventObj_get_returnValue(event, &v);
1062 ok(hres == S_OK, "get_returnValue failed: %08x\n", hres);
1063 ok(V_VT(&v) == VT_EMPTY, "V_VT(returnValue) = %d\n", V_VT(&v));
1064
1065 hres = IHTMLEventObj_put_returnValue(event, onclick_event_retval);
1066 ok(hres == S_OK, "put_returnValue failed: %08x\n", hres);
1067
1068 V_VT(&v) = VT_ERROR;
1069 hres = IHTMLEventObj_get_returnValue(event, &v);
1070 ok(hres == S_OK, "get_returnValue failed: %08x\n", hres);
1071 ok(VarCmp(&v, &onclick_event_retval, 0, 0) == VARCMP_EQ, "unexpected returnValue\n");
1072
1073 IHTMLEventObj_Release(event);
1074 *pvarRes = onclick_retval;
1075 return S_OK;
1076}
1077
1079
1080static HRESULT WINAPI submit_onclick_cancel(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1081 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1082{
1083 IHTMLEventObj *event;
1084 HRESULT hres;
1085
1087 test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
1088 test_event_src("INPUT");
1089
1090 event = NULL;
1091 hres = IHTMLWindow2_get_event(window, &event);
1092 ok(hres == S_OK, "get_event failed: %08x\n", hres);
1093 ok(event != NULL, "event == NULL\n");
1094
1095 test_event_cancelbubble(event, VARIANT_FALSE);
1096
1097 hres = IHTMLEventObj_put_cancelBubble(event, VARIANT_TRUE);
1098 ok(hres == S_OK, "put_returnValue failed: %08x\n", hres);
1099
1100 test_event_cancelbubble(event, VARIANT_TRUE);
1101 IHTMLEventObj_Release(event);
1102 return S_OK;
1103}
1104
1106
1108 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1109{
1110 IHTMLEventObj *event = NULL;
1111 HRESULT hres;
1112
1114 test_event_args(&DIID_DispHTMLDocument, id, wFlags, pdp, pvarRes, pei, pspCaller);
1115
1116 event = (void*)0xdeadbeef;
1117 hres = IHTMLWindow2_get_event(window, &event);
1118 ok(hres == S_OK, "get_event failed: %08x\n", hres);
1119 ok(!event, "event = %p\n", event);
1120
1121 return S_OK;
1122}
1123
1125
1126static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1127 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1128{
1129 IHTMLWindow2 *iframe_window;
1130 IHTMLDocument2 *iframe_doc;
1131 IHTMLFrameBase2 *iframe;
1132 IHTMLElement2 *elem2;
1133 IHTMLElement *elem;
1134 VARIANT v;
1135 BSTR str, str2;
1136 HRESULT hres;
1137
1138 test_event_args(&DIID_DispHTMLIFrame, id, wFlags, pdp, pvarRes, pei, pspCaller);
1139 test_event_src("IFRAME");
1140
1141 elem = get_event_src();
1142 elem2 = get_elem2_iface((IUnknown*)elem);
1143 IHTMLElement_Release(elem);
1144
1145 V_VT(&v) = VT_EMPTY;
1146 hres = IHTMLElement2_get_readyState(elem2, &v);
1147 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
1148 ok(V_VT(&v) == VT_BSTR, "V_VT(readyState) = %d\n", V_VT(&v));
1149
1150 hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase2, (void**)&iframe);
1151 IHTMLElement2_Release(elem2);
1152 ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
1153
1154 str = NULL;
1155 hres = IHTMLFrameBase2_get_readyState(iframe, &str);
1156 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
1157 ok(str != NULL, "readyState == NULL\n");
1158 ok(!lstrcmpW(str, V_BSTR(&v)), "ready states differ\n");
1159 VariantClear(&v);
1160
1161 hres = IHTMLFrameBase2_get_contentWindow(iframe, &iframe_window);
1162 ok(hres == S_OK, "get_contentDocument failed: %08x\n", hres);
1163
1164 hres = IHTMLWindow2_get_document(iframe_window, &iframe_doc);
1165 IHTMLWindow2_Release(iframe_window);
1166 ok(hres == S_OK, "get_document failed: %08x\n", hres);
1167
1168 hres = IHTMLDocument2_get_readyState(iframe_doc, &str2);
1169 ok(hres == S_OK, "get_document failed: %08x\n", hres);
1170 ok(!lstrcmpW(str, str2), "unexpected document readyState %s\n", wine_dbgstr_w(str2));
1171 SysFreeString(str2);
1172
1173 if(!strcmp_wa(str, "loading")) {
1174 CHECK_EXPECT(iframe_onreadystatechange_loading);
1175
1176 V_VT(&v) = VT_DISPATCH;
1177 V_DISPATCH(&v) = (IDispatch*)&iframedoc_onreadystatechange_obj;
1178 hres = IHTMLDocument2_put_onreadystatechange(iframe_doc, v);
1179 ok(hres == S_OK, "put_onreadystatechange: %08x\n", hres);
1180 }else if(!strcmp_wa(str, "interactive"))
1181 CHECK_EXPECT(iframe_onreadystatechange_interactive);
1182 else if(!strcmp_wa(str, "complete"))
1183 CHECK_EXPECT(iframe_onreadystatechange_complete);
1184 else
1185 ok(0, "unexpected state %s\n", wine_dbgstr_w(str));
1186
1188 IHTMLDocument2_Release(iframe_doc);
1189 IHTMLFrameBase2_Release(iframe);
1190 return S_OK;
1191}
1192
1194
1195static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1196 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1197{
1198 ok(0, "unexpected call\n");
1199 return S_OK;
1200}
1201
1203
1204#define CONNECTION_POINT_OBJ(cpname, diid) \
1205 static HRESULT WINAPI cpname ## _QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) \
1206 { \
1207 *ppv = NULL; \
1208 if(IsEqualGUID(riid, &IID_IUnknown) \
1209 || IsEqualGUID(riid, &IID_IDispatch) \
1210 || IsEqualGUID(riid, &diid)) \
1211 *ppv = iface; \
1212 else { \
1213 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); \
1214 return E_NOINTERFACE; \
1215 } \
1216 return S_OK; \
1217 } \
1218 static IDispatchExVtbl cpname ## Vtbl = { \
1219 cpname ## _QueryInterface, \
1220 DispatchEx_AddRef, \
1221 DispatchEx_Release, \
1222 DispatchEx_GetTypeInfoCount, \
1223 DispatchEx_GetTypeInfo, \
1224 DispatchEx_GetIDsOfNames, \
1225 cpname, \
1226 DispatchEx_GetDispID, \
1227 DispatchEx_InvokeEx, \
1228 DispatchEx_DeleteMemberByName, \
1229 DispatchEx_DeleteMemberByDispID, \
1230 DispatchEx_GetMemberProperties, \
1231 DispatchEx_GetMemberName, \
1232 DispatchEx_GetNextDispID, \
1233 DispatchEx_GetNameSpaceParent \
1234 }; \
1235 static IDispatchEx cpname ## _obj = { &cpname ## Vtbl }
1236
1237#define test_cp_args(a,b,c,d,e,f) _test_cp_args(__LINE__,a,b,c,d,e,f)
1238static void _test_cp_args(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
1239{
1240 ok_(__FILE__,line)(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
1241 ok_(__FILE__,line)(flags == DISPATCH_METHOD, "flags = %x\n", flags);
1242 ok_(__FILE__,line)(dp != NULL, "dp == NULL\n");
1243 ok_(__FILE__,line)(!dp->cArgs, "dp->cArgs = %d\n", dp->cArgs);
1244 ok_(__FILE__,line)(!dp->rgvarg, "dp->rgvarg = %p\n", dp->rgvarg);
1245 ok_(__FILE__,line)(!dp->cNamedArgs, "dp->cNamedArgs = %d\n", dp->cNamedArgs);
1246 ok_(__FILE__,line)(!dp->rgdispidNamedArgs, "dp->rgdispidNamedArgs = %p\n", dp->rgdispidNamedArgs);
1247 ok_(__FILE__,line)(vres != NULL, "vres == NULL\n");
1248 ok_(__FILE__,line)(V_VT(vres) == VT_EMPTY, "V_VT(vres) = %d\n", V_VT(vres));
1249 ok_(__FILE__,line)(ei != NULL, "ei == NULL\n");
1250 ok_(__FILE__,line)(argerr != NULL, "argerr == NULL\n");
1251}
1252
1253#define test_cp_eventarg(a,b,c,d,e,f) _test_cp_eventarg(__LINE__,a,b,c,d,e,f)
1254static void _test_cp_eventarg(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
1255{
1256 IHTMLEventObj *event;
1257
1258 ok_(__FILE__,line)(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
1259 ok_(__FILE__,line)(flags == DISPATCH_METHOD, "flags = %x\n", flags);
1260 ok_(__FILE__,line)(dp != NULL, "dp == NULL\n");
1261 ok_(__FILE__,line)(dp->cArgs == 1, "dp->cArgs = %d\n", dp->cArgs);
1262 ok_(__FILE__,line)(dp->rgvarg != NULL, "dp->rgvarg = %p\n", dp->rgvarg);
1263 ok_(__FILE__,line)(!dp->cNamedArgs, "dp->cNamedArgs = %d\n", dp->cNamedArgs);
1264 ok_(__FILE__,line)(!dp->rgdispidNamedArgs, "dp->rgdispidNamedArgs = %p\n", dp->rgdispidNamedArgs);
1265 ok_(__FILE__,line)(vres != NULL, "vres == NULL\n");
1266 ok_(__FILE__,line)(V_VT(vres) == VT_EMPTY, "V_VT(vres) = %d\n", V_VT(vres));
1267 ok_(__FILE__,line)(ei != NULL, "ei == NULL\n");
1268 ok_(__FILE__,line)(argerr != NULL, "argerr == NULL\n");
1269
1270 ok(V_VT(dp->rgvarg) == VT_DISPATCH, "V_VT(dp->rgvarg) = %d\n", V_VT(dp->rgvarg));
1271 ok(V_DISPATCH(dp->rgvarg) != NULL, "V_DISPATCH(dp->rgvarg) = %p\n", V_DISPATCH(dp->rgvarg));
1272
1273 event = _get_event_obj(line);
1274 ok(iface_cmp((IUnknown*)event, (IUnknown*)V_DISPATCH(dp->rgvarg)), "event != arg0\n");
1275 IHTMLEventObj_Release(event);
1276}
1277
1278static HRESULT WINAPI doccp(IDispatchEx *iface, DISPID dispIdMember,
1279 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1280 VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
1281{
1282 switch(dispIdMember) {
1284 CHECK_EXPECT(doccp_onclick);
1285 test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr);
1286 break;
1287 default:
1288 ok(0, "unexpected call %d\n", dispIdMember);
1289 return E_NOTIMPL;
1290 }
1291
1292 return S_OK;
1293}
1294
1295CONNECTION_POINT_OBJ(doccp, DIID_HTMLDocumentEvents);
1296
1298 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
1299{
1300 switch(dispIdMember) {
1303 test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr);
1304 V_VT(pVarResult) = VT_BOOL;
1305 V_BOOL(pVarResult) = VARIANT_FALSE;
1306 break;
1307 default:
1308 ok(0, "unexpected call %d\n", dispIdMember);
1309 return E_NOTIMPL;
1310 }
1311
1312 return S_OK;
1313}
1314
1316
1317static HRESULT WINAPI elem2_cp(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
1318 WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
1319{
1320 switch(dispIdMember) {
1322 CHECK_EXPECT(elem2_cp_onclick);
1323 test_cp_eventarg(riid, wFlags, pdp, pVarResult, pei, puArgErr);
1324 break;
1325 default:
1326 ok(0, "unexpected call %d\n", dispIdMember);
1327 return E_NOTIMPL;
1328 }
1329
1330 return S_OK;
1331}
1332
1333CONNECTION_POINT_OBJ(elem2_cp, DIID_HTMLElementEvents2);
1334
1336 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1337 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1338{
1340
1341 ok(dispIdMember == DISPID_VALUE, "dispIdMember = %d\n", dispIdMember);
1342 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
1343 ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
1344 ok(!lcid, "lcid = %x\n", lcid);
1345 ok(pDispParams != NULL, "pDispParams == NULL\n");
1346 ok(!pDispParams->cArgs, "pdp->cArgs = %d\n", pDispParams->cArgs);
1347 ok(!pDispParams->cNamedArgs, "pdp->cNamedArgs = %d\n", pDispParams->cNamedArgs);
1348 ok(!pDispParams->rgdispidNamedArgs, "pdp->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
1349 ok(!pDispParams->rgvarg, "rgvarg = %p\n", pDispParams->rgvarg);
1350 ok(pVarResult != NULL, "pVarResult = NULL\n");
1351 ok(pExcepInfo != NULL, "pExcepInfo = NULL\n");
1352 ok(!puArgErr, "puArgErr = %p\n", puArgErr);
1353 ok(V_VT(pVarResult) == VT_EMPTY, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
1354
1355 return S_OK;
1356}
1357
1358static const IDispatchExVtbl timeoutFuncVtbl = {
1374};
1375
1377
1379 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1380 VARIANT *pvarRes, EXCEPINFO *pei, UINT *puArgErr)
1381{
1383
1384 test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
1385
1386 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
1387 ok(!puArgErr, "puArgErr = %p\n", puArgErr);
1388
1389 return S_OK;
1390}
1391
1392static const IDispatchExVtbl div_onclick_dispVtbl = {
1400};
1401
1403
1404static void pump_msgs(BOOL *b)
1405{
1406 MSG msg;
1407
1408 if(b) {
1409 while(!*b && GetMessageW(&msg, NULL, 0, 0)) {
1412 }
1413 }else {
1414 while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
1417 }
1418 }
1419}
1420
1422{
1423 IConnectionPointContainer *cp_container;
1425 HRESULT hres;
1426
1427 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&cp_container);
1428 ok(hres == S_OK, "Could not get IConnectionPointContainer: %08x\n", hres);
1429
1430 hres = IConnectionPointContainer_FindConnectionPoint(cp_container, riid, &cp);
1431 IConnectionPointContainer_Release(cp_container);
1432 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
1433
1434 return cp;
1435}
1436
1438{
1440 DWORD cookie;
1441 HRESULT hres;
1442
1443 cp = get_cp(unk, riid);
1444 hres = IConnectionPoint_Advise(cp, sink, &cookie);
1445 IConnectionPoint_Release(cp);
1446 ok(hres == S_OK, "Advise failed: %08x\n", hres);
1447
1448 return cookie;
1449}
1450
1452{
1454 HRESULT hres;
1455
1456 cp = get_cp(unk, riid);
1457 hres = IConnectionPoint_Unadvise(cp, cookie);
1458 IConnectionPoint_Release(cp);
1459 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
1460}
1461
1463{
1465 *ppv = iface;
1466 return S_OK;
1467 }
1468
1469 ok(0, "Unexpected call\n");
1470 return E_NOINTERFACE;
1471}
1472
1474{
1475 return 2;
1476}
1477
1479{
1480 return 1;
1481}
1482
1484{
1485 ok(0, "Unexpected call\n");
1486 return E_NOTIMPL;
1487}
1488
1489static HRESULT WINAPI EventDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
1490{
1491 ok(0, "Unexpected call\n");
1492 return E_NOTIMPL;
1493}
1494
1496 UINT cNames, LCID lcid, DISPID *rgDispId)
1497{
1498 ok(0, "Unexpected call\n");
1499 return E_NOTIMPL;
1500}
1501
1503 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1504 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1505{
1506 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
1507 ok(pDispParams != NULL, "pDispParams == NULL\n");
1508 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
1509 ok(puArgErr != NULL, "puArgErr == NULL\n");
1510 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
1511 ok(wFlags == DISPATCH_METHOD, "wFlags = %d\n", wFlags);
1512
1513 switch(dispIdMember) {
1515 CHECK_EXPECT2(invoke_onclick);
1516 break;
1519 case 1027:
1520 case 1034:
1521 case 1037:
1522 case 1044:
1523 case 1045:
1524 case 1047:
1525 case 1048:
1526 case 1049:
1527 break; /* TODO */
1528 default:
1529 ok(0, "Unexpected call: %d\n", dispIdMember);
1530 }
1531
1532 return S_OK;
1533}
1534
1535static const IDispatchVtbl EventDispatchVtbl = {
1543};
1544
1546
1547static void test_onclick(IHTMLDocument2 *doc)
1548{
1549 DWORD cp_cookie, elem2_cp_cookie;
1550 IHTMLElement *div, *body;
1551 VARIANT v;
1552 HRESULT hres;
1553
1555
1556 div = get_elem_id(doc, "clickdiv");
1557
1558 elem_attach_event((IUnknown*)div, "abcde", (IDispatch*)&nocall_obj);
1559 elem_attach_event((IUnknown*)div, "onclick", (IDispatch*)&div_onclick_attached_obj);
1560
1561 V_VT(&v) = VT_EMPTY;
1562 hres = IHTMLElement_get_onclick(div, &v);
1563 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1564 ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
1565
1566 V_VT(&v) = VT_EMPTY;
1567 hres = IHTMLElement_put_onclick(div, v);
1568 ok(hres == E_NOTIMPL, "put_onclick failed: %08x\n", hres);
1569
1570 V_VT(&v) = VT_BSTR;
1571 V_BSTR(&v) = a2bstr("function();");
1572 hres = IHTMLElement_put_onclick(div, v);
1573 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1574
1575 if(hres == S_OK) {
1576 V_VT(&v) = VT_EMPTY;
1577 hres = IHTMLElement_get_onclick(div, &v);
1578 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1579 ok(V_VT(&v) == VT_BSTR, "V_VT(onclick) = %d\n", V_VT(&v));
1580 ok(!strcmp_wa(V_BSTR(&v), "function();"), "V_BSTR(onclick) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1581 }
1582 VariantClear(&v);
1583
1584 V_VT(&v) = VT_DISPATCH;
1585 V_DISPATCH(&v) = (IDispatch*)&div_onclick_obj;
1586 hres = IHTMLElement_put_onclick(div, v);
1587 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1588
1589 V_VT(&v) = VT_NULL;
1590 hres = IHTMLElement_put_ondblclick(div, v);
1591 ok(hres == S_OK, "put_ondblclick failed: %08x\n", hres);
1592
1593 V_VT(&v) = VT_EMPTY;
1594 hres = IHTMLElement_get_onclick(div, &v);
1595 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1596 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onclick) = %d\n", V_VT(&v));
1597 ok(V_DISPATCH(&v) == (IDispatch*)&div_onclick_obj, "V_DISPATCH(onclick) != onclickFunc\n");
1598 VariantClear(&v);
1599
1600 V_VT(&v) = VT_EMPTY;
1601 hres = IHTMLDocument2_get_onclick(doc, &v);
1602 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1603 ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
1604
1605 V_VT(&v) = VT_DISPATCH;
1606 V_DISPATCH(&v) = (IDispatch*)&document_onclick_obj;
1607 hres = IHTMLDocument2_put_onclick(doc, v);
1608 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1609
1610 V_VT(&v) = VT_EMPTY;
1611 hres = IHTMLDocument2_get_onclick(doc, &v);
1612 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1613 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onclick) = %d\n", V_VT(&v));
1614 ok(V_DISPATCH(&v) == (IDispatch*)&document_onclick_obj, "V_DISPATCH(onclick) != onclickFunc\n");
1615 VariantClear(&v);
1616
1617 body = doc_get_body(doc);
1618
1619 V_VT(&v) = VT_DISPATCH;
1620 V_DISPATCH(&v) = (IDispatch*)&body_onclick_obj;
1621 hres = IHTMLElement_put_onclick(body, v);
1622 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1623
1629 SET_EXPECT(invoke_onclick);
1630 pump_msgs(&called_document_onclick);
1635 CHECK_CALLED(invoke_onclick);
1636 }
1637
1642 SET_EXPECT(invoke_onclick);
1643
1644 hres = IHTMLElement_click(div);
1645 ok(hres == S_OK, "click failed: %08x\n", hres);
1646
1651 CHECK_CALLED(invoke_onclick);
1652
1657 SET_EXPECT(invoke_onclick);
1658
1659 V_VT(&v) = VT_EMPTY;
1660 elem_fire_event((IUnknown*)div, "onclick", &v);
1661
1666 CHECK_CALLED(invoke_onclick);
1667
1668 cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, (IUnknown*)&doccp_obj);
1670 doc_attach_event(doc, "onclick", (IDispatch*)&doc_onclick_attached_obj);
1671
1678 SET_EXPECT(doccp_onclick);
1679 SET_EXPECT(invoke_onclick);
1680
1681 hres = IHTMLElement_click(div);
1682 ok(hres == S_OK, "click failed: %08x\n", hres);
1683
1690 CHECK_CALLED(doccp_onclick);
1691 CHECK_CALLED(invoke_onclick);
1692
1693 elem2_cp_cookie = register_cp((IUnknown*)div, &DIID_HTMLElementEvents2, (IUnknown*)&elem2_cp_obj);
1694
1698 SET_EXPECT(elem2_cp_onclick);
1702 SET_EXPECT(doccp_onclick);
1703 SET_EXPECT(invoke_onclick);
1704
1705 trace("click >>>\n");
1706 hres = IHTMLElement_click(div);
1707 ok(hres == S_OK, "click failed: %08x\n", hres);
1708 trace("click <<<\n");
1709
1713 CHECK_CALLED(elem2_cp_onclick);
1717 CHECK_CALLED(doccp_onclick);
1718 CHECK_CALLED(invoke_onclick);
1719
1720 unregister_cp((IUnknown*)div, &DIID_HTMLElementEvents2, elem2_cp_cookie);
1721 unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, cp_cookie);
1722
1723 V_VT(&v) = VT_NULL;
1724 hres = IHTMLElement_put_onclick(div, v);
1725 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1726
1727 hres = IHTMLElement_get_onclick(div, &v);
1728 ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
1729 ok(V_VT(&v) == VT_NULL, "get_onclick returned vt %d\n", V_VT(&v));
1730
1734 doc_detach_event(doc, "onclick", (IDispatch*)&doc_onclick_attached_obj);
1735
1739 SET_EXPECT(invoke_onclick);
1740
1741 hres = IHTMLElement_click(div);
1742 ok(hres == S_OK, "click failed: %08x\n", hres);
1743
1747 CHECK_CALLED(invoke_onclick);
1748
1749 IHTMLElement_Release(div);
1750 IHTMLElement_Release(body);
1751}
1752
1753static void test_onreadystatechange(IHTMLDocument2 *doc)
1754{
1755 IHTMLFrameBase *iframe;
1756 IHTMLElement2 *elem2;
1757 IHTMLElement *elem;
1758 VARIANT v;
1759 BSTR str;
1760 HRESULT hres;
1761
1762 elem = get_elem_id(doc, "iframe");
1763 elem2 = get_elem2_iface((IUnknown*)elem);
1764 IHTMLElement_Release(elem);
1765
1766 V_VT(&v) = VT_EMPTY;
1767 hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
1768 ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
1769 ok(V_VT(&v) == VT_NULL, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
1770
1771 V_VT(&v) = VT_DISPATCH;
1772 V_DISPATCH(&v) = (IDispatch*)&iframe_onreadystatechange_obj;
1773 hres = IHTMLElement2_put_onreadystatechange(elem2, v);
1774 ok(hres == S_OK, "put_onreadystatechange failed: %08x\n", hres);
1775
1776 V_VT(&v) = VT_EMPTY;
1777 hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
1778 ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
1779 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
1780 ok(V_DISPATCH(&v) == (IDispatch*)&iframe_onreadystatechange_obj, "unexpected onreadystatechange value\n");
1781
1782 hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase, (void**)&iframe);
1783 IHTMLElement2_Release(elem2);
1784 ok(hres == S_OK, "Could not get IHTMLFrameBase iface: %08x\n", hres);
1785
1786 hres = IHTMLFrameBase_put_src(iframe, (str = a2bstr("about:blank")));
1788 ok(hres == S_OK, "put_src failed: %08x\n", hres);
1789
1790 SET_EXPECT(iframe_onreadystatechange_loading);
1792 SET_EXPECT(iframe_onreadystatechange_interactive);
1793 SET_EXPECT(iframe_onreadystatechange_complete);
1794 pump_msgs(&called_iframe_onreadystatechange_complete);
1795 CHECK_CALLED(iframe_onreadystatechange_loading);
1797 CHECK_CALLED(iframe_onreadystatechange_interactive);
1798 CHECK_CALLED(iframe_onreadystatechange_complete);
1799
1800 IHTMLFrameBase_Release(iframe);
1801}
1802
1803static void test_imgload(IHTMLDocument2 *doc)
1804{
1805 IHTMLImgElement *img;
1806 IHTMLElement *elem;
1807 VARIANT v;
1808 BSTR str;
1809 HRESULT hres;
1810
1811 elem = get_elem_id(doc, "imgid");
1812 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLImgElement, (void**)&img);
1813 IHTMLElement_Release(elem);
1814 ok(hres == S_OK, "Could not get IHTMLImgElement iface: %08x\n", hres);
1815
1816 V_VT(&v) = VT_EMPTY;
1817 hres = IHTMLImgElement_get_onload(img, &v);
1818 ok(hres == S_OK, "get_onload failed: %08x\n", hres);
1819 ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v));
1820
1821 V_VT(&v) = VT_DISPATCH;
1822 V_DISPATCH(&v) = (IDispatch*)&img_onload_obj;
1823 hres = IHTMLImgElement_put_onload(img, v);
1824 ok(hres == S_OK, "put_onload failed: %08x\n", hres);
1825
1826 V_VT(&v) = VT_EMPTY;
1827 hres = IHTMLImgElement_get_onload(img, &v);
1828 ok(hres == S_OK, "get_onload failed: %08x\n", hres);
1829 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v));
1830 ok(V_DISPATCH(&v) == (IDispatch*)&img_onload_obj, "V_DISPATCH(onload) != onloadkFunc\n");
1831 VariantClear(&v);
1832
1833 V_VT(&v) = VT_DISPATCH;
1834 V_DISPATCH(&v) = (IDispatch*)&img_onerror_obj;
1835 hres = IHTMLImgElement_put_onerror(img, v);
1836 ok(hres == S_OK, "put_onerror failed: %08x\n", hres);
1837
1838 V_VT(&v) = VT_EMPTY;
1839 hres = IHTMLImgElement_get_onerror(img, &v);
1840 ok(hres == S_OK, "get_onerror failed: %08x\n", hres);
1841 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onerror) = %d\n", V_VT(&v));
1842 ok(V_DISPATCH(&v) == (IDispatch*)&img_onerror_obj, "V_DISPATCH(onerror) != onerrorFunc\n");
1843 VariantClear(&v);
1844
1845 str = a2bstr("http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png");
1846 hres = IHTMLImgElement_put_src(img, str);
1847 ok(hres == S_OK, "put_src failed: %08x\n", hres);
1849
1851 pump_msgs(&called_img_onload);
1853
1855
1856 str = a2bstr("about:blank");
1857 hres = IHTMLImgElement_put_src(img, str);
1858 ok(hres == S_OK, "put_src failed: %08x\n", hres);
1860
1861 pump_msgs(&called_img_onerror); /* FIXME: should not be needed */
1862
1864
1865 IHTMLImgElement_Release(img);
1866}
1867
1868static void test_focus(IHTMLDocument2 *doc)
1869{
1870 IHTMLElement2 *elem2;
1871 IHTMLElement *elem;
1872 VARIANT v;
1873 HRESULT hres;
1874
1875 elem = get_elem_id(doc, "inputid");
1876 elem2 = get_elem2_iface((IUnknown*)elem);
1877 IHTMLElement_Release(elem);
1878
1879 V_VT(&v) = VT_EMPTY;
1880 hres = IHTMLElement2_get_onfocus(elem2, &v);
1881 ok(hres == S_OK, "get_onfocus failed: %08x\n", hres);
1882 ok(V_VT(&v) == VT_NULL, "V_VT(onfocus) = %d\n", V_VT(&v));
1883
1884 V_VT(&v) = VT_DISPATCH;
1885 V_DISPATCH(&v) = (IDispatch*)&input_onfocus_obj;
1886 hres = IHTMLElement2_put_onfocus(elem2, v);
1887 ok(hres == S_OK, "put_onfocus failed: %08x\n", hres);
1888
1889 V_VT(&v) = VT_EMPTY;
1890 hres = IHTMLElement2_get_onfocus(elem2, &v);
1891 ok(hres == S_OK, "get_onfocus failed: %08x\n", hres);
1892 ok(V_VT(&v) == VT_DISPATCH, "V_VT(onfocus) = %d\n", V_VT(&v));
1893 ok(V_DISPATCH(&v) == (IDispatch*)&input_onfocus_obj, "V_DISPATCH(onfocus) != onfocusFunc\n");
1894 VariantClear(&v);
1895
1898
1899 SetFocus(NULL);
1900 ok(!IsChild(container_hwnd, GetFocus()), "focus belongs to document window\n");
1901
1902 hres = IHTMLWindow2_focus(window);
1903 ok(hres == S_OK, "focus failed: %08x\n", hres);
1904
1905 ok(IsChild(container_hwnd, GetFocus()), "focus does not belong to document window\n");
1906 pump_msgs(NULL);
1907
1909 hres = IHTMLElement2_focus(elem2);
1910 pump_msgs(NULL);
1912 ok(hres == S_OK, "focus failed: %08x\n", hres);
1913
1914 V_VT(&v) = VT_DISPATCH;
1915 V_DISPATCH(&v) = (IDispatch*)&input_onblur_obj;
1916 hres = IHTMLElement2_put_onblur(elem2, v);
1917 ok(hres == S_OK, "put_onblur failed: %08x\n", hres);
1918
1920 hres = IHTMLElement2_blur(elem2);
1921 pump_msgs(NULL);
1923 ok(hres == S_OK, "blur failed: %08x\n", hres);
1924
1927
1928 IHTMLElement2_Release(elem2);
1929}
1930
1931static void test_submit(IHTMLDocument2 *doc)
1932{
1933 IHTMLElement *elem, *submit;
1934 IHTMLFormElement *form;
1935 VARIANT v;
1936 DWORD cp_cookie;
1937 HRESULT hres;
1938
1939 elem = get_elem_id(doc, "formid");
1940
1941 V_VT(&v) = VT_DISPATCH;
1942 V_DISPATCH(&v) = (IDispatch*)&form_onclick_obj;
1943 hres = IHTMLElement_put_onclick(elem, v);
1944 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1945
1946 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLFormElement, (void**)&form);
1947 IHTMLElement_Release(elem);
1948 ok(hres == S_OK, "Could not get IHTMLFormElement iface: %08x\n", hres);
1949
1950 V_VT(&v) = VT_DISPATCH;
1951 V_DISPATCH(&v) = (IDispatch*)&form_onsubmit_obj;
1952 hres = IHTMLFormElement_put_onsubmit(form, v);
1953 ok(hres == S_OK, "put_onsubmit failed: %08x\n", hres);
1954
1955 IHTMLFormElement_Release(form);
1956
1957 submit = get_elem_id(doc, "submitid");
1958
1961 hres = IHTMLElement_click(submit);
1962 ok(hres == S_OK, "click failed: %08x\n", hres);
1965
1966 V_VT(&v) = VT_DISPATCH;
1967 V_DISPATCH(&v) = (IDispatch*)&submit_onclick_obj;
1968 hres = IHTMLElement_put_onclick(submit, v);
1969 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1970
1973 hres = IHTMLElement_click(submit);
1974 ok(hres == S_OK, "click failed: %08x\n", hres);
1977
1978 elem_attach_event((IUnknown*)submit, "onclick", (IDispatch*)&submit_onclick_attached_obj);
1979
1983 hres = IHTMLElement_click(submit);
1984 ok(hres == S_OK, "click failed: %08x\n", hres);
1988
1989 V_VT(&v) = VT_NULL;
1990 hres = IHTMLElement_put_onclick(submit, v);
1991 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
1992
1995 hres = IHTMLElement_click(submit);
1996 ok(hres == S_OK, "click failed: %08x\n", hres);
1999
2000 elem_detach_event((IUnknown*)submit, "onclick", (IDispatch*)&submit_onclick_attached_obj);
2001
2002 cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, (IUnknown*)&doccp_onclick_cancel_obj);
2003
2006 hres = IHTMLElement_click(submit);
2007 ok(hres == S_OK, "click failed: %08x\n", hres);
2010
2011 unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, cp_cookie);
2012
2013 V_VT(&v) = VT_DISPATCH;
2014 V_DISPATCH(&v) = (IDispatch*)&submit_onclick_setret_obj;
2015 hres = IHTMLElement_put_onclick(submit, v);
2016 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
2017
2019 V_BOOL(&onclick_retval) = VARIANT_TRUE;
2021 V_BOOL(&onclick_event_retval) = VARIANT_TRUE;
2022
2026 hres = IHTMLElement_click(submit);
2027 ok(hres == S_OK, "click failed: %08x\n", hres);
2031
2033 V_BOOL(&onclick_event_retval) = VARIANT_FALSE;
2034
2037 hres = IHTMLElement_click(submit);
2038 ok(hres == S_OK, "click failed: %08x\n", hres);
2041
2043 V_BOOL(&onclick_retval) = VARIANT_FALSE;
2045 V_BOOL(&onclick_event_retval) = VARIANT_TRUE;
2046
2049 hres = IHTMLElement_click(submit);
2050 ok(hres == S_OK, "click failed: %08x\n", hres);
2053
2055 V_BOOL(&onclick_event_retval) = VARIANT_FALSE;
2056
2059 hres = IHTMLElement_click(submit);
2060 ok(hres == S_OK, "click failed: %08x\n", hres);
2063
2064 elem_attach_event((IUnknown*)submit, "onclick", (IDispatch*)&submit_onclick_attached_obj);
2065 elem_attach_event((IUnknown*)submit, "onclick", (IDispatch*)&submit_onclick_attached_check_cancel_obj);
2066
2067 V_VT(&v) = VT_DISPATCH;
2068 V_DISPATCH(&v) = (IDispatch*)&submit_onclick_cancel_obj;
2069 hres = IHTMLElement_put_onclick(submit, v);
2070 ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
2071
2075 hres = IHTMLElement_click(submit);
2076 ok(hres == S_OK, "click failed: %08x\n", hres);
2080
2081 if(1)pump_msgs(NULL);
2082
2083 IHTMLElement_Release(submit);
2084}
2085
2086static void test_timeout(IHTMLDocument2 *doc)
2087{
2088 IHTMLWindow3 *win3;
2089 VARIANT expr, var;
2090 LONG id;
2091 HRESULT hres;
2092
2093 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow3, (void**)&win3);
2094 ok(hres == S_OK, "Could not get IHTMLWindow3 iface: %08x\n", hres);
2095
2096 V_VT(&expr) = VT_DISPATCH;
2098 V_VT(&var) = VT_EMPTY;
2099 id = 0;
2100 hres = IHTMLWindow3_setTimeout(win3, &expr, 0, &var, &id);
2101 ok(hres == S_OK, "setTimeout failed: %08x\n", hres);
2102 ok(id, "id = 0\n");
2103
2105 pump_msgs(&called_timeout);
2107
2108 V_VT(&expr) = VT_DISPATCH;
2110 V_VT(&var) = VT_EMPTY;
2111 id = 0;
2112 hres = IHTMLWindow3_setTimeout(win3, &expr, 0, &var, &id);
2113 ok(hres == S_OK, "setTimeout failed: %08x\n", hres);
2114 ok(id, "id = 0\n");
2115
2116 hres = IHTMLWindow2_clearTimeout(window, id);
2117 ok(hres == S_OK, "clearTimeout failed: %08x\n", hres);
2118
2119 IHTMLWindow3_Release(win3);
2120}
2121
2122static IHTMLElement* find_element_by_id(IHTMLDocument2 *doc, const char *id)
2123{
2124 HRESULT hres;
2125 IHTMLDocument3 *doc3;
2126 IHTMLElement *result;
2127 BSTR idW = a2bstr(id);
2128
2129 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
2130 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
2131
2132 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
2133 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
2134 ok(result != NULL, "result == NULL\n");
2135 SysFreeString(idW);
2136
2137 IHTMLDocument3_Release(doc3);
2138 return result;
2139}
2140
2141static IHTMLDocument2* get_iframe_doc(IHTMLIFrameElement *iframe)
2142{
2143 HRESULT hres;
2144 IHTMLFrameBase2 *base;
2145 IHTMLDocument2 *result = NULL;
2146
2147 hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&base);
2148 ok(hres == S_OK, "QueryInterface(IID_IHTMLFrameBase2) failed: %08x\n", hres);
2149 if(hres == S_OK) {
2151
2152 hres = IHTMLFrameBase2_get_contentWindow(base, &window);
2153 ok(hres == S_OK, "get_contentWindow failed: %08x\n", hres);
2154 ok(window != NULL, "window == NULL\n");
2155 if(window) {
2156 hres = IHTMLWindow2_get_document(window, &result);
2157 ok(hres == S_OK, "get_document failed: %08x\n", hres);
2158 ok(result != NULL, "result == NULL\n");
2159 IHTMLWindow2_Release(window);
2160 }
2161 }
2162 if(base) IHTMLFrameBase2_Release(base);
2163
2164 return result;
2165}
2166
2167static void test_iframe_connections(IHTMLDocument2 *doc)
2168{
2169 IHTMLIFrameElement *iframe;
2170 IHTMLDocument2 *iframes_doc;
2171 DWORD cookie;
2173 IHTMLElement *element;
2174 BSTR str;
2175 HRESULT hres;
2176
2177 trace("iframe tests...\n");
2178
2179 element = find_element_by_id(doc, "ifr");
2180 iframe = get_iframe_iface((IUnknown*)element);
2181 IHTMLElement_Release(element);
2182
2183 iframes_doc = get_iframe_doc(iframe);
2184 IHTMLIFrameElement_Release(iframe);
2185
2187
2188 cp = get_cp((IUnknown*)doc, &IID_IDispatch);
2189 hres = IConnectionPoint_Unadvise(cp, cookie);
2190 IConnectionPoint_Release(cp);
2191 ok(hres == CONNECT_E_NOCONNECTION, "Unadvise returned %08x, expected CONNECT_E_NOCONNECTION\n", hres);
2192
2193 unregister_cp((IUnknown*)iframes_doc, &IID_IDispatch, cookie);
2194
2195 if(is_ie9plus) {
2196 IHTMLFrameBase2 *frame_base2;
2197 VARIANT v;
2198
2199 hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&frame_base2);
2200 ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
2201
2202 V_VT(&v) = VT_DISPATCH;
2203 V_DISPATCH(&v) = (IDispatch*)&iframe_onload_obj;
2204 hres = IHTMLFrameBase2_put_onload(frame_base2, v);
2205 ok(hres == S_OK, "put_onload failed: %08x\n", hres);
2206
2207 IHTMLFrameBase2_Release(frame_base2);
2208
2209 str = a2bstr("about:blank");
2210 hres = IHTMLDocument2_put_URL(iframes_doc, str);
2211 ok(hres == S_OK, "put_URL failed: %08x\n", hres);
2213
2215 pump_msgs(&called_iframe_onload);
2217
2218 str = a2bstr("about:test");
2219 hres = IHTMLDocument2_put_URL(iframes_doc, str);
2220 ok(hres == S_OK, "put_URL failed: %08x\n", hres);
2222
2224 pump_msgs(&called_iframe_onload);
2226 }else {
2227 win_skip("Skipping iframe onload tests on IE older than 9.\n");
2228 }
2229
2230 IHTMLDocument2_Release(iframes_doc);
2231}
2232
2233static HRESULT QueryInterface(REFIID,void**);
2234
2236{
2237 return E_NOINTERFACE;
2238}
2239
2241{
2242 return 2;
2243}
2244
2246{
2247 return 1;
2248}
2249
2251{
2252 return E_NOTIMPL;
2253}
2254
2256{
2257 return E_NOTIMPL;
2258}
2259
2261{
2262 return E_NOTIMPL;
2263}
2264
2266 LPCBORDERWIDTHS pborderwidths)
2267{
2268 return E_NOTIMPL;
2269}
2270
2272 LPCBORDERWIDTHS pborderwidths)
2273{
2274 return S_OK;
2275}
2276
2278 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
2279{
2280 return S_OK;
2281}
2282
2284 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
2285{
2286 return S_OK;
2287}
2288
2290 LPOLEMENUGROUPWIDTHS lpMenuWidths)
2291{
2292 return E_NOTIMPL;
2293}
2294
2296 HOLEMENU holemenu, HWND hwndActiveObject)
2297{
2298 ok(0, "unexpected call\n");
2299 return E_NOTIMPL;
2300}
2301
2303{
2304 ok(0, "unexpected call\n");
2305 return E_NOTIMPL;
2306}
2307
2308static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
2309{
2310 return S_OK;
2311}
2312
2314{
2315 return E_NOTIMPL;
2316}
2317
2319{
2320 ok(0, "unexpected call\n");
2321 return E_NOTIMPL;
2322}
2323
2324static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
2340};
2341
2343
2344static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
2354};
2355
2357
2359{
2360 return QueryInterface(riid, ppv);
2361}
2362
2364{
2365 return 2;
2366}
2367
2369{
2370 return 1;
2371}
2372
2374{
2375 *phwnd = container_hwnd;
2376 return S_OK;
2377}
2378
2380{
2381 ok(0, "unexpected call\n");
2382 return E_NOTIMPL;
2383}
2384
2386{
2387 return S_OK;
2388}
2389
2391{
2392 return S_OK;
2393}
2394
2396{
2397 return S_OK;
2398}
2399
2401 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
2402 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
2403{
2404 static const RECT rect = {0,0,300,300};
2405
2406 *ppFrame = &InPlaceFrame;
2408 *lprcPosRect = rect;
2409 *lprcClipRect = rect;
2410
2411 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
2412 lpFrameInfo->fMDIApp = FALSE;
2413 lpFrameInfo->hwndFrame = container_hwnd;
2414 lpFrameInfo->haccel = NULL;
2415 lpFrameInfo->cAccelEntries = 0;
2416
2417 return S_OK;
2418}
2419
2421{
2422 return E_NOTIMPL;
2423}
2424
2426{
2427 return S_OK;
2428}
2429
2431{
2432 return S_OK;
2433}
2434
2436{
2437 return E_NOTIMPL;
2438}
2439
2441{
2442 return E_NOTIMPL;
2443}
2444
2446{
2447 return E_NOTIMPL;
2448}
2449
2450static const IOleInPlaceSiteVtbl InPlaceSiteVtbl = {
2466};
2467
2469
2471{
2472 return QueryInterface(riid, ppv);
2473}
2474
2476{
2477 return 2;
2478}
2479
2481{
2482 return 1;
2483}
2484
2486{
2487 ok(0, "unexpected call\n");
2488 return E_NOTIMPL;
2489}
2490
2491static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
2492 IMoniker **ppmon)
2493{
2494 ok(0, "unexpected call\n");
2495 return E_NOTIMPL;
2496}
2497
2499{
2500 return E_NOTIMPL;
2501}
2502
2504{
2505 ok(0, "unexpected call\n");
2506 return E_NOTIMPL;
2507}
2508
2510{
2511 ok(0, "unexpected call\n");
2512 return E_NOTIMPL;
2513}
2514
2516{
2517 ok(0, "unexpected call\n");
2518 return E_NOTIMPL;
2519}
2520
2521static const IOleClientSiteVtbl ClientSiteVtbl = {
2531};
2532
2534
2536{
2537 return QueryInterface(riid, ppv);
2538}
2539
2541{
2542 return 2;
2543}
2544
2546{
2547 return 1;
2548}
2549
2551{
2552 RECT rect = {0,0,300,300};
2553 IOleDocument *document;
2554 HRESULT hres;
2555
2556 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2557 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2558
2559 hres = IOleDocument_CreateView(document, &InPlaceSite, NULL, 0, &view);
2560 IOleDocument_Release(document);
2561 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2562
2563 hres = IOleDocumentView_SetInPlaceSite(view, &InPlaceSite);
2564 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2565
2566 hres = IOleDocumentView_UIActivate(view, TRUE);
2567 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2568
2569 hres = IOleDocumentView_SetRect(view, &rect);
2570 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2571
2572 hres = IOleDocumentView_Show(view, TRUE);
2573 ok(hres == S_OK, "Show failed: %08x\n", hres);
2574
2575 return S_OK;
2576}
2577
2578static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2583};
2584
2586
2588{
2589 *ppv = NULL;
2590
2592 *ppv = &ClientSite;
2593 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
2594 *ppv = &DocumentSite;
2596 *ppv = &InPlaceSite;
2597
2598 return *ppv ? S_OK : E_NOINTERFACE;
2599}
2600
2601static IHTMLDocument2 *notif_doc;
2603
2605 REFIID riid, void**ppv)
2606{
2608 *ppv = iface;
2609 return S_OK;
2610 }
2611
2612 ok(0, "unexpected call\n");
2613 return E_NOINTERFACE;
2614}
2615
2617{
2618 return 2;
2619}
2620
2622{
2623 return 1;
2624}
2625
2627{
2628 if(dispID == DISPID_READYSTATE){
2629 BSTR state;
2630 HRESULT hres;
2631
2632 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2633 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2634
2635 if(!strcmp_wa(state, "complete"))
2637
2639 }
2640
2641 return S_OK;
2642}
2643
2645{
2646 ok(0, "unexpected call\n");
2647 return E_NOTIMPL;
2648}
2649
2650static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2656};
2657
2659
2660static void doc_load_string(IHTMLDocument2 *doc, const char *str)
2661{
2663 IStream *stream;
2664 HGLOBAL mem;
2665 SIZE_T len;
2666
2667 notif_doc = doc;
2668
2670 len = strlen(str);
2671 mem = GlobalAlloc(0, len);
2672 memcpy(mem, str, len);
2674
2675 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2676
2677 IPersistStreamInit_Load(init, stream);
2678 IPersistStreamInit_Release(init);
2679 IStream_Release(stream);
2680}
2681
2682static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2683{
2686 DWORD cookie;
2687 HRESULT hres;
2688
2689 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2690 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2691
2692 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2693 IConnectionPointContainer_Release(container);
2694 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2695
2696 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2697 IConnectionPoint_Release(cp);
2698 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2699}
2700
2701static void set_client_site(IHTMLDocument2 *doc, BOOL set)
2702{
2703 IOleObject *oleobj;
2704 HRESULT hres;
2705
2706 if(!set && view) {
2707 IOleDocumentView_Show(view, FALSE);
2708 IOleDocumentView_CloseView(view, 0);
2709 IOleDocumentView_SetInPlaceSite(view, NULL);
2710 IOleDocumentView_Release(view);
2711 view = NULL;
2712 }
2713
2714 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
2715 ok(hres == S_OK, "Could not et IOleObject: %08x\n", hres);
2716
2717 hres = IOleObject_SetClientSite(oleobj, set ? &ClientSite : NULL);
2718 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
2719
2720 if(set) {
2721 IHlinkTarget *hlink;
2722
2723 hres = IOleObject_QueryInterface(oleobj, &IID_IHlinkTarget, (void**)&hlink);
2724 ok(hres == S_OK, "Could not get IHlinkTarget iface: %08x\n", hres);
2725
2726 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
2727 ok(hres == S_OK, "Navgate failed: %08x\n", hres);
2728
2729 IHlinkTarget_Release(hlink);
2730 }
2731
2732 IOleObject_Release(oleobj);
2733}
2734static IHTMLDocument2 *create_document(void)
2735{
2736 IHTMLDocument2 *doc;
2737 HRESULT hres;
2738
2739 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2740 &IID_IHTMLDocument2, (void**)&doc);
2741 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2742 return SUCCEEDED(hres) ? doc : NULL;
2743}
2744
2745
2746typedef void (*testfunc_t)(IHTMLDocument2*);
2747
2748static void run_test(const char *str, testfunc_t test)
2749{
2750 IHTMLDocument2 *doc;
2751 IHTMLElement *body = NULL;
2752 MSG msg;
2753 HRESULT hres;
2754
2755 doc = create_document();
2756 if (!doc)
2757 return;
2758 set_client_site(doc, TRUE);
2759 doc_load_string(doc, str);
2761
2762 while(!doc_complete && GetMessageA(&msg, NULL, 0, 0)) {
2765 }
2766
2767 hres = IHTMLDocument2_get_body(doc, &body);
2768 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2769
2770 if(body) {
2771 IHTMLElement_Release(body);
2772
2773 hres = IHTMLDocument2_get_parentWindow(doc, &window);
2774 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
2775 ok(window != NULL, "window == NULL\n");
2776
2777 test(doc);
2778
2779 IHTMLWindow2_Release(window);
2780 window = NULL;
2781 }else {
2782 skip("Could not get document body. Assuming no Gecko installed.\n");
2783 }
2784
2785 set_client_site(doc, FALSE);
2786 IHTMLDocument2_Release(doc);
2787}
2788
2790{
2791 return DefWindowProcA(hwnd, msg, wParam, lParam);
2792}
2793
2795{
2796 static const CHAR szHTMLDocumentTest[] = "HTMLDocumentTest";
2797 static WNDCLASSEXA wndclass = {
2798 sizeof(WNDCLASSEXA),
2799 0,
2800 wnd_proc,
2801 0, 0, NULL, NULL, NULL, NULL, NULL,
2802 szHTMLDocumentTest,
2803 NULL
2804 };
2805
2806 RegisterClassExA(&wndclass);
2807 return CreateWindowA(szHTMLDocumentTest, szHTMLDocumentTest,
2809 300, 300, NULL, NULL, NULL, NULL);
2810}
2811
2812static void test_empty_document(void)
2813{
2814 HRESULT hres;
2816 IHTMLDocument2 *windows_doc, *doc;
2818 DWORD cookie;
2819
2820 doc = create_document();
2821 if(!doc)
2822 return;
2823
2824 hres = IHTMLDocument2_get_parentWindow(doc, &window);
2825 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
2826
2827 hres = IHTMLWindow2_get_document(window, &windows_doc);
2828 IHTMLWindow2_Release(window);
2829 ok(hres == S_OK, "get_document failed: %08x\n", hres);
2830
2832
2833 cp = get_cp((IUnknown*)doc, &IID_IDispatch);
2834 hres = IConnectionPoint_Unadvise(cp, cookie);
2835 IConnectionPoint_Release(cp);
2836 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
2837
2838 IHTMLDocument2_Release(windows_doc);
2839 IHTMLDocument2_Release(doc);
2840}
2841
2842static BOOL check_ie(void)
2843{
2844 IHTMLDocument2 *doc;
2845 IHTMLDocument5 *doc5;
2846 IHTMLDocument7 *doc7;
2847 HRESULT hres;
2848
2849 doc = create_document();
2850 if(!doc)
2851 return FALSE;
2852
2853 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
2854 if(SUCCEEDED(hres)) {
2855 is_ie9plus = TRUE;
2856 IHTMLDocument7_Release(doc7);
2857 }
2858
2859 trace("is_ie9plus %x\n", is_ie9plus);
2860
2861 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2862 if(SUCCEEDED(hres))
2863 IHTMLDocument5_Release(doc5);
2864
2865 IHTMLDocument2_Release(doc);
2866 return SUCCEEDED(hres);
2867}
2868
2870{
2872
2873 if(check_ie()) {
2875
2878
2886
2888
2890 }else {
2891 win_skip("Too old IE\n");
2892 }
2893
2895}
_STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y)
Definition: _cstdlib.h:137
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static int state
Definition: maze.c:121
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
const GUID IID_IUnknown
r l[0]
Definition: byte_order.h:168
Definition: _set.h:50
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_ERROR
Definition: compat.h:2305
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4194
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
int form
Definition: main.c:89
GLint GLvoid * img
Definition: gl.h:1956
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _cl_event * event
Definition: glext.h:7739
GLuint res
Definition: glext.h:9613
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
GLuint id
Definition: glext.h:5910
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define DISPID_READYSTATE
Definition: idispids.h:22
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
POINT cp
Definition: magnifier.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HANDLE events[2]
Definition: event.c:4
static void test_focus(void)
Definition: treeview.c:739
const char * var
Definition: shader.c:5666
HRESULT hres
Definition: protocol.c:465
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: events.c:2289
#define SET_EXPECT(func)
Definition: events.c:26
static HRESULT WINAPI input_onfocus(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:935
static const char input_doc_str[]
Definition: events.c:104
static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
Definition: events.c:2324
static IOleDocumentSite DocumentSite
Definition: events.c:2585
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
Definition: events.c:2445
static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
Definition: events.c:2277
static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1195
static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:560
static DWORD register_cp(IUnknown *unk, REFIID riid, IUnknown *sink)
Definition: events.c:1437
static IDispatchEx timeoutFunc
Definition: events.c:1376
static const char iframe_doc_str[]
Definition: events.c:107
static void _test_cp_args(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
Definition: events.c:1238
static IHTMLElement * find_element_by_id(IHTMLDocument2 *doc, const char *id)
Definition: events.c:2122
static DWORD WINAPI EventDispatch_Release(IDispatch *iface)
Definition: events.c:1478
static void _test_event_obj(unsigned line, const char *type, const xy_test_t *xy)
Definition: events.c:616
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
Definition: events.c:2515
static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
Definition: events.c:2313
static IHTMLEventObj * _get_event_obj(unsigned line)
Definition: events.c:292
static HRESULT WINAPI timeoutFunc_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: events.c:1335
static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
Definition: events.c:2545
static HRESULT WINAPI document_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:852
#define test_attached_event_args(a, b, c, d, e)
Definition: events.c:341
static const IOleDocumentSiteVtbl DocumentSiteVtbl
Definition: events.c:2578
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
Definition: events.c:2363
#define get_iframe_iface(u)
Definition: events.c:234
static void _test_event_x(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:494
static void test_empty_document(void)
Definition: events.c:2812
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
Definition: events.c:2626
static HRESULT WINAPI input_onblur(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:946
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:789
#define elem_attach_event(a, b, c)
Definition: events.c:651
#define test_event_args(a, b, c, d, e, f, g)
Definition: events.c:321
static IOleInPlaceFrame InPlaceFrame
Definition: events.c:2342
static const IOleInPlaceSiteVtbl InPlaceSiteVtbl
Definition: events.c:2450
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
Definition: events.c:2425
static IOleClientSite ClientSite
Definition: events.c:2533
static void test_imgload(IHTMLDocument2 *doc)
Definition: events.c:1803
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
Definition: events.c:2385
static HRESULT WINAPI body_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:902
static HRESULT WINAPI Dispatch_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: events.c:727
static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
Definition: events.c:2250
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
Definition: events.c:2503
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: events.c:808
static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
Definition: events.c:2650
static IHTMLWindow2 * window
Definition: events.c:77
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
Definition: events.c:135
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
Definition: events.c:2475
#define test_event_obj(t, x)
Definition: events.c:615
static void _test_event_args(unsigned line, const IID *dispiid, DISPID id, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:322
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: events.c:749
#define test_event_src(t)
Definition: events.c:379
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: events.c:767
static BOOL is_ie9plus
Definition: events.c:79
static const IDispatchExVtbl timeoutFuncVtbl
Definition: events.c:1358
static void _test_event_button(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:474
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: events.c:802
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: events.c:826
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: events.c:2789
static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:516
static HRESULT WINAPI submit_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1007
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: events.c:783
static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
Definition: events.c:2260
static void _test_event_cancelbubble(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
Definition: events.c:424
static HRESULT WINAPI submit_onclick_attached_check_cancel(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1021
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
static void _test_cp_eventarg(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
Definition: events.c:1254
static const char click_doc_str[]
Definition: events.c:93
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: events.c:775
#define CHECK_EXPECT(func)
Definition: events.c:36
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
Definition: events.c:2390
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
Definition: events.c:2616
static BOOL check_ie(void)
Definition: events.c:2842
static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
Definition: events.c:2245
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
Definition: events.c:2379
static void _test_event_type(unsigned line, IHTMLEventObj *event, const char *exstr)
Definition: events.c:582
#define get_doc3_iface(u)
Definition: events.c:186
#define DEFINE_EXPECT(func)
Definition: events.c:23
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
Definition: events.c:2480
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: events.c:814
static IHTMLDocument3 * _get_doc3_iface(unsigned line, IUnknown *unk)
Definition: events.c:187
static const char form_doc_str[]
Definition: events.c:110
static IHTMLIFrameElement * _get_iframe_iface(unsigned line, IUnknown *unk)
Definition: events.c:235
static HRESULT WINAPI submit_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:982
static const IDispatchVtbl EventDispatchVtbl
Definition: events.c:1535
static HRESULT WINAPI submit_onclick_cancel(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1080
static VARIANT onclick_retval
Definition: events.c:1042
static IDispatch EventDispatch
Definition: events.c:1545
static IHTMLElement * _get_elem_iface(unsigned line, IUnknown *unk)
Definition: events.c:199
static void pump_msgs(BOOL *b)
Definition: events.c:1404
static BSTR a2bstr(const char *str)
Definition: events.c:123
static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
Definition: events.c:2283
static void _test_event_offsety(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:549
static void _test_event_toelem(unsigned line, IHTMLEventObj *event, const char *to_tag)
Definition: events.c:449
static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
Definition: events.c:2540
static HRESULT WINAPI EventDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
Definition: events.c:1483
static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
Definition: events.c:2255
#define test_cp_args(a, b, c, d, e, f)
Definition: events.c:1237
static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
Definition: events.c:1462
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: events.c:116
#define elem_fire_event(a, b, c)
Definition: events.c:305
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
Definition: events.c:2644
static HRESULT WINAPI EventDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: events.c:1489
static const char img_doc_str[]
Definition: events.c:101
static HRESULT WINAPI EventDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: events.c:1495
static VARIANT onclick_event_retval
Definition: events.c:1042
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
Definition: events.c:2395
static HRESULT WINAPI form_onsubmit(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:957
static void _test_event_src(unsigned line, const char *src_tag)
Definition: events.c:380
static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
Definition: events.c:2535
#define get_event_src()
Definition: events.c:365
static HRESULT WINAPI iframe_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:996
static void unregister_cp(IUnknown *unk, REFIID riid, DWORD cookie)
Definition: events.c:1451
static IHTMLDocument2 * create_document(void)
Definition: events.c:2734
static HRESULT WINAPI img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:913
static IDispatchEx div_onclick_disp
Definition: events.c:1402
static HRESULT WINAPI img_onerror(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:924
static void test_onclick(IHTMLDocument2 *doc)
Definition: events.c:1547
static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
Definition: events.c:2682
static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
Definition: events.c:2308
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: events.c:820
static void _test_event_ctrlkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
Definition: events.c:403
static HRESULT WINAPI submit_onclick_setret(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1044
#define CHECK_EXPECT2(func)
Definition: events.c:29
static const IDispatchExVtbl div_onclick_dispVtbl
Definition: events.c:1392
static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
Definition: events.c:2295
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
Definition: events.c:2485
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
Definition: events.c:2373
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: events.c:711
#define elem_detach_event(a, b, c)
Definition: events.c:667
#define EVENT_HANDLER_FUNC_OBJ(event)
Definition: events.c:832
static void _test_event_reason(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:484
static void _test_event_keycode(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:464
static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface, IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: events.c:2400
static IHTMLDocument2 * get_iframe_doc(IHTMLIFrameElement *iframe)
Definition: events.c:2141
static HRESULT WINAPI doccp_onclick_cancel(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
Definition: events.c:1297
static IConnectionPoint * get_cp(IUnknown *unk, REFIID riid)
Definition: events.c:1421
static void _test_elem_tag(unsigned line, IUnknown *unk, const char *extag)
Definition: events.c:277
#define doc_attach_event(a, b, c)
Definition: events.c:681
static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
Definition: events.c:2344
static HWND container_hwnd
Definition: events.c:76
static IHTMLElement * _get_elem_id(unsigned line, IHTMLDocument2 *doc, const char *id)
Definition: events.c:260
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
Definition: events.c:2440
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
Definition: events.c:2368
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: events.c:744
static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:1126
static IOleDocumentView * view
Definition: events.c:78
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
Definition: events.c:2621
static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:538
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
Definition: events.c:2358
static void test_iframe_connections(IHTMLDocument2 *doc)
Definition: events.c:2167
static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:527
static HRESULT WINAPI div_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: events.c:867
static void _test_event_y(unsigned line, IHTMLEventObj *event, LONG exl)
Definition: events.c:505
#define CHECK_CALLED(func)
Definition: events.c:42
void(* testfunc_t)(IHTMLDocument2 *)
Definition: events.c:2746
static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
Definition: events.c:2302
static void _test_event_srcfilter(unsigned line, IHTMLEventObj *event)
Definition: events.c:605