diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2021-12-03 01:05:55 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2022-01-11 13:26:26 +0300 |
commit | 43f5e61b5f602e0bc33a3b4a1724123768871614 (patch) | |
tree | c5f42b8ee2f0b3bdd74419f133a6d6ac878772f9 /tests | |
parent | 4d0088e72f029c1dcafec99a1306ef0fc601bda6 (diff) |
Add possibility to wait for current job to stop.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/slic3rutils/slic3r_jobs_tests.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/slic3rutils/slic3r_jobs_tests.cpp b/tests/slic3rutils/slic3r_jobs_tests.cpp index 56c2fab43..39682ff98 100644 --- a/tests/slic3rutils/slic3r_jobs_tests.cpp +++ b/tests/slic3rutils/slic3r_jobs_tests.cpp @@ -37,8 +37,7 @@ TEST_CASE("State should not be idle while running a job", "[Jobs]") { }).wait(); }); - while (!worker.is_idle()) - worker.process_events(); + worker.wait_for_idle(); REQUIRE(worker.is_idle()); } @@ -55,8 +54,7 @@ TEST_CASE("Status messages should be received by the main thread during job exec } }); - while (!worker.is_idle()) - worker.process_events(); + worker.wait_for_idle(); REQUIRE(pri->pr == 100); REQUIRE(pri->statustxt == "Running"); @@ -85,8 +83,7 @@ TEST_CASE("Cancellation should be recognized be the worker", "[Jobs]") { std::this_thread::sleep_for(std::chrono::milliseconds(1)); worker.cancel(); - while (!worker.is_idle()) - worker.process_events(); + worker.wait_for_current_job(); REQUIRE(pri->pr != 100); } @@ -146,6 +143,6 @@ TEST_CASE("Exception should be properly forwarded to finalize()", "[Jobs]") { eptr = nullptr; }); - while (!worker.is_idle()) - worker.process_events(); + worker.wait_for_idle(); + REQUIRE(worker.is_idle()); } |