Added test hook for checking a malformed uiControl whose type field is invalid.
This commit is contained in:
parent
f90150a579
commit
c28adcbd01
|
@ -1,5 +1,6 @@
|
||||||
// 8 june 2019
|
// 8 june 2019
|
||||||
#include "uipriv.h"
|
#include "uipriv.h"
|
||||||
|
#include "testhooks.h"
|
||||||
|
|
||||||
struct controlType {
|
struct controlType {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
@ -202,3 +203,13 @@ void *uiControlImplData(uiControl *c)
|
||||||
}
|
}
|
||||||
return c->implData;
|
return c->implData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uiControl testHookControlWithInvalidType = {
|
||||||
|
.controlID = controlTypeID,
|
||||||
|
.typeID = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
uiControl *uiprivTestHookControlWithInvalidType(void)
|
||||||
|
{
|
||||||
|
return &testHookControlWithInvalidType;
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ extern "C" {
|
||||||
typedef void (*uiprivTestHookReportProgrammerErrorFunc)(const char *msg, void *data);
|
typedef void (*uiprivTestHookReportProgrammerErrorFunc)(const char *msg, void *data);
|
||||||
uiprivExtern void uiprivTestHookReportProgrammerError(uiprivTestHookReportProgrammerErrorFunc f, void *data);
|
uiprivExtern void uiprivTestHookReportProgrammerError(uiprivTestHookReportProgrammerErrorFunc f, void *data);
|
||||||
|
|
||||||
|
// controls.c
|
||||||
|
uiprivExtern uiControl *uiprivTestHookControlWithInvalidType(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,9 +73,16 @@ static const struct checkErrorCase casesAfterOSVtable[] = {
|
||||||
{
|
{
|
||||||
"uiCheckControlType() with a control with an unknown type",
|
"uiCheckControlType() with a control with an unknown type",
|
||||||
[](void) {
|
[](void) {
|
||||||
// TODO
|
uiCheckControlType(uiprivTestHookControlWithInvalidType(), testControlType);
|
||||||
},
|
},
|
||||||
"TODO",
|
"uiCheckControlType(): unknown uiControl type 5 found in uiControl (this is likely not a real uiControl or some data is corrupt)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uiCheckControlType() with a control with an unknown type, even with uiControlType()",
|
||||||
|
[](void) {
|
||||||
|
uiCheckControlType(uiprivTestHookControlWithInvalidType(), uiControlType());
|
||||||
|
},
|
||||||
|
"uiCheckControlType(): unknown uiControl type 5 found in uiControl (this is likely not a real uiControl or some data is corrupt)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uiCheckControlType() asking for an unknown control type",
|
"uiCheckControlType() asking for an unknown control type",
|
||||||
|
|
Loading…
Reference in New Issue