summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-12-29 17:54:29 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2023-06-20 09:08:03 +0200
commit1f6cac0da9c31b67f5cb5850ce52a4622e57b4d5 (patch)
treec053e1b0e4d39c2436c150eb4208ecab6023bad3 /tests/manual
parentdb9e206deecab7b78dd2177d4bcaf6415fb84c94 (diff)
Make WASM export names different across modules
The export name is now ${TARGET_NAME}Entry. This can also be overridden by using QT_WASM_EXPORT_NAME, both in CMake and qmake Change-Id: I59c97ae6e22f0b2720716e9d7eff7b6b13d37ab5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/wasm/a11y/basic_widgets/basic_widgets.html2
-rw-r--r--tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto.html2
-rw-r--r--tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto_asyncify.html2
-rw-r--r--tests/manual/wasm/network/sockify_sockets_auto/sockify_sockets_auto.html2
-rw-r--r--tests/manual/wasm/qstdweb/files_auto.html2
-rw-r--r--tests/manual/wasm/qstdweb/promise_auto.html2
-rw-r--r--tests/manual/wasm/qstdweb/qwasmcompositor_auto.html2
-rw-r--r--tests/manual/wasm/qtloader_integration/test_body.js56
-rw-r--r--tests/manual/wasm/qtwasmtestlib/README.md4
-rw-r--r--tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.js10
10 files changed, 54 insertions, 30 deletions
diff --git a/tests/manual/wasm/a11y/basic_widgets/basic_widgets.html b/tests/manual/wasm/a11y/basic_widgets/basic_widgets.html
index 899e72bb00..091809be5c 100644
--- a/tests/manual/wasm/a11y/basic_widgets/basic_widgets.html
+++ b/tests/manual/wasm/a11y/basic_widgets/basic_widgets.html
@@ -7,7 +7,7 @@
<script>
window.onload = async () => {
- let qt_instance = await createQtAppInstance({
+ let qt_instance = await a11y_basic_widgets_entry({
qtContainerElements: [document.getElementById("qt_container")],
});
}
diff --git a/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto.html b/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto.html
index 7ff9d8e7f2..e8e35abcbb 100644
--- a/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto.html
+++ b/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto.html
@@ -3,7 +3,7 @@
<script type="text/javascript" src="eventloop_auto.js"></script>
<script>
window.onload = () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(eventloop_auto_entry, document.getElementById("log"));
};
</script>
<p>Running event dispatcher auto test.</p>
diff --git a/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto_asyncify.html b/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto_asyncify.html
index a277c9b9e0..f09b29d85b 100644
--- a/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto_asyncify.html
+++ b/tests/manual/wasm/eventloop/eventloop_auto/eventloop_auto_asyncify.html
@@ -3,7 +3,7 @@
<script type="text/javascript" src="eventloop_auto_asyncify.js"></script>
<script>
window.onload = () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(eventloop_auto_asyncify_entry, document.getElementById("log"));
};
</script>
<p>Running event dispatcher auto test.</p>
diff --git a/tests/manual/wasm/network/sockify_sockets_auto/sockify_sockets_auto.html b/tests/manual/wasm/network/sockify_sockets_auto/sockify_sockets_auto.html
index 5376249a71..080ada94e7 100644
--- a/tests/manual/wasm/network/sockify_sockets_auto/sockify_sockets_auto.html
+++ b/tests/manual/wasm/network/sockify_sockets_auto/sockify_sockets_auto.html
@@ -3,7 +3,7 @@
<script type="text/javascript" src="sockify_sockets_auto.js"></script>
<script>
window.onload = async () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(sockify_sockets_auto_entry, document.getElementById("log"));
};
</script>
<p> Sockify tunneled sockets auto test.
diff --git a/tests/manual/wasm/qstdweb/files_auto.html b/tests/manual/wasm/qstdweb/files_auto.html
index 71e8088dfb..9027fdc660 100644
--- a/tests/manual/wasm/qstdweb/files_auto.html
+++ b/tests/manual/wasm/qstdweb/files_auto.html
@@ -6,7 +6,7 @@
<script type="text/javascript" src="files_auto.js"></script>
<script>
window.onload = () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(files_auto_entry, document.getElementById("log"));
};
</script>
<p>Running files auto test.</p>
diff --git a/tests/manual/wasm/qstdweb/promise_auto.html b/tests/manual/wasm/qstdweb/promise_auto.html
index 786145419f..94a8dbb88a 100644
--- a/tests/manual/wasm/qstdweb/promise_auto.html
+++ b/tests/manual/wasm/qstdweb/promise_auto.html
@@ -3,7 +3,7 @@
<script type="text/javascript" src="promise_auto.js"></script>
<script>
window.onload = () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(promise_auto_entry, document.getElementById("log"));
};
</script>
<p>Running promise auto test.</p>
diff --git a/tests/manual/wasm/qstdweb/qwasmcompositor_auto.html b/tests/manual/wasm/qstdweb/qwasmcompositor_auto.html
index 26daecdf41..f33aab0b9c 100644
--- a/tests/manual/wasm/qstdweb/qwasmcompositor_auto.html
+++ b/tests/manual/wasm/qstdweb/qwasmcompositor_auto.html
@@ -3,7 +3,7 @@
<script type="text/javascript" src="qwasmcompositor_auto.js"></script>
<script>
window.onload = () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(qwasmcompositor_auto_entry, document.getElementById("log"));
};
</script>
<p>Running files auto test.</p>
diff --git a/tests/manual/wasm/qtloader_integration/test_body.js b/tests/manual/wasm/qtloader_integration/test_body.js
index d68c6ba8cc..385a3816d3 100644
--- a/tests/manual/wasm/qtloader_integration/test_body.js
+++ b/tests/manual/wasm/qtloader_integration/test_body.js
@@ -48,10 +48,32 @@ export class QtLoaderIntegrationTests
'config.qt is required, expected an object', caughtException.message);
}
- async useDefaultOnMissingEntryFunction()
+ async missingEntryFunction()
{
- const instance = await qtLoad({ arguments: ['--no-gui'], qt: {}});
- assert.isNotUndefined(instance);
+ let caughtException;
+ try {
+ await qtLoad({ qt: {}});
+ } catch (e) {
+ caughtException = e;
+ }
+
+ assert.isNotUndefined(caughtException);
+ assert.equal(
+ 'config.qt.entryFunction is required, expected a function', caughtException.message);
+ }
+
+ async badEntryFunction()
+ {
+ let caughtException;
+ try {
+ await qtLoad({ qt: { entryFunction: 'invalid' }});
+ } catch (e) {
+ caughtException = e;
+ }
+
+ assert.isNotUndefined(caughtException);
+ assert.equal(
+ 'config.qt.entryFunction is required, expected a function', caughtException.message);
}
async environmentVariables()
@@ -62,7 +84,7 @@ export class QtLoaderIntegrationTests
variable1: 'value1',
variable2: 'value2'
},
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: [this.#testScreenContainers[0]]
}
});
@@ -79,7 +101,7 @@ export class QtLoaderIntegrationTests
const instance = await qtLoad({
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: this.#testScreenContainers
}
});
@@ -125,7 +147,7 @@ export class QtLoaderIntegrationTests
{
const instance = await qtLoad({
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: this.#testScreenContainers,
}
});
@@ -181,7 +203,7 @@ export class QtLoaderIntegrationTests
const instances = await Promise.all([1, 2, 3].map(i => qtLoad({
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: [this.#addScreenContainer(`screen-container-${i}`, {
width: `${i * 10}px`,
height: `${i * 10}px`,
@@ -222,7 +244,7 @@ export class QtLoaderIntegrationTests
accumulatedStdout += output;
},
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
@@ -246,7 +268,7 @@ export class QtLoaderIntegrationTests
{
await qtLoad({
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: [this.#testScreenContainers[0]],
module: await WebAssembly.compileStreaming(
fetch('tst_qtloader_integration.wasm'))
@@ -259,7 +281,7 @@ export class QtLoaderIntegrationTests
const instance = await qtLoad({
arguments: ['--no-gui', 'arg1', 'other', 'yetanotherarg'],
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
const args = this.#callTestInstanceApi(instance, 'retrieveArguments');
@@ -275,7 +297,7 @@ export class QtLoaderIntegrationTests
try {
await qtLoad({
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
containerElements: [this.#testScreenContainers[0]],
module: Promise.reject(new Error('Failed to load')),
}
@@ -294,7 +316,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui'],
qt: {
onExit: onExitMock,
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
try {
@@ -316,7 +338,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui', '--crash-immediately'],
qt: {
onExit: onExitMock,
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
} catch (e) {
@@ -340,7 +362,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui'],
onAbort: onAbortMock,
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
try {
@@ -358,7 +380,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui'],
qt: {
onExit: onExitMock,
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
// The module is running. onExit should not have been called.
@@ -383,7 +405,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui', '--exit-immediately'],
qt: {
onExit: onExitMock,
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
assert.equal(1, onExitMock.calls.length);
@@ -402,7 +424,7 @@ export class QtLoaderIntegrationTests
arguments: ['--no-gui'],
quit: quitMock,
qt: {
- entryFunction: createQtAppInstance,
+ entryFunction: tst_qtloader_integration_entry,
}
});
try {
diff --git a/tests/manual/wasm/qtwasmtestlib/README.md b/tests/manual/wasm/qtwasmtestlib/README.md
index 515c33ae6a..6de81fe8b4 100644
--- a/tests/manual/wasm/qtwasmtestlib/README.md
+++ b/tests/manual/wasm/qtwasmtestlib/README.md
@@ -48,7 +48,7 @@ Finally provide an html file which hosts the test runner and calls runTestCase()
<script type="text/javascript" src="test_case.js"></script>
<script>
window.onload = async () => {
- runTestCase(document.getElementById("log"));
+ runTestCase(entryFunction, document.getElementById("log"));
};
</script>
<p>Running Foo auto test.</p>
@@ -67,7 +67,7 @@ html file provides container elements which becomes QScreens for the test code.
window.onload = async () => {
let log = document.getElementById("log")
let containers = [document.getElementById("container")];
- runTestCase(log, containers);
+ runTestCase(entryFunction, log, containers);
};
</script>
<p>Running Foo auto test.</p>
diff --git a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.js b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.js
index eaf518d1ef..01003f30f9 100644
--- a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.js
+++ b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.js
@@ -77,12 +77,13 @@ async function runTestFunction(instance, name) {
}
}
-async function runTestCaseImpl(testFunctionStarted, testFunctionCompleted, qtContainers) {
+async function runTestCaseImpl(entryFunction, testFunctionStarted, testFunctionCompleted, qtContainers)
+{
// Create test case instance
const config = {
qtContainerElements: qtContainers || []
}
- const instance = await createQtAppInstance(config);
+ const instance = await entryFunction(config);
// Run all test functions
const functionsString = instance.getTestFunctions();
@@ -124,10 +125,11 @@ function testFunctionCompleted(status) {
g_htmlLogElement.innerHTML += line;
}
-async function runTestCase(htmlLogElement, qtContainers) {
+async function runTestCase(entryFunction, htmlLogElement, qtContainers)
+{
g_htmlLogElement = htmlLogElement;
try {
- await runTestCaseImpl(testFunctionStarted, testFunctionCompleted, qtContainers);
+ await runTestCaseImpl(entryFunction, testFunctionStarted, testFunctionCompleted, qtContainers);
g_htmlLogElement.innerHTML += "<br> DONE"
} catch (err) {
g_htmlLogElement.innerHTML += err