Commit a85ebbce authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Add visibilitychange event stub.

parent 7d85bd5d
...@@ -206,6 +206,8 @@ static const event_info_t event_info[] = { ...@@ -206,6 +206,8 @@ static const event_info_t event_info[] = {
EVENT_BIND_TO_TARGET}, EVENT_BIND_TO_TARGET},
{L"unload", EVENT_TYPE_UIEVENT, DISPID_EVMETH_ONUNLOAD, {L"unload", EVENT_TYPE_UIEVENT, DISPID_EVMETH_ONUNLOAD,
EVENT_FIXME}, EVENT_FIXME},
{L"visibilitychange", EVENT_TYPE_EVENT, DISPID_EVPROP_VISIBILITYCHANGE,
EVENT_FIXME | EVENT_BUBBLES},
/* EVENTID_LAST special entry */ /* EVENTID_LAST special entry */
{NULL, EVENT_TYPE_EVENT, 0, 0} {NULL, EVENT_TYPE_EVENT, 0, 0}
......
...@@ -63,6 +63,7 @@ typedef enum { ...@@ -63,6 +63,7 @@ typedef enum {
EVENTID_SUBMIT, EVENTID_SUBMIT,
EVENTID_TIMEOUT, EVENTID_TIMEOUT,
EVENTID_UNLOAD, EVENTID_UNLOAD,
EVENTID_VISIBILITYCHANGE,
EVENTID_LAST EVENTID_LAST
} eventid_t; } eventid_t;
......
<html>
<head><meta http-equiv="x-ua-compatible" content="IE=10" /></head>
</html>
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
var compat_version; var compat_version;
var tests = []; var tests = [];
if(window.addEventListener) {
document.addEventListener("visibilitychange", function() { ok(false, "visibilitychange fired"); });
}
sync_test("builtin_toString", function() { sync_test("builtin_toString", function() {
var tags = [ var tags = [
[ "abbr", "Phrase" ], [ "abbr", "Phrase" ],
......
...@@ -97,6 +97,7 @@ DEFINE_EXPECT(submit_onclick_attached_check_cancel); ...@@ -97,6 +97,7 @@ DEFINE_EXPECT(submit_onclick_attached_check_cancel);
DEFINE_EXPECT(submit_onclick_setret); DEFINE_EXPECT(submit_onclick_setret);
DEFINE_EXPECT(elem2_cp_onclick); DEFINE_EXPECT(elem2_cp_onclick);
DEFINE_EXPECT(iframe_onload); DEFINE_EXPECT(iframe_onload);
DEFINE_EXPECT(visibilitychange);
DEFINE_EXPECT(doc1_onstorage); DEFINE_EXPECT(doc1_onstorage);
DEFINE_EXPECT(doc1_onstoragecommit); DEFINE_EXPECT(doc1_onstoragecommit);
DEFINE_EXPECT(window1_onstorage); DEFINE_EXPECT(window1_onstorage);
...@@ -1406,6 +1407,30 @@ static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, L ...@@ -1406,6 +1407,30 @@ static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, L
EVENT_HANDLER_FUNC_OBJ(iframe_onreadystatechange); EVENT_HANDLER_FUNC_OBJ(iframe_onreadystatechange);
static HRESULT WINAPI onvisibilitychange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
IDispatchEx *dispex;
HRESULT hres;
BSTR bstr;
CHECK_EXPECT(visibilitychange);
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
hres = IDispatch_QueryInterface(V_DISPATCH(&pdp->rgvarg[1]), &IID_IDispatchEx, (void**)&dispex);
ok(hres == S_OK, "Could not get IDispatchEx: %08lx\n", hres);
bstr = SysAllocString(L"toString");
hres = IDispatchEx_GetDispID(dispex, bstr, 0, &id);
todo_wine
ok(hres == S_OK, "GetDispID(\"toString\") failed: %08lx\n", hres);
SysFreeString(bstr);
return S_OK;
}
EVENT_HANDLER_FUNC_OBJ(onvisibilitychange);
static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{ {
...@@ -2387,6 +2412,54 @@ static void test_focus(IHTMLDocument2 *doc) ...@@ -2387,6 +2412,54 @@ static void test_focus(IHTMLDocument2 *doc)
IHTMLElement4_Release(div); IHTMLElement4_Release(div);
} }
static void test_visibilitychange(IHTMLDocument2 *doc)
{
if(!winetest_interactive) {
ShowWindow(container_hwnd, SW_SHOW);
pump_msgs(NULL);
}
add_event_listener((IUnknown*)doc, L"visibilitychange", (IDispatch*)&onvisibilitychange_obj, VARIANT_TRUE);
ShowWindow(container_hwnd, SW_HIDE);
pump_msgs(NULL);
ShowWindow(container_hwnd, SW_SHOW);
pump_msgs(NULL);
if(document_mode < 10) {
ShowWindow(container_hwnd, SW_MINIMIZE);
pump_msgs(NULL);
ShowWindow(container_hwnd, SW_RESTORE);
pump_msgs(NULL);
}else {
/* FIXME: currently not implemented in Wine, so we can't wait for it */
BOOL *expect = broken(1) ? &called_visibilitychange : NULL;
SET_EXPECT(visibilitychange);
ShowWindow(container_hwnd, SW_MINIMIZE);
pump_msgs(expect);
todo_wine
CHECK_CALLED(visibilitychange);
SET_EXPECT(visibilitychange);
ShowWindow(container_hwnd, SW_RESTORE);
pump_msgs(expect);
todo_wine
CHECK_CALLED(visibilitychange);
}
navigate(doc, document_mode < 10 ? L"blank_ie10.html" : L"blank.html");
if(document_mode >= 9)
add_event_listener((IUnknown*)doc, L"visibilitychange", (IDispatch*)&onvisibilitychange_obj, VARIANT_TRUE);
if(!winetest_interactive) {
ShowWindow(container_hwnd, SW_HIDE);
pump_msgs(NULL);
}
}
static void test_submit(IHTMLDocument2 *doc) static void test_submit(IHTMLDocument2 *doc)
{ {
IHTMLElement *elem, *submit; IHTMLElement *elem, *submit;
...@@ -5091,6 +5164,10 @@ static IHTMLDocument2 *create_document_with_origin(const char *str) ...@@ -5091,6 +5164,10 @@ static IHTMLDocument2 *create_document_with_origin(const char *str)
return doc; return doc;
} }
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcA(hwnd, msg, wParam, lParam);
}
typedef void (*testfunc_t)(IHTMLDocument2*); typedef void (*testfunc_t)(IHTMLDocument2*);
...@@ -5154,6 +5231,7 @@ static void run_test_impl(const char *str, const WCHAR *res, testfunc_t test) ...@@ -5154,6 +5231,7 @@ static void run_test_impl(const char *str, const WCHAR *res, testfunc_t test)
ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres);
ok(window != NULL, "window == NULL\n"); ok(window != NULL, "window == NULL\n");
ok((WNDPROC)GetWindowLongPtrA(container_hwnd, GWLP_WNDPROC) == wnd_proc, "container_hwnd is subclassed\n");
test(doc); test(doc);
IHTMLWindow2_Release(window); IHTMLWindow2_Release(window);
...@@ -5176,11 +5254,6 @@ static void run_test_from_res(const WCHAR *res, testfunc_t test) ...@@ -5176,11 +5254,6 @@ static void run_test_from_res(const WCHAR *res, testfunc_t test)
return run_test_impl(NULL, res, test); return run_test_impl(NULL, res, test);
} }
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static HWND create_container_window(void) static HWND create_container_window(void)
{ {
static const CHAR szHTMLDocumentTest[] = "HTMLDocumentTest"; static const CHAR szHTMLDocumentTest[] = "HTMLDocumentTest";
...@@ -5496,6 +5569,8 @@ START_TEST(events) ...@@ -5496,6 +5569,8 @@ START_TEST(events)
if(is_ie9plus) { if(is_ie9plus) {
run_test_from_res(L"doc_with_prop.html", test_doc_obj); run_test_from_res(L"doc_with_prop.html", test_doc_obj);
run_test_from_res(L"doc_with_prop_ie9.html", test_doc_obj); run_test_from_res(L"doc_with_prop_ie9.html", test_doc_obj);
run_test_from_res(L"doc_with_prop_ie9.html", test_visibilitychange);
run_test_from_res(L"blank_ie10.html", test_visibilitychange);
run_test(empty_doc_ie9_str, test_create_event); run_test(empty_doc_ie9_str, test_create_event);
} }
......
...@@ -73,6 +73,9 @@ blank2.html HTML "blank.html" ...@@ -73,6 +73,9 @@ blank2.html HTML "blank.html"
/* @makedep: blank.html */ /* @makedep: blank.html */
123 HTML "blank.html" 123 HTML "blank.html"
/* @makedep: blank_ie10.html */
blank_ie10.html HTML "blank_ie10.html"
/* @makedep: doc_with_prop.html */ /* @makedep: doc_with_prop.html */
doc_with_prop.html HTML "doc_with_prop.html" doc_with_prop.html HTML "doc_with_prop.html"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment