MSHTML: added tests

cjacek cjacek at gmail.com
Sat Jun 25 14:54:00 CDT 2005


It's a very simple test. I'll clean up my tests
and integrate them with Wine tests later.

Changelog:
    Added tests
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.366
diff -u -p -r1.366 configure.ac
--- configure.ac	20 Jun 2005 15:52:16 -0000	1.366
+++ configure.ac	25 Jun 2005 19:47:25 -0000
@@ -1629,6 +1629,7 @@ dlls/mscms/Makefile
 dlls/mscms/tests/Makefile
 dlls/msdmo/Makefile
 dlls/mshtml/Makefile
+dlls/mshtml/tests/Makefile
 dlls/msi/Makefile
 dlls/msi/tests/Makefile
 dlls/msimg32/Makefile
Index: dlls/mshtml/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/Makefile.in,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.in
--- dlls/mshtml/Makefile.in	25 Jun 2005 17:58:35 -0000	1.12
+++ dlls/mshtml/Makefile.in	25 Jun 2005 19:47:25 -0000
@@ -17,6 +17,8 @@ C_SRCS = \
 
 RC_SRCS = rsrc.rc
 
+SUBDIRS = tests
+
 @MAKE_DLL_RULES@
 
 rsrc.res: mshtml.inf
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/mshtml/tests/Makefile.in	2005-06-25 21:18:38.000000000 +0200
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = mshtml.dll
+IMPORTS   = ole32
+EXTRALIBS = -luuid
+
+CTESTS = \
+	htmldoc.c
+
+ at MAKE_TEST_RULES@
+
+### Dependencies:
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/mshtml/tests/htmldoc.c	2005-06-25 21:39:26.000000000 +0200
@@ -0,0 +1,107 @@
+/*
+ * 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();
+}


More information about the wine-patches mailing list