Commit 613a6598 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32/tests: Some tests for IsMatchingType().

parent 8c826a3c
......@@ -517,12 +517,7 @@ static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInf
TRACE( "(%p)->(%p)\n", This, info2 );
IRecordInfo_GetGuid( info2, &guid2 );
if (IsEqualGUID( &This->guid, &guid2 )) return TRUE;
FIXME( "records have different guids (%s %s) but could still match\n",
debugstr_guid( &This->guid ), debugstr_guid( &guid2 ) );
return FALSE;
return IsEqualGUID( &This->guid, &guid2 );
}
static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
......
......@@ -142,4 +142,12 @@ library register_test
[propputref, id(2)]
LONG testprop2([in] IUnknown *i);
}
/* uuid is same as for test_struct2 in test_tlb.idl, fields are different */
[uuid(4029f190-ca4a-4611-aeb9-673983cb96de)]
struct test_struct3
{
UINT32 field;
HRESULT hr;
};
}
......@@ -48,4 +48,14 @@ library Test
IDispatch *disp;
BSTR bstr;
};
/* identical to 'test_struct', only guid is different */
[uuid(4029f190-ca4a-4611-aeb9-673983cb96de)]
struct test_struct2
{
HRESULT hr;
VARIANT_BOOL b;
IDispatch *disp;
BSTR bstr;
};
}
......@@ -4002,6 +4002,11 @@ static const type_info info[] = {
"test_struct",
"{4029f190-ca4a-4611-aeb9-673983cb96dd}",
/* kind */ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct)
},
{
"test_struct2",
"{4029f190-ca4a-4611-aeb9-673983cb96de}",
/* kind */ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct)
}
};
......@@ -4210,7 +4215,7 @@ static void test_register_typelib(BOOL system_registration)
{
TYPEKIND kind;
WORD flags;
} attrs[12] =
} attrs[13] =
{
{ TKIND_INTERFACE, 0 },
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
......@@ -4223,7 +4228,8 @@ static void test_register_typelib(BOOL system_registration)
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE }
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
{ TKIND_RECORD, 0 }
};
trace("Starting %s typelib registration tests\n",
......@@ -4258,7 +4264,7 @@ static void test_register_typelib(BOOL system_registration)
ok(hr == S_OK, "got %08x\n", hr);
count = ITypeLib_GetTypeInfoCount(typelib);
ok(count == 12, "got %d\n", count);
ok(count == 13, "got %d\n", count);
for(i = 0; i < count; i++)
{
......
......@@ -6382,24 +6382,32 @@ static void test_recinfo(void)
{
static const WCHAR testW[] = {'t','e','s','t',0};
static WCHAR teststructW[] = {'t','e','s','t','_','s','t','r','u','c','t',0};
static WCHAR teststruct2W[] = {'t','e','s','t','_','s','t','r','u','c','t','2',0};
static WCHAR teststruct3W[] = {'t','e','s','t','_','s','t','r','u','c','t','3',0};
WCHAR filenameW[MAX_PATH], filename2W[MAX_PATH];
ITypeInfo *typeinfo, *typeinfo2, *typeinfo3;
IRecordInfo *recinfo, *recinfo2, *recinfo3;
struct test_struct teststruct, testcopy;
WCHAR filenameW[MAX_PATH];
ITypeLib *typelib, *typelib2;
const char *filename;
IRecordInfo *recinfo;
ITypeInfo *typeinfo;
DummyDispatch dispatch;
ITypeLib *typelib;
TYPEATTR *attr;
MEMBERID memid;
UINT16 found;
HRESULT hr;
ULONG size;
BOOL ret;
filename = create_test_typelib(2);
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, MAX_PATH);
hr = LoadTypeLibEx(filenameW, REGKIND_NONE, &typelib);
ok(hr == S_OK, "got 0x%08x\n", hr);
filename = create_test_typelib(3);
MultiByteToWideChar(CP_ACP, 0, filename, -1, filename2W, MAX_PATH);
hr = LoadTypeLibEx(filename2W, REGKIND_NONE, &typelib2);
ok(hr == S_OK, "got 0x%08x\n", hr);
typeinfo = NULL;
found = 1;
hr = ITypeLib_FindName(typelib, teststructW, 0, &typeinfo, &memid, &found);
......@@ -6410,9 +6418,40 @@ static void test_recinfo(void)
ok(IsEqualGUID(&attr->guid, &UUID_test_struct), "got %s\n", wine_dbgstr_guid(&attr->guid));
ok(attr->typekind == TKIND_RECORD, "got %d\n", attr->typekind);
typeinfo2 = NULL;
found = 1;
hr = ITypeLib_FindName(typelib, teststruct2W, 0, &typeinfo2, &memid, &found);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(typeinfo2 != NULL, "got %p\n", typeinfo2);
typeinfo3 = NULL;
found = 1;
hr = ITypeLib_FindName(typelib2, teststruct3W, 0, &typeinfo3, &memid, &found);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(typeinfo3 != NULL, "got %p\n", typeinfo3);
hr = GetRecordInfoFromTypeInfo(typeinfo, &recinfo);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetRecordInfoFromTypeInfo(typeinfo2, &recinfo2);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetRecordInfoFromTypeInfo(typeinfo3, &recinfo3);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* IsMatchingType, these two records only differ in GUIDs */
ret = IRecordInfo_IsMatchingType(recinfo, recinfo2);
ok(!ret, "got %d\n", ret);
/* these two have same GUIDs, but different set of fields */
ret = IRecordInfo_IsMatchingType(recinfo2, recinfo3);
ok(ret, "got %d\n", ret);
IRecordInfo_Release(recinfo3);
ITypeInfo_Release(typeinfo3);
IRecordInfo_Release(recinfo2);
ITypeInfo_Release(typeinfo2);
size = 0;
hr = IRecordInfo_GetSize(recinfo, &size);
ok(hr == S_OK, "got 0x%08x\n", hr);
......@@ -6471,7 +6510,8 @@ static void test_recinfo(void)
ITypeInfo_Release(typeinfo);
ITypeLib_Release(typelib);
DeleteFileA(filename);
DeleteFileW(filenameW);
DeleteFileW(filename2W);
}
START_TEST(vartype)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment