Slight refactoring of the controls test. One more thing to do for now.

This commit is contained in:
Pietro Gagliardi 2019-06-13 10:31:17 -04:00
parent c1ca78c46e
commit f3b0dc16ab
2 changed files with 13 additions and 5 deletions

View File

@ -17,12 +17,18 @@ static void testVtableFree(uiControl *c, void *implData)
// do nothing
}
static void createTestVtable(uiControlVtable *vtable)
uiControlVtable *allocVtableFull(testingT *t, const char *file, long line)
{
memset(vtable, 0, sizeof (uiControlVtable));
vtable->Size = sizeof (uiControlVtable);
vtable->Init = testVtableInit;
vtable->Free = testVtableFree;
uiControlVtable *v;
v = (uiControlVtable *) malloc(sizeof (uiControlVtable));
if (v == NULL)
testingTFatalfFull(t, file, line, "memory exhausted allocating uiControlVtable");
memset(v, 0, sizeof (uiControlVtable));
v->Size = sizeof (uiControlVtable);
v->Init = testVtableInit;
v->Free = testVtableFree;
return v;
}
struct checkControlErrorsParams {

View File

@ -39,5 +39,7 @@ extern void checkProgrammerErrorFull(testingT *t, const char *file, long line, c
#define checkProgrammerErrorInThread(t, name, f, data, msgWant) checkProgrammerErrorFull(t, __FILE__, __LINE__, name, f, data, msgWant, true)
// controls.c
extern uiControlVtable *allocVtableFull(testingT *t, const char *file, long line);
#define allocVtable(t) allocVtableFull(t, __FILE__, __LINE__)
extern uiControlOSVtable *allocOSVtableFull(testingT *t, const char *file, long line);
#define allocOSVtable(t) allocOSVtableFull(t, __FILE__, __LINE__)