Reintegrated the Windows control tests. We may be close to getting rid of zNEW_test!

This commit is contained in:
Pietro Gagliardi 2020-05-11 22:30:30 -04:00
parent 22bcf088e9
commit e73c3363ec
5 changed files with 30 additions and 29 deletions

25
test/controls_windows.c Normal file
View File

@ -0,0 +1,25 @@
// 10 june 2019
#include "test_windows.h"
static const uiControlOSVtable osVtable = {
.Size = sizeof (uiControlOSVtable),
};
const uiControlOSVtable *testOSVtable(void)
{
return &osVtable;
}
Test(WrongControlOSVtableSizeIsProgrammerError)
{
uiControlVtable vtable;
uiControlOSVtable osvt;
void *ctx;
testControlLoadNopVtable(&vtable);
ctx = beginCheckProgrammerError("uiRegisterControlType(): wrong size 1 for uiControlOSVtable");
memset(&osvt, 0, sizeof (uiControlOSVtable));
osvt.Size = 1;
uiRegisterControlType("name", &vtable, &osvt, 0);
endCheckProgrammerError(ctx);
}

View File

@ -9,7 +9,11 @@ libui_test_sources = files([
libui_allcalls_headers = files([
'allcalls.h',
])
if libui_OS == 'darwin'
if libui_OS == 'windows'
libui_test_sources += files([
'controls_windows.c',
])
elif libui_OS == 'darwin'
libui_test_sources += files([
'controls_darwin.m',
])

View File

@ -1,11 +0,0 @@
// 10 june 2019
#include "test_windows.h"
static const uiControlOSVtable vtable = {
.Size = sizeof (uiControlOSVtable),
};
const uiControlOSVtable *testOSVtable(void)
{
return &vtable;
}

View File

@ -1,17 +0,0 @@
// 16 june 2019
#include "test_windows.h"
const struct checkErrorCase controlOSVtableCases[] = {
{
"uiRegisterControlType() with OS vtable with wrong size",
[](void) {
uiControlOSVtable vtable;
memset(&vtable, 0, sizeof (uiControlOSVtable));
vtable.Size = 1;
uiRegisterControlType("name", testVtable(), &vtable, 0);
},
"uiRegisterControlType(): wrong size 1 for uiControlOSVtable",
},
{ NULL, NULL, NULL },
};