summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-04-26 12:46:18 +0200
committerRobert Griebl <robert.griebl@qt.io>2022-04-26 19:17:30 +0000
commit5184cb19845e1b5bc25665e49e423f0dd8a25a5c (patch)
tree3610e4e943edb83e17ed7fbdfb83a32ec46ded39 /tests/auto
parent6a8ed85a1933fd7185475cb3459ec5730c81464d (diff)
downloadqtapplicationmanager-5184cb19845e1b5bc25665e49e423f0dd8a25a5c.tar.gz
Fix the QML tst_installer to run on Windows
Change-Id: Ic6a24d2d849a3d00e4e44f83ef6410bab4aca7c2 Pick-to: 5.15 6.2 6.3 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/installer/tst_installer.qml40
1 files changed, 26 insertions, 14 deletions
diff --git a/tests/auto/qml/installer/tst_installer.qml b/tests/auto/qml/installer/tst_installer.qml
index 701b7242..ae4e8559 100644
--- a/tests/auto/qml/installer/tst_installer.qml
+++ b/tests/auto/qml/installer/tst_installer.qml
@@ -37,6 +37,15 @@ TestCase {
name: "Installer"
when: windowShown
+ property string packageDir: ApplicationManager.systemProperties.AM_TESTDATA_DIR + "/packages/"
+
+ // this should be initTestCase(), but a skip() there doesn't skip the whole TestCase the
+ // same way as it works on the C++ side, so we have to call this from every test function
+ function checkSkip() {
+ if (!AmTest.dirExists(packageDir))
+ skip("No test packages available in the data/ directory")
+ }
+
property var stateList: []
property int spyTimeout: 5000 * AmTest.timeoutFactor
@@ -99,6 +108,8 @@ TestCase {
}
function test_1states() {
+ checkSkip()
+
PackageManager.packageAdded.connect(function(pkgId) {
var pkg = PackageManager.package(pkgId);
stateList.push(pkg.state)
@@ -109,8 +120,7 @@ TestCase {
})
taskStateChangedSpy.clear();
- var id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/test-dev-signed.appkg")
+ var id = PackageManager.startPackageInstallation(packageDir + "test-dev-signed.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskRequestingInstallationAcknowledgeSpy.count, 1);
compare(taskRequestingInstallationAcknowledgeSpy.signalArguments[0][0], id);
@@ -130,8 +140,7 @@ TestCase {
compare(PackageManager.package(pkgId).version, "1.0");
- id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/test-update-dev-signed.appkg")
+ id = PackageManager.startPackageInstallation(packageDir + "test-update-dev-signed.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskRequestingInstallationAcknowledgeSpy.count, 1);
compare(taskRequestingInstallationAcknowledgeSpy.signalArguments[0][0], id);
@@ -175,8 +184,9 @@ TestCase {
}
function test_2cancel_update() {
- var id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/test-dev-signed.appkg")
+ checkSkip()
+
+ var id = PackageManager.startPackageInstallation(packageDir + "test-dev-signed.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskRequestingInstallationAcknowledgeSpy.count, 1);
compare(taskRequestingInstallationAcknowledgeSpy.signalArguments[0][0], id);
@@ -191,8 +201,7 @@ TestCase {
var pkg = PackageManager.package(pkgId);
compare(pkg.version, "1.0");
- id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/test-update-dev-signed.appkg")
+ id = PackageManager.startPackageInstallation(packageDir + "test-update-dev-signed.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
pkgId = taskRequestingInstallationAcknowledgeSpy.signalArguments[0][1].id
compare(pkgId, "com.pelagicore.test");
@@ -206,14 +215,15 @@ TestCase {
}
function test_3cancel_builtin_update() {
+ checkSkip()
+
taskStateChangedSpy.clear()
var pkg = PackageManager.package("hello-world.red");
verify(pkg.builtIn);
compare(pkg.icon.toString().slice(-9), "icon1.png")
compare(pkg.version, "v1");
- var id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/hello-world.red.appkg")
+ var id = PackageManager.startPackageInstallation(packageDir + "hello-world.red.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskRequestingInstallationAcknowledgeSpy.count, 1);
compare(taskRequestingInstallationAcknowledgeSpy.signalArguments[0][0], id);
@@ -229,10 +239,11 @@ TestCase {
}
function test_4builtin_update_downgrade() {
+ checkSkip()
+
taskStateChangedSpy.clear()
- var id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/hello-world.red.appkg")
+ var id = PackageManager.startPackageInstallation(packageDir + "hello-world.red.appkg")
taskRequestingInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskRequestingInstallationAcknowledgeSpy.count, 1);
compare(taskRequestingInstallationAcknowledgeSpy.signalArguments[0][0], id);
@@ -263,6 +274,8 @@ TestCase {
}
function test_5stop_on_update() {
+ checkSkip()
+
taskStateChangedSpy.clear()
taskBlockingUntilInstallationAcknowledgeSpy.clear()
applicationRunStateChangedSpy.clear()
@@ -283,8 +296,7 @@ TestCase {
applicationRunStateChangedSpy.clear()
// now install the update
- var id = PackageManager.startPackageInstallation(ApplicationManager.systemProperties.AM_TESTDATA_DIR
- + "/packages/hello-world.red.appkg")
+ var id = PackageManager.startPackageInstallation(packageDir + "hello-world.red.appkg")
taskBlockingUntilInstallationAcknowledgeSpy.wait(spyTimeout);
compare(taskBlockingUntilInstallationAcknowledgeSpy.count, 1);
compare(taskBlockingUntilInstallationAcknowledgeSpy.signalArguments[0][0], id);