on xenial help sign in
fix closing surfaces in tests under high cpu load
8a4d67cMichael Zanetti
qml/Components/Dialogs.qml+2−2
@@ -51,8 +51,8 @@ Item {
51 var comp = Qt.createComponent(Qt.resolvedUrl("ModeSwitchWarningDialog.qml"))
51 var comp = Qt.createComponent(Qt.resolvedUrl("ModeSwitchWarningDialog.qml"))
52 d.modeSwitchWarningPopup = comp.createObject(root, {model: legacyAppsModel});
52 d.modeSwitchWarningPopup = comp.createObject(root, {model: legacyAppsModel});
53 d.modeSwitchWarningPopup.forceClose.connect(function() {
53 d.modeSwitchWarningPopup.forceClose.connect(function() {
54− while (legacyAppsModel.count > 0) {
54+ for (var i = legacyAppsModel.count - 1; i >= 0; i--) {
55− ApplicationManager.stopApplication(legacyAppsModel.get(0).appId);
55+ ApplicationManager.stopApplication(legacyAppsModel.get(i).appId);
56 }
56 }
57 d.modeSwitchWarningPopup.hide();
57 d.modeSwitchWarningPopup.hide();
58 d.modeSwitchWarningPopup.destroy();
58 d.modeSwitchWarningPopup.destroy();
tests/mocks/Unity/Application/MirSurface.cpp+4−2
@@ -402,8 +402,10 @@ void MirSurface::raise()
402void MirSurface::close()
402void MirSurface::close()
403{
403{
404 DEBUG_MSG("");
404 DEBUG_MSG("");
405+ if (!m_zombieTimer.isActive()) {
405− m_zombieTimer.start();
406+ m_zombieTimer.start();
406− Q_EMIT closeRequested();
407+ Q_EMIT closeRequested();
408+ }
407}
409}
408
410
409void MirSurface::createPromptSurface()
411void MirSurface::createPromptSurface()
tests/qmltests/tst_Shell.qml+3−3
@@ -2156,14 +2156,14 @@ Rectangle {
2156
2156
2157 // Popup must be gone now
2157 // Popup must be gone now
2158 popup = findChild(root, "modeSwitchWarningDialog");
2158 popup = findChild(root, "modeSwitchWarningDialog");
2159− compare(popup === null, true);
2159+ tryCompareFunction(function() { return popup === null}, true);
2160
2160
2161 if (data.replug) {
2161 if (data.replug) {
2162 // Libreoffice must still be running
2162 // Libreoffice must still be running
2163 compare(ApplicationManager.findApplication("libreoffice") !== null, true);
2163 compare(ApplicationManager.findApplication("libreoffice") !== null, true);
2164 } else {
2164 } else {
2165− // Libreoffice must be gone now
2165+ // Libreoffice must be gone now (or soon at least)
2166− compare(ApplicationManager.findApplication("libreoffice") === null, true);
2166+ tryCompareFunction(function() { return ApplicationManager.findApplication("libreoffice") === null}, true);
2167 }
2167 }
2168 }
2168 }
2169
2169