From 964765f686bca3ba62833e76e5ed689fce9a62bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Wed, 6 Jul 2022 23:01:59 +0200 Subject: wasm: add event loop auto test Add basic tests for timers and event processing, for different use cases such as on the main thread, on a secondary thread, and with asyncify. Pick-to: 6.4 Change-Id: Ie0f82b5de97f639867b1e65dbb0ab8b11db86f85 Reviewed-by: Lorn Potter --- tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp') diff --git a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp index dd7d11c398f..c70c3902496 100644 --- a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp +++ b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp @@ -45,7 +45,6 @@ void verify(bool condition, std::string_view conditionString, std::string_view f // thread-safe and call be called from any thread. void completeTestFunction(TestResult result, std::string message) { - // Report test result to JavaScript test runner, on the main thread runOnMainThread([resultString = result == TestResult::Pass ? "PASS" : "FAIL", message](){ EM_ASM({ @@ -54,6 +53,12 @@ void completeTestFunction(TestResult result, std::string message) }); } +// Completes the currently running test function with a Pass result. +void completeTestFunction() +{ + completeTestFunction(TestResult::Pass, std::string()); +} + // // Private API for the Javascript test runnner // -- cgit v1.2.3