Also test that the resource has the expected contents

pull/3715/head
Jon Turney 7 years ago
parent 80ce5e0817
commit 4bc6b68bae
  1. 15
      test cases/windows/16 resource scripts with duplicate filenames/meson.build
  2. 23
      test cases/windows/16 resource scripts with duplicate filenames/verify.c

@ -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')

@ -0,0 +1,23 @@
#include <assert.h>
#include <windows.h>
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;
}
Loading…
Cancel
Save