summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/manager-lib/fakeapplicationmanagerwindow.cpp10
-rw-r--r--tests/qml/windowmapping/tst_windowmapping.qml57
2 files changed, 38 insertions, 29 deletions
diff --git a/src/manager-lib/fakeapplicationmanagerwindow.cpp b/src/manager-lib/fakeapplicationmanagerwindow.cpp
index c6a8a736..6a8c6b87 100644
--- a/src/manager-lib/fakeapplicationmanagerwindow.cpp
+++ b/src/manager-lib/fakeapplicationmanagerwindow.cpp
@@ -74,6 +74,7 @@ FakeApplicationManagerWindow::FakeApplicationManagerWindow(QQuickItem *parent)
, m_windowProperties(new QObject)
{
setFlag(ItemHasContents);
+ setClip(true);
connect(this, &QQuickItem::visibleChanged, this, &FakeApplicationManagerWindow::onVisibleChanged);
m_windowProperties.data()->installEventFilter(this);
@@ -97,8 +98,13 @@ void FakeApplicationManagerWindow::setFakeVisible(bool visible)
if (visible != m_fakeVisible) {
m_fakeVisible = visible;
setVisible(visible);
- if (m_surfaceItem)
+ if (m_surfaceItem) {
m_surfaceItem->setVisible(visible);
+ if (m_runtime && !visible)
+ m_runtime->removeWindow(m_surfaceItem);
+ } else {
+ visibleChanged();
+ }
}
}
@@ -246,7 +252,7 @@ void FakeApplicationManagerWindow::componentComplete()
void FakeApplicationManagerWindow::onVisibleChanged()
{
- if (m_runtime && isVisible())
+ if (m_runtime && isVisible() && !m_surfaceItem)
m_runtime->addWindow(this);
}
diff --git a/tests/qml/windowmapping/tst_windowmapping.qml b/tests/qml/windowmapping/tst_windowmapping.qml
index 0ea7a81c..6964fb09 100644
--- a/tests/qml/windowmapping/tst_windowmapping.qml
+++ b/tests/qml/windowmapping/tst_windowmapping.qml
@@ -133,10 +133,7 @@ TestCase {
windowLostSpy.clear();
}
- function test_amwin_mp_only() {
- if (ApplicationManager.singleProcess)
- skip("Test shows differences in single-process mode (and hence would fail)");
-
+ function test_amwin_peculiarities() {
var appId = "test.winmap.amwin2";
ApplicationManager.startApplication(appId, "show-main");
windowReadySpy.wait(3000);
@@ -148,16 +145,20 @@ TestCase {
compare(windowReadySpy.count, 1);
windowReadySpy.clear();
- // This part would fail, because sub-window 2 has an invisible Rectangle as parent and
- // hence the effective visible state is false in the current implementation of
- // FakeApplicationManagerWindow. Consequently no windowReady signal will be emitted.
+ // Single- vs. multiprocess difference:
ApplicationManager.startApplication(appId, "show-sub2");
- windowReadySpy.wait(3000);
- compare(windowReadySpy.count, 1);
- windowReadySpy.clear();
+ if (ApplicationManager.singleProcess) {
+ // Sub-window 2 has an invisible Rectangle as parent and hence the effective
+ // visible state is false. Consequently no windowReady signal will be emitted.
+ wait(2000);
+ compare(windowLostSpy.count, 0);
+ } else {
+ // A Window's effective visible state solely depends on Window hierarchy.
+ windowReadySpy.wait(3000);
+ compare(windowReadySpy.count, 1);
+ windowReadySpy.clear();
+ }
- // This part would fail, because FakeApplicationManagerWindow will not send
- // windowClosing/windowLost signals when the window is set to invisible.
ApplicationManager.startApplication(appId, "hide-sub");
windowLostSpy.wait(2000);
compare(windowLostSpy.count, 1);
@@ -177,11 +178,18 @@ TestCase {
compare(windowLostSpy.count, 1);
windowLostSpy.clear();
- // 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.
+ // Single- vs. multiprocess difference:
ApplicationManager.startApplication(appId, "hide-sub");
- wait(2000);
- compare(windowLostSpy.count, 0);
+ if (ApplicationManager.singleProcess) {
+ windowLostSpy.wait(2000);
+ compare(windowLostSpy.count, 1);
+ windowLostSpy.clear();
+ } 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(2000);
+ compare(windowLostSpy.count, 0);
+ }
ApplicationManager.stopApplication(appId);
ensureAppTerminated(appId);
@@ -240,20 +248,15 @@ TestCase {
windowReadySpy.clear();
compare(subChrome.children.length, 1);
- var openWindows = 2;
- // visible handling needs to be fixed for single process mode (AUTOSUITE-131):
- if (!ApplicationManager.singleProcess) {
- ApplicationManager.startApplication(appId, "hide-sub");
- windowLostSpy.wait(2000);
- compare(windowLostSpy.count, 1);
- windowLostSpy.clear();
- openWindows = 1;
- compare(subChrome.children.length, 0);
- }
+ ApplicationManager.startApplication(appId, "hide-sub");
+ windowLostSpy.wait(2000);
+ compare(windowLostSpy.count, 1);
+ windowLostSpy.clear();
+ compare(subChrome.children.length, 0);
ApplicationManager.stopApplication(appId);
windowLostSpy.wait(2000);
- compare(windowLostSpy.count, openWindows);
+ compare(windowLostSpy.count, 1);
windowLostSpy.clear();
ensureAppTerminated(appId);
}