2019-06-15 19:38:18 -05:00
|
|
|
// 11 june 2019
|
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
static const struct checkErrorCase cases[] = {
|
|
|
|
{
|
|
|
|
"uiRegisterControlType() with NULL name",
|
|
|
|
[](void) {
|
|
|
|
uiRegisterControlType(NULL, NULL, NULL, 0);
|
|
|
|
},
|
2019-06-15 20:38:21 -05:00
|
|
|
"uiRegisterControlType(): invalid null pointer for name",
|
2019-06-15 19:38:18 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"uiRegisterControlType() with NULL vtable",
|
|
|
|
[](void) {
|
|
|
|
uiRegisterControlType("name", NULL, NULL, 0);
|
|
|
|
},
|
|
|
|
"uiRegisterControlType(): invalid null pointer for uiControlVtable",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"uiRegisterControlType() with vtable with wrong size",
|
|
|
|
[](void) {
|
|
|
|
uiControlVtable vtable;
|
|
|
|
|
|
|
|
memset(&vtable, 0, sizeof (uiControlVtable));
|
|
|
|
vtable.Size = 1;
|
2019-06-15 19:48:20 -05:00
|
|
|
uiRegisterControlType("name", &vtable, NULL, 0);
|
2019-06-15 19:38:18 -05:00
|
|
|
},
|
|
|
|
"uiRegisterControlType(): wrong size 1 for uiControlVtable",
|
|
|
|
},
|
2019-06-15 22:38:17 -05:00
|
|
|
#define checkVtableMethod(name) \
|
|
|
|
{ \
|
|
|
|
"uiRegisterControlType() with NULL " #name " method", \
|
|
|
|
[](void) { \
|
|
|
|
uiControlVtable vtable; \
|
|
|
|
vtable = *testVtable(); \
|
|
|
|
vtable.name = NULL; \
|
|
|
|
uiRegisterControlType("name", &vtable, NULL, 0); \
|
|
|
|
}, \
|
|
|
|
"uiRegisterControlType(): required uiControlVtable method " #name "() missing for uiControl type name", \
|
|
|
|
}
|
|
|
|
checkVtableMethod(Init),
|
|
|
|
checkVtableMethod(Free),
|
2019-06-15 19:38:18 -05:00
|
|
|
{
|
|
|
|
"uiRegisterControlType() with NULL OS vtable",
|
|
|
|
[](void) {
|
2019-06-15 20:33:53 -05:00
|
|
|
uiRegisterControlType("name", testVtable(), NULL, 0);
|
2019-06-15 19:38:18 -05:00
|
|
|
},
|
|
|
|
"uiRegisterControlType(): invalid null pointer for uiControlOSVtable",
|
|
|
|
},
|
|
|
|
// OS vtable sizes are tested per-OS
|
|
|
|
{ NULL, NULL, NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
testingTest(ControlErrors)
|
|
|
|
{
|
|
|
|
checkProgrammerErrors(t, cases);
|
|
|
|
}
|