Jacek Caban : oleaut32: Added more Invoke tests.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 12 12:15:21 CST 2016


Module: wine
Branch: master
Commit: 17baf1e769f2e777b68c978aacad7e7ba1ad5685
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=17baf1e769f2e777b68c978aacad7e7ba1ad5685

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jan 11 20:11:05 2016 +0100

oleaut32: Added more Invoke tests.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/tests/test_reg.idl |  2 ++
 dlls/oleaut32/tests/typelib.c    | 39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/tests/test_reg.idl b/dlls/oleaut32/tests/test_reg.idl
index efc7c89..179d8c5 100644
--- a/dlls/oleaut32/tests/test_reg.idl
+++ b/dlls/oleaut32/tests/test_reg.idl
@@ -141,6 +141,8 @@ library register_test
         LONG testprop([in] LONG *i);
         [propputref, id(2)]
         LONG testprop2([in] IUnknown *i);
+        [id(3)]
+        HRESULT testfunc([in] int i, [out, retval] int *p);
     }
 
     /* uuid is same as for test_struct2 in test_tlb.idl, fields are different */
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index adc98b5..fe80b70 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -37,6 +37,7 @@
 #include "ocidl.h"
 #include "shlwapi.h"
 #include "tmarshal.h"
+#include "olectl.h"
 
 #include "test_reg.h"
 #include "test_tlb.h"
@@ -156,6 +157,12 @@ static LONG WINAPI invoketest_putref_testprop2(IInvokeTest *iface, IUnknown *i)
     return 6;
 }
 
+static HRESULT WINAPI invoketest_testfunc(IInvokeTest *iface, int i, int *p)
+{
+    *p = i+1;
+    return S_OK;
+}
+
 static const IInvokeTestVtbl invoketestvtbl = {
     invoketest_QueryInterface,
     invoketest_AddRef,
@@ -166,7 +173,8 @@ static const IInvokeTestVtbl invoketestvtbl = {
     invoketest_Invoke,
     invoketest_get_test,
     invoketest_putref_testprop,
-    invoketest_putref_testprop2
+    invoketest_putref_testprop2,
+    invoketest_testfunc
 };
 
 static IInvokeTest invoketest = { &invoketestvtbl };
@@ -667,6 +675,33 @@ static void write_typelib(int res_no, const char *filename)
     CloseHandle( file );
 }
 
+static void test_invoke_func(ITypeInfo *typeinfo)
+{
+    DISPID named_args[3] = { DISPID_THIS };
+    VARIANT args[3], res;
+    DISPPARAMS dp = {args, named_args, 1, 0};
+    UINT i;
+    HRESULT hres;
+
+    V_VT(args) = VT_INT;
+    V_INT(args) = 3;
+    V_VT(&res) = VT_ERROR;
+    hres = ITypeInfo_Invoke(typeinfo, &invoketest, 3, DISPATCH_METHOD, &dp, &res, NULL, &i);
+    ok(hres == S_OK, "got 0x%08x\n", hres);
+    ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res));
+    ok(V_I4(&res) == 4, "got %d\n", V_I4(&res));
+
+    V_VT(args) = VT_DISPATCH;
+    V_DISPATCH(args) = (IDispatch*)&invoketest;
+    V_VT(args+1) = VT_INT;
+    V_INT(args+1) = 3;
+    V_VT(&res) = VT_ERROR;
+    dp.cNamedArgs = 1;
+    dp.cArgs = 2;
+    hres = ITypeInfo_Invoke(typeinfo, &invoketest, 3, DISPATCH_METHOD, &dp, &res, NULL, &i);
+    ok(hres == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hres);
+}
+
 static const char *create_test_typelib(int res_no)
 {
     static char filename[MAX_PATH];
@@ -959,6 +994,8 @@ static void test_TypeInfo(void)
     hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 2, DISPATCH_PROPERTYPUT, &dispparams, &res, NULL, &i);
     ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x, %d\n", hr, i);
 
+    test_invoke_func(pTypeInfo);
+
     ITypeInfo_Release(pTypeInfo);
     ITypeLib_Release(pTypeLib);
     DeleteFileA(filenameA);




More information about the wine-cvs mailing list