Gabriel Ivăncescu : vbscript/tests: Add tests for the script TypeInfo's TypeComp binds.

Alexandre Julliard julliard at winehq.org
Mon Dec 9 16:57:39 CST 2019


Module: wine
Branch: master
Commit: d393681e41b59b475d1e91e6f7da7c8243105037
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d393681e41b59b475d1e91e6f7da7c8243105037

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Mon Dec  9 17:29:26 2019 +0200

vbscript/tests: Add tests for the script TypeInfo's TypeComp binds.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/tests/vbscript.c | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c
index 1d246c50b4..ad3ccf37a0 100644
--- a/dlls/vbscript/tests/vbscript.c
+++ b/dlls/vbscript/tests/vbscript.c
@@ -1077,6 +1077,65 @@ static void test_script_typeinfo(void)
     ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
     hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, NULL);
     ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
+
+    hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, &bindptr);
+    ok(hr == S_OK, "Bind failed: %08x\n", hr);
+    ok(desckind == DESCKIND_NONE, "Unexpected desckind %u\n", desckind);
+    wcscpy(str, L"GLOBAL_VAR");
+    hr = ITypeComp_Bind(typecomp, str, 0, INVOKE_FUNC, &typeinfo2, &desckind, &bindptr);
+    ok(hr == TYPE_E_TYPEMISMATCH, "Bind returned: %08x\n", hr);
+    ok(!lstrcmpW(str, L"GLOBAL_VAR"), "Unexpected string %s\n", wine_dbgstr_w(str));
+    wcscpy(str, L"C");
+    hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, &bindptr);
+    ok(hr == S_OK, "Bind failed: %08x\n", hr);
+    ok(desckind == DESCKIND_NONE, "Unexpected desckind %u\n", desckind);
+    wcscpy(str, L"addRef");
+    hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, &bindptr);
+    ok(hr == S_OK, "Bind failed: %08x\n", hr);
+    ok(desckind == DESCKIND_FUNCDESC, "Unexpected desckind %u\n", desckind);
+    ok(!lstrcmpW(str, L"addRef"), "Unexpected string %s\n", wine_dbgstr_w(str));
+    ITypeInfo_ReleaseFuncDesc(typeinfo2, bindptr.lpfuncdesc);
+    ITypeInfo_Release(typeinfo2);
+    for (i = 0; i < ARRAY_SIZE(var); i++)
+    {
+        wcscpy(str, var[i].name);
+        hr = ITypeComp_Bind(typecomp, str, 0, INVOKE_PROPERTYGET, &typeinfo2, &desckind, &bindptr);
+        ok(hr == S_OK, "Bind failed: %08x\n", hr);
+        ok(desckind == DESCKIND_VARDESC, "Unexpected desckind %u\n", desckind);
+        ITypeInfo_ReleaseVarDesc(typeinfo2, bindptr.lpvardesc);
+        ITypeInfo_Release(typeinfo2);
+    }
+    for (i = 0; i < ARRAY_SIZE(func); i++)
+    {
+        wcscpy(str, func[i].name);
+        hr = ITypeComp_Bind(typecomp, str, 0, INVOKE_FUNC, &typeinfo2, &desckind, &bindptr);
+        ok(hr == S_OK, "Bind failed: %08x\n", hr);
+        ok(desckind == DESCKIND_FUNCDESC, "Unexpected desckind %u\n", desckind);
+        ITypeInfo_ReleaseFuncDesc(typeinfo2, bindptr.lpfuncdesc);
+        ITypeInfo_Release(typeinfo2);
+    }
+    wcscpy(str, L"VBScriptTypeInfo");
+    hr = ITypeComp_BindType(typecomp, NULL, 0, &typeinfo2, &typecomp2);
+    ok(hr == E_INVALIDARG, "BindType returned: %08x\n", hr);
+    hr = ITypeComp_BindType(typecomp, str, 0, NULL, &typecomp2);
+    ok(hr == E_INVALIDARG, "BindType returned: %08x\n", hr);
+    hr = ITypeComp_BindType(typecomp, str, 0, &typeinfo2, NULL);
+    ok(hr == E_INVALIDARG, "BindType returned: %08x\n", hr);
+    hr = ITypeComp_BindType(typecomp, str, 0, &typeinfo2, &typecomp2);
+    ok(hr == S_OK, "BindType failed: %08x\n", hr);
+    ok(!typeinfo2, "Unexpected TypeInfo %p (expected null)\n", typeinfo2);
+    ok(!typecomp2, "Unexpected TypeComp %p (expected null)\n", typecomp2);
+    wcscpy(str, L"C");
+    hr = ITypeComp_BindType(typecomp, str, 0, &typeinfo2, &typecomp2);
+    ok(hr == S_OK, "BindType failed: %08x\n", hr);
+    ok(!typeinfo2, "Unexpected TypeInfo %p (expected null)\n", typeinfo2);
+    ok(!typecomp2, "Unexpected TypeComp %p (expected null)\n", typecomp2);
+    wcscpy(str, L"IDispatch");
+    hr = ITypeComp_BindType(typecomp, str, 0, &typeinfo2, &typecomp2);
+    ok(hr == S_OK, "BindType failed: %08x\n", hr);
+    ok(!typeinfo2, "Unexpected TypeInfo %p (expected null)\n", typeinfo2);
+    ok(!typecomp2, "Unexpected TypeComp %p (expected null)\n", typecomp2);
+
     ITypeComp_Release(typecomp);
 
     /* Updating the script won't update the typeinfo obtained before,




More information about the wine-cvs mailing list