Fixed build errors. The test itself will fail at present, but we have some cleanups to do still...
This commit is contained in:
parent
e30ed33046
commit
63773f703c
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func)
|
bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func)
|
||||||
{
|
{
|
||||||
if (vtable->Size != sizeof (uiControlOSVtable)) {
|
if (osVtable->Size != sizeof (uiControlOSVtable)) {
|
||||||
uiprivProgrammerErrorWrongStructSize(vtable->Size, "uiControlOSVtable", func);
|
uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,17 +17,12 @@ static void testVtableFree(uiControl *c, void *implData)
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testVtableTestMethod(uiControl *c, void *implData)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
static void createTestVtable(uiControlVtable *vtable)
|
static void createTestVtable(uiControlVtable *vtable)
|
||||||
{
|
{
|
||||||
memset(&vtable, 0, sizeof (uiControlVtable));
|
memset(vtable, 0, sizeof (uiControlVtable));
|
||||||
vtable.Size = sizeof (uiControlVtable);
|
vtable->Size = sizeof (uiControlVtable);
|
||||||
vtable.Init = testVtableInit;
|
vtable->Init = testVtableInit;
|
||||||
vtable.Free = testVtableFree;
|
vtable->Free = testVtableFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct checkControlErrorsParams {
|
struct checkControlErrorsParams {
|
||||||
|
@ -35,7 +30,7 @@ struct checkControlErrorsParams {
|
||||||
uiControlVtable *vtablePlaceholder;
|
uiControlVtable *vtablePlaceholder;
|
||||||
uiControlOSVtable *osVtablePlaceholder;
|
uiControlOSVtable *osVtablePlaceholder;
|
||||||
size_t implDataSizePlaceholder;
|
size_t implDataSizePlaceholder;
|
||||||
uiControlVtable *badSizeVtable;
|
uiControlVtable *vtableBadSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO clean up these macros
|
// TODO clean up these macros
|
||||||
|
@ -43,7 +38,7 @@ struct checkControlErrorsParams {
|
||||||
#define checkErrorCaseFull(line, call, msgWant) \
|
#define checkErrorCaseFull(line, call, msgWant) \
|
||||||
static void checkCat(doCheck, line)(void *data) \
|
static void checkCat(doCheck, line)(void *data) \
|
||||||
{ \
|
{ \
|
||||||
struct checkEventErrorsParams *p = (struct checkEventErrorsParams *) data; \
|
struct checkControlErrorsParams *p = (struct checkControlErrorsParams *) data; \
|
||||||
(void) p; /* in the event call does not use this */ \
|
(void) p; /* in the event call does not use this */ \
|
||||||
call; \
|
call; \
|
||||||
}
|
}
|
||||||
|
@ -59,7 +54,7 @@ static const struct {
|
||||||
} controlErrorCases[] = {
|
} controlErrorCases[] = {
|
||||||
#define checkErrorCaseFull(line, callstr, msgWant) { callstr, checkCat(doCheck, line), msgWant },
|
#define checkErrorCaseFull(line, callstr, msgWant) { callstr, checkCat(doCheck, line), msgWant },
|
||||||
#define checkErrorCase(call, msgWant) checkErrorCaseFull(__LINE__, #call, msgWant)
|
#define checkErrorCase(call, msgWant) checkErrorCaseFull(__LINE__, #call, msgWant)
|
||||||
#include "events_errors.h"
|
#include "controls_errors.h"
|
||||||
#undef checkErrorCase
|
#undef checkErrorCase
|
||||||
#undef checkErrorCaseFull
|
#undef checkErrorCaseFull
|
||||||
#undef checkCat
|
#undef checkCat
|
||||||
|
@ -69,14 +64,19 @@ static const struct {
|
||||||
testingTest(ControlErrors)
|
testingTest(ControlErrors)
|
||||||
{
|
{
|
||||||
struct checkControlErrorsParams p;
|
struct checkControlErrorsParams p;
|
||||||
|
uiControlVtable vtable;
|
||||||
|
uiControlVtable vtableBadSize;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
memset(&p, 0, sizeof (struct checkControlErrorsParams));
|
memset(&p, 0, sizeof (struct checkControlErrorsParams));
|
||||||
p.namePlaceholder = "name";
|
p.namePlaceholder = "name";
|
||||||
createTestVtable(&p.vtablePlaceholder);
|
createTestVtable(&vtable);
|
||||||
|
p.vtablePlaceholder = &vtable;
|
||||||
// TODO osVtablePlaceholder
|
// TODO osVtablePlaceholder
|
||||||
p.implDataSizePlaceholder = sizeof (struct testImplData);
|
p.implDataSizePlaceholder = sizeof (struct testImplData);
|
||||||
p.badSizeVtable.Size = 1;
|
memset(&vtableBadSize, 0, sizeof (uiControlVtable));
|
||||||
|
vtableBadSize.Size = 1;
|
||||||
|
p.vtableBadSize = &vtableBadSize;
|
||||||
|
|
||||||
for (i = 0; controlErrorCases[i].name != NULL; i++)
|
for (i = 0; controlErrorCases[i].name != NULL; i++)
|
||||||
checkProgrammerError(t, controlErrorCases[i].name, controlErrorCases[i].f, &p, controlErrorCases[i].msgWant);
|
checkProgrammerError(t, controlErrorCases[i].name, controlErrorCases[i].f, &p, controlErrorCases[i].msgWant);
|
||||||
|
|
|
@ -4,9 +4,9 @@ checkErrorCase(uiRegisterControlType(NULL, p->vtablePlaceholder, p->osVtablePlac
|
||||||
"TODO")
|
"TODO")
|
||||||
checkErrorCase(uiRegisterControlType(p->namePlaceholder, NULL, p->osVtablePlaceholder, p->implDataSizePlaceholder),
|
checkErrorCase(uiRegisterControlType(p->namePlaceholder, NULL, p->osVtablePlaceholder, p->implDataSizePlaceholder),
|
||||||
"TODO")
|
"TODO")
|
||||||
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->badVtableSize, p->osVtablePlaceholder, p->implDataSizePlaceholder),
|
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->vtableBadSize, p->osVtablePlaceholder, p->implDataSizePlaceholder),
|
||||||
"TODO");
|
"TODO")
|
||||||
// TODO individual methods
|
// TODO individual methods
|
||||||
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->vtablePlaceholder, NULL, p->implDataSizePlaceholder),
|
checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->vtablePlaceholder, NULL, p->implDataSizePlaceholder),
|
||||||
"TODO");
|
"TODO")
|
||||||
// OS vtable sizes are tested per-OS
|
// OS vtable sizes are tested per-OS
|
||||||
|
|
Loading…
Reference in New Issue