- Code cleanup.
- Dissable tests after UIActivate failes (fixes tests win 9x).
This commit is contained in:
parent
724415602d
commit
260df18a31
|
@ -43,7 +43,6 @@
|
||||||
ok(called_ ## func, "expected " #func "\n"); \
|
ok(called_ ## func, "expected " #func "\n"); \
|
||||||
expect_ ## func = called_ ## func = FALSE
|
expect_ ## func = called_ ## func = FALSE
|
||||||
|
|
||||||
static IUnknown *htmldoc_unk = NULL;
|
|
||||||
static IOleDocumentView *view = NULL;
|
static IOleDocumentView *view = NULL;
|
||||||
static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
|
static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
|
||||||
|
|
||||||
|
@ -469,7 +468,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
|
||||||
CHECK_EXPECT(ActivateMe);
|
CHECK_EXPECT(ActivateMe);
|
||||||
ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
|
ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IOleDocument, (void**)&document);
|
hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
|
||||||
ok(hres == S_OK, "could not get IOleDocument: %08lx\n", hres);
|
ok(hres == S_OK, "could not get IOleDocument: %08lx\n", hres);
|
||||||
|
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
|
@ -513,8 +512,15 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
|
||||||
SET_EXPECT(SetActiveObject);
|
SET_EXPECT(SetActiveObject);
|
||||||
SET_EXPECT(ShowUI);
|
SET_EXPECT(ShowUI);
|
||||||
expect_SetActiveObject_active = TRUE;
|
expect_SetActiveObject_active = TRUE;
|
||||||
|
|
||||||
hres = IOleDocumentView_UIActivate(view, TRUE);
|
hres = IOleDocumentView_UIActivate(view, TRUE);
|
||||||
|
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
trace("UIActivate failed: %08lx\n", hres);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
ok(hres == S_OK, "UIActivate failed: %08lx\n", hres);
|
ok(hres == S_OK, "UIActivate failed: %08lx\n", hres);
|
||||||
|
|
||||||
CHECK_CALLED(CanInPlaceActivate);
|
CHECK_CALLED(CanInPlaceActivate);
|
||||||
CHECK_CALLED(GetWindowContext);
|
CHECK_CALLED(GetWindowContext);
|
||||||
CHECK_CALLED(GetWindow);
|
CHECK_CALLED(GetWindow);
|
||||||
|
@ -796,14 +802,14 @@ static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_Persist()
|
static void test_Persist(IUnknown *unk)
|
||||||
{
|
{
|
||||||
IPersistMoniker *persist_mon;
|
IPersistMoniker *persist_mon;
|
||||||
IPersistFile *persist_file;
|
IPersistFile *persist_file;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IPersistFile, (void**)&persist_file);
|
hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&persist_file);
|
||||||
ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08lx\n", hres);
|
ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08lx\n", hres);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
hres = IPersist_GetClassID(persist_file, NULL);
|
hres = IPersist_GetClassID(persist_file, NULL);
|
||||||
|
@ -816,7 +822,7 @@ static void test_Persist()
|
||||||
IPersist_Release(persist_file);
|
IPersist_Release(persist_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IPersistMoniker, (void**)&persist_mon);
|
hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&persist_mon);
|
||||||
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08lx\n", hres);
|
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08lx\n", hres);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
hres = IPersistMoniker_GetClassID(persist_mon, NULL);
|
hres = IPersistMoniker_GetClassID(persist_mon, NULL);
|
||||||
|
@ -872,12 +878,18 @@ static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
|
||||||
OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
|
OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void test_OleCommandTarget(IOleCommandTarget *cmdtrg)
|
static void test_OleCommandTarget(IUnknown *unk)
|
||||||
{
|
{
|
||||||
|
IOleCommandTarget *cmdtrg;
|
||||||
OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
|
OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
|
||||||
int i;
|
int i;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
||||||
|
ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
|
for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
|
||||||
cmds[i].cmdID = i+1;
|
cmds[i].cmdID = i+1;
|
||||||
cmds[i].cmdf = 0xf0f0;
|
cmds[i].cmdf = 0xf0f0;
|
||||||
|
@ -891,104 +903,28 @@ static void test_OleCommandTarget(IOleCommandTarget *cmdtrg)
|
||||||
ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%lx, expected %x\n",
|
ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%lx, expected %x\n",
|
||||||
i+1, cmds[i].cmdf, expect_cmds[i+1]);
|
i+1, cmds[i].cmdf, expect_cmds[i+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOleCommandTarget_Release(cmdtrg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_HTMLDocument(void)
|
static void test_OleCommandTarget_fail(IUnknown *unk)
|
||||||
{
|
{
|
||||||
IOleObject *oleobj = NULL;
|
IOleCommandTarget *cmdtrg;
|
||||||
IOleClientSite *clientsite = (LPVOID)0xdeadbeef;
|
|
||||||
IOleInPlaceObjectWindowless *windowlessobj = NULL;
|
|
||||||
IOleInPlaceActiveObject *activeobject = NULL;
|
|
||||||
IOleCommandTarget *cmdtrg = NULL;
|
|
||||||
GUID guid;
|
|
||||||
RECT rect = {0,0,500,500};
|
|
||||||
HRESULT hres;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
static const WCHAR wszHTMLDocumentTest[] =
|
|
||||||
{'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
|
|
||||||
static WNDCLASSEXW wndclass = {
|
|
||||||
sizeof(WNDCLASSEXW),
|
|
||||||
0,
|
|
||||||
wnd_proc,
|
|
||||||
0, 0, NULL, NULL, NULL, NULL, NULL,
|
|
||||||
wszHTMLDocumentTest,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
||||||
&IID_IUnknown, (void**)&htmldoc_unk);
|
|
||||||
ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
|
|
||||||
if(FAILED(hres))
|
|
||||||
return;
|
|
||||||
|
|
||||||
RegisterClassExW(&wndclass);
|
|
||||||
container_hwnd = CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
|
|
||||||
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
test_Persist();
|
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IOleInPlaceObjectWindowless,
|
|
||||||
(void**)&windowlessobj);
|
|
||||||
ok(hres == S_OK, "Could not get IOleInPlaceObjectWindowless interface: %08lx\n", hres);
|
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
||||||
ok(hres == S_OK, "could not get IOleCommandTarget: %08lx\n", hres);
|
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(htmldoc_unk, &IID_IOleObject, (void**)&oleobj);
|
|
||||||
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08lx\n", hres);
|
|
||||||
if(oleobj) {
|
|
||||||
hres = IOleObject_GetUserClassID(oleobj, NULL);
|
|
||||||
ok(hres == E_INVALIDARG, "GetUserClassID returned: %08lx, expected E_INVALIDARG\n", hres);
|
|
||||||
|
|
||||||
hres = IOleObject_GetUserClassID(oleobj, &guid);
|
|
||||||
ok(hres == S_OK, "GetUserClassID failed: %08lx\n", hres);
|
|
||||||
ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
|
|
||||||
|
|
||||||
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(GetOptionKeyPath);
|
|
||||||
SET_EXPECT(GetOverrideKeyPath);
|
|
||||||
SET_EXPECT(GetWindow);
|
|
||||||
hres = IOleObject_SetClientSite(oleobj, &ClientSite);
|
|
||||||
ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
|
|
||||||
CHECK_CALLED(GetHostInfo);
|
|
||||||
CHECK_CALLED(GetOptionKeyPath);
|
|
||||||
CHECK_CALLED(GetOverrideKeyPath);
|
|
||||||
CHECK_CALLED(GetWindow);
|
|
||||||
|
|
||||||
hres = IOleObject_GetClientSite(oleobj, &clientsite);
|
|
||||||
ok(hres == S_OK, "GetClientSite failed: %08lx\n", hres);
|
|
||||||
ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
|
|
||||||
|
|
||||||
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(cmdtrg) {
|
|
||||||
int i;
|
int i;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
OLECMD cmd[2] = {
|
OLECMD cmd[2] = {
|
||||||
{OLECMDID_OPEN, 0xf0f0},
|
{OLECMDID_OPEN, 0xf0f0},
|
||||||
{OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
|
{OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
||||||
|
ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
|
hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
|
||||||
ok(hres == S_OK, "QueryStatus failed: %08lx\n", hres);
|
ok(hres == S_OK, "QueryStatus failed: %08lx\n", hres);
|
||||||
|
|
||||||
|
@ -1019,227 +955,201 @@ static void test_HTMLDocument(void)
|
||||||
ok(hres == OLECMDERR_E_NOTSUPPORTED,
|
ok(hres == OLECMDERR_E_NOTSUPPORTED,
|
||||||
"Exec failed: %08lx, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
|
"Exec failed: %08lx, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
|
||||||
|
|
||||||
test_OleCommandTarget(cmdtrg);
|
IOleCommandTarget_Release(cmdtrg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HWND create_container_window(void)
|
||||||
|
{
|
||||||
|
static const WCHAR wszHTMLDocumentTest[] =
|
||||||
|
{'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
|
||||||
|
static WNDCLASSEXW wndclass = {
|
||||||
|
sizeof(WNDCLASSEXW),
|
||||||
|
0,
|
||||||
|
wnd_proc,
|
||||||
|
0, 0, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
wszHTMLDocumentTest,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
RegisterClassExW(&wndclass);
|
||||||
|
return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
|
||||||
|
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT test_DoVerb(IOleObject *oleobj)
|
||||||
|
{
|
||||||
|
RECT rect = {0,0,500,500};
|
||||||
|
HRESULT 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);
|
||||||
|
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
ok(hres == S_OK, "DoVerb failed: %08lx\n", hres);
|
||||||
|
CHECK_CALLED(GetContainer);
|
||||||
|
CHECK_CALLED(LockContainer);
|
||||||
|
CHECK_CALLED(ActivateMe);
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CLIENTSITE_EXPECTPATH 0x00000001
|
||||||
|
#define CLIENTSITE_SETNULL 0x00000002
|
||||||
|
#define CLIENTSITE_DONTSET 0x00000004
|
||||||
|
|
||||||
|
static void test_ClientSite(IOleObject *oleobj, DWORD flags)
|
||||||
|
{
|
||||||
|
IOleClientSite *clientsite;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
if(flags & CLIENTSITE_SETNULL) {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(flags & CLIENTSITE_DONTSET)
|
||||||
|
return;
|
||||||
|
|
||||||
|
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);
|
||||||
|
if(flags & CLIENTSITE_EXPECTPATH) {
|
||||||
|
SET_EXPECT(GetOptionKeyPath);
|
||||||
|
SET_EXPECT(GetOverrideKeyPath);
|
||||||
|
}
|
||||||
|
SET_EXPECT(GetWindow);
|
||||||
|
hres = IOleObject_SetClientSite(oleobj, &ClientSite);
|
||||||
|
ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
|
||||||
|
CHECK_CALLED(GetHostInfo);
|
||||||
|
if(flags & CLIENTSITE_EXPECTPATH) {
|
||||||
|
CHECK_CALLED(GetOptionKeyPath);
|
||||||
|
CHECK_CALLED(GetOverrideKeyPath);
|
||||||
|
}
|
||||||
|
CHECK_CALLED(GetWindow);
|
||||||
|
|
||||||
|
hres = IOleObject_GetClientSite(oleobj, &clientsite);
|
||||||
|
ok(hres == S_OK, "GetClientSite failed: %08lx\n", hres);
|
||||||
|
ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_Close(IUnknown *unk, BOOL set_client)
|
||||||
|
{
|
||||||
|
IOleObject *oleobj = NULL;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
|
||||||
|
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
|
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(set_client)
|
||||||
|
test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
|
||||||
|
|
||||||
|
IOleObject_Release(oleobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
|
||||||
|
{
|
||||||
|
IOleInPlaceObjectWindowless *windowlessobj = NULL;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObjectWindowless,
|
||||||
|
(void**)&windowlessobj);
|
||||||
|
ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(expect_call) SET_EXPECT(OnInPlaceDeactivate);
|
||||||
|
hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
|
||||||
|
ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
|
||||||
|
if(expect_call) CHECK_CALLED(OnInPlaceDeactivate);
|
||||||
|
|
||||||
|
IOleInPlaceObjectWindowless_Release(windowlessobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT test_Activate(IUnknown *unk, DWORD flags)
|
||||||
|
{
|
||||||
|
IOleObject *oleobj = NULL;
|
||||||
|
GUID guid;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
last_hwnd = hwnd;
|
||||||
|
|
||||||
|
if(view)
|
||||||
|
IOleDocumentView_Release(view);
|
||||||
|
view = NULL;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
|
||||||
|
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
hres = IOleObject_GetUserClassID(oleobj, NULL);
|
||||||
|
ok(hres == E_INVALIDARG, "GetUserClassID returned: %08lx, expected E_INVALIDARG\n", hres);
|
||||||
|
|
||||||
|
hres = IOleObject_GetUserClassID(oleobj, &guid);
|
||||||
|
ok(hres == S_OK, "GetUserClassID failed: %08lx\n", hres);
|
||||||
|
ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
|
||||||
|
|
||||||
|
test_ClientSite(oleobj, flags);
|
||||||
|
test_InPlaceDeactivate(unk, FALSE);
|
||||||
|
|
||||||
|
hres = test_DoVerb(oleobj);
|
||||||
|
|
||||||
|
IOleObject_Release(oleobj);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_Window(IUnknown *unk, BOOL expect_success)
|
||||||
|
{
|
||||||
|
IOleInPlaceActiveObject *activeobject = NULL;
|
||||||
|
HWND tmp_hwnd;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
|
hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
|
||||||
ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08lx\n", hres);
|
ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
if(activeobject) {
|
|
||||||
HWND tmp_hwnd;
|
|
||||||
hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
|
hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
|
||||||
|
|
||||||
|
if(expect_success) {
|
||||||
ok(hres == S_OK, "GetWindow failed: %08lx\n", hres);
|
ok(hres == S_OK, "GetWindow failed: %08lx\n", hres);
|
||||||
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
|
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
|
||||||
}
|
}else {
|
||||||
|
|
||||||
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(cmdtrg)
|
|
||||||
test_OleCommandTarget(cmdtrg);
|
|
||||||
|
|
||||||
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(windowlessobj) {
|
|
||||||
SET_EXPECT(OnInPlaceDeactivate);
|
|
||||||
hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
|
|
||||||
ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
|
|
||||||
CHECK_CALLED(OnInPlaceDeactivate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calling test_OleCommandTarget here couses Segmentation Fault with native
|
|
||||||
* MSHTML. It doesn't with Wine. */
|
|
||||||
|
|
||||||
if(activeobject) {
|
|
||||||
HWND tmp_hwnd;
|
|
||||||
hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
|
|
||||||
ok(hres == E_FAIL, "GetWindow returned %08lx, expected E_FAIL\n", hres);
|
ok(hres == E_FAIL, "GetWindow returned %08lx, expected E_FAIL\n", hres);
|
||||||
ok(IsWindow(hwnd), "hwnd is destroyed\n");
|
ok(IsWindow(hwnd), "hwnd is destroyed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(view) {
|
IOleInPlaceActiveObject_Release(activeobject);
|
||||||
hres = IOleDocumentView_Show(view, FALSE);
|
}
|
||||||
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
|
||||||
}
|
|
||||||
if(windowlessobj) {
|
|
||||||
hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
|
|
||||||
ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(view) {
|
static void test_CloseView(void)
|
||||||
|
{
|
||||||
IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
|
IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IOleDocumentView_Show(view, FALSE);
|
if(!view)
|
||||||
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
return;
|
||||||
|
|
||||||
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(cmdtrg)
|
|
||||||
test_OleCommandTarget(cmdtrg);
|
|
||||||
|
|
||||||
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(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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
/* Activate HTMLDocument again, this time without UIActivate */
|
|
||||||
last_hwnd = hwnd;
|
|
||||||
call_UIActivate = FALSE;
|
|
||||||
|
|
||||||
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) {
|
|
||||||
expect_SetActiveObject_active = FALSE;
|
|
||||||
hres = IOleDocumentView_UIActivate(view, FALSE);
|
|
||||||
ok(hres == S_OK, "UIActivate failed: %08lx\n", hres);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(windowlessobj) {
|
|
||||||
SET_EXPECT(OnInPlaceDeactivate);
|
|
||||||
hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
|
|
||||||
ok(hres == S_OK, "InPlaceDeactivate failed: %08lx\n", hres);
|
|
||||||
CHECK_CALLED(OnInPlaceDeactivate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(view) {
|
|
||||||
IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
|
|
||||||
|
|
||||||
hres = IOleDocumentView_Show(view, FALSE);
|
hres = IOleDocumentView_Show(view, FALSE);
|
||||||
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
||||||
|
@ -1253,65 +1163,115 @@ static void test_HTMLDocument(void)
|
||||||
hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
|
hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
|
||||||
ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
|
ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
|
||||||
ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
|
ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_UIDeactivate(void)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
if(call_UIActivate) {
|
||||||
|
SET_EXPECT(SetActiveObject);
|
||||||
|
SET_EXPECT(HideUI);
|
||||||
|
SET_EXPECT(OnUIDeactivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(view) {
|
expect_SetActiveObject_active = FALSE;
|
||||||
IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
|
hres = IOleDocumentView_UIActivate(view, FALSE);
|
||||||
|
ok(hres == S_OK, "UIActivate failed: %08lx\n", hres);
|
||||||
|
|
||||||
|
if(call_UIActivate) {
|
||||||
|
CHECK_CALLED(SetActiveObject);
|
||||||
|
CHECK_CALLED(HideUI);
|
||||||
|
CHECK_CALLED(OnUIDeactivate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_Hide(void)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
if(!view)
|
||||||
|
return;
|
||||||
|
|
||||||
hres = IOleDocumentView_Show(view, FALSE);
|
hres = IOleDocumentView_Show(view, FALSE);
|
||||||
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
ok(hres == S_OK, "Show failed: %08lx\n", hres);
|
||||||
|
}
|
||||||
|
|
||||||
hres = IOleDocumentView_CloseView(view, 0);
|
static void test_HTMLDocument(void)
|
||||||
ok(hres == S_OK, "CloseVire failed: %08lx\n", hres);
|
{
|
||||||
|
IUnknown *unk;
|
||||||
|
HRESULT hres;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
hres = IOleDocumentView_SetInPlaceSite(view, NULL);
|
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||||
ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
|
&IID_IUnknown, (void**)&unk);
|
||||||
|
ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
|
test_Persist(unk);
|
||||||
ok(hres == S_OK, "SetInPlaceSite failed: %08lx\n", hres);
|
|
||||||
ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
|
|
||||||
|
|
||||||
SET_EXPECT(GetContainer);
|
hres = test_Activate(unk, CLIENTSITE_EXPECTPATH);
|
||||||
SET_EXPECT(LockContainer);
|
if(FAILED(hres)) {
|
||||||
expect_LockContainer_fLock = FALSE;
|
IUnknown_Release(unk);
|
||||||
hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
|
return;
|
||||||
ok(hres == S_OK, "Close failed: %08lx\n", hres);
|
|
||||||
CHECK_CALLED(GetContainer);
|
|
||||||
CHECK_CALLED(LockContainer);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmdtrg)
|
test_OleCommandTarget_fail(unk);
|
||||||
IOleCommandTarget_Release(cmdtrg);
|
test_OleCommandTarget(unk);
|
||||||
if(windowlessobj)
|
test_Window(unk, TRUE);
|
||||||
IOleInPlaceObjectWindowless_Release(windowlessobj);
|
test_UIDeactivate();
|
||||||
if(oleobj)
|
test_OleCommandTarget(unk);
|
||||||
IOleObject_Release(oleobj);
|
test_Window(unk, TRUE);
|
||||||
|
test_InPlaceDeactivate(unk, TRUE);
|
||||||
|
|
||||||
|
/* Calling test_OleCommandTarget here couses Segmentation Fault with native
|
||||||
|
* MSHTML. It doesn't with Wine. */
|
||||||
|
|
||||||
|
test_Window(unk, FALSE);
|
||||||
|
test_Hide();
|
||||||
|
test_InPlaceDeactivate(unk, FALSE);
|
||||||
|
test_CloseView();
|
||||||
|
test_Close(unk, FALSE);
|
||||||
|
|
||||||
|
/* Activate HTMLDocument again */
|
||||||
|
test_Activate(unk, CLIENTSITE_SETNULL);
|
||||||
|
test_Window(unk, TRUE);
|
||||||
|
test_OleCommandTarget(unk);
|
||||||
|
test_UIDeactivate();
|
||||||
|
test_InPlaceDeactivate(unk, TRUE);
|
||||||
|
test_Close(unk, FALSE);
|
||||||
|
|
||||||
|
/* Activate HTMLDocument again, this time without UIActivate */
|
||||||
|
call_UIActivate = FALSE;
|
||||||
|
test_Activate(unk, CLIENTSITE_SETNULL);
|
||||||
|
test_Window(unk, TRUE);
|
||||||
|
test_UIDeactivate();
|
||||||
|
test_InPlaceDeactivate(unk, TRUE);
|
||||||
|
test_CloseView();
|
||||||
|
test_CloseView();
|
||||||
|
test_Close(unk, TRUE);
|
||||||
|
|
||||||
if(view)
|
if(view)
|
||||||
IOleDocumentView_Release(view);
|
IOleDocumentView_Release(view);
|
||||||
if(activeobject)
|
view = NULL;
|
||||||
IOleInPlaceActiveObject_Release(activeobject);
|
|
||||||
|
|
||||||
ok(IsWindow(hwnd), "hwnd is destroyed\n");
|
ok(IsWindow(hwnd), "hwnd is destroyed\n");
|
||||||
|
|
||||||
ref = IUnknown_Release(htmldoc_unk);
|
ref = IUnknown_Release(unk);
|
||||||
ok(ref == 0, "ref=%ld, expected 0\n", ref);
|
ok(ref == 0, "ref=%ld, expected 0\n", ref);
|
||||||
|
|
||||||
ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
|
ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
|
||||||
|
|
||||||
DestroyWindow(container_hwnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(htmldoc)
|
START_TEST(htmldoc)
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
|
container_hwnd = create_container_window();
|
||||||
|
|
||||||
test_HTMLDocument();
|
test_HTMLDocument();
|
||||||
|
|
||||||
|
DestroyWindow(container_hwnd);
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue