From 04a76cf561fcd231d04cdd271e251a7a8741a444 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 17 May 2007 11:47:16 +0100 Subject: [PATCH] oleaut32: Tests for more 'syntax 2' dispinterfaces. --- dlls/oleaut32/tests/tmarshal.idl | 39 ++++++++++++++++++ dlls/oleaut32/tests/typelib.c | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index 24cc83b5a6b..2d1a9bc5560 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -228,4 +228,43 @@ library TestTypelib { [id(0x1236)] HRESULT fn6([in] int a); } + + [ + odl, + uuid(bdfa260b-ef40-43d3-b071-cddec919f132) + ] + interface ItestIF8 + { + HRESULT fn1([in] int x); + HRESULT fn2([out,retval] int *x); + } + + [ + odl, + uuid(51033a23-dc37-4f19-aa34-4d8a670458a0) + + ] + interface ItestIF9 : ItestIF8 + { + HRESULT fn3([in] int y); + } + + [ + odl, + uuid(2e8f14fe-0bce-42f0-8b7d-3af8393c7967) + ] + dispinterface ItestIF10 + { + interface ItestIF9; + } + + [ + odl, + uuid(7d9e9371-482e-4944-9b19-511fc705236f) + ] + dispinterface ItestIF11 + { + interface ItestIF7; + } + }; diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 49c1261a73f..cb85f3c1042 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -720,6 +720,76 @@ if(use_midl_tlb) { ITypeInfo_ReleaseFuncDesc(pTI, pFD); ITypeInfo_Release(pTI); + /* ItestIF10 is a syntax 2 dispinterface which doesn't derive from IUnknown */ + hr = ITypeLib_GetTypeInfoOfGuid(pTL, &DIID_ItestIF10, &pTI); + ok(hr == S_OK, "hr %08x\n", hr); + + hr = ITypeInfo_GetTypeAttr(pTI, &pTA); + ok(hr == S_OK, "hr %08x\n", hr); + ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind); + ok(pTA->cbSizeVft == 28, "sizevft %d\n", pTA->cbSizeVft); + ok(pTA->wTypeFlags == TYPEFLAG_FDISPATCHABLE, "typeflags %x\n", pTA->wTypeFlags); +if(use_midl_tlb) { + ok(pTA->cFuncs == 3, "cfuncs %d\n", pTA->cFuncs); + ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes); + ITypeInfo_ReleaseTypeAttr(pTI, pTA); + + hr = ITypeInfo_GetRefTypeOfImplType(pTI, -1, &href); + ok(hr == TYPE_E_ELEMENTNOTFOUND, "hr %08x\n", hr); + hr = ITypeInfo_GetRefTypeOfImplType(pTI, 0, &href); + ok(hr == S_OK, "hr %08x\n", hr); + hr = ITypeInfo_GetRefTypeInfo(pTI, href, &pTI_p); + ok(hr == S_OK, "hr %08x\n", hr); + hr = ITypeInfo_GetTypeAttr(pTI_p, &pTA); + ok(IsEqualGUID(&pTA->guid, &IID_IDispatch), "guid {%08x-....\n", pTA->guid.Data1); + ITypeInfo_ReleaseTypeAttr(pTI_p, pTA); + ITypeInfo_Release(pTI_p); + + /* Should have three methods */ + hr = ITypeInfo_GetFuncDesc(pTI, 3, &pFD); + ok(hr == TYPE_E_ELEMENTNOTFOUND, "hr %08x\n", hr); + hr = ITypeInfo_GetFuncDesc(pTI, 2, &pFD); + ok(hr == S_OK, "hr %08x\n", hr); + ok(pFD->memid == 0x60010000, "memid %08x\n", pFD->memid); + ok(pFD->oVft == 8, "oVft %d\n", pFD->oVft); + ITypeInfo_ReleaseFuncDesc(pTI, pFD); +} + ITypeInfo_Release(pTI); + + /* ItestIF11 is a syntax 2 dispinterface which derives from IDispatch */ + hr = ITypeLib_GetTypeInfoOfGuid(pTL, &DIID_ItestIF11, &pTI); + ok(hr == S_OK, "hr %08x\n", hr); + + hr = ITypeInfo_GetTypeAttr(pTI, &pTA); + ok(hr == S_OK, "hr %08x\n", hr); + ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind); + ok(pTA->cbSizeVft == 28, "sizevft %d\n", pTA->cbSizeVft); + ok(pTA->wTypeFlags == TYPEFLAG_FDISPATCHABLE, "typeflags %x\n", pTA->wTypeFlags); +if(use_midl_tlb) { + ok(pTA->cFuncs == 10, "cfuncs %d\n", pTA->cFuncs); + ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes); + ITypeInfo_ReleaseTypeAttr(pTI, pTA); + + hr = ITypeInfo_GetRefTypeOfImplType(pTI, 0, &href); + ok(hr == S_OK, "hr %08x\n", hr); + hr = ITypeInfo_GetRefTypeInfo(pTI, href, &pTI_p); + ok(hr == S_OK, "hr %08x\n", hr); + hr = ITypeInfo_GetTypeAttr(pTI_p, &pTA); + ok(IsEqualGUID(&pTA->guid, &IID_IDispatch), "guid {%08x-....\n", pTA->guid.Data1); + ITypeInfo_ReleaseTypeAttr(pTI_p, pTA); + ITypeInfo_Release(pTI_p); + + /* Should have ten methods */ + hr = ITypeInfo_GetFuncDesc(pTI, 10, &pFD); + ok(hr == TYPE_E_ELEMENTNOTFOUND, "hr %08x\n", hr); + hr = ITypeInfo_GetFuncDesc(pTI, 9, &pFD); + ok(hr == S_OK, "hr %08x\n", hr); + ok(pFD->memid == 0x1236, "memid %08x\n", pFD->memid); + ok(pFD->oVft == 36, "oVft %d\n", pFD->oVft); + ITypeInfo_ReleaseFuncDesc(pTI, pFD); +} + ITypeInfo_Release(pTI); + ITypeLib_Release(pTL); return;