And added those control errors. Back to passing, and more importantly, back to actually writing tests! (Once we get to the uiControlOSVtable tests, that is...) Also more TODOs.
This commit is contained in:
parent
3f744de64e
commit
aa7da7b647
|
@ -114,10 +114,12 @@ This function can only be used to set the parent of an unparented control or to
|
||||||
It is a programmer error to pass `NULL` or a non-control for `c`.
|
It is a programmer error to pass `NULL` or a non-control for `c`.
|
||||||
|
|
||||||
TODO circular parenting
|
TODO circular parenting
|
||||||
|
TODO self-parenting
|
||||||
|
TODO top-levels and parenting
|
||||||
|
|
||||||
**For control implementations**: You would call this when adding a control to your container, preferably before actually doing the OS-level work involved. Likewise, call this when removing a child, preferably after doing the OS-level work involved.
|
**For control implementations**: You would call this when adding a control to your container, preferably before actually doing the OS-level work involved. Likewise, call this when removing a child, preferably after doing the OS-level work involved.
|
||||||
|
|
||||||
TODO do things this way to avoid needing to check if reparenting from a container implementation, or do that manually each time?
|
TODO do things this way to avoid needing to check if reparenting from a container implementation, or do that manually each time? we used to have uiControlVerifySetParent()...
|
||||||
|
|
||||||
## `uiControlImplData()`
|
## `uiControlImplData()`
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,59 @@ static const struct checkErrorCase casesAfterOSVtable[] = {
|
||||||
{
|
{
|
||||||
"uiControlFree() with a uiControl that still has a parent",
|
"uiControlFree() with a uiControl that still has a parent",
|
||||||
[](void) {
|
[](void) {
|
||||||
// TODO
|
uiControl *c, *d;
|
||||||
|
|
||||||
|
c = uiNewControl(testControlType, NULL);
|
||||||
|
d = uiNewControl(testControlType, NULL);
|
||||||
|
|
||||||
|
// this should fail
|
||||||
|
uiControlSetParent(c, d);
|
||||||
|
uiControlFree(c);
|
||||||
|
|
||||||
|
uiControlSetParent(c, NULL);
|
||||||
|
uiControlFree(d);
|
||||||
|
uiControlFree(c);
|
||||||
},
|
},
|
||||||
"TODO",
|
"uiControlFree(): cannot be called on a control with has a parent",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"uiControlSetParent() with a NULL uiControl",
|
||||||
|
[](void) {
|
||||||
|
uiControlSetParent(NULL, NULL);
|
||||||
|
},
|
||||||
|
"uiControlSetParent(): invalid null pointer for uiControl",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uiControlSetParent() to unparent an already parentless control",
|
||||||
|
[](void) {
|
||||||
|
uiControl *c;
|
||||||
|
|
||||||
|
c = uiNewControl(testControlType, NULL);
|
||||||
|
uiControlSetParent(c, NULL);
|
||||||
|
uiControlFree(c);
|
||||||
|
},
|
||||||
|
"uiControlSetParent(): cannot set a control with no parent to have no parent",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uiControlSetParent() to reparent an already parented control",
|
||||||
|
[](void) {
|
||||||
|
uiControl *c, *d, *e;
|
||||||
|
|
||||||
|
c = uiNewControl(testControlType, NULL);
|
||||||
|
d = uiNewControl(testControlType, NULL);
|
||||||
|
e = uiNewControl(testControlType, NULL);
|
||||||
|
|
||||||
|
// this should fail
|
||||||
|
uiControlSetParent(c, d);
|
||||||
|
uiControlSetParent(c, e);
|
||||||
|
|
||||||
|
uiControlSetParent(c, NULL);
|
||||||
|
uiControlFree(e);
|
||||||
|
uiControlFree(d);
|
||||||
|
uiControlFree(c);
|
||||||
|
},
|
||||||
|
"uiControlSetParent(): cannot set a control with a parent to have another parent",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue