108 lines
3.4 KiB
C
108 lines
3.4 KiB
C
|
/*
|
||
|
* Copyright 2005 Jacek Caban
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
*/
|
||
|
|
||
|
#define COBJMACROS
|
||
|
|
||
|
#include <wine/test.h>
|
||
|
#include <stdarg.h>
|
||
|
|
||
|
#include "windef.h"
|
||
|
#include "winbase.h"
|
||
|
#include "ole2.h"
|
||
|
#include "mshtml.h"
|
||
|
|
||
|
static void test_Persist(IUnknown *punk)
|
||
|
{
|
||
|
IPersistMoniker *persist_mon;
|
||
|
IPersistFile *persist_file;
|
||
|
GUID guid;
|
||
|
HRESULT hres;
|
||
|
|
||
|
hres = IUnknown_QueryInterface(punk, &IID_IPersistFile, (void**)&persist_file);
|
||
|
ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08lx\n", hres);
|
||
|
if(SUCCEEDED(hres)) {
|
||
|
hres = IPersist_GetClassID(persist_file, NULL);
|
||
|
ok(hres == E_INVALIDARG, "GetClassID returned: %08lx, expected E_INVALIDARG\n", hres);
|
||
|
|
||
|
hres = IPersist_GetClassID(persist_file, &guid);
|
||
|
ok(hres == S_OK, "GetClassID failed: %08lx\n", hres);
|
||
|
ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
|
||
|
|
||
|
IPersist_Release(persist_file);
|
||
|
}
|
||
|
|
||
|
hres = IUnknown_QueryInterface(punk, &IID_IPersistMoniker, (void**)&persist_mon);
|
||
|
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08lx\n", hres);
|
||
|
if(SUCCEEDED(hres)) {
|
||
|
hres = IPersistMoniker_GetClassID(persist_mon, NULL);
|
||
|
ok(hres == E_INVALIDARG, "GetClassID returned: %08lx, expected E_INVALIDARG\n", hres);
|
||
|
|
||
|
hres = IPersistMoniker_GetClassID(persist_mon, &guid);
|
||
|
ok(hres == S_OK, "GetClassID failed: %08lx\n", hres);
|
||
|
ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
|
||
|
|
||
|
IPersistMoniker_Release(persist_mon);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void test_OleObj(IUnknown *punk)
|
||
|
{
|
||
|
IOleObject *oleobj;
|
||
|
HRESULT hres;
|
||
|
GUID guid;
|
||
|
|
||
|
hres = IUnknown_QueryInterface(punk, &IID_IOleObject, (void**)&oleobj);
|
||
|
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08lx\n", hres);
|
||
|
if(SUCCEEDED(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");
|
||
|
|
||
|
IOleObject_Release(oleobj);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void test_HTMLDocument()
|
||
|
{
|
||
|
IUnknown *htmldoc_unk = NULL;
|
||
|
HRESULT hres;
|
||
|
|
||
|
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;
|
||
|
|
||
|
test_Persist(htmldoc_unk);
|
||
|
test_OleObj(htmldoc_unk);
|
||
|
|
||
|
IUnknown_Release(htmldoc_unk);
|
||
|
}
|
||
|
|
||
|
START_TEST(htmldoc)
|
||
|
{
|
||
|
CoInitialize(NULL);
|
||
|
|
||
|
test_HTMLDocument();
|
||
|
|
||
|
CoUninitialize();
|
||
|
}
|