Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/internal_window.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "kwin_wayland_test.h" | 20 | #include "kwin_wayland_test.h" | ||
21 | #include "platform.h" | 21 | #include "platform.h" | ||
22 | #include "cursor.h" | 22 | #include "cursor.h" | ||
23 | #include "effects.h" | 23 | #include "effects.h" | ||
24 | #include "internal_client.h" | 24 | #include "internal_client.h" | ||
25 | #include "shell_client.h" | | |||
26 | #include "screens.h" | 25 | #include "screens.h" | ||
26 | #include "shell_client.h" | ||||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | 29 | | |||
30 | #include <QPainter> | 30 | #include <QPainter> | ||
31 | #include <QRasterWindow> | 31 | #include <QRasterWindow> | ||
32 | 32 | | |||
33 | #include <KWayland/Client/keyboard.h> | 33 | #include <KWayland/Client/keyboard.h> | ||
34 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | |||||
179 | void HelperWindow::keyReleaseEvent(QKeyEvent *event) | 179 | void HelperWindow::keyReleaseEvent(QKeyEvent *event) | ||
180 | { | 180 | { | ||
181 | Q_UNUSED(event) | 181 | Q_UNUSED(event) | ||
182 | emit keyReleased(); | 182 | emit keyReleased(); | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | void InternalWindowTest::initTestCase() | 185 | void InternalWindowTest::initTestCase() | ||
186 | { | 186 | { | ||
187 | qRegisterMetaType<KWin::ShellClient*>(); | | |||
188 | qRegisterMetaType<KWin::AbstractClient*>(); | 187 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
188 | qRegisterMetaType<KWin::InternalClient *>(); | ||||
189 | qRegisterMetaType<KWin::ShellClient *>(); | ||||
189 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 190 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
190 | QVERIFY(workspaceCreatedSpy.isValid()); | 191 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
191 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 192 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
192 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 193 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
193 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 194 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
194 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | 195 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | ||
195 | 196 | | |||
196 | kwinApp()->start(); | 197 | kwinApp()->start(); | ||
Show All 9 Lines | 206 | { | |||
206 | Cursor::setPos(QPoint(1280, 512)); | 207 | Cursor::setPos(QPoint(1280, 512)); | ||
207 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); | 208 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); | ||
208 | QVERIFY(Test::waitForWaylandKeyboard()); | 209 | QVERIFY(Test::waitForWaylandKeyboard()); | ||
209 | } | 210 | } | ||
210 | 211 | | |||
211 | void InternalWindowTest::cleanup() | 212 | void InternalWindowTest::cleanup() | ||
212 | { | 213 | { | ||
213 | Test::destroyWaylandConnection(); | 214 | Test::destroyWaylandConnection(); | ||
215 | | ||||
216 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||||
romangg: Feels a bit odd to do it in the cleanup. But not critical. | |||||
214 | } | 217 | } | ||
215 | 218 | | |||
216 | void InternalWindowTest::testEnterLeave() | 219 | void InternalWindowTest::testEnterLeave() | ||
217 | { | 220 | { | ||
218 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 221 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
219 | QVERIFY(clientAddedSpy.isValid()); | 222 | QVERIFY(clientAddedSpy.isValid()); | ||
220 | HelperWindow win; | 223 | HelperWindow win; | ||
221 | QVERIFY(!workspace()->findToplevel(nullptr)); | 224 | QVERIFY(!workspace()->findInternal(nullptr)); | ||
222 | QVERIFY(!workspace()->findToplevel(&win)); | 225 | QVERIFY(!workspace()->findInternal(&win)); | ||
223 | win.setGeometry(0, 0, 100, 100); | 226 | win.setGeometry(0, 0, 100, 100); | ||
224 | win.show(); | 227 | win.show(); | ||
225 | 228 | | |||
226 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 229 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
227 | QVERIFY(!workspace()->activeClient()); | 230 | QVERIFY(!workspace()->activeClient()); | ||
228 | ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>(); | 231 | InternalClient *c = clientAddedSpy.first().first().value<InternalClient *>(); | ||
232 | QVERIFY(c); | ||||
229 | QVERIFY(c->isInternal()); | 233 | QVERIFY(c->isInternal()); | ||
230 | QVERIFY(qobject_cast<InternalClient*>(c)); | | |||
231 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | | |||
232 | QVERIFY(!c->isDecorated()); | 234 | QVERIFY(!c->isDecorated()); | ||
233 | QCOMPARE(workspace()->findToplevel(&win), c); | 235 | QCOMPARE(workspace()->findInternal(&win), c); | ||
234 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 100)); | 236 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 100)); | ||
235 | QVERIFY(c->isShown(false)); | 237 | QVERIFY(c->isShown(false)); | ||
236 | QVERIFY(workspace()->xStackingOrder().contains(c)); | 238 | QVERIFY(workspace()->xStackingOrder().contains(c)); | ||
237 | 239 | | |||
238 | QSignalSpy enterSpy(&win, &HelperWindow::entered); | 240 | QSignalSpy enterSpy(&win, &HelperWindow::entered); | ||
239 | QVERIFY(enterSpy.isValid()); | 241 | QVERIFY(enterSpy.isValid()); | ||
240 | QSignalSpy leaveSpy(&win, &HelperWindow::left); | 242 | QSignalSpy leaveSpy(&win, &HelperWindow::left); | ||
241 | QVERIFY(leaveSpy.isValid()); | 243 | QVERIFY(leaveSpy.isValid()); | ||
Show All 15 Lines | |||||
257 | win.setMask(QRegion(10, 20, 30, 40)); | 259 | win.setMask(QRegion(10, 20, 30, 40)); | ||
258 | // outside the mask we should not get an enter | 260 | // outside the mask we should not get an enter | ||
259 | kwinApp()->platform()->pointerMotion(QPoint(5, 5), timestamp++); | 261 | kwinApp()->platform()->pointerMotion(QPoint(5, 5), timestamp++); | ||
260 | QVERIFY(!enterSpy.wait(100)); | 262 | QVERIFY(!enterSpy.wait(100)); | ||
261 | QCOMPARE(enterSpy.count(), 1); | 263 | QCOMPARE(enterSpy.count(), 1); | ||
262 | // inside the mask we should still get an enter | 264 | // inside the mask we should still get an enter | ||
263 | kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++); | 265 | kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++); | ||
264 | QTRY_COMPARE(enterSpy.count(), 2); | 266 | QTRY_COMPARE(enterSpy.count(), 2); | ||
265 | | ||||
266 | // hide the window, which should be removed from the stacking order | | |||
267 | win.hide(); | | |||
268 | QTRY_VERIFY(!c->isShown(false)); | | |||
269 | QVERIFY(!workspace()->xStackingOrder().contains(c)); | | |||
270 | | ||||
271 | // show again | | |||
272 | win.show(); | | |||
273 | QTRY_VERIFY(c->isShown(false)); | | |||
274 | QVERIFY(workspace()->xStackingOrder().contains(c)); | | |||
275 | } | 267 | } | ||
276 | 268 | | |||
277 | void InternalWindowTest::testPointerPressRelease() | 269 | void InternalWindowTest::testPointerPressRelease() | ||
278 | { | 270 | { | ||
279 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 271 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
280 | QVERIFY(clientAddedSpy.isValid()); | 272 | QVERIFY(clientAddedSpy.isValid()); | ||
281 | HelperWindow win; | 273 | HelperWindow win; | ||
282 | win.setGeometry(0, 0, 100, 100); | 274 | win.setGeometry(0, 0, 100, 100); | ||
283 | win.show(); | 275 | win.show(); | ||
284 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | 276 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | ||
285 | QVERIFY(pressSpy.isValid()); | 277 | QVERIFY(pressSpy.isValid()); | ||
286 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | 278 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | ||
287 | QVERIFY(releaseSpy.isValid()); | 279 | QVERIFY(releaseSpy.isValid()); | ||
288 | 280 | | |||
289 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 281 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
290 | 282 | | |||
291 | quint32 timestamp = 1; | 283 | quint32 timestamp = 1; | ||
292 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | 284 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | ||
293 | 285 | | |||
294 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | 286 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | ||
295 | QTRY_COMPARE(pressSpy.count(), 1); | 287 | QTRY_COMPARE(pressSpy.count(), 1); | ||
296 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | 288 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | ||
297 | QTRY_COMPARE(releaseSpy.count(), 1); | 289 | QTRY_COMPARE(releaseSpy.count(), 1); | ||
298 | } | 290 | } | ||
299 | 291 | | |||
300 | void InternalWindowTest::testPointerAxis() | 292 | void InternalWindowTest::testPointerAxis() | ||
301 | { | 293 | { | ||
302 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 294 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
303 | QVERIFY(clientAddedSpy.isValid()); | 295 | QVERIFY(clientAddedSpy.isValid()); | ||
304 | HelperWindow win; | 296 | HelperWindow win; | ||
305 | win.setGeometry(0, 0, 100, 100); | 297 | win.setGeometry(0, 0, 100, 100); | ||
306 | win.show(); | 298 | win.show(); | ||
307 | QSignalSpy wheelSpy(&win, &HelperWindow::wheel); | 299 | QSignalSpy wheelSpy(&win, &HelperWindow::wheel); | ||
308 | QVERIFY(wheelSpy.isValid()); | 300 | QVERIFY(wheelSpy.isValid()); | ||
309 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 301 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
310 | 302 | | |||
Show All 11 Lines | 313 | { | |||
322 | QTest::addColumn<QPoint>("cursorPos"); | 314 | QTest::addColumn<QPoint>("cursorPos"); | ||
323 | 315 | | |||
324 | QTest::newRow("on Window") << QPoint(50, 50); | 316 | QTest::newRow("on Window") << QPoint(50, 50); | ||
325 | QTest::newRow("outside Window") << QPoint(250, 250); | 317 | QTest::newRow("outside Window") << QPoint(250, 250); | ||
326 | } | 318 | } | ||
327 | 319 | | |||
328 | void InternalWindowTest::testKeyboard() | 320 | void InternalWindowTest::testKeyboard() | ||
329 | { | 321 | { | ||
330 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 322 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
331 | QVERIFY(clientAddedSpy.isValid()); | 323 | QVERIFY(clientAddedSpy.isValid()); | ||
332 | HelperWindow win; | 324 | HelperWindow win; | ||
333 | win.setGeometry(0, 0, 100, 100); | 325 | win.setGeometry(0, 0, 100, 100); | ||
334 | win.show(); | 326 | win.show(); | ||
335 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 327 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
336 | QVERIFY(pressSpy.isValid()); | 328 | QVERIFY(pressSpy.isValid()); | ||
337 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 329 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
338 | QVERIFY(releaseSpy.isValid()); | 330 | QVERIFY(releaseSpy.isValid()); | ||
339 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 331 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
340 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 332 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
341 | QVERIFY(internalClient); | 333 | QVERIFY(internalClient); | ||
342 | QVERIFY(internalClient->isInternal()); | 334 | QVERIFY(internalClient->isInternal()); | ||
343 | QVERIFY(internalClient->readyForPainting()); | 335 | QVERIFY(internalClient->readyForPainting()); | ||
344 | 336 | | |||
345 | quint32 timestamp = 1; | 337 | quint32 timestamp = 1; | ||
346 | QFETCH(QPoint, cursorPos); | 338 | QFETCH(QPoint, cursorPos); | ||
347 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | 339 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | ||
348 | 340 | | |||
349 | kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); | 341 | kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); | ||
350 | QTRY_COMPARE(pressSpy.count(), 1); | 342 | QTRY_COMPARE(pressSpy.count(), 1); | ||
351 | QCOMPARE(releaseSpy.count(), 0); | 343 | QCOMPARE(releaseSpy.count(), 0); | ||
352 | kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); | 344 | kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); | ||
353 | QTRY_COMPARE(releaseSpy.count(), 1); | 345 | QTRY_COMPARE(releaseSpy.count(), 1); | ||
354 | QCOMPARE(pressSpy.count(), 1); | 346 | QCOMPARE(pressSpy.count(), 1); | ||
355 | } | 347 | } | ||
356 | 348 | | |||
357 | void InternalWindowTest::testKeyboardShowWithoutActivating() | 349 | void InternalWindowTest::testKeyboardShowWithoutActivating() | ||
358 | { | 350 | { | ||
359 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 351 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
360 | QVERIFY(clientAddedSpy.isValid()); | 352 | QVERIFY(clientAddedSpy.isValid()); | ||
361 | HelperWindow win; | 353 | HelperWindow win; | ||
362 | win.setProperty("_q_showWithoutActivating", true); | 354 | win.setProperty("_q_showWithoutActivating", true); | ||
363 | win.setGeometry(0, 0, 100, 100); | 355 | win.setGeometry(0, 0, 100, 100); | ||
364 | win.show(); | 356 | win.show(); | ||
365 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 357 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
366 | QVERIFY(pressSpy.isValid()); | 358 | QVERIFY(pressSpy.isValid()); | ||
367 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 359 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
368 | QVERIFY(releaseSpy.isValid()); | 360 | QVERIFY(releaseSpy.isValid()); | ||
369 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 361 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
370 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 362 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
371 | QVERIFY(internalClient); | 363 | QVERIFY(internalClient); | ||
372 | QVERIFY(internalClient->isInternal()); | 364 | QVERIFY(internalClient->isInternal()); | ||
373 | QVERIFY(internalClient->readyForPainting()); | 365 | QVERIFY(internalClient->readyForPainting()); | ||
374 | 366 | | |||
375 | quint32 timestamp = 1; | 367 | quint32 timestamp = 1; | ||
376 | const QPoint cursorPos = QPoint(50, 50); | 368 | const QPoint cursorPos = QPoint(50, 50); | ||
377 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | 369 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | ||
378 | 370 | | |||
Show All 28 Lines | 382 | { | |||
407 | QVERIFY(!c->isInternal()); | 399 | QVERIFY(!c->isInternal()); | ||
408 | 400 | | |||
409 | if (enteredSpy.isEmpty()) { | 401 | if (enteredSpy.isEmpty()) { | ||
410 | QVERIFY(enteredSpy.wait()); | 402 | QVERIFY(enteredSpy.wait()); | ||
411 | } | 403 | } | ||
412 | QCOMPARE(enteredSpy.count(), 1); | 404 | QCOMPARE(enteredSpy.count(), 1); | ||
413 | 405 | | |||
414 | // create internal window | 406 | // create internal window | ||
415 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 407 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
416 | QVERIFY(clientAddedSpy.isValid()); | 408 | QVERIFY(clientAddedSpy.isValid()); | ||
417 | HelperWindow win; | 409 | HelperWindow win; | ||
418 | win.setGeometry(0, 0, 100, 100); | 410 | win.setGeometry(0, 0, 100, 100); | ||
419 | win.show(); | 411 | win.show(); | ||
420 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 412 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
421 | QVERIFY(pressSpy.isValid()); | 413 | QVERIFY(pressSpy.isValid()); | ||
422 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 414 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
423 | QVERIFY(releaseSpy.isValid()); | 415 | QVERIFY(releaseSpy.isValid()); | ||
424 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 416 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
425 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 417 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
426 | QVERIFY(internalClient); | 418 | QVERIFY(internalClient); | ||
427 | QVERIFY(internalClient->isInternal()); | 419 | QVERIFY(internalClient->isInternal()); | ||
428 | QVERIFY(internalClient->readyForPainting()); | 420 | QVERIFY(internalClient->readyForPainting()); | ||
429 | 421 | | |||
430 | QVERIFY(leftSpy.isEmpty()); | 422 | QVERIFY(leftSpy.isEmpty()); | ||
431 | QVERIFY(!leftSpy.wait(100)); | 423 | QVERIFY(!leftSpy.wait(100)); | ||
432 | 424 | | |||
433 | // now let's trigger a key, which should result in a leave | 425 | // now let's trigger a key, which should result in a leave | ||
Show All 10 Lines | |||||
444 | kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); | 436 | kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); | ||
445 | QVERIFY(enteredSpy.wait()); | 437 | QVERIFY(enteredSpy.wait()); | ||
446 | kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); | 438 | kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); | ||
447 | } | 439 | } | ||
448 | 440 | | |||
449 | void InternalWindowTest::testTouch() | 441 | void InternalWindowTest::testTouch() | ||
450 | { | 442 | { | ||
451 | // touch events for internal windows are emulated through mouse events | 443 | // touch events for internal windows are emulated through mouse events | ||
452 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 444 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
453 | QVERIFY(clientAddedSpy.isValid()); | 445 | QVERIFY(clientAddedSpy.isValid()); | ||
454 | HelperWindow win; | 446 | HelperWindow win; | ||
455 | win.setGeometry(0, 0, 100, 100); | 447 | win.setGeometry(0, 0, 100, 100); | ||
456 | win.show(); | 448 | win.show(); | ||
457 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 449 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
458 | 450 | | |||
459 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | 451 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | ||
460 | QVERIFY(pressSpy.isValid()); | 452 | QVERIFY(pressSpy.isValid()); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
508 | QCOMPARE(releaseSpy.count(), 1); | 500 | QCOMPARE(releaseSpy.count(), 1); | ||
509 | QCOMPARE(moveSpy.count(), 1); | 501 | QCOMPARE(moveSpy.count(), 1); | ||
510 | QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); | 502 | QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); | ||
511 | QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); | 503 | QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); | ||
512 | } | 504 | } | ||
513 | 505 | | |||
514 | void InternalWindowTest::testOpacity() | 506 | void InternalWindowTest::testOpacity() | ||
515 | { | 507 | { | ||
516 | // this test verifies that opacity is properly synced from QWindow to ShellClient | 508 | // this test verifies that opacity is properly synced from QWindow to InternalClient | ||
517 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 509 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
518 | QVERIFY(clientAddedSpy.isValid()); | 510 | QVERIFY(clientAddedSpy.isValid()); | ||
519 | HelperWindow win; | 511 | HelperWindow win; | ||
520 | win.setOpacity(0.5); | 512 | win.setOpacity(0.5); | ||
521 | win.setGeometry(0, 0, 100, 100); | 513 | win.setGeometry(0, 0, 100, 100); | ||
522 | win.show(); | 514 | win.show(); | ||
523 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 515 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
524 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 516 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
525 | QVERIFY(internalClient); | 517 | QVERIFY(internalClient); | ||
526 | QVERIFY(internalClient->isInternal()); | 518 | QVERIFY(internalClient->isInternal()); | ||
527 | QCOMPARE(internalClient->opacity(), 0.5); | 519 | QCOMPARE(internalClient->opacity(), 0.5); | ||
528 | 520 | | |||
529 | QSignalSpy opacityChangedSpy(internalClient, &ShellClient::opacityChanged); | 521 | QSignalSpy opacityChangedSpy(internalClient, &InternalClient::opacityChanged); | ||
530 | QVERIFY(opacityChangedSpy.isValid()); | 522 | QVERIFY(opacityChangedSpy.isValid()); | ||
531 | win.setOpacity(0.75); | 523 | win.setOpacity(0.75); | ||
532 | QCOMPARE(opacityChangedSpy.count(), 1); | 524 | QCOMPARE(opacityChangedSpy.count(), 1); | ||
533 | QCOMPARE(internalClient->opacity(), 0.75); | 525 | QCOMPARE(internalClient->opacity(), 0.75); | ||
534 | } | 526 | } | ||
535 | 527 | | |||
536 | void InternalWindowTest::testMove() | 528 | void InternalWindowTest::testMove() | ||
537 | { | 529 | { | ||
538 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 530 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
539 | QVERIFY(clientAddedSpy.isValid()); | 531 | QVERIFY(clientAddedSpy.isValid()); | ||
540 | HelperWindow win; | 532 | HelperWindow win; | ||
541 | win.setOpacity(0.5); | 533 | win.setOpacity(0.5); | ||
542 | win.setGeometry(0, 0, 100, 100); | 534 | win.setGeometry(0, 0, 100, 100); | ||
543 | win.show(); | 535 | win.show(); | ||
544 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 536 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
545 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 537 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
546 | QVERIFY(internalClient); | 538 | QVERIFY(internalClient); | ||
547 | QCOMPARE(internalClient->geometry(), QRect(0, 0, 100, 100)); | 539 | QCOMPARE(internalClient->geometry(), QRect(0, 0, 100, 100)); | ||
548 | 540 | | |||
549 | // normal move should be synced | 541 | // normal move should be synced | ||
550 | internalClient->move(5, 10); | 542 | internalClient->move(5, 10); | ||
551 | QCOMPARE(internalClient->geometry(), QRect(5, 10, 100, 100)); | 543 | QCOMPARE(internalClient->geometry(), QRect(5, 10, 100, 100)); | ||
552 | QTRY_COMPARE(win.geometry(), QRect(5, 10, 100, 100)); | 544 | QTRY_COMPARE(win.geometry(), QRect(5, 10, 100, 100)); | ||
553 | // another move should also be synced | 545 | // another move should also be synced | ||
Show All 17 Lines | 562 | { | |||
571 | QTest::addColumn<bool>("initial"); | 563 | QTest::addColumn<bool>("initial"); | ||
572 | 564 | | |||
573 | QTest::newRow("set") << true; | 565 | QTest::newRow("set") << true; | ||
574 | QTest::newRow("not set") << false; | 566 | QTest::newRow("not set") << false; | ||
575 | } | 567 | } | ||
576 | 568 | | |||
577 | void InternalWindowTest::testSkipCloseAnimation() | 569 | void InternalWindowTest::testSkipCloseAnimation() | ||
578 | { | 570 | { | ||
579 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 571 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
580 | QVERIFY(clientAddedSpy.isValid()); | 572 | QVERIFY(clientAddedSpy.isValid()); | ||
581 | HelperWindow win; | 573 | HelperWindow win; | ||
582 | win.setOpacity(0.5); | 574 | win.setOpacity(0.5); | ||
583 | win.setGeometry(0, 0, 100, 100); | 575 | win.setGeometry(0, 0, 100, 100); | ||
584 | QFETCH(bool, initial); | 576 | QFETCH(bool, initial); | ||
585 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | 577 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | ||
586 | win.show(); | 578 | win.show(); | ||
587 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 579 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
588 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 580 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
589 | QVERIFY(internalClient); | 581 | QVERIFY(internalClient); | ||
590 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | 582 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | ||
591 | QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged); | 583 | QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged); | ||
592 | QVERIFY(skipCloseChangedSpy.isValid()); | 584 | QVERIFY(skipCloseChangedSpy.isValid()); | ||
593 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", !initial); | 585 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", !initial); | ||
594 | QCOMPARE(skipCloseChangedSpy.count(), 1); | 586 | QCOMPARE(skipCloseChangedSpy.count(), 1); | ||
595 | QCOMPARE(internalClient->skipsCloseAnimation(), !initial); | 587 | QCOMPARE(internalClient->skipsCloseAnimation(), !initial); | ||
596 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | 588 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | ||
597 | QCOMPARE(skipCloseChangedSpy.count(), 2); | 589 | QCOMPARE(skipCloseChangedSpy.count(), 2); | ||
598 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | 590 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | ||
599 | } | 591 | } | ||
600 | 592 | | |||
601 | void InternalWindowTest::testModifierClickUnrestrictedMove() | 593 | void InternalWindowTest::testModifierClickUnrestrictedMove() | ||
602 | { | 594 | { | ||
603 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 595 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
604 | QVERIFY(clientAddedSpy.isValid()); | 596 | QVERIFY(clientAddedSpy.isValid()); | ||
605 | HelperWindow win; | 597 | HelperWindow win; | ||
606 | win.setGeometry(0, 0, 100, 100); | 598 | win.setGeometry(0, 0, 100, 100); | ||
607 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 599 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
608 | win.show(); | 600 | win.show(); | ||
609 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 601 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
610 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 602 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
611 | QVERIFY(internalClient); | 603 | QVERIFY(internalClient); | ||
612 | QVERIFY(internalClient->isDecorated()); | 604 | QVERIFY(internalClient->isDecorated()); | ||
613 | 605 | | |||
614 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 606 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
615 | group.writeEntry("CommandAllKey", "Alt"); | 607 | group.writeEntry("CommandAllKey", "Alt"); | ||
616 | group.writeEntry("CommandAll1", "Move"); | 608 | group.writeEntry("CommandAll1", "Move"); | ||
617 | group.writeEntry("CommandAll2", "Move"); | 609 | group.writeEntry("CommandAll2", "Move"); | ||
618 | group.writeEntry("CommandAll3", "Move"); | 610 | group.writeEntry("CommandAll3", "Move"); | ||
Show All 18 Lines | |||||
637 | QVERIFY(internalClient->isMove()); | 629 | QVERIFY(internalClient->isMove()); | ||
638 | // but releasing the key should end move/resize | 630 | // but releasing the key should end move/resize | ||
639 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | 631 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | ||
640 | QVERIFY(!internalClient->isMove()); | 632 | QVERIFY(!internalClient->isMove()); | ||
641 | } | 633 | } | ||
642 | 634 | | |||
643 | void InternalWindowTest::testModifierScroll() | 635 | void InternalWindowTest::testModifierScroll() | ||
644 | { | 636 | { | ||
645 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 637 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
646 | QVERIFY(clientAddedSpy.isValid()); | 638 | QVERIFY(clientAddedSpy.isValid()); | ||
647 | HelperWindow win; | 639 | HelperWindow win; | ||
648 | win.setGeometry(0, 0, 100, 100); | 640 | win.setGeometry(0, 0, 100, 100); | ||
649 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 641 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
650 | win.show(); | 642 | win.show(); | ||
651 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 643 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
652 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 644 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
653 | QVERIFY(internalClient); | 645 | QVERIFY(internalClient); | ||
654 | QVERIFY(internalClient->isDecorated()); | 646 | QVERIFY(internalClient->isDecorated()); | ||
655 | 647 | | |||
656 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 648 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
657 | group.writeEntry("CommandAllKey", "Alt"); | 649 | group.writeEntry("CommandAllKey", "Alt"); | ||
658 | group.writeEntry("CommandAllWheel", "change opacity"); | 650 | group.writeEntry("CommandAllWheel", "change opacity"); | ||
659 | group.sync(); | 651 | group.sync(); | ||
660 | workspace()->slotReconfigure(); | 652 | workspace()->slotReconfigure(); | ||
Show All 10 Lines | |||||
671 | QCOMPARE(internalClient->opacity(), 0.6); | 663 | QCOMPARE(internalClient->opacity(), 0.6); | ||
672 | kwinApp()->platform()->pointerAxisVertical(5, timestamp++); | 664 | kwinApp()->platform()->pointerAxisVertical(5, timestamp++); | ||
673 | QCOMPARE(internalClient->opacity(), 0.5); | 665 | QCOMPARE(internalClient->opacity(), 0.5); | ||
674 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); | 666 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); | ||
675 | } | 667 | } | ||
676 | 668 | | |||
677 | void InternalWindowTest::testPopup() | 669 | void InternalWindowTest::testPopup() | ||
678 | { | 670 | { | ||
679 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 671 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
680 | QVERIFY(clientAddedSpy.isValid()); | 672 | QVERIFY(clientAddedSpy.isValid()); | ||
681 | HelperWindow win; | 673 | HelperWindow win; | ||
682 | win.setGeometry(0, 0, 100, 100); | 674 | win.setGeometry(0, 0, 100, 100); | ||
683 | win.setFlags(win.flags() | Qt::Popup); | 675 | win.setFlags(win.flags() | Qt::Popup); | ||
684 | win.show(); | 676 | win.show(); | ||
685 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 677 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
686 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 678 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
687 | QVERIFY(internalClient); | 679 | QVERIFY(internalClient); | ||
688 | QCOMPARE(internalClient->isPopupWindow(), true); | 680 | QCOMPARE(internalClient->isPopupWindow(), true); | ||
689 | } | 681 | } | ||
690 | 682 | | |||
691 | void InternalWindowTest::testScale() | 683 | void InternalWindowTest::testScale() | ||
692 | { | 684 | { | ||
693 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, | 685 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, | ||
694 | Q_ARG(int, 2), | 686 | Q_ARG(int, 2), | ||
695 | Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})), | 687 | Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})), | ||
696 | Q_ARG(QVector<int>, QVector<int>({2,2}))); | 688 | Q_ARG(QVector<int>, QVector<int>({2,2}))); | ||
697 | 689 | | |||
698 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 690 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
699 | QVERIFY(clientAddedSpy.isValid()); | 691 | QVERIFY(clientAddedSpy.isValid()); | ||
700 | HelperWindow win; | 692 | HelperWindow win; | ||
701 | win.setGeometry(0, 0, 100, 100); | 693 | win.setGeometry(0, 0, 100, 100); | ||
702 | win.setFlags(win.flags() | Qt::Popup); | 694 | win.setFlags(win.flags() | Qt::Popup); | ||
703 | win.show(); | 695 | win.show(); | ||
704 | QCOMPARE(win.devicePixelRatio(), 2.0); | 696 | QCOMPARE(win.devicePixelRatio(), 2.0); | ||
705 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 697 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
706 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 698 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
707 | QCOMPARE(internalClient->surface()->scale(), 2); | 699 | QCOMPARE(internalClient->bufferScale(), 2); | ||
708 | | ||||
709 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | | |||
710 | } | 700 | } | ||
711 | 701 | | |||
712 | void InternalWindowTest::testWindowType_data() | 702 | void InternalWindowTest::testWindowType_data() | ||
713 | { | 703 | { | ||
714 | QTest::addColumn<NET::WindowType>("windowType"); | 704 | QTest::addColumn<NET::WindowType>("windowType"); | ||
715 | 705 | | |||
716 | QTest::newRow("normal") << NET::Normal; | 706 | QTest::newRow("normal") << NET::Normal; | ||
717 | QTest::newRow("desktop") << NET::Desktop; | 707 | QTest::newRow("desktop") << NET::Desktop; | ||
Show All 9 Lines | |||||
727 | QTest::newRow("Notification") << NET::Notification; | 717 | QTest::newRow("Notification") << NET::Notification; | ||
728 | QTest::newRow("ComboBox") << NET::ComboBox; | 718 | QTest::newRow("ComboBox") << NET::ComboBox; | ||
729 | QTest::newRow("OnScreenDisplay") << NET::OnScreenDisplay; | 719 | QTest::newRow("OnScreenDisplay") << NET::OnScreenDisplay; | ||
730 | QTest::newRow("CriticalNotification") << NET::CriticalNotification; | 720 | QTest::newRow("CriticalNotification") << NET::CriticalNotification; | ||
731 | } | 721 | } | ||
732 | 722 | | |||
733 | void InternalWindowTest::testWindowType() | 723 | void InternalWindowTest::testWindowType() | ||
734 | { | 724 | { | ||
735 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 725 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
736 | QVERIFY(clientAddedSpy.isValid()); | 726 | QVERIFY(clientAddedSpy.isValid()); | ||
737 | HelperWindow win; | 727 | HelperWindow win; | ||
738 | win.setGeometry(0, 0, 100, 100); | 728 | win.setGeometry(0, 0, 100, 100); | ||
739 | QFETCH(NET::WindowType, windowType); | 729 | QFETCH(NET::WindowType, windowType); | ||
740 | KWindowSystem::setType(win.winId(), windowType); | 730 | KWindowSystem::setType(win.winId(), windowType); | ||
741 | win.show(); | 731 | win.show(); | ||
742 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 732 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
743 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 733 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
744 | QVERIFY(internalClient); | 734 | QVERIFY(internalClient); | ||
745 | QCOMPARE(internalClient->windowType(), windowType); | 735 | QCOMPARE(internalClient->windowType(), windowType); | ||
746 | } | 736 | } | ||
747 | 737 | | |||
748 | void InternalWindowTest::testChangeWindowType_data() | 738 | void InternalWindowTest::testChangeWindowType_data() | ||
749 | { | 739 | { | ||
750 | QTest::addColumn<NET::WindowType>("windowType"); | 740 | QTest::addColumn<NET::WindowType>("windowType"); | ||
751 | 741 | | |||
Show All 10 Lines | |||||
762 | QTest::newRow("Notification") << NET::Notification; | 752 | QTest::newRow("Notification") << NET::Notification; | ||
763 | QTest::newRow("ComboBox") << NET::ComboBox; | 753 | QTest::newRow("ComboBox") << NET::ComboBox; | ||
764 | QTest::newRow("OnScreenDisplay") << NET::OnScreenDisplay; | 754 | QTest::newRow("OnScreenDisplay") << NET::OnScreenDisplay; | ||
765 | QTest::newRow("CriticalNotification") << NET::CriticalNotification; | 755 | QTest::newRow("CriticalNotification") << NET::CriticalNotification; | ||
766 | } | 756 | } | ||
767 | 757 | | |||
768 | void InternalWindowTest::testChangeWindowType() | 758 | void InternalWindowTest::testChangeWindowType() | ||
769 | { | 759 | { | ||
770 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 760 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
771 | QVERIFY(clientAddedSpy.isValid()); | 761 | QVERIFY(clientAddedSpy.isValid()); | ||
772 | HelperWindow win; | 762 | HelperWindow win; | ||
773 | win.setGeometry(0, 0, 100, 100); | 763 | win.setGeometry(0, 0, 100, 100); | ||
774 | win.show(); | 764 | win.show(); | ||
775 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 765 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
776 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 766 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
777 | QVERIFY(internalClient); | 767 | QVERIFY(internalClient); | ||
778 | QCOMPARE(internalClient->windowType(), NET::Normal); | 768 | QCOMPARE(internalClient->windowType(), NET::Normal); | ||
779 | 769 | | |||
780 | QFETCH(NET::WindowType, windowType); | 770 | QFETCH(NET::WindowType, windowType); | ||
781 | KWindowSystem::setType(win.winId(), windowType); | 771 | KWindowSystem::setType(win.winId(), windowType); | ||
782 | QTRY_COMPARE(internalClient->windowType(), windowType); | 772 | QTRY_COMPARE(internalClient->windowType(), windowType); | ||
783 | 773 | | |||
784 | KWindowSystem::setType(win.winId(), NET::Normal); | 774 | KWindowSystem::setType(win.winId(), NET::Normal); | ||
785 | QTRY_COMPARE(internalClient->windowType(), NET::Normal); | 775 | QTRY_COMPARE(internalClient->windowType(), NET::Normal); | ||
786 | } | 776 | } | ||
787 | 777 | | |||
788 | void InternalWindowTest::testEffectWindow() | 778 | void InternalWindowTest::testEffectWindow() | ||
789 | { | 779 | { | ||
790 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 780 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
791 | QVERIFY(clientAddedSpy.isValid()); | 781 | QVERIFY(clientAddedSpy.isValid()); | ||
792 | HelperWindow win; | 782 | HelperWindow win; | ||
793 | win.setGeometry(0, 0, 100, 100); | 783 | win.setGeometry(0, 0, 100, 100); | ||
794 | win.show(); | 784 | win.show(); | ||
795 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 785 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
796 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 786 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
797 | QVERIFY(internalClient); | 787 | QVERIFY(internalClient); | ||
798 | QVERIFY(internalClient->effectWindow()); | 788 | QVERIFY(internalClient->effectWindow()); | ||
799 | QCOMPARE(internalClient->effectWindow()->internalWindow(), &win); | 789 | QCOMPARE(internalClient->effectWindow()->internalWindow(), &win); | ||
800 | 790 | | |||
801 | QCOMPARE(effects->findWindow(&win), internalClient->effectWindow()); | 791 | QCOMPARE(effects->findWindow(&win), internalClient->effectWindow()); | ||
802 | QCOMPARE(effects->findWindow(&win)->internalWindow(), &win); | 792 | QCOMPARE(effects->findWindow(&win)->internalWindow(), &win); | ||
803 | } | 793 | } | ||
804 | 794 | | |||
805 | } | 795 | } | ||
806 | 796 | | |||
807 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | 797 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | ||
808 | #include "internal_window.moc" | 798 | #include "internal_window.moc" |
Feels a bit odd to do it in the cleanup. But not critical.