diff options
author | Morten Sørvig <[email protected]> | 2022-07-06 23:01:59 +0200 |
---|---|---|
committer | Morten Sørvig <[email protected]> | 2022-08-08 18:14:28 +0200 |
commit | 964765f686bca3ba62833e76e5ed689fce9a62bb (patch) | |
tree | fc0b7cfae17f7a930c07003562115c78548255bc /tests/manual/wasm/qtwasmtestlib | |
parent | 2a17034ddc513870bda49e5d76cb0b1bf358c754 (diff) |
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 <[email protected]>
Diffstat (limited to 'tests/manual/wasm/qtwasmtestlib')
-rw-r--r-- | tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp | 7 | ||||
-rw-r--r-- | tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.h | 1 |
2 files changed, 7 insertions, 1 deletions
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 // diff --git a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.h b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.h index f4b0f752417..c691f44600e 100644 --- a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.h +++ b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.h @@ -20,6 +20,7 @@ std::string formatMessage(std::string_view file, std::string_view message); void completeTestFunction(TestResult result, std::string message); +void completeTestFunction(); void initTestCase(QObject *testObject, std::function<void ()> cleanup); template <typename App> void initTestCase(int argc, |