Commit 16000c61 authored by Guillaume Charifi's avatar Guillaume Charifi Committed by Alexandre Julliard

oleaut32/tests: Add test for TLB dependencies lookup in resources.

parent be415f3c
...@@ -5509,6 +5509,101 @@ static void test_stub(void) ...@@ -5509,6 +5509,101 @@ static void test_stub(void)
CoUninitialize(); CoUninitialize();
} }
static void test_dep(void) {
HRESULT hr;
const char *refFilename;
WCHAR refFilenameW[MAX_PATH];
ITypeLib *preftLib;
ITypeInfo *preftInfo;
char filename[MAX_PATH];
WCHAR filenameW[MAX_PATH];
ICreateTypeLib2 *pctLib;
ICreateTypeInfo *pctInfo;
ITypeLib *ptLib;
ITypeInfo *ptInfo;
ITypeInfo *ptInfoExt = NULL;
HREFTYPE refType;
static WCHAR ifacenameW[] = {'I','T','e','s','t','D','e','p',0};
static const GUID libguid = {0xe0228f26,0x2946,0x478c,{0xb6,0x4a,0x93,0xfe,0xef,0xa5,0x05,0x32}};
static const GUID ifaceguid = {0x394376dd,0x3bb8,0x4804,{0x8c,0xcc,0x95,0x59,0x43,0x40,0x04,0xf3}};
trace("Starting typelib dependency tests\n");
refFilename = create_test_typelib(2);
MultiByteToWideChar(CP_ACP, 0, refFilename, -1, refFilenameW, MAX_PATH);
hr = LoadTypeLibEx(refFilenameW, REGKIND_NONE, &preftLib);
ok(hr == S_OK, "got %08x\n", hr);
hr = ITypeLib_GetTypeInfoOfGuid(preftLib, &IID_ISimpleIface, &preftInfo);
ok(hr == S_OK, "got %08x\n", hr);
GetTempFileNameA(".", "tlb", 0, filename);
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, MAX_PATH);
if(sizeof(void*) == 8) {
hr = CreateTypeLib2(SYS_WIN64, filenameW, &pctLib);
ok(hr == S_OK, "got %08x\n", hr);
} else {
hr = CreateTypeLib2(SYS_WIN32, filenameW, &pctLib);
ok(hr == S_OK, "got %08x\n", hr);
}
hr = ICreateTypeLib2_SetGuid(pctLib, &libguid);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeLib2_SetLcid(pctLib, LOCALE_NEUTRAL);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeLib2_CreateTypeInfo(pctLib, ifacenameW, TKIND_INTERFACE, &pctInfo);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_SetGuid(pctInfo, &ifaceguid);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_SetTypeFlags(pctInfo, TYPEFLAG_FOLEAUTOMATION);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_AddRefTypeInfo(pctInfo, preftInfo, &refType);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_AddImplType(pctInfo, 0, refType);
ok(hr == S_OK, "got %08x\n", hr);
ICreateTypeInfo_Release(pctInfo);
hr = ICreateTypeLib2_SaveAllChanges(pctLib);
ok(hr == S_OK, "got %08x\n", hr);
ICreateTypeLib2_Release(pctLib);
ITypeInfo_Release(preftInfo);
ITypeLib_Release(preftLib);
DeleteFileW(refFilenameW);
hr = LoadTypeLibEx(filenameW, REGKIND_NONE, &ptLib);
ok(hr == S_OK, "got: %x\n", hr);
hr = ITypeLib_GetTypeInfoOfGuid(ptLib, &ifaceguid, &ptInfo);
ok(hr == S_OK, "got: %x\n", hr);
hr = ITypeInfo_GetRefTypeOfImplType(ptInfo, 0, &refType);
ok(hr == S_OK, "got: %x\n", hr);
hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt);
todo_wine ok(hr == S_OK || broken(hr == TYPE_E_CANTLOADLIBRARY) /* win 2000 */, "got: %x\n", hr);
ITypeInfo_Release(ptInfo);
if(ptInfoExt)
ITypeInfo_Release(ptInfoExt);
ITypeLib_Release(ptLib);
DeleteFileW(filenameW);
}
START_TEST(typelib) START_TEST(typelib)
{ {
const char *filename; const char *filename;
...@@ -5548,4 +5643,5 @@ START_TEST(typelib) ...@@ -5548,4 +5643,5 @@ START_TEST(typelib)
test_LoadRegTypeLib(); test_LoadRegTypeLib();
test_GetLibAttr(); test_GetLibAttr();
test_stub(); test_stub();
test_dep();
} }
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