And with Unix.

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

25
test/controls_unix.c Normal file
View File

@ -0,0 +1,25 @@
// 10 june 2019
#include "test_unix.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

@ -17,6 +17,10 @@ elif libui_OS == 'darwin'
libui_test_sources += files([
'controls_darwin.m',
])
else
libui_test_sources += files([
'controls_unix.c',
])
endif
libui_test_sources_without_cases = [

View File

@ -1,11 +0,0 @@
// 10 june 2019
#include "test_unix.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_unix.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 },
};