From e1760f84229abf107afa5414bb20251e01127951 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 6 Oct 2015 15:55:03 +0800 Subject: [PATCH] oleaut32/tests: Add more tests for typelib data. Signed-off-by: Dmitry Timoshkov --- dlls/oleaut32/tests/test_tlb.idl | 15 +++++ dlls/oleaut32/tests/typelib.c | 111 +++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) diff --git a/dlls/oleaut32/tests/test_tlb.idl b/dlls/oleaut32/tests/test_tlb.idl index fa084ec46f6..8275c37dbbd 100644 --- a/dlls/oleaut32/tests/test_tlb.idl +++ b/dlls/oleaut32/tests/test_tlb.idl @@ -58,4 +58,19 @@ library Test IDispatch *disp; BSTR bstr; }; + + typedef [public] enum _a { a1, a2 } a; + typedef [public] enum aa { aa1, aa2 } aa; + typedef enum _b { b1, b2 } b; + typedef enum bb { bb1, bb2 } bb; + typedef [uuid(016fe2ec-b2c8-45f8-b23b-39e53a75396b)] enum _c { c1, c2 } c; + typedef [uuid(016fe2ec-b2c8-45f8-b23b-39e53a75396c)] enum cc { cc1, cc2 } cc; + + [uuid(ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a)] + interface ITestIface : IDispatch + { + HRESULT test1(a value); + HRESULT test2(b value); + HRESULT test3(c value); + } } diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index a9ef5fb06e6..1d13b898ac5 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -4252,6 +4252,104 @@ static const type_info info[] = { "{4029f190-ca4a-4611-aeb9-673983cb96de}", /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct2), /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "a", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "_a", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "aa", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "_b", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "bb", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "c", + "{016fe2ec-b2c8-45f8-b23b-39e53a75396b}", + /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "_c", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "cc", + "{00000000-0000-0000-0000-000000000000}", + /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4, + /*#vtbl*/ 0, /*#func*/ 0 +}, +{ + "ITestIface", + "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a}", + /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ 4, /*size*/ sizeof(ITestIface*), + /*#vtbl*/ 10, /*#func*/ 3, + { + { + /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL, + /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0, + {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */ + { /* params */ + {VT_USERDEFINED, TKIND_ALIAS, PARAMFLAG_NONE}, + {-1, 0, 0} + }, + { /* names */ + "test1", + "value", + NULL, + }, + }, + { + /*id*/ 0x60020001, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL, + /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0, + {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */ + { /* params */ + {VT_USERDEFINED, TKIND_ENUM, PARAMFLAG_NONE}, + {-1, 0, 0} + }, + { /* names */ + "test2", + "value", + NULL, + }, + }, + { + /*id*/ 0x60020002, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL, + /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0, + {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */ + { /* params */ + {VT_USERDEFINED, TKIND_ALIAS, PARAMFLAG_NONE}, + {-1, 0, 0} + }, + { /* names */ + "test3", + "value", + NULL, + }, + }, + } } }; @@ -4286,8 +4384,21 @@ static void test_dump_typelib(const char *name) ole_check(ITypeInfo_GetTypeAttr(typeinfo, &typeattr)); expect_int(typeattr->typekind, ti->type); expect_hex(typeattr->wTypeFlags, ti->wTypeFlags); + /* FIXME: remove once widl is fixed */ + if (typeattr->typekind == TKIND_ALIAS) + { +todo_wine /* widl generates broken typelib and typeattr just reflects that */ + ok(typeattr->cbAlignment == ti->cbAlignment || broken(typeattr->cbAlignment == 1), + "expected %d, got %d\n", ti->cbAlignment, typeattr->cbAlignment); +todo_wine /* widl generates broken typelib and typeattr just reflects that */ + ok(typeattr->cbSizeInstance == ti->cbSizeInstance || broken(typeattr->cbSizeInstance == 0), + "expected %d, got %d\n", ti->cbSizeInstance, typeattr->cbSizeInstance); + } + else + { expect_int(typeattr->cbAlignment, ti->cbAlignment); expect_int(typeattr->cbSizeInstance, ti->cbSizeInstance); + } expect_int(typeattr->cbSizeVft, ti->cbSizeVft * sizeof(void*)); expect_int(typeattr->cFuncs, ti->cFuncs);