test: timer: Add dynamically allocated timer test

Timers should be automatically stopped and unregistered when deleted.
Add a test to verify this is the case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-07-01 23:27:12 +03:00 committed by Niklas Söderlund
parent 08b2e03a8a
commit 3952d49d8d

View file

@ -152,6 +152,17 @@ protected:
return TestFail;
}
/*
* Test that dynamically allocated timers are stopped when
* deleted. This will result in a crash on failure.
*/
ManagedTimer *dyntimer = new ManagedTimer();
dyntimer->start(100);
delete dyntimer;
timer.start(200);
dispatcher->processEvents();
return TestPass;
}