summaryrefslogtreecommitdiff
path: root/test/timer.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-01 23:27:12 +0300
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-07-01 23:48:37 +0200
commit3952d49d8db15eb0788817f97b4de9eadd036324 (patch)
tree2c884319a513926ca68511c32a6c3ef23f91e718 /test/timer.cpp
parent08b2e03a8ac4758e4973d7fd549026ebeb28ff29 (diff)
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>
Diffstat (limited to 'test/timer.cpp')
-rw-r--r--test/timer.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/timer.cpp b/test/timer.cpp
index 41c132bd..addebce3 100644
--- a/test/timer.cpp
+++ b/test/timer.cpp
@@ -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;
}