summaryrefslogtreecommitdiffstats
path: root/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-07-04 09:57:27 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-08-12 20:32:29 +0200
commitf8e460b9151ee03195dd886c58144b74b01f33f8 (patch)
tree625747c9f1410c23f643b199c786323b6747eb65 /tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp
parent742ae9ea1cadbb438e2d02bb58ae900c676dc41c (diff)
Use the local file APIs to save/load files on WASM
QFileDialog::saveFileContent, QFileDialog::getOpenFileContent are now using local file APIs to access files on any browser that passes a feature check. The feature is thoroughly tested using sinon and a new mock library. Task-number: QTBUG-99611 Change-Id: I3dd27a9d21eb143c71ea7db0563f70ac7db3a3ac Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp')
-rw-r--r--tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp
index c70c3902496..7d1db44cb0e 100644
--- a/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp
+++ b/tests/manual/wasm/qtwasmtestlib/qtwasmtestlib.cpp
@@ -101,10 +101,22 @@ void runTestFunction(std::string name)
QMetaObject::invokeMethod(g_testObject, name.c_str());
}
+void failTest(std::string message)
+{
+ completeTestFunction(QtWasmTest::Fail, std::move(message));
+}
+
+void passTest()
+{
+ completeTestFunction(QtWasmTest::Pass, "");
+}
+
EMSCRIPTEN_BINDINGS(qtwebtestrunner) {
emscripten::function("cleanupTestCase", &cleanupTestCase);
emscripten::function("getTestFunctions", &getTestFunctions);
emscripten::function("runTestFunction", &runTestFunction);
+ emscripten::function("qtWasmFail", &failTest);
+ emscripten::function("qtWasmPass", &passTest);
}
//