summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-09-16 16:09:53 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-09-23 10:14:28 +0200
commitb1b61636b374c544ab6d09a876af73cb8beb6b4a (patch)
tree2119e76d75ca33bb0356741ab4fd80dd8e36d8ef /tests/manual
parent20ae1cd486104cda556051040719dcbd56516bad (diff)
Introduce centralized means of checking for asyncify
The new function has an advantage of not requring EM_JS. Change-Id: Ib9ad0e6b59cfe2e6864697a14b5cfdb39f62af2d Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/wasm/eventloop/eventloop_auto/CMakeLists.txt2
-rw-r--r--tests/manual/wasm/eventloop/eventloop_auto/main.cpp13
2 files changed, 7 insertions, 8 deletions
diff --git a/tests/manual/wasm/eventloop/eventloop_auto/CMakeLists.txt b/tests/manual/wasm/eventloop/eventloop_auto/CMakeLists.txt
index f8669c2030..9bfa875be7 100644
--- a/tests/manual/wasm/eventloop/eventloop_auto/CMakeLists.txt
+++ b/tests/manual/wasm/eventloop/eventloop_auto/CMakeLists.txt
@@ -7,6 +7,7 @@ qt_internal_add_manual_test(eventloop_auto
../../qtwasmtestlib/qtwasmtestlib.cpp
LIBRARIES
Qt::Core
+ Qt::CorePrivate
)
add_custom_command(
@@ -28,6 +29,7 @@ qt_internal_add_manual_test(eventloop_auto_asyncify
../../qtwasmtestlib/qtwasmtestlib.cpp
LIBRARIES
Qt::Core
+ Qt::CorePrivate
)
target_link_options(eventloop_auto_asyncify PRIVATE -sASYNCIFY -Os)
diff --git a/tests/manual/wasm/eventloop/eventloop_auto/main.cpp b/tests/manual/wasm/eventloop/eventloop_auto/main.cpp
index b6de2310ad..b2ff6779fd 100644
--- a/tests/manual/wasm/eventloop/eventloop_auto/main.cpp
+++ b/tests/manual/wasm/eventloop/eventloop_auto/main.cpp
@@ -7,6 +7,7 @@
#include <QtCore/QObject>
#include <QtCore/QThread>
#include <QtCore/QTimer>
+#include <QtCore/private/qstdweb_p.h>
#include <qtwasmtestlib.h>
@@ -14,10 +15,6 @@
const int timerTimeout = 10;
-EM_JS(bool, have_asyncify, (), {
- return typeof Asyncify != "undefined";
-});
-
class WasmEventDispatcherTest: public QObject
{
Q_OBJECT
@@ -242,7 +239,7 @@ void WasmEventDispatcherTest::timerSecondaryThread()
// Post an event to the main thread and asyncify wait for it
void WasmEventDispatcherTest::postEventAsyncify()
{
- if (!have_asyncify()) {
+ if (!qstdweb::haveAsyncify()) {
QtWasmTest::completeTestFunction(QtWasmTest::TestResult::Skip, "requires asyncify");
return;
}
@@ -259,7 +256,7 @@ void WasmEventDispatcherTest::postEventAsyncify()
// Create a timer on the main thread and asyncify wait for it
void WasmEventDispatcherTest::timerAsyncify()
{
- if (!have_asyncify()) {
+ if (!qstdweb::haveAsyncify()) {
QtWasmTest::completeTestFunction(QtWasmTest::TestResult::Skip, "requires asyncify");
return;
}
@@ -276,7 +273,7 @@ void WasmEventDispatcherTest::timerAsyncify()
// Asyncify wait in a loop
void WasmEventDispatcherTest::postEventAsyncifyLoop()
{
- if (!have_asyncify()) {
+ if (!qstdweb::haveAsyncify()) {
QtWasmTest::completeTestFunction(QtWasmTest::TestResult::Skip, "requires asyncify");
return;
}
@@ -296,7 +293,7 @@ void WasmEventDispatcherTest::postEventAsyncifyLoop()
// Asyncify wait for QThread::wait() / pthread_join()
void WasmEventDispatcherTest::threadAsyncifyWait()
{
- if (!have_asyncify())
+ if (!qstdweb::haveAsyncify())
QtWasmTest::completeTestFunction(QtWasmTest::TestResult::Skip, "requires asyncify");
const int threadCount = 15;