on xenial help sign in
fix closing surfaces in tests under high cpu load
commit8a4d67c6c99e0f086bcc5ec9b85a3568efc13d8a authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 21 Apr 2016, 15:33 (11 years ago) parente97d5b6
3 files changed+9−7
qml/Components/Dialogs.qml+2−2 tests/mocks/Unity/Application/MirSurface.cpp+4−2 tests/qmltests/tst_Shell.qml+3−3
qml/Components/Dialogs.qml+2−2
@@ -51,8 +51,8 @@ Item {
5151 var comp = Qt.createComponent(Qt.resolvedUrl("ModeSwitchWarningDialog.qml"))
5252 d.modeSwitchWarningPopup = comp.createObject(root, {model: legacyAppsModel});
5353 d.modeSwitchWarningPopup.forceClose.connect(function() {
54− while (legacyAppsModel.count > 0) {
55− ApplicationManager.stopApplication(legacyAppsModel.get(0).appId);
54+ for (var i = legacyAppsModel.count - 1; i >= 0; i--) {
55+ ApplicationManager.stopApplication(legacyAppsModel.get(i).appId);
5656 }
5757 d.modeSwitchWarningPopup.hide();
5858 d.modeSwitchWarningPopup.destroy();
tests/mocks/Unity/Application/MirSurface.cpp+4−2
@@ -402,8 +402,10 @@ void MirSurface::raise()
402402void MirSurface::close()
403403{
404404 DEBUG_MSG("");
405− m_zombieTimer.start();
406− Q_EMIT closeRequested();
405+ if (!m_zombieTimer.isActive()) {
406+ m_zombieTimer.start();
407+ Q_EMIT closeRequested();
408+ }
407409}
408410
409411void MirSurface::createPromptSurface()
tests/qmltests/tst_Shell.qml+3−3
@@ -2156,14 +2156,14 @@ Rectangle {
21562156
21572157 // Popup must be gone now
21582158 popup = findChild(root, "modeSwitchWarningDialog");
2159− compare(popup === null, true);
2159+ tryCompareFunction(function() { return popup === null}, true);
21602160
21612161 if (data.replug) {
21622162 // Libreoffice must still be running
21632163 compare(ApplicationManager.findApplication("libreoffice") !== null, true);
21642164 } else {
2165− // Libreoffice must be gone now
2166− compare(ApplicationManager.findApplication("libreoffice") === null, true);
2165+ // Libreoffice must be gone now (or soon at least)
2166+ tryCompareFunction(function() { return ApplicationManager.findApplication("libreoffice") === null}, true);
21672167 }
21682168 }
21692169