And integrated the cycle-checking code. Woo it's got tests! Now we need to worry about the OS-side test code, assuming I don't have any more pesky TODOs to fix immediately...
This commit is contained in:
parent
b1d733e9a2
commit
19a776e446
|
@ -237,6 +237,10 @@ void uiControlSetParent(uiControl *c, uiControl *parent)
|
|||
uiprivProgrammerErrorReparenting("a", "another", uiprivFunc);
|
||||
return;
|
||||
}
|
||||
if (parentHasCycle(c, parent)) {
|
||||
uiprivProgrammerErrorControlParentCycle(uiprivFunc);
|
||||
return;
|
||||
}
|
||||
c->parent = parent;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,4 +75,7 @@
|
|||
uiprivProgrammerError("%s(): cannot set a control with %s parent to have %s parent", \
|
||||
func, current, next)
|
||||
|
||||
#define uiprivProgrammerErrorControlParentCycle(func) \
|
||||
uiprivProgrammerError("%s(): cannot create a parent cycle", func)
|
||||
|
||||
// }
|
||||
|
|
|
@ -435,7 +435,7 @@ Test(ControlParentCyclesDisallowed_TwoControls)
|
|||
d = uiNewControl(testControlType(), NULL);
|
||||
|
||||
uiControlSetParent(c, d);
|
||||
ctx = beginCheckProgrammerError("TODO");
|
||||
ctx = beginCheckProgrammerError("uiControlSetParent(): cannot create a parent cycle");
|
||||
uiControlSetParent(d, c);
|
||||
endCheckProgrammerError(ctx);
|
||||
|
||||
|
@ -457,7 +457,7 @@ Test(ControlParentCyclesDisallowed_ThreeControls)
|
|||
|
||||
uiControlSetParent(c, d);
|
||||
uiControlSetParent(d, e);
|
||||
ctx = beginCheckProgrammerError("TODO");
|
||||
ctx = beginCheckProgrammerError("uiControlSetParent(): cannot create a parent cycle");
|
||||
uiControlSetParent(e, c);
|
||||
endCheckProgrammerError(ctx);
|
||||
|
||||
|
@ -475,7 +475,7 @@ Test(ControlCannotBeItsOwnParent)
|
|||
void *ctx;
|
||||
|
||||
c = uiNewControl(testControlType(), NULL);
|
||||
ctx = beginCheckProgrammerError("TODO");
|
||||
ctx = beginCheckProgrammerError("uiControlSetParent(): cannot create a parent cycle");
|
||||
uiControlSetParent(c, c);
|
||||
endCheckProgrammerError(ctx);
|
||||
uiControlFree(c);
|
||||
|
|
Loading…
Reference in New Issue