From 4bc6b68bae3a11d9a77ac5511d3dd54aa2d9ff3b Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Thu, 7 Jun 2018 18:00:18 +0100 Subject: [PATCH] Also test that the resource has the expected contents --- .../meson.build | 15 +++++++----- .../verify.c | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 test cases/windows/16 resource scripts with duplicate filenames/verify.c diff --git a/test cases/windows/16 resource scripts with duplicate filenames/meson.build b/test cases/windows/16 resource scripts with duplicate filenames/meson.build index ec6d98d82..4073a8e7c 100644 --- a/test cases/windows/16 resource scripts with duplicate filenames/meson.build +++ b/test cases/windows/16 resource scripts with duplicate filenames/meson.build @@ -8,9 +8,12 @@ subdir('c') main = win.compile_resources('rsrc.rc') -# these make the resource compilation a dependency of something which is built -# by default -static_library('libmain', main) -static_library('liba', a) -static_library('libb', b) -static_library('libc', c) +testa = executable('testa', 'verify.c', a) +testb = executable('testb', 'verify.c', b) +testc = executable('testc', 'verify.c', c) +testmain = executable('testmain', 'verify.c', main) + +test('a', testa, args: 'a') +test('b', testb, args: 'b') +test('c', testc, args: 'c') +test('main', testmain, args: 'main') diff --git a/test cases/windows/16 resource scripts with duplicate filenames/verify.c b/test cases/windows/16 resource scripts with duplicate filenames/verify.c new file mode 100644 index 000000000..4d2ccf028 --- /dev/null +++ b/test cases/windows/16 resource scripts with duplicate filenames/verify.c @@ -0,0 +1,23 @@ +#include +#include + +int main(int arc, char *argv[]) +{ + // verify that the expected resource exists and has the expected contents + HRSRC hRsrc; + unsigned int size; + HGLOBAL hGlobal; + void* data; + + hRsrc = FindResource(NULL, argv[1], RT_RCDATA); + assert(hRsrc); + + size = SizeofResource(NULL, hRsrc); + hGlobal = LoadResource(NULL, hRsrc); + data = LockResource(hGlobal); + + assert(size == strlen(argv[1])); + assert(memcmp(data, argv[1], size) == 0); + + return 0; +}