Module: wine Branch: master Commit: c76de89885c4c8cd97204d5e09b22ca0e3588b02 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c76de89885c4c8cd97204d5e09...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Apr 25 12:09:03 2008 +0200
oleaut32/tests: Store the test typelib in resources instead of depending on an external file.
---
dlls/oleaut32/tests/tmarshal.rc | 3 +++ dlls/oleaut32/tests/typelib.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.rc b/dlls/oleaut32/tests/tmarshal.rc index 30c2a9b..707895f 100644 --- a/dlls/oleaut32/tests/tmarshal.rc +++ b/dlls/oleaut32/tests/tmarshal.rc @@ -29,3 +29,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: tmarshal.tlb */ 1 TYPELIB LOADONCALL DISCARDABLE tmarshal.tlb + +/* @makedep: test_tlb.tlb */ +2 TYPELIB LOADONCALL DISCARDABLE test_tlb.tlb diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index a30b275..74a7812 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -1337,13 +1337,41 @@ static void test_dump_typelib(const char *name)
#endif
+static const char *create_test_typelib(void) +{ + static char filename[MAX_PATH]; + HANDLE file; + HRSRC res; + void *ptr; + DWORD written; + + GetTempFileNameA( ".", "tlb", 0, filename ); + file = CreateFile( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); + ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" ); + if (file == INVALID_HANDLE_VALUE) return NULL; + res = FindResource( GetModuleHandle(0), MAKEINTRESOURCE(2), "TYPELIB" ); + ok( res != 0, "couldn't find resource\n" ); + ptr = LockResource( LoadResource( GetModuleHandle(0), res )); + WriteFile( file, ptr, SizeofResource( GetModuleHandle(0), res ), &written, NULL ); + ok( written == SizeofResource( GetModuleHandle(0), res ), "couldn't write resource\n" ); + CloseHandle( file ); + return filename; +} + START_TEST(typelib) { + const char *filename; + ref_count_test(wszStdOle2); test_TypeComp(); test_CreateDispTypeInfo(); test_TypeInfo(); test_QueryPathOfRegTypeLib(); test_inheritance(); - test_dump_typelib("test_tlb.tlb"); + + if ((filename = create_test_typelib())) + { + test_dump_typelib( filename ); + DeleteFile( filename ); + } }