Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/struts_test.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | |||||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | void StrutsTest::testWaylandStruts_data() | 105 | void StrutsTest::testWaylandStruts_data() | ||
106 | { | 106 | { | ||
107 | QTest::addColumn<QVector<QRect>>("windowGeometries"); | 107 | QTest::addColumn<QVector<QRect>>("windowGeometries"); | ||
108 | QTest::addColumn<QRect>("screen0Maximized"); | 108 | QTest::addColumn<QRect>("screen0Maximized"); | ||
109 | QTest::addColumn<QRect>("screen1Maximized"); | 109 | QTest::addColumn<QRect>("screen1Maximized"); | ||
110 | QTest::addColumn<QRect>("workArea"); | 110 | QTest::addColumn<QRect>("workArea"); | ||
111 | QTest::addColumn<QRegion>("restrictedMoveArea"); | ||||
111 | 112 | | |||
112 | QTest::newRow("bottom/0") << QVector<QRect>{QRect(0, 992, 1280, 32)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 992); | 113 | QTest::newRow("bottom/0") << QVector<QRect>{QRect(0, 992, 1280, 32)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 992) << QRegion(0, 992, 1280, 32); | ||
113 | QTest::newRow("bottom/1") << QVector<QRect>{QRect(1280, 992, 1280, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 992) << QRect(0, 0, 2560, 992); | 114 | QTest::newRow("bottom/1") << QVector<QRect>{QRect(1280, 992, 1280, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 992) << QRect(0, 0, 2560, 992) << QRegion(1280, 992, 1280, 32); | ||
114 | QTest::newRow("top/0") << QVector<QRect>{QRect(0, 0, 1280, 32)} << QRect(0, 32, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 32, 2560, 992); | 115 | QTest::newRow("top/0") << QVector<QRect>{QRect(0, 0, 1280, 32)} << QRect(0, 32, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 32, 2560, 992) << QRegion(0, 0, 1280, 32); | ||
115 | QTest::newRow("top/1") << QVector<QRect>{QRect(1280, 0, 1280, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 32, 1280, 992) << QRect(0, 32, 2560, 992); | 116 | QTest::newRow("top/1") << QVector<QRect>{QRect(1280, 0, 1280, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 32, 1280, 992) << QRect(0, 32, 2560, 992) << QRegion(1280, 0, 1280, 32); | ||
116 | QTest::newRow("left/0") << QVector<QRect>{QRect(0, 0, 32, 1024)} << QRect(32, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(32, 0, 2528, 1024); | 117 | QTest::newRow("left/0") << QVector<QRect>{QRect(0, 0, 32, 1024)} << QRect(32, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(32, 0, 2528, 1024) << QRegion(0, 0, 32, 1024); | ||
117 | QTest::newRow("left/1") << QVector<QRect>{QRect(1280, 0, 32, 1024)} << QRect(0, 0, 1280, 1024) << QRect(1312, 0, 1248, 1024) << QRect(0, 0, 2560, 1024); | 118 | QTest::newRow("left/1") << QVector<QRect>{QRect(1280, 0, 32, 1024)} << QRect(0, 0, 1280, 1024) << QRect(1312, 0, 1248, 1024) << QRect(0, 0, 2560, 1024) << QRegion(1280, 0, 32, 1024); | ||
118 | QTest::newRow("right/0") << QVector<QRect>{QRect(1248, 0, 32, 1024)} << QRect(0, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 1024); | 119 | QTest::newRow("right/0") << QVector<QRect>{QRect(1248, 0, 32, 1024)} << QRect(0, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 1024) << QRegion(1248, 0, 32, 1024); | ||
119 | QTest::newRow("right/1") << QVector<QRect>{QRect(2528, 0, 32, 1024)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1248, 1024) << QRect(0, 0, 2528, 1024); | 120 | QTest::newRow("right/1") << QVector<QRect>{QRect(2528, 0, 32, 1024)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1248, 1024) << QRect(0, 0, 2528, 1024) << QRegion(2528, 0, 32, 1024); | ||
120 | 121 | | |||
121 | // same with partial panels not covering the whole area | 122 | // same with partial panels not covering the whole area | ||
122 | QTest::newRow("part bottom/0") << QVector<QRect>{QRect(100, 992, 1080, 32)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 992); | 123 | QTest::newRow("part bottom/0") << QVector<QRect>{QRect(100, 992, 1080, 32)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 992) << QRegion(100, 992, 1080, 32); | ||
123 | QTest::newRow("part bottom/1") << QVector<QRect>{QRect(1380, 992, 1080, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 992) << QRect(0, 0, 2560, 992); | 124 | QTest::newRow("part bottom/1") << QVector<QRect>{QRect(1380, 992, 1080, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 992) << QRect(0, 0, 2560, 992) << QRegion(1380, 992, 1080, 32); | ||
124 | QTest::newRow("part top/0") << QVector<QRect>{QRect(100, 0, 1080, 32)} << QRect(0, 32, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 32, 2560, 992); | 125 | QTest::newRow("part top/0") << QVector<QRect>{QRect(100, 0, 1080, 32)} << QRect(0, 32, 1280, 992) << QRect(1280, 0, 1280, 1024) << QRect(0, 32, 2560, 992) << QRegion(100, 0, 1080, 32); | ||
125 | QTest::newRow("part top/1") << QVector<QRect>{QRect(1380, 0, 1080, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 32, 1280, 992) << QRect(0, 32, 2560, 992); | 126 | QTest::newRow("part top/1") << QVector<QRect>{QRect(1380, 0, 1080, 32)} << QRect(0, 0, 1280, 1024) << QRect(1280, 32, 1280, 992) << QRect(0, 32, 2560, 992) << QRegion(1380, 0, 1080, 32); | ||
126 | QTest::newRow("part left/0") << QVector<QRect>{QRect(0, 100, 32, 824)} << QRect(32, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(32, 0, 2528, 1024); | 127 | QTest::newRow("part left/0") << QVector<QRect>{QRect(0, 100, 32, 824)} << QRect(32, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(32, 0, 2528, 1024) << QRegion(0, 100, 32, 824); | ||
127 | QTest::newRow("part left/1") << QVector<QRect>{QRect(1280, 100, 32, 824)} << QRect(0, 0, 1280, 1024) << QRect(1312, 0, 1248, 1024) << QRect(0, 0, 2560, 1024); | 128 | QTest::newRow("part left/1") << QVector<QRect>{QRect(1280, 100, 32, 824)} << QRect(0, 0, 1280, 1024) << QRect(1312, 0, 1248, 1024) << QRect(0, 0, 2560, 1024) << QRegion(1280, 100, 32, 824); | ||
128 | QTest::newRow("part right/0") << QVector<QRect>{QRect(1248, 100, 32, 824)} << QRect(0, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 1024); | 129 | QTest::newRow("part right/0") << QVector<QRect>{QRect(1248, 100, 32, 824)} << QRect(0, 0, 1248, 1024) << QRect(1280, 0, 1280, 1024) << QRect(0, 0, 2560, 1024) << QRegion(1248, 100, 32, 824); | ||
129 | QTest::newRow("part right/1") << QVector<QRect>{QRect(2528, 100, 32, 824)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1248, 1024) << QRect(0, 0, 2528, 1024); | 130 | QTest::newRow("part right/1") << QVector<QRect>{QRect(2528, 100, 32, 824)} << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1248, 1024) << QRect(0, 0, 2528, 1024) << QRegion(2528, 100, 32, 824); | ||
130 | 131 | | |||
131 | // multiple panels | 132 | // multiple panels | ||
132 | QTest::newRow("two bottom panels") << QVector<QRect>{QRect(100, 992, 1080, 32), QRect(1380, 984, 1080, 40)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 984) << QRect(0, 0, 2560, 984); | 133 | QTest::newRow("two bottom panels") << QVector<QRect>{QRect(100, 992, 1080, 32), QRect(1380, 984, 1080, 40)} << QRect(0, 0, 1280, 992) << QRect(1280, 0, 1280, 984) << QRect(0, 0, 2560, 984) << QRegion(100, 992, 1080, 32).united(QRegion(1380, 984, 1080, 40)); | ||
133 | QTest::newRow("two left panels") << QVector<QRect>{QRect(0, 10, 32, 390), QRect(0, 450, 40, 100)} << QRect(40, 0, 1240, 1024) << QRect(1280, 0, 1280, 1024) << QRect(40, 0, 2520, 1024); | 134 | QTest::newRow("two left panels") << QVector<QRect>{QRect(0, 10, 32, 390), QRect(0, 450, 40, 100)} << QRect(40, 0, 1240, 1024) << QRect(1280, 0, 1280, 1024) << QRect(40, 0, 2520, 1024) << QRegion(0, 10, 32, 390).united(QRegion(0, 450, 40, 100)); | ||
134 | } | 135 | } | ||
135 | 136 | | |||
136 | void StrutsTest::testWaylandStruts() | 137 | void StrutsTest::testWaylandStruts() | ||
137 | { | 138 | { | ||
138 | // this test verifies that struts on Wayland panels are handled correctly | 139 | // this test verifies that struts on Wayland panels are handled correctly | ||
139 | using namespace KWayland::Client; | 140 | using namespace KWayland::Client; | ||
140 | // no, struts yet | 141 | // no, struts yet | ||
141 | QVERIFY(waylandServer()->clients().isEmpty()); | 142 | QVERIFY(waylandServer()->clients().isEmpty()); | ||
Show All 9 Lines | |||||
151 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 152 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
152 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 153 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
153 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 154 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
154 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 155 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
155 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 156 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
156 | // combined | 157 | // combined | ||
157 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | 158 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
158 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 159 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
160 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | ||||
159 | 161 | | |||
160 | QFETCH(QVector<QRect>, windowGeometries); | 162 | QFETCH(QVector<QRect>, windowGeometries); | ||
161 | // create the panels | 163 | // create the panels | ||
162 | QHash<Surface*, ShellClient*> clients; | 164 | QHash<Surface*, ShellClient*> clients; | ||
163 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | 165 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | ||
164 | const QRect windowGeometry = *it; | 166 | const QRect windowGeometry = *it; | ||
165 | Surface *surface = Test::createSurface(m_compositor); | 167 | Surface *surface = Test::createSurface(m_compositor); | ||
166 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | 168 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | ||
Show All 28 Lines | |||||
195 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 197 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
196 | 198 | | |||
197 | // now verify the actual updated client areas | 199 | // now verify the actual updated client areas | ||
198 | QTEST(workspace()->clientArea(PlacementArea, 0, 1), "screen0Maximized"); | 200 | QTEST(workspace()->clientArea(PlacementArea, 0, 1), "screen0Maximized"); | ||
199 | QTEST(workspace()->clientArea(MaximizeArea, 0, 1), "screen0Maximized"); | 201 | QTEST(workspace()->clientArea(MaximizeArea, 0, 1), "screen0Maximized"); | ||
200 | QTEST(workspace()->clientArea(PlacementArea, 1, 1), "screen1Maximized"); | 202 | QTEST(workspace()->clientArea(PlacementArea, 1, 1), "screen1Maximized"); | ||
201 | QTEST(workspace()->clientArea(MaximizeArea, 1, 1), "screen1Maximized"); | 203 | QTEST(workspace()->clientArea(MaximizeArea, 1, 1), "screen1Maximized"); | ||
202 | QTEST(workspace()->clientArea(WorkArea, 0, 1), "workArea"); | 204 | QTEST(workspace()->clientArea(WorkArea, 0, 1), "workArea"); | ||
205 | QTEST(workspace()->restrictedMoveArea(-1), "restrictedMoveArea"); | ||||
203 | 206 | | |||
204 | // delete all surfaces | 207 | // delete all surfaces | ||
205 | for (auto it = clients.begin(); it != clients.end(); it++) { | 208 | for (auto it = clients.begin(); it != clients.end(); it++) { | ||
206 | QSignalSpy destroyedSpy(it.value(), &QObject::destroyed); | 209 | QSignalSpy destroyedSpy(it.value(), &QObject::destroyed); | ||
207 | QVERIFY(destroyedSpy.isValid()); | 210 | QVERIFY(destroyedSpy.isValid()); | ||
208 | delete it.key(); | 211 | delete it.key(); | ||
209 | QVERIFY(destroyedSpy.wait()); | 212 | QVERIFY(destroyedSpy.wait()); | ||
210 | } | 213 | } | ||
214 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | ||||
211 | } | 215 | } | ||
212 | 216 | | |||
213 | void StrutsTest::testMoveWaylandPanel() | 217 | void StrutsTest::testMoveWaylandPanel() | ||
214 | { | 218 | { | ||
215 | // this test verifies that repositioning a Wayland panel updates the client area | 219 | // this test verifies that repositioning a Wayland panel updates the client area | ||
216 | using namespace KWayland::Client; | 220 | using namespace KWayland::Client; | ||
217 | const QRect windowGeometry(0, 1000, 1280, 24); | 221 | const QRect windowGeometry(0, 1000, 1280, 24); | ||
218 | QScopedPointer<Surface> surface(Test::createSurface()); | 222 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
▲ Show 20 Lines • Show All 728 Lines • Show Last 20 Lines |