summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-04-27 17:06:19 +0200
committerDominik Holland <dominik.holland@qt.io>2022-05-17 16:14:59 +0200
commit6d0842beac17114bd9aeaf390a289b9475c2380b (patch)
treefdaf5c7fb966fd908ef5ec1d96b0a9d22b0a9964
parentefb7b784cb8a0f6c29cdd6db48205961dac45fd7 (diff)
downloadqtapplicationmanager-6d0842beac17114bd9aeaf390a289b9475c2380b.tar.gz
Use AM_TIMEOUT_FACTOR in all tests and the intent handling
Also works around the problem of the single-process qml/windowitem test crashing with just slightly more than idle CPU load. Change-Id: Ie24c7565bbaa448844879f4a57f0921693db9ce8 Reviewed-by: Dominik Holland <dominik.holland@qt.io> (cherry picked from commit 5335074a0d432c98bb8ec8e62557e29b6ba1446d) Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r--src/manager-lib/intentaminterface.cpp9
-rw-r--r--src/tools/testrunner/amtest.cpp21
-rw-r--r--tests/main/tst_main.cpp9
-rw-r--r--tests/packageextractor/tst_packageextractor.cpp3
-rw-r--r--tests/qml/configs/tst_configs.qml15
-rw-r--r--tests/qml/crash/tst_crash.qml7
-rw-r--r--tests/qml/intents/tst_intents.qml11
-rw-r--r--tests/qml/lifecycle/tst_lifecycle.qml29
-rw-r--r--tests/qml/processtitle/tst_processtitle.qml13
-rw-r--r--tests/qml/quicklaunch/tst_quicklaunch.qml21
-rw-r--r--tests/qml/resources/tst_resource.qml8
-rw-r--r--tests/qml/simple/tst_applicationmanager.qml8
-rw-r--r--tests/qml/windowitem/tst_windowitem.qml62
-rw-r--r--tests/qml/windowitem2/tst_windowitem2.qml6
-rw-r--r--tests/qml/windowmanager/tst_windowmanager.qml2
-rw-r--r--tests/qml/windowmapping/tst_windowmapping.qml73
16 files changed, 160 insertions, 137 deletions
diff --git a/src/manager-lib/intentaminterface.cpp b/src/manager-lib/intentaminterface.cpp
index 66b97546..049c4266 100644
--- a/src/manager-lib/intentaminterface.cpp
+++ b/src/manager-lib/intentaminterface.cpp
@@ -61,6 +61,7 @@
#include "error.h"
#include "exception.h"
#include "logging.h"
+#include "utilities.h"
#include "runtimefactory.h"
#include "intentserver.h"
#include "intentclient.h"
@@ -94,20 +95,20 @@ IntentServer *IntentAMImplementation::createIntentServerAndClientInstance(Packag
auto intentServer = IntentServer::createInstance(intentServerAMInterface);
auto intentClient = IntentClient::createInstance(intentClientAMInterface);
- intentServer->setDisambiguationTimeout(disambiguationTimeout);
- intentServer->setStartApplicationTimeout(startApplicationTimeout);
+ intentServer->setDisambiguationTimeout(disambiguationTimeout * timeoutFactor());
+ intentServer->setStartApplicationTimeout(startApplicationTimeout * timeoutFactor());
// These timeouts are for the same thing - the time needed for the application's handler to
// generate a reply - but one is for the server side, while the other for the client side.
// Having two separate config values would be confusing, so we set the application side to
// 90% of the server side, because the communication overhead is not included there.
{
- int t = replyFromApplicationTimeout;
+ int t = replyFromApplicationTimeout * timeoutFactor();
intentServer->setReplyFromApplicationTimeout(t);
intentClient->setReplyFromApplicationTimeout(t <= 0 ? t : int(t * 0.9));
}
- intentClient->setReplyFromSystemTimeout(replyFromSystemTimeout);
+ intentClient->setReplyFromSystemTimeout(replyFromSystemTimeout * timeoutFactor());
// this way, deleting the server (the return value of this factory function) will get rid
// of both client and server as well as both their AM interfaces
diff --git a/src/tools/testrunner/amtest.cpp b/src/tools/testrunner/amtest.cpp
index 83dd5381..edfbc96a 100644
--- a/src/tools/testrunner/amtest.cpp
+++ b/src/tools/testrunner/amtest.cpp
@@ -126,18 +126,23 @@ QString AmTest::ps(int pid)
{
QProcess process;
process.start(qSL("ps"), QStringList{qSL("--no-headers"), QString::number(pid)});
- if (process.waitForFinished(5000)) {
- QString str = QString::fromLocal8Bit(process.readAllStandardOutput());
- str.chop(1);
- return str;
- }
- return QString();
+ QString str;
+ if (process.waitForFinished(5000 * timeoutFactor()))
+ str = QString::fromLocal8Bit(process.readAllStandardOutput().trimmed());
+ return str;
}
QString AmTest::cmdLine(int pid)
{
QFile file(QString::fromUtf8("/proc/%1/cmdline").arg(pid));
- return file.open(QFile::ReadOnly) ? QString::fromLocal8Bit(file.readLine()) : QString();
+ QString str;
+ if (file.open(QFile::ReadOnly)) {
+ str = QString::fromLocal8Bit(file.readLine().trimmed());
+ int nullPos = str.indexOf(QChar::Null);
+ if (nullPos >= 0)
+ str.truncate(nullPos);
+ }
+ return str;
}
QString AmTest::environment(int pid)
@@ -151,7 +156,7 @@ int AmTest::findChildProcess(int ppid, const QString &substr)
QProcess process;
process.start(qSL("ps"), QStringList{qSL("--ppid"), QString::number(ppid), qSL("-o"),
qSL("pid,args"), qSL("--no-headers")});
- if (process.waitForFinished(5000)) {
+ if (process.waitForFinished(5000 * timeoutFactor())) {
const QString str = QString::fromLocal8Bit(process.readAllStandardOutput());
QRegularExpression re(qSL(" *(\\d*) .*") + substr);
QRegularExpressionMatch match = re.match(str);
diff --git a/tests/main/tst_main.cpp b/tests/main/tst_main.cpp
index a27222ad..75fb5950 100644
--- a/tests/main/tst_main.cpp
+++ b/tests/main/tst_main.cpp
@@ -40,6 +40,7 @@
#include "main.h"
#include "intentserver.h"
#include "intent.h"
+#include "utilities.h"
#include <QtAppManMain/defaultconfiguration.h>
@@ -75,9 +76,11 @@ private:
Main *main{nullptr};
DefaultConfiguration *config{nullptr};
bool m_verbose = false;
+ int m_spyTimeout;
};
tst_Main::tst_Main()
+ : m_spyTimeout(5000 * timeoutFactor())
{
argc = 3;
argv = new char*[argc + 1];
@@ -192,8 +195,7 @@ void tst_Main::installPackage(const QString &pkgPath)
});
packageManager->startPackageInstallation(QUrl::fromLocalFile(pkgPath));
-
- QTRY_VERIFY(installationFinished);
+ QTRY_VERIFY_WITH_TIMEOUT(installationFinished, m_spyTimeout);
}
void tst_Main::removePackage(const QString &id)
@@ -209,8 +211,7 @@ void tst_Main::removePackage(const QString &id)
});
packageManager->removePackage(id, false /* keepDocuments */);
-
- QTRY_VERIFY(removalFinished);
+ QTRY_VERIFY_WITH_TIMEOUT(removalFinished, m_spyTimeout);
}
/*
diff --git a/tests/packageextractor/tst_packageextractor.cpp b/tests/packageextractor/tst_packageextractor.cpp
index 32979bb9..e14b90a7 100644
--- a/tests/packageextractor/tst_packageextractor.cpp
+++ b/tests/packageextractor/tst_packageextractor.cpp
@@ -42,6 +42,7 @@
#include "packageextractor.h"
#include "installationreport.h"
#include "packageutilities.h"
+#include "utilities.h"
#include "../error-checking.h"
@@ -295,7 +296,7 @@ void tst_PackageExtractor::extractFromFifo()
PackageExtractor extractor(QUrl::fromLocalFile(fifo.path()), m_extractDir->path());
QVERIFY2(extractor.extract(), qPrintable(extractor.errorString()));
- QTRY_VERIFY(fifo.isFinished());
+ QTRY_VERIFY_WITH_TIMEOUT(fifo.isFinished(), 5000 * timeoutFactor());
}
int main(int argc, char *argv[])
diff --git a/tests/qml/configs/tst_configs.qml b/tests/qml/configs/tst_configs.qml
index 56f19cda..dcdea25e 100644
--- a/tests/qml/configs/tst_configs.qml
+++ b/tests/qml/configs/tst_configs.qml
@@ -51,6 +51,7 @@ TestCase {
name: "Configs"
visible: true
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
ApplicationIPCInterface {
id: appif
@@ -89,8 +90,8 @@ TestCase {
function cleanup() {
runStateChangedSpy.clear();
ApplicationManager.stopApplication("test.configs.app");
- runStateChangedSpy.wait();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
+ runStateChangedSpy.wait(spyTimeout);
compare(runStateChangedSpy.signalArguments[1][1], ApplicationObject.NotRunning);
}
@@ -98,12 +99,12 @@ TestCase {
compare(NotificationManager.count, 0);
compare(windowAddedSpy.count, 0);
verify(ApplicationManager.startApplication("test.configs.app"))
- windowAddedSpy.wait();
+ windowAddedSpy.wait(spyTimeout);
compare(windowAddedSpy.count, 1);
var window = windowAddedSpy.signalArguments[0][0];
compare(window.windowProperty("prop1"), "foo");
appif.trigger("PropertyChange");
- windowPropertyChangedSpy.wait();
+ windowPropertyChangedSpy.wait(spyTimeout);
compare(windowPropertyChangedSpy.count, 1);
compare(windowPropertyChangedSpy.signalArguments[0][0], window);
compare(window.windowProperty("prop1"), "bar");
@@ -111,16 +112,16 @@ TestCase {
if (!ApplicationManager.systemProperties.nodbus) {
appif.trigger("Notification");
- tryVerify(function() { return NotificationManager.count === 1; });
+ tryVerify(function() { return NotificationManager.count === 1; }, spyTimeout);
compare(NotificationManager.get(0).summary, "Test");
}
window.setWindowProperty("trigger", "now");
- windowPropertyChangedSpy.aboutToBlockWait();
+ windowPropertyChangedSpy.aboutToBlockWait(spyTimeout);
compare(windowPropertyChangedSpy.signalArguments[0][0], window);
compare(window.windowProperty("trigger"), "now");
- windowPropertyChangedSpy.wait();
+ windowPropertyChangedSpy.wait(spyTimeout);
compare(windowPropertyChangedSpy.signalArguments[1][0], window);
compare(window.windowProperty("ack"), "done");
}
diff --git a/tests/qml/crash/tst_crash.qml b/tests/qml/crash/tst_crash.qml
index e41b0c39..c9f2c348 100644
--- a/tests/qml/crash/tst_crash.qml
+++ b/tests/qml/crash/tst_crash.qml
@@ -49,6 +49,7 @@ TestCase {
when: windowShown
name: "Crashtest"
+ property int spyTimeout: 3000 * AmTest.timeoutFactor
property string appId: "tld.test.crash"
property var app: ApplicationManager.application(appId);
@@ -75,11 +76,11 @@ TestCase {
function test_crash(data) {
ApplicationManager.startApplication(appId);
- runStateChangedSpy.wait(3000);
- runStateChangedSpy.wait(3000);
+ runStateChangedSpy.wait(spyTimeout);
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.Running);
ApplicationManager.startApplication(appId, data.tag);
- runStateChangedSpy.wait(3000);
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.NotRunning);
if (data.tag === "gracefully") {
compare(app.lastExitStatus, ApplicationObject.NormalExit);
diff --git a/tests/qml/intents/tst_intents.qml b/tests/qml/intents/tst_intents.qml
index 167e4f02..7b56b135 100644
--- a/tests/qml/intents/tst_intents.qml
+++ b/tests/qml/intents/tst_intents.qml
@@ -51,6 +51,8 @@ TestCase {
when: windowShown
name: "Intents"
+ property int spyTimeout: 1000 * AmTest.timeoutFactor
+
property var stdParams: { "para": "meter" }
property var matchParams: { "list": "a", "int": 42, "string": "foo_x_bar", "complex": { "a": 1 } }
@@ -166,7 +168,10 @@ TestCase {
var req = IntentClient.sendIntentRequest(data.intentId, data.appId, params)
verify(req)
requestSpy.target = req
- tryCompare(requestSpy, "count", 1, 1000)
+ let requestTimeout = spyTimeout
+ if (data.isTimeout)
+ requestTimeout *= 10
+ tryCompare(requestSpy, "count", 1, requestTimeout)
compare(req.succeeded, data.succeeding)
if (req.succeeded) {
compare(req.result, { "from": data.appId, "in": params })
@@ -212,7 +217,7 @@ TestCase {
requestSpy.target = req
if (data.action !== "none") {
- tryCompare(disambiguateSpy, "count", 1, 1000)
+ tryCompare(disambiguateSpy, "count", 1, spyTimeout)
var possibleIntents = disambiguateSpy.signalArguments[0][1]
compare(possibleIntents.length, 2)
compare(possibleIntents[0].intentId, intentId)
@@ -235,7 +240,7 @@ TestCase {
disambiguateSpy.clear()
}
- tryCompare(requestSpy, "count", 1, data.action === "timeout" ? 15000 : 1000)
+ tryCompare(requestSpy, "count", 1, spyTimeout * (data.action === "timeout" ? 15 : 1))
var succeeding = data.succeeding
compare(req.succeeded, succeeding)
if (succeeding) {
diff --git a/tests/qml/lifecycle/tst_lifecycle.qml b/tests/qml/lifecycle/tst_lifecycle.qml
index 538eb709..cbd5863f 100644
--- a/tests/qml/lifecycle/tst_lifecycle.qml
+++ b/tests/qml/lifecycle/tst_lifecycle.qml
@@ -49,6 +49,7 @@ TestCase {
name: "LifeCycleTest"
visible: true
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
property var app: ApplicationManager.application("tld.test.lifecycle");
@@ -97,8 +98,8 @@ TestCase {
var index = AmTest.observeObjectDestroyed(app.runtime);
app.stop();
while (app.runState !== ApplicationObject.NotRunning)
- runStateChangedSpy.wait();
- objectDestroyedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
+ objectDestroyedSpy.wait(spyTimeout);
compare(objectDestroyedSpy.signalArguments[0][0], index);
}
@@ -106,27 +107,27 @@ TestCase {
// Start followed by quick stop/start in single-porcess mode caused an abort in the past
function test_fast_stop_start() {
app.start();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.StartingUp);
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.Running);
objectDestroyedSpy.clear();
var index = AmTest.observeObjectDestroyed(app.runtime);
app.stop();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.ShuttingDown);
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.NotRunning);
app.start();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.StartingUp);
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.Running);
- objectDestroyedSpy.wait();
+ objectDestroyedSpy.wait(spyTimeout);
compare(objectDestroyedSpy.signalArguments[0][0], index);
}
@@ -136,11 +137,11 @@ TestCase {
stopTimer.start();
while (app.runState !== ApplicationObject.NotRunning)
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
app.start();
while (app.runState !== ApplicationObject.Running)
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
}
function test_restart() {
@@ -154,11 +155,11 @@ TestCase {
app.start();
while (app.runState !== ApplicationObject.Running)
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
app.stop();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(app.runState, ApplicationObject.ShuttingDown);
while (app.runState !== ApplicationObject.Running)
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
}
}
diff --git a/tests/qml/processtitle/tst_processtitle.qml b/tests/qml/processtitle/tst_processtitle.qml
index a94b7e86..a4598fbb 100644
--- a/tests/qml/processtitle/tst_processtitle.qml
+++ b/tests/qml/processtitle/tst_processtitle.qml
@@ -50,6 +50,7 @@ TestCase {
name: "ProcessTitle"
visible: true
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
property int sysuiPid
ProcessStatus {
@@ -82,8 +83,8 @@ TestCase {
tryVerify(function() {
pid = AmTest.findChildProcess(sysuiPid, executable + quickArg);
return pid
- });
- wait(250);
+ }, spyTimeout);
+ wait(250 * AmTest.timeoutFactor);
verify(AmTest.cmdLine(pid).endsWith(executable + quickArg));
} else {
sigIdx = 1;
@@ -92,9 +93,9 @@ TestCase {
runStateChangedSpy.clear();
verify(ApplicationManager.startApplication(data.appId));
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
if (sigIdx === 1)
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
compare(runStateChangedSpy.signalArguments[sigIdx][0], data.appId);
compare(runStateChangedSpy.signalArguments[sigIdx][1], ApplicationObject.Running);
@@ -109,8 +110,8 @@ TestCase {
runStateChangedSpy.clear();
ApplicationManager.stopAllApplications();
- runStateChangedSpy.wait();
- runStateChangedSpy.wait();
+ runStateChangedSpy.wait(spyTimeout);
+ runStateChangedSpy.wait(spyTimeout);
compare(runStateChangedSpy.signalArguments[1][1], ApplicationObject.NotRunning);
}
}
diff --git a/tests/qml/quicklaunch/tst_quicklaunch.qml b/tests/qml/quicklaunch/tst_quicklaunch.qml
index 6a8bbcdf..287ec488 100644
--- a/tests/qml/quicklaunch/tst_quicklaunch.qml
+++ b/tests/qml/quicklaunch/tst_quicklaunch.qml
@@ -51,6 +51,7 @@ TestCase {
when: windowShown
name: "Quicklaunch"
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
property bool acknowledged: false
SignalSpy {
@@ -74,27 +75,27 @@ TestCase {
var app = ApplicationManager.application("tld.test.quicklaunch");
runStateChangedSpy.target = app;
- wait(1000);
+ wait(1000 * AmTest.timeoutFactor);
// Check for quick-launching is done every second in appman. After 1s now, this test
// sometimes caused some race where the app would not be started at all in the past:
app.start();
- windowAddedSpy.wait(3000);
- tryCompare(testCase, "acknowledged", true);
+ windowAddedSpy.wait(spyTimeout);
+ tryCompare(testCase, "acknowledged", true, spyTimeout);
runStateChangedSpy.clear();
app.stop(true);
- runStateChangedSpy.wait(3000); // wait for ShuttingDown
- runStateChangedSpy.wait(3000); // wait for NotRunning
+ runStateChangedSpy.wait(spyTimeout); // wait for ShuttingDown
+ runStateChangedSpy.wait(spyTimeout); // wait for NotRunning
- wait(1000);
+ wait(1000 * AmTest.timeoutFactor);
// Unfortunately there is no reliable means to determine, whether a quicklaunch process
// is running, but after at least 2s now, there should be a process that can be attached to.
acknowledged = false;
app.start();
- windowAddedSpy.wait(3000);
- tryCompare(testCase, "acknowledged", true);
+ windowAddedSpy.wait(spyTimeout);
+ tryCompare(testCase, "acknowledged", true, spyTimeout);
runStateChangedSpy.clear();
app.stop(true);
- runStateChangedSpy.wait(3000); // wait for ShuttingDown
- runStateChangedSpy.wait(3000); // wait for NotRunning
+ runStateChangedSpy.wait(spyTimeout); // wait for ShuttingDown
+ runStateChangedSpy.wait(spyTimeout); // wait for NotRunning
}
}
diff --git a/tests/qml/resources/tst_resource.qml b/tests/qml/resources/tst_resource.qml
index 36b47dfb..7451e404 100644
--- a/tests/qml/resources/tst_resource.qml
+++ b/tests/qml/resources/tst_resource.qml
@@ -70,23 +70,23 @@ TestCase {
}
function test_basic(data) {
- wait(1200); // wait for quicklaunch
+ wait(1200 * AmTest.timeoutFactor); // wait for quicklaunch
var app = ApplicationManager.application(data.tag);
windowPropertyChangedSpy.clear();
app.start();
while (app.runState !== ApplicationObject.Running)
- runStateChangedSpy.wait(3000);
+ runStateChangedSpy.wait(3000 * AmTest.timeoutFactor);
if (data.tag === "app2") {
- windowPropertyChangedSpy.wait(2000);
+ windowPropertyChangedSpy.wait(2000 * AmTest.timeoutFactor);
compare(windowPropertyChangedSpy.count, 1);
compare(windowPropertyChangedSpy.signalArguments[0][0].windowProperty("meaning"), 42);
}
app.stop();
while (app.runState !== ApplicationObject.NotRunning)
- runStateChangedSpy.wait(3000);
+ runStateChangedSpy.wait(3000 * AmTest.timeoutFactor);
}
}
diff --git a/tests/qml/simple/tst_applicationmanager.qml b/tests/qml/simple/tst_applicationmanager.qml
index a974c5c8..92718be0 100644
--- a/tests/qml/simple/tst_applicationmanager.qml
+++ b/tests/qml/simple/tst_applicationmanager.qml
@@ -81,7 +81,7 @@ TestCase {
function initTestCase() {
//Wait for the debugging wrappers to be setup.
- wait(2000);
+ wait(2000 * AmTest.timeoutFactor);
WindowManager.windowAdded.connect(windowHandler.windowAddedHandler)
WindowManager.windowContentStateChanged.connect(windowHandler.windowContentStateChangedHandler)
@@ -224,7 +224,7 @@ TestCase {
appModelCountSpy.clear();
appModel.filterFunction = function(app) { return app.capabilities.indexOf("cameraAccess") >= 0; };
- appModelCountSpy.wait(1000);
+ appModelCountSpy.wait(1000 * AmTest.timeoutFactor);
compare(appModelCountSpy.count, 1);
compare(appModel.count, 1);
compare(appModel.indexOfApplication(capsApplication.id), 0);
@@ -290,7 +290,7 @@ TestCase {
function checkApplicationState(id, state) {
if (runStateChangedSpy.count < 1)
- runStateChangedSpy.wait(10000);
+ runStateChangedSpy.wait(10000 * AmTest.timeoutFactor);
verify(runStateChangedSpy.count)
compare(runStateChangedSpy.signalArguments[0][0], id)
compare(runStateChangedSpy.signalArguments[0][1], state)
@@ -398,7 +398,7 @@ TestCase {
ApplicationManager.stopAllApplications(data.forceKill);
while (runStateChangedSpy.count < 4)
- runStateChangedSpy.wait(10000);
+ runStateChangedSpy.wait(10000 * AmTest.timeoutFactor);
var args = runStateChangedSpy.signalArguments
diff --git a/tests/qml/windowitem/tst_windowitem.qml b/tests/qml/windowitem/tst_windowitem.qml
index 94c3675c..4f67a209 100644
--- a/tests/qml/windowitem/tst_windowitem.qml
+++ b/tests/qml/windowitem/tst_windowitem.qml
@@ -50,6 +50,8 @@ Item {
height: 500
visible: true
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
+
Repeater {
id: windowItemsRepeater
model: ListModel { id: windowItemsModel }
@@ -149,7 +151,7 @@ Item {
}
if (numRunningApps > 0) {
- wait(50);
+ wait(100 * AmTest.timeoutFactor);
} else
break;
}
@@ -169,8 +171,8 @@ Item {
app = ApplicationManager.application("test.windowitem.app");
app.start();
- tryCompare(root.chosenModel, "count", 1);
- tryCompare(WindowManager, "count", 1);
+ tryCompare(root.chosenModel, "count", 1, spyTimeout);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
}
/*
@@ -225,7 +227,9 @@ Item {
Check that once the primary WindowItem is destroyed,
the remaining one takes over the primary role.
*/
- function test_destroyPrimaryRemainingTakesOver() {
+ // the function is called 'x*' on purpose: QML tests are executed in alphabetical
+ // order and running this directly after the close* functions crashes in RHI
+ function test_xdestroyPrimaryRemainingTakesOver() {
initWindowItemsModel();
var firstWindowItem = windowItemsRepeater.itemAt(0);
@@ -246,7 +250,7 @@ Item {
compare(windowItemsModel.count, 1);
// And the remaining item takes over the primary role.
- tryCompare(secondWindowItem, "primary", true);
+ tryCompare(secondWindowItem, "primary", true, spyTimeout);
}
/*
@@ -271,9 +275,9 @@ Item {
// The WindowObject should still exist, albeit without a surface, even though
// no longer present in WindowManager's model.
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
compare(objectDestroyedSpy.count, 0)
- tryCompare(window, "contentState", WindowObject.NoSurface);
+ tryCompare(window, "contentState", WindowObject.NoSurface, spyTimeout);
// Destroy all WindowItems
firstWindowItem = null;
@@ -282,7 +286,7 @@ Item {
// Now that there are no WindowItems using that WindowObject anymore, it should
// eventually be deleted by WindowManager
- objectDestroyedSpy.wait();
+ objectDestroyedSpy.wait(spyTimeout);
compare(objectDestroyedSpy.signalArguments[0][0], destroyId);
}
@@ -314,13 +318,13 @@ Item {
window.setWindowProperty("requestedWidth", width);
window.setWindowProperty("requestedHeight", height);
- tryCompare(window, "size", Qt.size(width,height));
- tryCompare(windowItem, "width", width);
- tryCompare(windowItem, "height", height);
+ tryCompare(window, "size", Qt.size(width,height), spyTimeout);
+ tryCompare(windowItem, "width", width, spyTimeout);
+ tryCompare(windowItem, "height", height, spyTimeout);
width += 5;
height += 5;
- wait(10);
+ wait(50 * AmTest.timeoutFactor);
}
}
@@ -334,7 +338,7 @@ Item {
var windowItem = sizedWindowItemsRepeater.itemAt(0);
var window = windowItem.window
- tryCompare(window, "size", Qt.size(windowItem.width, windowItem.height));
+ tryCompare(window, "size", Qt.size(windowItem.width, windowItem.height), spyTimeout);
}
/*
@@ -349,15 +353,15 @@ Item {
windowItem.width = 200;
windowItem.height = 100;
- tryCompare(window, "size", Qt.size(200, 100));
+ tryCompare(window, "size", Qt.size(200, 100), spyTimeout);
windowItem.width = 201;
windowItem.height = 101;
- tryCompare(window, "size", Qt.size(201, 101));
+ tryCompare(window, "size", Qt.size(201, 101), spyTimeout);
windowItem.width = 202;
windowItem.height = 102;
- tryCompare(window, "size", Qt.size(202, 102));
+ tryCompare(window, "size", Qt.size(202, 102), spyTimeout);
}
/*
@@ -373,15 +377,15 @@ Item {
windowItem.width = 200;
windowItem.height = 100;
- tryCompare(window, "size", Qt.size(123, 321));
+ tryCompare(window, "size", Qt.size(123, 321), spyTimeout);
windowItem.width = 201;
windowItem.height = 101;
- tryCompare(window, "size", Qt.size(123, 321));
+ tryCompare(window, "size", Qt.size(123, 321), spyTimeout);
windowItem.width = 202;
windowItem.height = 102;
- tryCompare(window, "size", Qt.size(123, 321));
+ tryCompare(window, "size", Qt.size(123, 321), spyTimeout);
}
/*
@@ -396,7 +400,7 @@ Item {
app.stop();
- tryCompare(window, "contentState", WindowObject.NoSurface);
+ tryCompare(window, "contentState", WindowObject.NoSurface, spyTimeout);
window.close();
}
@@ -415,8 +419,8 @@ Item {
app = ApplicationManager.application("test.windowitem.multiwin");
app.start();
- tryCompare(windowItemsModel, "count", 2);
- tryCompare(WindowManager, "count", 2);
+ tryCompare(windowItemsModel, "count", 2, spyTimeout);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
var firstWindow = windowItemsModel.get(0).window;
var secondWindow = windowItemsModel.get(1).window;
@@ -426,19 +430,19 @@ Item {
firstWindow.close();
- tryCompare(firstWindow, "contentState", WindowObject.NoSurface);
+ tryCompare(firstWindow, "contentState", WindowObject.NoSurface, spyTimeout);
windowItemsModel.remove(0);
firstWindow = null;
- wait(100);
+ wait(100 * AmTest.timeoutFactor);
compare(app.runState, Am.Running);
compare(secondWindow.contentState, WindowObject.SurfaceWithContent);
secondWindow.close();
- tryCompare(secondWindow, "contentState", WindowObject.NoSurface);
- tryCompare(app, "runState", Am.NotRunning);
+ tryCompare(secondWindow, "contentState", WindowObject.NoSurface, spyTimeout);
+ tryCompare(app, "runState", Am.NotRunning, spyTimeout);
}
/*
@@ -457,7 +461,7 @@ Item {
// There's nothing in front of the wayland item (at least nothing visible).
// The touch event will reach it.
- tryVerify(function() { return window.windowProperty("clickCount") === 1; });
+ tryVerify(function() { return window.windowProperty("clickCount") === 1; }, spyTimeout);
compare(windowItem.clickCount, 0);
windowItem.mouseAreaVisible = true;
@@ -467,7 +471,7 @@ Item {
// Since a visible MouseArea is now in front of WindowItem's internal wayland item
// the second touch event was caught by that MouseArea instead.
- tryCompare(windowItem, "clickCount", 1);
+ tryCompare(windowItem, "clickCount", 1, spyTimeout);
compare(window.windowProperty("clickCount"), 1);
}
@@ -486,7 +490,7 @@ Item {
app.stop();
- tryCompare(window, "contentState", WindowObject.NoSurface);
+ tryCompare(window, "contentState", WindowObject.NoSurface, spyTimeout);
compare(window.windowProperty("foo"), "bar");
}
}
diff --git a/tests/qml/windowitem2/tst_windowitem2.qml b/tests/qml/windowitem2/tst_windowitem2.qml
index 43f5ac9b..b3773afb 100644
--- a/tests/qml/windowitem2/tst_windowitem2.qml
+++ b/tests/qml/windowitem2/tst_windowitem2.qml
@@ -102,7 +102,7 @@ Item {
}
if (numRunningApps > 0) {
- wait(50);
+ wait(100 * AmTest.timeoutFactor);
} else
break;
}
@@ -131,8 +131,8 @@ Item {
var app = ApplicationManager.application("test.windowitem2.app");
app.start();
- tryVerify(function() { return windowItem.window !== null });
- wait(50);
+ tryVerify(function() { return windowItem.window !== null }, 5000 * AmTest.timeoutFactor);
+ wait(100 * AmTest.timeoutFactor);
app.stop();
}
diff --git a/tests/qml/windowmanager/tst_windowmanager.qml b/tests/qml/windowmanager/tst_windowmanager.qml
index 11cb9265..2ef90c0b 100644
--- a/tests/qml/windowmanager/tst_windowmanager.qml
+++ b/tests/qml/windowmanager/tst_windowmanager.qml
@@ -65,7 +65,7 @@ TestCase {
if (!ApplicationManager.windowManagerCompositorReady) {
var extnull = Qt.createComponent("IviApplicationExtension.qml").createObject(null).addExtension();
compare(extnull, null);
- windowManagerCompositorReadyChangedSpy.wait(2000);
+ windowManagerCompositorReadyChangedSpy.wait(2000 * AmTest.timeoutFactor);
verify(ApplicationManager.windowManagerCompositorReady);
}
var extension = Qt.createComponent("IviApplicationExtension.qml").createObject(null).addExtension();
diff --git a/tests/qml/windowmapping/tst_windowmapping.qml b/tests/qml/windowmapping/tst_windowmapping.qml
index a0dfe468..63a3c00e 100644
--- a/tests/qml/windowmapping/tst_windowmapping.qml
+++ b/tests/qml/windowmapping/tst_windowmapping.qml
@@ -50,7 +50,8 @@ TestCase {
name: "WindowMapping"
visible: true
- property var lastWindowAdded;
+ property int spyTimeout: 5000 * AmTest.timeoutFactor
+ property var lastWindowAdded
WindowItem {
id: chrome
@@ -127,7 +128,7 @@ TestCase {
}
if (numRunningApps > 0) {
- wait(2000);
+ wait(2000 * AmTest.timeoutFactor);
} else
break;
}
@@ -141,71 +142,71 @@ TestCase {
compare(windowAddedSpy.count, 0);
app.start("show-main");
- tryCompare(windowAddedSpy, "count", 1);
+ tryCompare(windowAddedSpy, "count", 1, spyTimeout);
compare(windowAboutToBeRemovedSpy.count, 0);
app.stop();
- tryCompare(windowAboutToBeRemovedSpy, "count", 1);
+ tryCompare(windowAboutToBeRemovedSpy, "count", 1, spyTimeout);
}
function test_amwin_advanced() {
var app = ApplicationManager.application("test.winmap.amwin2");
app.start("show-sub");
- wait(2000);
+ wait(2000 * AmTest.timeoutFactor);
compare(WindowManager.count, 0);
app.start("show-main");
- tryCompare(WindowManager, "count", 2);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
}
function test_amwin_loader() {
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
var app = ApplicationManager.application("test.winmap.loader");
app.start("show-sub");
- tryCompare(WindowManager, "count", 2);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
app.start("hide-sub");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
app.start("show-sub");
- tryCompare(WindowManager, "count", 2);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
}
function test_amwin_peculiarities() {
var app = ApplicationManager.application("test.winmap.amwin2");
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
app.start("show-main");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
app.start("show-sub");
- tryCompare(WindowManager, "count", 2);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
// Single- vs. multiprocess difference:
app.start("show-sub2");
var expectedWindowCount;
// A Window's effective visible state solely depends on Window hierarchy.
expectedWindowCount = 3;
- tryCompare(WindowManager, "count", expectedWindowCount);
+ tryCompare(WindowManager, "count", expectedWindowCount, spyTimeout);
app.start("hide-sub");
expectedWindowCount -= 1;
- tryCompare(WindowManager, "count", expectedWindowCount);
+ tryCompare(WindowManager, "count", expectedWindowCount, spyTimeout);
// Make child (sub) window visible again, parent (main) window is still visible
app.start("show-sub");
expectedWindowCount += 1;
- tryCompare(WindowManager, "count", expectedWindowCount);
+ tryCompare(WindowManager, "count", expectedWindowCount, spyTimeout);
// This is weird Window behavior: a child window becomes only visible, when the parent
// window is visible, but when you change the parent window back to invisible, the child
// will NOT become invisible.
app.start("hide-main");
expectedWindowCount -= 1;
- tryCompare(WindowManager, "count", expectedWindowCount);
+ tryCompare(WindowManager, "count", expectedWindowCount, spyTimeout);
// Single- vs. multiprocess difference:
app.start("hide-sub");
@@ -214,9 +215,9 @@ TestCase {
} else {
// This is even more weird Window behavior: when the parent window is invisible, it is
// not possible any more to explicitly set the child window to invisible.
- wait(50);
+ wait(50 * AmTest.timeoutFactor);
}
- tryCompare(WindowManager, "count", expectedWindowCount);
+ tryCompare(WindowManager, "count", expectedWindowCount, spyTimeout);
}
function test_default_data() {
@@ -235,11 +236,11 @@ TestCase {
var app = ApplicationManager.application(data.appId);
verify(chrome.window === null);
app.start();
- tryCompare(WindowManager, "count", 1);
- tryVerify(function () { return chrome.window !== null });
+ tryCompare(WindowManager, "count", 1, spyTimeout);
+ tryVerify(function () { return chrome.window !== null }, spyTimeout);
app.stop();
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
}
function test_mapping_data() {
@@ -258,16 +259,16 @@ TestCase {
compare(WindowManager.count, 0);
app.start("show-main");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
app.start("show-sub");
- tryCompare(WindowManager, "count", 2);
+ tryCompare(WindowManager, "count", 2, spyTimeout);
app.start("hide-sub");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
app.stop();
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
}
function test_wayland_ping_pong() {
@@ -278,12 +279,12 @@ TestCase {
AmTest.ignoreMessage(AmTest.CriticalMsg, /Stopping application.*because we did not receive a Wayland-Pong/);
app.start();
- tryCompare(app, "runState", Am.Running);
+ tryCompare(app, "runState", Am.Running, spyTimeout);
runStateChangedSpy.clear();
- wait(2200);
- runStateChangedSpy.wait(2000);
+ wait(2200 * AmTest.timeoutFactor);
+ runStateChangedSpy.wait(spyTimeout);
compare(runStateChangedSpy.signalArguments[0][1], Am.ShuttingDown);
- runStateChangedSpy.wait(2000);
+ runStateChangedSpy.wait(spyTimeout);
compare(runStateChangedSpy.signalArguments[1][1], Am.NotRunning);
}
@@ -292,17 +293,17 @@ TestCase {
windowPropertyChangedSpy.clear();
app.start();
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
app.start("show-main");
- windowPropertyChangedSpy.wait(2000);
+ windowPropertyChangedSpy.wait(spyTimeout);
compare(windowPropertyChangedSpy.count, 1);
compare(lastWindowAdded.windowProperty("key1"), "val1");
compare(lastWindowAdded.windowProperty("objectName"), 42);
lastWindowAdded.setWindowProperty("key2", "val2");
- windowPropertyChangedSpy.wait(2000);
+ windowPropertyChangedSpy.wait(spyTimeout);
compare(windowPropertyChangedSpy.count, 2);
var allProps = lastWindowAdded.windowProperties()
@@ -318,14 +319,14 @@ TestCase {
var app = ApplicationManager.application("test.winmap.amwin");
app.start("show-main");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
compare(lastWindowAdded.windowProperty("objectName"), 42);
app.start("hide-main");
- tryCompare(WindowManager, "count", 0);
+ tryCompare(WindowManager, "count", 0, spyTimeout);
app.start("show-main");
- tryCompare(WindowManager, "count", 1);
+ tryCompare(WindowManager, "count", 1, spyTimeout);
compare(lastWindowAdded.windowProperty("objectName"), 42);
}