Jacek Caban : shdocvw: Added test of IProvideClassInfo.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 6 10:44:03 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 010f5729dd6bf8d13f8eb68a88a335b48f634cf9
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=010f5729dd6bf8d13f8eb68a88a335b48f634cf9

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul  6 12:29:14 2006 +0200

shdocvw: Added test of IProvideClassInfo.

---

 dlls/shdocvw/tests/.gitignore   |    1 
 dlls/shdocvw/tests/Makefile.in  |    3 +
 dlls/shdocvw/tests/webbrowser.c |   86 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+), 1 deletions(-)
 create mode 100644 dlls/shdocvw/tests/webbrowser.c

diff --git a/dlls/shdocvw/tests/.gitignore b/dlls/shdocvw/tests/.gitignore
index acc365b..0ee8f83 100644
--- a/dlls/shdocvw/tests/.gitignore
+++ b/dlls/shdocvw/tests/.gitignore
@@ -1,3 +1,4 @@
 Makefile
 shortcut.ok
 testlist.c
+webbrowser.ok
diff --git a/dlls/shdocvw/tests/Makefile.in b/dlls/shdocvw/tests/Makefile.in
index b31efb9..ac61218 100644
--- a/dlls/shdocvw/tests/Makefile.in
+++ b/dlls/shdocvw/tests/Makefile.in
@@ -7,7 +7,8 @@ IMPORTS   = shell32 ole32 advapi32 kerne
 EXTRALIBS = -luuid
 
 CTESTS = \
-	shortcut.c 
+	shortcut.c \
+	webbrowser.c
 
 @MAKE_TEST_RULES@
 
diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c
new file mode 100644
index 0000000..a895062
--- /dev/null
+++ b/dlls/shdocvw/tests/webbrowser.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include <wine/test.h>
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "exdisp.h"
+
+static void test_ClassInfo(IUnknown *unk)
+{
+    IProvideClassInfo2 *class_info;
+    GUID guid;
+    HRESULT hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IProvideClassInfo2, (void**)&class_info);
+    ok(hres == S_OK, "QueryInterface(IID_IProvideClassInfo)  failed: %08lx\n", hres);
+    if(FAILED(hres))
+        return;
+
+    hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid);
+    ok(hres == S_OK, "GetGUID failed: %08lx\n", hres);
+    ok(IsEqualGUID(&DIID_DWebBrowserEvents2, &guid), "wrong guid\n");
+
+    hres = IProvideClassInfo2_GetGUID(class_info, 0, &guid);
+    ok(hres == E_FAIL, "GetGUID failed: %08lx, expected E_FAIL\n", hres);
+    ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
+
+    hres = IProvideClassInfo2_GetGUID(class_info, 2, &guid);
+    ok(hres == E_FAIL, "GetGUID failed: %08lx, expected E_FAIL\n", hres);
+    ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
+
+    hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, NULL);
+    ok(hres == E_POINTER, "GetGUID failed: %08lx, expected E_POINTER\n", hres);
+
+    hres = IProvideClassInfo2_GetGUID(class_info, 0, NULL);
+    ok(hres == E_POINTER, "GetGUID failed: %08lx, expected E_POINTER\n", hres);
+
+    IProvideClassInfo2_Release(class_info);
+}
+
+static void test_WebBrowser(void)
+{
+    IUnknown *unk = NULL;
+    ULONG ref;
+    HRESULT hres;
+
+    hres = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
+            &IID_IUnknown, (void**)&unk);
+    ok(hres == S_OK, "CoCreateInterface failed: %08lx\n", hres);
+    if(FAILED(hres))
+        return;
+
+    test_ClassInfo(unk);
+
+    ref = IUnknown_Release(unk);
+    ok(ref == 0, "ref=%ld, expected 0\n", ref);
+}
+
+START_TEST(webbrowser)
+{
+    OleInitialize(NULL);
+
+    test_WebBrowser();
+
+    OleUninitialize();
+}




More information about the wine-cvs mailing list