Added tests.
[wine/wine64.git] / dlls / mshtml / tests / htmldoc.c
blob5addd58d4c405afbc346a011b5a390efb86ae066
1 /*
2 * Copyright 2005 Jacek Caban
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #define COBJMACROS
21 #include <wine/test.h>
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "ole2.h"
27 #include "mshtml.h"
29 static void test_Persist(IUnknown *punk)
31 IPersistMoniker *persist_mon;
32 IPersistFile *persist_file;
33 GUID guid;
34 HRESULT hres;
36 hres = IUnknown_QueryInterface(punk, &IID_IPersistFile, (void**)&persist_file);
37 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08lx\n", hres);
38 if(SUCCEEDED(hres)) {
39 hres = IPersist_GetClassID(persist_file, NULL);
40 ok(hres == E_INVALIDARG, "GetClassID returned: %08lx, expected E_INVALIDARG\n", hres);
42 hres = IPersist_GetClassID(persist_file, &guid);
43 ok(hres == S_OK, "GetClassID failed: %08lx\n", hres);
44 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
46 IPersist_Release(persist_file);
49 hres = IUnknown_QueryInterface(punk, &IID_IPersistMoniker, (void**)&persist_mon);
50 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08lx\n", hres);
51 if(SUCCEEDED(hres)) {
52 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
53 ok(hres == E_INVALIDARG, "GetClassID returned: %08lx, expected E_INVALIDARG\n", hres);
55 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
56 ok(hres == S_OK, "GetClassID failed: %08lx\n", hres);
57 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
59 IPersistMoniker_Release(persist_mon);
63 static void test_OleObj(IUnknown *punk)
65 IOleObject *oleobj;
66 HRESULT hres;
67 GUID guid;
69 hres = IUnknown_QueryInterface(punk, &IID_IOleObject, (void**)&oleobj);
70 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08lx\n", hres);
71 if(SUCCEEDED(hres)) {
72 hres = IOleObject_GetUserClassID(oleobj, NULL);
73 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08lx, expected E_INVALIDARG\n", hres);
75 hres = IOleObject_GetUserClassID(oleobj, &guid);
76 ok(hres == S_OK, "GetUserClassID failed: %08lx\n", hres);
77 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
79 IOleObject_Release(oleobj);
83 static void test_HTMLDocument()
85 IUnknown *htmldoc_unk = NULL;
86 HRESULT hres;
88 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
89 &IID_IUnknown, (void**)&htmldoc_unk);
90 ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
91 if(FAILED(hres))
92 return;
94 test_Persist(htmldoc_unk);
95 test_OleObj(htmldoc_unk);
97 IUnknown_Release(htmldoc_unk);
100 START_TEST(htmldoc)
102 CoInitialize(NULL);
104 test_HTMLDocument();
106 CoUninitialize();