Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/placement_test.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 119 | { | |||
---|---|---|---|---|---|
133 | QSize size = rc.initiallyConfiguredSize; | 133 | QSize size = rc.initiallyConfiguredSize; | ||
134 | 134 | | |||
135 | if (size.isEmpty()) { | 135 | if (size.isEmpty()) { | ||
136 | size = defaultSize; | 136 | size = defaultSize; | ||
137 | } | 137 | } | ||
138 | 138 | | |||
139 | auto c = Test::renderAndWaitForShown(surface, size, Qt::red); | 139 | auto c = Test::renderAndWaitForShown(surface, size, Qt::red); | ||
140 | 140 | | |||
141 | rc.finalGeometry = c->geometry(); | 141 | rc.finalGeometry = c->frameGeometry(); | ||
142 | return rc; | 142 | return rc; | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | void TestPlacement::testPlaceSmart() | 145 | void TestPlacement::testPlaceSmart() | ||
146 | { | 146 | { | ||
147 | setPlacementPolicy(Placement::Smart); | 147 | setPlacementPolicy(Placement::Smart); | ||
148 | 148 | | |||
149 | QScopedPointer<QObject> testParent(new QObject); //dumb QObject just for scoping surfaces to the test | 149 | QScopedPointer<QObject> testParent(new QObject); //dumb QObject just for scoping surfaces to the test | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 208 | { | |||
212 | group.writeEntry("Placement", Placement::policyToString(Placement::Centered)); | 212 | group.writeEntry("Placement", Placement::policyToString(Placement::Centered)); | ||
213 | group.sync(); | 213 | group.sync(); | ||
214 | workspace()->slotReconfigure(); | 214 | workspace()->slotReconfigure(); | ||
215 | 215 | | |||
216 | QScopedPointer<Surface> surface(Test::createSurface()); | 216 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
217 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 217 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
218 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | 218 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | ||
219 | QVERIFY(client); | 219 | QVERIFY(client); | ||
220 | QCOMPARE(client->geometry(), QRect(590, 487, 100, 50)); | 220 | QCOMPARE(client->frameGeometry(), QRect(590, 487, 100, 50)); | ||
221 | 221 | | |||
222 | shellSurface.reset(); | 222 | shellSurface.reset(); | ||
223 | QVERIFY(Test::waitForWindowDestroyed(client)); | 223 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
224 | } | 224 | } | ||
225 | 225 | | |||
226 | void TestPlacement::testPlaceUnderMouse() | 226 | void TestPlacement::testPlaceUnderMouse() | ||
227 | { | 227 | { | ||
228 | // This test verifies that Under Mouse placement policy works. | 228 | // This test verifies that Under Mouse placement policy works. | ||
229 | 229 | | |||
230 | KConfigGroup group = kwinApp()->config()->group("Windows"); | 230 | KConfigGroup group = kwinApp()->config()->group("Windows"); | ||
231 | group.writeEntry("Placement", Placement::policyToString(Placement::UnderMouse)); | 231 | group.writeEntry("Placement", Placement::policyToString(Placement::UnderMouse)); | ||
232 | group.sync(); | 232 | group.sync(); | ||
233 | workspace()->slotReconfigure(); | 233 | workspace()->slotReconfigure(); | ||
234 | 234 | | |||
235 | KWin::Cursor::setPos(QPoint(200, 300)); | 235 | KWin::Cursor::setPos(QPoint(200, 300)); | ||
236 | QCOMPARE(KWin::Cursor::pos(), QPoint(200, 300)); | 236 | QCOMPARE(KWin::Cursor::pos(), QPoint(200, 300)); | ||
237 | 237 | | |||
238 | QScopedPointer<Surface> surface(Test::createSurface()); | 238 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
239 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 239 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
240 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | 240 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | ||
241 | QVERIFY(client); | 241 | QVERIFY(client); | ||
242 | QCOMPARE(client->geometry(), QRect(151, 276, 100, 50)); | 242 | QCOMPARE(client->frameGeometry(), QRect(151, 276, 100, 50)); | ||
243 | 243 | | |||
244 | shellSurface.reset(); | 244 | shellSurface.reset(); | ||
245 | QVERIFY(Test::waitForWindowDestroyed(client)); | 245 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
246 | } | 246 | } | ||
247 | 247 | | |||
248 | void TestPlacement::testPlaceCascaded() | 248 | void TestPlacement::testPlaceCascaded() | ||
249 | { | 249 | { | ||
250 | // This test verifies that Cascaded placement policy works. | 250 | // This test verifies that Cascaded placement policy works. | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |