mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Fix recurring C++ timers
* sixtyfps_timer_start needs to *take* the timer id out of the Rust timer to avoid that the subsequent drop stops the timer again * For the Qt event loop, call `timer_event()` once before entering QCoreApplication::exec(), to schedule any timers that were started beforehand. * Added a way to quit the event loop gently, in order to use that from the C++ unit test.
This commit is contained in:
parent
f4ed0e333b
commit
4cbcf2611f
10 changed files with 50 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
Please contact info@sixtyfps.io for more information.
|
||||
LICENSE END */
|
||||
|
||||
#include <chrono>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch2/catch.hpp"
|
||||
|
||||
|
@ -63,4 +64,13 @@ TEST_CASE("Property Tracker")
|
|||
prop.set(100);
|
||||
REQUIRE(tracker2.is_dirty());
|
||||
REQUIRE(!tracker1.is_dirty());
|
||||
}
|
||||
|
||||
TEST_CASE("C++ Timers")
|
||||
{
|
||||
using namespace sixtyfps;
|
||||
|
||||
Timer testTimer(std::chrono::milliseconds(16), []() { sixtyfps::quit_event_loop(); });
|
||||
|
||||
sixtyfps::run_event_loop();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue