MSHTML: tests & fixes
Jacek Caban
jack at itma.pwr.wroc.pl
Fri Jul 15 17:15:39 CDT 2005
The main benefit from this patch is correct implementation
of UIActivate (not create the new window if it is already created),
what happened every time user went to the new page in IE.
Is there any reason why mshtml tests don't appear in
test.winehq.org/data/ ?
Changelog:
- Added more tests
- Make tests pass under Wine
-------------- next part --------------
? dlls/mshtml/gecko.diff
? dlls/mshtml/nsembed.c
? dlls/mshtml/nsiface.h
? dlls/mshtml/nsiface.idl
? dlls/mshtml/tests/log
Index: dlls/mshtml/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- dlls/mshtml/Makefile.in 3 Jul 2005 11:22:23 -0000 1.17
+++ dlls/mshtml/Makefile.in 15 Jul 2005 22:04:11 -0000
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mshtml.dll
IMPORTLIB = libmshtml.$(IMPLIBEXT)
-IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
+IMPORTS = user32 gdi32 advapi32 kernel32 ntdll ole32
EXTRALIBS = $(LIBUNICODE) -lstrmiids -luuid
EXTRADEFS = -DCOM_NO_WINDOWS_H
Index: dlls/mshtml/mshtml_private.h
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/mshtml_private.h,v
retrieving revision 1.15
diff -u -p -r1.15 mshtml_private.h
--- dlls/mshtml/mshtml_private.h 14 Jul 2005 10:14:33 -0000 1.15
+++ dlls/mshtml/mshtml_private.h 15 Jul 2005 22:04:11 -0000
@@ -41,6 +41,7 @@ typedef struct {
BOOL in_place_active;
BOOL ui_active;
+ BOOL has_key_path;
} HTMLDocument;
#define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
Index: dlls/mshtml/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/oleobj.c,v
retrieving revision 1.9
diff -u -p -r1.9 oleobj.c
--- dlls/mshtml/oleobj.c 14 Jul 2005 12:18:59 -0000 1.9
+++ dlls/mshtml/oleobj.c 15 Jul 2005 22:04:11 -0000
@@ -96,18 +96,30 @@ static HRESULT WINAPI OleObject_SetClien
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
- hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
- if(hres == S_OK && key_path && key_path[0])
- /* FIXME: use key_path */
- TRACE("key_path = %s\n", debugstr_w(key_path));
+ if(!This->has_key_path) {
+ hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
+ if(hres == S_OK && key_path) {
+ if(key_path[0]) {
+ /* FIXME: use key_path */
+ TRACE("key_path = %s\n", debugstr_w(key_path));
+ }
+ CoTaskMemFree(key_path);
+ }
- hres = IDocHostUIHandler_QueryInterface(pDocHostUIHandler, &IID_IDocHostUIHandler2,
- (void**)&pDocHostUIHandler2);
- if(SUCCEEDED(hres)) {
- /*FIXME: use override_key_path */
- hres = IDocHostUIHandler2_GetOverrideKeyPath(pDocHostUIHandler2, &override_key_path, 0);
- if(hres == S_OK && override_key_path && override_key_path[0])
- FIXME("override_key_path = %s\n", debugstr_w(override_key_path));
+ hres = IDocHostUIHandler_QueryInterface(pDocHostUIHandler, &IID_IDocHostUIHandler2,
+ (void**)&pDocHostUIHandler2);
+ if(SUCCEEDED(hres)) {
+ hres = IDocHostUIHandler2_GetOverrideKeyPath(pDocHostUIHandler2, &override_key_path, 0);
+ if(hres == S_OK && override_key_path && override_key_path[0]) {
+ if(override_key_path[0]) {
+ /*FIXME: use override_key_path */
+ TRACE("override_key_path = %s\n", debugstr_w(override_key_path));
+ }
+ CoTaskMemFree(override_key_path);
+ }
+ }
+
+ This->has_key_path = TRUE;
}
}
@@ -503,4 +515,6 @@ void HTMLDocument_OleObj_Init(HTMLDocume
This->client = NULL;
This->hostui = NULL;
+
+ This->has_key_path = FALSE;
}
Index: dlls/mshtml/olewnd.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/olewnd.c,v
retrieving revision 1.4
diff -u -p -r1.4 olewnd.c
--- dlls/mshtml/olewnd.c 14 Jul 2005 10:14:33 -0000 1.4
+++ dlls/mshtml/olewnd.c 15 Jul 2005 22:04:11 -0000
@@ -71,8 +71,10 @@ static HRESULT WINAPI OleInPlaceActiveOb
if(!phwnd)
return E_INVALIDARG;
- if(!This->in_place_active)
+ if(!This->in_place_active) {
+ *phwnd = NULL;
return E_FAIL;
+ }
*phwnd = This->hwnd;
return S_OK;
Index: dlls/mshtml/view.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/view.c,v
retrieving revision 1.9
diff -u -p -r1.9 view.c
--- dlls/mshtml/view.c 14 Jul 2005 10:14:33 -0000 1.9
+++ dlls/mshtml/view.c 15 Jul 2005 22:04:11 -0000
@@ -221,7 +221,7 @@ static HRESULT WINAPI OleDocumentView_UI
IOleInPlaceFrame *pIPFrame;
RECT posrect, cliprect;
OLEINPLACEFRAMEINFO frameinfo;
- HWND parent_hwnd, hwnd;
+ HWND parent_hwnd;
TRACE("(%p)->(%x)\n", This, fUIActivate);
@@ -262,10 +262,22 @@ static HRESULT WINAPI OleDocumentView_UI
TRACE("got parent window %p\n", parent_hwnd);
- hwnd = CreateWindowExW(0, wszInternetExplorer_Server, NULL,
- WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
- parent_hwnd, NULL, hInst, This);
+ if(This->hwnd) {
+ if(GetParent(This->hwnd) != parent_hwnd)
+ SetParent(This->hwnd, parent_hwnd);
+ SetWindowPos(This->hwnd, HWND_TOP,
+ posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
+ SWP_NOACTIVATE | SWP_SHOWWINDOW);
+ }else {
+ This->hwnd = CreateWindowExW(0, wszInternetExplorer_Server, NULL,
+ WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
+ parent_hwnd, NULL, hInst, This);
+ SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+ RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
+ SetFocus(This->hwnd);
+ }
This->in_place_active = TRUE;
hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
@@ -275,11 +287,6 @@ static HRESULT WINAPI OleDocumentView_UI
return hres;
}
- SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
- SetFocus(hwnd);
-
/* NOTE:
* Windows implementation calls:
* RegisterWindowMessage("MSWHEEL_ROLLMSG");
@@ -293,13 +300,11 @@ static HRESULT WINAPI OleDocumentView_UI
}else {
FIXME("OnUIActivate failed: %08lx\n", hres);
This->ui_active = FALSE;
- DestroyWindow(hwnd);
return hres;
}
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
This->frame = pIPFrame;
- This->hwnd = hwnd;
hres = IDocHostUIHandler_ShowUI(This->hostui, 0, ACTOBJ(This), CMDTARGET(This),
pIPFrame, NULL);
Index: dlls/mshtml/tests/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/tests/htmldoc.c,v
retrieving revision 1.3
diff -u -p -r1.3 htmldoc.c
--- dlls/mshtml/tests/htmldoc.c 14 Jul 2005 12:18:59 -0000 1.3
+++ dlls/mshtml/tests/htmldoc.c 15 Jul 2005 22:04:12 -0000
@@ -40,12 +40,12 @@
called_ ## func = TRUE
#define CHECK_CALLED(func) \
- ok(called_ ## func, "unexpected call\n"); \
+ ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE
static IUnknown *htmldoc_unk = NULL;
static IOleDocumentView *view = NULL;
-static HWND container_hwnd = NULL, hwnd = NULL;
+static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
DEFINE_EXPECT(LockContainer);
DEFINE_EXPECT(SetActiveObject);
@@ -525,6 +525,8 @@ static HRESULT WINAPI DocumentSite_Activ
IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
ok(hres == S_OK, "GetWindow failed: %08lx\n", hres);
ok(hwnd != NULL, "hwnd == NULL\n");
+ if(last_hwnd)
+ ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
}
hres = IOleDocumentView_UIActivate(view, TRUE);
@@ -927,7 +929,7 @@ static void test_HTMLDocument(void)
if(activeobject) {
HWND tmp_hwnd;
hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
- ok(hres == E_FAIL, "GetWindow failed: %08lx\n", hres);
+ ok(hres == E_FAIL, "GetWindow returned %08lx, expected E_FAIL\n", hres);
ok(IsWindow(hwnd), "hwnd is destroyed\n");
}
@@ -939,8 +941,97 @@ static void test_HTMLDocument(void)
if(windowlessobj) {
hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
+ }
- IOleInPlaceObjectWindowless_Release(windowlessobj);
+ if(view) {
+ IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
+
+ hres = IOleDocumentView_Show(view, FALSE);
+ ok(hres == S_OK, "Show failed: %08lx\n", hres);
+
+ hres = IOleDocumentView_CloseView(view, 0);
+ ok(hres == S_OK, "CloseVire failed: %08lx\n", hres);
+
+ hres = IOleDocumentView_SetInPlaceSite(view, NULL);
+ ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
+
+ hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
+ ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
+ ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
+ }
+
+ if(oleobj) {
+ SET_EXPECT(GetContainer);
+ SET_EXPECT(LockContainer);
+ expect_LockContainer_fLock = FALSE;
+ hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
+ ok(hres == S_OK, "Close failed: %08lx\n", hres);
+ CHECK_CALLED(GetContainer);
+ CHECK_CALLED(LockContainer);
+
+ if(view)
+ IOleDocumentView_Release(view);
+
+ /* Activate HTMLDocument again */
+ last_hwnd = hwnd;
+
+ hres = IOleObject_GetClientSite(oleobj, &clientsite);
+ ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
+
+ hres = IOleObject_SetClientSite(oleobj, NULL);
+ ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
+
+ hres = IOleObject_GetClientSite(oleobj, &clientsite);
+ ok(hres == S_OK, "GetClientSite failed: %08lx\n", hres);
+ ok(clientsite == NULL, "GetClientSite() = %p, expected NULL\n", clientsite);
+
+ SET_EXPECT(GetHostInfo);
+ SET_EXPECT(GetWindow);
+ hres = IOleObject_SetClientSite(oleobj, &ClientSite);
+ ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
+ CHECK_CALLED(GetHostInfo);
+ CHECK_CALLED(GetWindow);
+
+ if(windowlessobj) {
+ hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
+ ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
+ }
+
+ SET_EXPECT(GetContainer);
+ SET_EXPECT(LockContainer);
+ SET_EXPECT(ActivateMe);
+ expect_LockContainer_fLock = TRUE;
+ hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
+ ok(hres == S_OK, "DoVerb failed: %08lx\n", hres);
+ CHECK_CALLED(GetContainer);
+ CHECK_CALLED(LockContainer);
+ CHECK_CALLED(ActivateMe);
+ }
+
+ if(activeobject) {
+ HWND tmp_hwnd;
+ hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
+ ok(hres == S_OK, "GetWindow failed: %08lx\n", hres);
+ ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
+ }
+
+ if(view) {
+ SET_EXPECT(SetActiveObject);
+ SET_EXPECT(HideUI);
+ SET_EXPECT(OnUIDeactivate);
+ expect_SetActiveObject_active = FALSE;
+ hres = IOleDocumentView_UIActivate(view, FALSE);
+ ok(hres == S_OK, "UIActivate failed: %08lx\n", hres);
+ CHECK_CALLED(SetActiveObject);
+ CHECK_CALLED(HideUI);
+ CHECK_CALLED(OnUIDeactivate);
+ }
+
+ if(windowlessobj) {
+ SET_EXPECT(OnInPlaceDeactivate);
+ hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
+ ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
+ CHECK_CALLED(OnInPlaceDeactivate);
}
if(view) {
@@ -976,6 +1067,8 @@ static void test_HTMLDocument(void)
ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
}
+ if(windowlessobj)
+ IOleInPlaceObjectWindowless_Release(windowlessobj);
if(oleobj)
IOleObject_Release(oleobj);
if(view)
More information about the wine-patches
mailing list