summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@pelagicore.com>2017-11-07 16:53:48 +0100
committerBernd Weimer <bernd.weimer@pelagicore.com>2017-11-28 08:19:08 +0000
commit8f8b4078bd2adcf6963b5a5c248cfa7251b7b299 (patch)
tree0b446e4a08895e768d65a4ca960591c6a3d52687
parente6d5d275f3fa7057701c19b3a399a49dcd073e51 (diff)
Improve in-process window mapping
WindowManager signal emission is done more aligned with the multi- process case, windowClosing and windowLost signals will be emitted. Changing the surface container's visible state on the systemUI side will not be propagated to the application (e.g. no second windowReady signal when the surface container changes from invisible to visible). Also set clipping in FakeApplicationManagerWindow to true, since real windows also do clip. Task-number: AUTOSUITE-131 Change-Id: I789ed4f7b308c828b9b0cb8cb8fd754d8c9c5b9a Reviewed-by: Thomas Senyk <thomas.senyk@pelagicore.com> Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-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);
}