summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/xdgshellv6
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-06-05 16:16:13 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-06-07 07:57:16 +0000
commitaaedbabcc9096e458b2bef6c2b03586939de6871 (patch)
tree51b090a1e03f6d650ce525c941533594ee803830 /tests/auto/client/xdgshellv6
parent6b65b9da479974b88dc00dfe8ebb67f94eca9e35 (diff)
Client: Add tests for xdg-shell v6 window geometry
Change-Id: Ifb7a1d63a136349cd99d516e63732b4393967468 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client/xdgshellv6')
-rw-r--r--tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
index 070a9a34c..91679cb57 100644
--- a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
+++ b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
@@ -99,6 +99,8 @@ private slots:
void unsetMaximized();
void focusWindowFollowsConfigure();
void windowStateChangedEvents();
+ void windowGeometrySimple();
+ void windowGeometryFixed();
private:
MockCompositor *m_compositor = nullptr;
@@ -317,6 +319,47 @@ void tst_WaylandClientXdgShellV6::windowStateChangedEvents()
}
}
+void tst_WaylandClientXdgShellV6::windowGeometrySimple()
+{
+ QWindow window;
+ window.show();
+
+ QSharedPointer<MockXdgToplevelV6> toplevel;
+ QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
+ QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect)));
+
+ m_compositor->sendXdgToplevelV6Configure(toplevel);
+ QTRY_COMPARE(geometrySpy.count(), 1);
+ QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), window.frameGeometry().size());
+
+ m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456));
+ QTRY_COMPARE(geometrySpy.count(), 1);
+ QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), QSize(123, 456));
+}
+
+void tst_WaylandClientXdgShellV6::windowGeometryFixed()
+{
+ QWindow window;
+ window.resize(QSize(1337, 137));
+ window.setMaximumSize(window.size());
+ window.setMinimumSize(window.size());
+ window.show();
+
+ QSharedPointer<MockXdgToplevelV6> toplevel;
+ QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
+ QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect)));
+
+ m_compositor->sendXdgToplevelV6Configure(toplevel);
+ QTRY_COMPARE(geometrySpy.count(), 1);
+ QRect initialWindowGeometry = geometrySpy.takeFirst().at(0).toRect();
+ QCOMPARE(initialWindowGeometry.size(), window.frameGeometry().size());
+
+ m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456));
+ QTRY_COMPARE(geometrySpy.count(), 1);
+ // Configuring the window should not change the window geometry
+ QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size());
+}
+
int main(int argc, char **argv)
{
setenv("XDG_RUNTIME_DIR", ".", 1);