Started writing the uiControl error tests.

This commit is contained in:
Pietro Gagliardi 2019-06-11 12:01:35 -04:00
parent 6903bebe7d
commit 28a5cd543a
2 changed files with 22 additions and 4 deletions

View File

@ -24,17 +24,23 @@ static void testVtableTestMethod(uiControl *c, void *implData)
// do nothing
}
static void createTestVtables(uiControlVtable *vtable, uiControlOSVtable **osVtable)
static void createTestVtable(uiControlVtable *vtable)
{
memset(&vtable, 0, sizeof (uiControlVtable));
vtable.Size = sizeof (uiControlVtable);
vtable.Init = testVtableInit;
vtable.Free = testVtableFree;
memset(&osVtable, 0, sizeof (struct testOSVtable));
osVtable.Size = sizeof (struct testOSVtable);
osVtable.TestMethod = testVtableTestMethod;
}
// TODO namePlaceholder == "name"
struct checkControlErrorsParams {
const char *namePlaceholder;
uiControlVtable *vtablePlaceholder;
uiControlOSVtable *osVtablePlaceholder;
size_t implDataSizePlaceholder;
uiControlVtable *badSizeVtable;
};
testingTest(ControlErrors)
{
uiControlVtable vtablePlacheolder, vtableBadSize;

12
test/controls_errors.h Normal file
View File

@ -0,0 +1,12 @@
// 11 june 2019
checkErrorCase(uiRegisterControlType(NULL, p->vtablePlaceholder, p->osVtablePlaceholder, p->implDataSizePlaceholder),
"TODO")
checkErrorCase(uiRegisterControlType(p->namePlaceholder, NULL, p->osVtablePlaceholder, p->implDataSizePlaceholder),
"TODO")
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->badVtableSize, p->osVtablePlaceholder, p->implDataSizePlaceholder),
"TODO");
// TODO individual methods
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->vtablePlaceholder, NULL, p->implDataSizePlaceholder),
"TODO");
// OS vtable sizes are tested per-OS