Okay, added uiFreeEvent() error tests. Now back to uiControl.

This commit is contained in:
Pietro Gagliardi 2019-06-02 19:11:22 -04:00
parent d040bca07e
commit c6294f163f
1 changed files with 8 additions and 0 deletions

View File

@ -756,6 +756,8 @@ static void testWhileFiring(void *sender, void *args, void *data)
idPlaceholder = 0;
blockedPlaceholder = false;
testProgrammerError(t, uiFreeEvent(firingEvent),
"attempt to change a uiEvent with uiFreeEvent() while it is firing");
testProgrammerError(t, uiEventAddHandler(firingEvent, handler, senderPlaceholder, dataPlaceholder),
"attempt to change a uiEvent with uiEventAddHandler() while it is firing");
testProgrammerError(t, uiEventDeleteHandler(firingEvent, idPlaceholder),
@ -807,6 +809,10 @@ testingTest(EventErrors)
nonglobalEvent = uiNewEvent(&opts);
testingTDefer(t, deferFreeEvent, nonglobalEvent);
testProgrammerError(t, uiFreeEvent(NULL),
"invalid null pointer for uiEvent passed into uiFreeEvent()");
// We test trying to free a uiEvent with handlers later, when we actually need to make one for testing firing.
eventPlaceholder = globalEvent;
senderPlaceholder = NULL;
argsPlaceholder = NULL;
@ -858,5 +864,7 @@ testingTest(EventErrors)
fp->e = firingEvent;
fp->id = uiEventAddHandler(fp->e, testWhileFiring, NULL, t);
testingTDefer(t, deferDeleteFiringHandler, fp);
testProgrammerError(t, uiFreeEvent(firingEvent),
"attempt to free a uiEvent that still has handlers registered");
uiEventFire(firingEvent, NULL, firingEvent);
}