Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/struts_test.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 50 | private Q_SLOTS: | |||
---|---|---|---|---|---|
54 | void testWaylandStruts_data(); | 54 | void testWaylandStruts_data(); | ||
55 | void testWaylandStruts(); | 55 | void testWaylandStruts(); | ||
56 | void testMoveWaylandPanel(); | 56 | void testMoveWaylandPanel(); | ||
57 | void testWaylandMobilePanel(); | 57 | void testWaylandMobilePanel(); | ||
58 | void testX11Struts_data(); | 58 | void testX11Struts_data(); | ||
59 | void testX11Struts(); | 59 | void testX11Struts(); | ||
60 | void test363804(); | 60 | void test363804(); | ||
61 | void testLeftScreenSmallerBottomAligned(); | 61 | void testLeftScreenSmallerBottomAligned(); | ||
62 | void testWindowMoveWithPanelBetweenScreens(); | ||||
62 | 63 | | |||
63 | private: | 64 | private: | ||
64 | KWayland::Client::Compositor *m_compositor = nullptr; | 65 | KWayland::Client::Compositor *m_compositor = nullptr; | ||
65 | KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; | 66 | KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; | ||
66 | }; | 67 | }; | ||
67 | 68 | | |||
68 | void StrutsTest::initTestCase() | 69 | void StrutsTest::initTestCase() | ||
69 | { | 70 | { | ||
▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Line(s) | 308 | { | |||
316 | QTest::addColumn<int>("rightStrutEnd"); | 317 | QTest::addColumn<int>("rightStrutEnd"); | ||
317 | QTest::addColumn<int>("topStrutStart"); | 318 | QTest::addColumn<int>("topStrutStart"); | ||
318 | QTest::addColumn<int>("topStrutEnd"); | 319 | QTest::addColumn<int>("topStrutEnd"); | ||
319 | QTest::addColumn<int>("bottomStrutStart"); | 320 | QTest::addColumn<int>("bottomStrutStart"); | ||
320 | QTest::addColumn<int>("bottomStrutEnd"); | 321 | QTest::addColumn<int>("bottomStrutEnd"); | ||
321 | QTest::addColumn<QRect>("screen0Maximized"); | 322 | QTest::addColumn<QRect>("screen0Maximized"); | ||
322 | QTest::addColumn<QRect>("screen1Maximized"); | 323 | QTest::addColumn<QRect>("screen1Maximized"); | ||
323 | QTest::addColumn<QRect>("workArea"); | 324 | QTest::addColumn<QRect>("workArea"); | ||
325 | QTest::addColumn<QRegion>("restrictedMoveArea"); | ||||
324 | 326 | | |||
325 | QTest::newRow("bottom panel/no strut") << QRect(0, 980, 1280, 44) | 327 | QTest::newRow("bottom panel/no strut") << QRect(0, 980, 1280, 44) | ||
326 | << 0 << 0 << 0 << 0 | 328 | << 0 << 0 << 0 << 0 | ||
327 | << 0 << 0 | 329 | << 0 << 0 | ||
328 | << 0 << 0 | 330 | << 0 << 0 | ||
329 | << 0 << 0 | 331 | << 0 << 0 | ||
330 | << 0 << 0 | 332 | << 0 << 0 | ||
331 | << QRect(0, 0, 1280, 1024) | 333 | << QRect(0, 0, 1280, 1024) | ||
332 | << QRect(1280, 0, 1280, 1024) | 334 | << QRect(1280, 0, 1280, 1024) | ||
333 | << QRect(0, 0, 2560, 1024); | 335 | << QRect(0, 0, 2560, 1024) | ||
336 | << QRegion(); | ||||
334 | QTest::newRow("bottom panel/strut") << QRect(0, 980, 1280, 44) | 337 | QTest::newRow("bottom panel/strut") << QRect(0, 980, 1280, 44) | ||
335 | << 0 << 0 << 0 << 44 | 338 | << 0 << 0 << 0 << 44 | ||
336 | << 0 << 0 | 339 | << 0 << 0 | ||
337 | << 0 << 0 | 340 | << 0 << 0 | ||
338 | << 0 << 0 | 341 | << 0 << 0 | ||
339 | << 0 << 1279 | 342 | << 0 << 1279 | ||
340 | << QRect(0, 0, 1280, 980) | 343 | << QRect(0, 0, 1280, 980) | ||
341 | << QRect(1280, 0, 1280, 1024) | 344 | << QRect(1280, 0, 1280, 1024) | ||
342 | << QRect(0, 0, 2560, 980); | 345 | << QRect(0, 0, 2560, 980) | ||
346 | << QRegion(0, 980, 1279, 44); | ||||
343 | QTest::newRow("top panel/no strut") << QRect(0, 0, 1280, 44) | 347 | QTest::newRow("top panel/no strut") << QRect(0, 0, 1280, 44) | ||
344 | << 0 << 0 << 0 << 0 | 348 | << 0 << 0 << 0 << 0 | ||
345 | << 0 << 0 | 349 | << 0 << 0 | ||
346 | << 0 << 0 | 350 | << 0 << 0 | ||
347 | << 0 << 0 | 351 | << 0 << 0 | ||
348 | << 0 << 0 | 352 | << 0 << 0 | ||
349 | << QRect(0, 0, 1280, 1024) | 353 | << QRect(0, 0, 1280, 1024) | ||
350 | << QRect(1280, 0, 1280, 1024) | 354 | << QRect(1280, 0, 1280, 1024) | ||
351 | << QRect(0, 0, 2560, 1024); | 355 | << QRect(0, 0, 2560, 1024) | ||
356 | << QRegion(); | ||||
352 | QTest::newRow("top panel/strut") << QRect(0, 0, 1280, 44) | 357 | QTest::newRow("top panel/strut") << QRect(0, 0, 1280, 44) | ||
353 | << 0 << 0 << 44 << 0 | 358 | << 0 << 0 << 44 << 0 | ||
354 | << 0 << 0 | 359 | << 0 << 0 | ||
355 | << 0 << 0 | 360 | << 0 << 0 | ||
356 | << 0 << 1279 | 361 | << 0 << 1279 | ||
357 | << 0 << 0 | 362 | << 0 << 0 | ||
358 | << QRect(0, 44, 1280, 980) | 363 | << QRect(0, 44, 1280, 980) | ||
359 | << QRect(1280, 0, 1280, 1024) | 364 | << QRect(1280, 0, 1280, 1024) | ||
360 | << QRect(0, 44, 2560, 980); | 365 | << QRect(0, 44, 2560, 980) | ||
366 | << QRegion(0, 0, 1279, 44); | ||||
361 | QTest::newRow("left panel/no strut") << QRect(0, 0, 60, 1024) | 367 | QTest::newRow("left panel/no strut") << QRect(0, 0, 60, 1024) | ||
362 | << 0 << 0 << 0 << 0 | 368 | << 0 << 0 << 0 << 0 | ||
363 | << 0 << 0 | 369 | << 0 << 0 | ||
364 | << 0 << 0 | 370 | << 0 << 0 | ||
365 | << 0 << 0 | 371 | << 0 << 0 | ||
366 | << 0 << 0 | 372 | << 0 << 0 | ||
367 | << QRect(0, 0, 1280, 1024) | 373 | << QRect(0, 0, 1280, 1024) | ||
368 | << QRect(1280, 0, 1280, 1024) | 374 | << QRect(1280, 0, 1280, 1024) | ||
369 | << QRect(0, 0, 2560, 1024); | 375 | << QRect(0, 0, 2560, 1024) | ||
376 | << QRegion(); | ||||
370 | QTest::newRow("left panel/strut") << QRect(0, 0, 60, 1024) | 377 | QTest::newRow("left panel/strut") << QRect(0, 0, 60, 1024) | ||
371 | << 60 << 0 << 0 << 0 | 378 | << 60 << 0 << 0 << 0 | ||
372 | << 0 << 1023 | 379 | << 0 << 1023 | ||
373 | << 0 << 0 | 380 | << 0 << 0 | ||
374 | << 0 << 0 | 381 | << 0 << 0 | ||
375 | << 0 << 0 | 382 | << 0 << 0 | ||
376 | << QRect(60, 0, 1220, 1024) | 383 | << QRect(60, 0, 1220, 1024) | ||
377 | << QRect(1280, 0, 1280, 1024) | 384 | << QRect(1280, 0, 1280, 1024) | ||
378 | << QRect(60, 0, 2500, 1024); | 385 | << QRect(60, 0, 2500, 1024) | ||
379 | QTest::newRow("right panel/no strut") << QRect(0, 1220, 60, 1024) | 386 | << QRegion(0, 0, 60, 1023); | ||
387 | QTest::newRow("right panel/no strut") << QRect(1220, 0, 60, 1024) | ||||
380 | << 0 << 0 << 0 << 0 | 388 | << 0 << 0 << 0 << 0 | ||
381 | << 0 << 0 | 389 | << 0 << 0 | ||
382 | << 0 << 0 | 390 | << 0 << 0 | ||
383 | << 0 << 0 | 391 | << 0 << 0 | ||
384 | << 0 << 0 | 392 | << 0 << 0 | ||
385 | << QRect(0, 0, 1280, 1024) | 393 | << QRect(0, 0, 1280, 1024) | ||
386 | << QRect(1280, 0, 1280, 1024) | 394 | << QRect(1280, 0, 1280, 1024) | ||
387 | << QRect(0, 0, 2560, 1024); | 395 | << QRect(0, 0, 2560, 1024) | ||
388 | QTest::newRow("right panel/strut") << QRect(0, 1220, 60, 1024) | 396 | << QRegion(); | ||
397 | QTest::newRow("right panel/strut") << QRect(1220, 0, 60, 1024) | ||||
389 | << 0 << 1340 << 0 << 0 | 398 | << 0 << 1340 << 0 << 0 | ||
390 | << 0 << 0 | 399 | << 0 << 0 | ||
391 | << 0 << 1023 | 400 | << 0 << 1023 | ||
392 | << 0 << 0 | 401 | << 0 << 0 | ||
393 | << 0 << 0 | 402 | << 0 << 0 | ||
394 | << QRect(0, 0, 1220, 1024) | 403 | << QRect(0, 0, 1220, 1024) | ||
395 | << QRect(1280, 0, 1280, 1024) | 404 | << QRect(1280, 0, 1280, 1024) | ||
396 | << QRect(0, 0, 2560, 1024); | 405 | << QRect(0, 0, 2560, 1024) | ||
406 | << QRegion(1220, 0, 60, 1023); | ||||
397 | // second screen | 407 | // second screen | ||
398 | QTest::newRow("bottom panel 1/no strut") << QRect(1280, 980, 1280, 44) | 408 | QTest::newRow("bottom panel 1/no strut") << QRect(1280, 980, 1280, 44) | ||
399 | << 0 << 0 << 0 << 0 | 409 | << 0 << 0 << 0 << 0 | ||
400 | << 0 << 0 | 410 | << 0 << 0 | ||
401 | << 0 << 0 | 411 | << 0 << 0 | ||
402 | << 0 << 0 | 412 | << 0 << 0 | ||
403 | << 0 << 0 | 413 | << 0 << 0 | ||
404 | << QRect(0, 0, 1280, 1024) | 414 | << QRect(0, 0, 1280, 1024) | ||
405 | << QRect(1280, 0, 1280, 1024) | 415 | << QRect(1280, 0, 1280, 1024) | ||
406 | << QRect(0, 0, 2560, 1024); | 416 | << QRect(0, 0, 2560, 1024) | ||
417 | << QRegion(); | ||||
407 | QTest::newRow("bottom panel 1/strut") << QRect(1280, 980, 1280, 44) | 418 | QTest::newRow("bottom panel 1/strut") << QRect(1280, 980, 1280, 44) | ||
408 | << 0 << 0 << 0 << 44 | 419 | << 0 << 0 << 0 << 44 | ||
409 | << 0 << 0 | 420 | << 0 << 0 | ||
410 | << 0 << 0 | 421 | << 0 << 0 | ||
411 | << 0 << 0 | 422 | << 0 << 0 | ||
412 | << 1280 << 2559 | 423 | << 1280 << 2559 | ||
413 | << QRect(0, 0, 1280, 1024) | 424 | << QRect(0, 0, 1280, 1024) | ||
414 | << QRect(1280, 0, 1280, 980) | 425 | << QRect(1280, 0, 1280, 980) | ||
415 | << QRect(0, 0, 2560, 980); | 426 | << QRect(0, 0, 2560, 980) | ||
427 | << QRegion(1280, 980, 1279, 44); | ||||
416 | QTest::newRow("top panel 1/no strut") << QRect(1280, 0, 1280, 44) | 428 | QTest::newRow("top panel 1/no strut") << QRect(1280, 0, 1280, 44) | ||
417 | << 0 << 0 << 0 << 0 | 429 | << 0 << 0 << 0 << 0 | ||
418 | << 0 << 0 | 430 | << 0 << 0 | ||
419 | << 0 << 0 | 431 | << 0 << 0 | ||
420 | << 0 << 0 | 432 | << 0 << 0 | ||
421 | << 0 << 0 | 433 | << 0 << 0 | ||
422 | << QRect(0, 0, 1280, 1024) | 434 | << QRect(0, 0, 1280, 1024) | ||
423 | << QRect(1280, 0, 1280, 1024) | 435 | << QRect(1280, 0, 1280, 1024) | ||
424 | << QRect(0, 0, 2560, 1024); | 436 | << QRect(0, 0, 2560, 1024) | ||
437 | << QRegion(); | ||||
425 | QTest::newRow("top panel 1 /strut") << QRect(1280, 0, 1280, 44) | 438 | QTest::newRow("top panel 1 /strut") << QRect(1280, 0, 1280, 44) | ||
426 | << 0 << 0 << 44 << 0 | 439 | << 0 << 0 << 44 << 0 | ||
427 | << 0 << 0 | 440 | << 0 << 0 | ||
428 | << 0 << 0 | 441 | << 0 << 0 | ||
429 | << 1280 << 2559 | 442 | << 1280 << 2559 | ||
430 | << 0 << 0 | 443 | << 0 << 0 | ||
431 | << QRect(0, 0, 1280, 1024) | 444 | << QRect(0, 0, 1280, 1024) | ||
432 | << QRect(1280, 44, 1280, 980) | 445 | << QRect(1280, 44, 1280, 980) | ||
433 | << QRect(0, 44, 2560, 980); | 446 | << QRect(0, 44, 2560, 980) | ||
447 | << QRegion(1280, 0, 1279, 44); | ||||
434 | QTest::newRow("left panel 1/no strut") << QRect(1280, 0, 60, 1024) | 448 | QTest::newRow("left panel 1/no strut") << QRect(1280, 0, 60, 1024) | ||
435 | << 0 << 0 << 0 << 0 | 449 | << 0 << 0 << 0 << 0 | ||
436 | << 0 << 0 | 450 | << 0 << 0 | ||
437 | << 0 << 0 | 451 | << 0 << 0 | ||
438 | << 0 << 0 | 452 | << 0 << 0 | ||
439 | << 0 << 0 | 453 | << 0 << 0 | ||
440 | << QRect(0, 0, 1280, 1024) | 454 | << QRect(0, 0, 1280, 1024) | ||
441 | << QRect(1280, 0, 1280, 1024) | 455 | << QRect(1280, 0, 1280, 1024) | ||
442 | << QRect(0, 0, 2560, 1024); | 456 | << QRect(0, 0, 2560, 1024) | ||
457 | << QRegion(); | ||||
443 | QTest::newRow("left panel 1/strut") << QRect(1280, 0, 60, 1024) | 458 | QTest::newRow("left panel 1/strut") << QRect(1280, 0, 60, 1024) | ||
444 | << 1340 << 0 << 0 << 0 | 459 | << 1340 << 0 << 0 << 0 | ||
445 | << 0 << 1023 | 460 | << 0 << 1023 | ||
446 | << 0 << 0 | 461 | << 0 << 0 | ||
447 | << 0 << 0 | 462 | << 0 << 0 | ||
448 | << 0 << 0 | 463 | << 0 << 0 | ||
449 | << QRect(0, 0, 1280, 1024) | 464 | << QRect(0, 0, 1280, 1024) | ||
450 | << QRect(1340, 0, 1220, 1024) | 465 | << QRect(1340, 0, 1220, 1024) | ||
451 | << QRect(0, 0, 2560, 1024); | 466 | << QRect(0, 0, 2560, 1024) | ||
467 | << QRegion(1280, 0, 60, 1023); | ||||
452 | // invalid struts | 468 | // invalid struts | ||
453 | QTest::newRow("bottom panel/ invalid strut") << QRect(0, 980, 1280, 44) | 469 | QTest::newRow("bottom panel/ invalid strut") << QRect(0, 980, 1280, 44) | ||
454 | << 1280 << 0 << 0 << 44 | 470 | << 1280 << 0 << 0 << 44 | ||
455 | << 980 << 1024 | 471 | << 980 << 1024 | ||
456 | << 0 << 0 | 472 | << 0 << 0 | ||
457 | << 0 << 0 | 473 | << 0 << 0 | ||
458 | << 0 << 1279 | 474 | << 0 << 1279 | ||
459 | << QRect(0, 0, 1280, 1024) | 475 | << QRect(0, 0, 1280, 1024) | ||
460 | << QRect(1280, 0, 1280, 1024) | 476 | << QRect(1280, 0, 1280, 1024) | ||
461 | << QRect(0, 0, 2560, 1024); | 477 | << QRect(0, 0, 2560, 1024) | ||
478 | << QRegion(0, 980, 1280, 44); | ||||
462 | QTest::newRow("top panel/ invalid strut") << QRect(0, 0, 1280, 44) | 479 | QTest::newRow("top panel/ invalid strut") << QRect(0, 0, 1280, 44) | ||
463 | << 1280 << 0 << 44 << 0 | 480 | << 1280 << 0 << 44 << 0 | ||
464 | << 0 << 44 | 481 | << 0 << 44 | ||
465 | << 0 << 0 | 482 | << 0 << 0 | ||
466 | << 0 << 1279 | 483 | << 0 << 1279 | ||
467 | << 0 << 0 | 484 | << 0 << 0 | ||
468 | << QRect(0, 0, 1280, 1024) | 485 | << QRect(0, 0, 1280, 1024) | ||
469 | << QRect(1280, 0, 1280, 1024) | 486 | << QRect(1280, 0, 1280, 1024) | ||
470 | << QRect(0, 0, 2560, 1024); | 487 | << QRect(0, 0, 2560, 1024) | ||
488 | << QRegion(0, 0, 1280, 44); | ||||
471 | QTest::newRow("top panel/invalid strut 2") << QRect(0, 0, 1280, 44) | 489 | QTest::newRow("top panel/invalid strut 2") << QRect(0, 0, 1280, 44) | ||
472 | << 0 << 0 << 1024 << 0 | 490 | << 0 << 0 << 1024 << 0 | ||
473 | << 0 << 0 | 491 | << 0 << 0 | ||
474 | << 0 << 0 | 492 | << 0 << 0 | ||
475 | << 0 << 1279 | 493 | << 0 << 1279 | ||
476 | << 0 << 0 | 494 | << 0 << 0 | ||
477 | << QRect(0, 0, 1280, 1024) | 495 | << QRect(0, 0, 1280, 1024) | ||
478 | << QRect(1280, 0, 1280, 1024) | 496 | << QRect(1280, 0, 1280, 1024) | ||
479 | << QRect(0, 0, 2560, 1024); | 497 | << QRect(0, 0, 2560, 1024) | ||
498 | << QRegion(0, 0, 1279, 1024); | ||||
480 | } | 499 | } | ||
481 | 500 | | |||
482 | struct XcbConnectionDeleter | 501 | struct XcbConnectionDeleter | ||
483 | { | 502 | { | ||
484 | static inline void cleanup(xcb_connection_t *pointer) | 503 | static inline void cleanup(xcb_connection_t *pointer) | ||
485 | { | 504 | { | ||
486 | xcb_disconnect(pointer); | 505 | xcb_disconnect(pointer); | ||
487 | } | 506 | } | ||
Show All 16 Lines | 510 | { | |||
504 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 523 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
505 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 524 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
506 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 525 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
507 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 526 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
508 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 527 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
509 | // combined | 528 | // combined | ||
510 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | 529 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
511 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 530 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
531 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | ||||
512 | 532 | | |||
513 | // create an xcb window | 533 | // create an xcb window | ||
514 | QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr)); | 534 | QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr)); | ||
515 | QVERIFY(!xcb_connection_has_error(c.data())); | 535 | QVERIFY(!xcb_connection_has_error(c.data())); | ||
516 | 536 | | |||
517 | xcb_window_t w = xcb_generate_id(c.data()); | 537 | xcb_window_t w = xcb_generate_id(c.data()); | ||
518 | QFETCH(QRect, windowGeometry); | 538 | QFETCH(QRect, windowGeometry); | ||
519 | xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(), | 539 | xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(), | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
586 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 606 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
587 | 607 | | |||
588 | // now verify the actual updated client areas | 608 | // now verify the actual updated client areas | ||
589 | QTEST(workspace()->clientArea(PlacementArea, 0, 1), "screen0Maximized"); | 609 | QTEST(workspace()->clientArea(PlacementArea, 0, 1), "screen0Maximized"); | ||
590 | QTEST(workspace()->clientArea(MaximizeArea, 0, 1), "screen0Maximized"); | 610 | QTEST(workspace()->clientArea(MaximizeArea, 0, 1), "screen0Maximized"); | ||
591 | QTEST(workspace()->clientArea(PlacementArea, 1, 1), "screen1Maximized"); | 611 | QTEST(workspace()->clientArea(PlacementArea, 1, 1), "screen1Maximized"); | ||
592 | QTEST(workspace()->clientArea(MaximizeArea, 1, 1), "screen1Maximized"); | 612 | QTEST(workspace()->clientArea(MaximizeArea, 1, 1), "screen1Maximized"); | ||
593 | QTEST(workspace()->clientArea(WorkArea, 0, 1), "workArea"); | 613 | QTEST(workspace()->clientArea(WorkArea, 0, 1), "workArea"); | ||
614 | QTEST(workspace()->restrictedMoveArea(-1), "restrictedMoveArea"); | ||||
594 | 615 | | |||
595 | // and destroy the window again | 616 | // and destroy the window again | ||
596 | xcb_unmap_window(c.data(), w); | 617 | xcb_unmap_window(c.data(), w); | ||
597 | xcb_destroy_window(c.data(), w); | 618 | xcb_destroy_window(c.data(), w); | ||
598 | xcb_flush(c.data()); | 619 | xcb_flush(c.data()); | ||
599 | c.reset(); | 620 | c.reset(); | ||
600 | 621 | | |||
601 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 622 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | ||
Show All 12 Lines | |||||
614 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 635 | QCOMPARE(workspace()->clientArea(MovementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
615 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 636 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
616 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 637 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
617 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 638 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
618 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 639 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
619 | // combined | 640 | // combined | ||
620 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | 641 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
621 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 642 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
643 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | ||||
622 | } | 644 | } | ||
623 | 645 | | |||
624 | void StrutsTest::test363804() | 646 | void StrutsTest::test363804() | ||
625 | { | 647 | { | ||
626 | // this test verifies the condition described in BUG 363804 | 648 | // this test verifies the condition described in BUG 363804 | ||
627 | // two screens in a vertical setup, aligned to right border with panel on the bottom screen | 649 | // two screens in a vertical setup, aligned to right border with panel on the bottom screen | ||
628 | const QVector<QRect> geometries{QRect(0, 0, 1920, 1080), QRect(554, 1080, 1366, 768)}; | 650 | const QVector<QRect> geometries{QRect(0, 0, 1920, 1080), QRect(554, 1080, 1366, 768)}; | ||
629 | QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged", | 651 | QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged", | ||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | 724 | { | |||
803 | xcb_flush(c.data()); | 825 | xcb_flush(c.data()); | ||
804 | c.reset(); | 826 | c.reset(); | ||
805 | 827 | | |||
806 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 828 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | ||
807 | QVERIFY(windowClosedSpy.isValid()); | 829 | QVERIFY(windowClosedSpy.isValid()); | ||
808 | QVERIFY(windowClosedSpy.wait()); | 830 | QVERIFY(windowClosedSpy.wait()); | ||
809 | } | 831 | } | ||
810 | 832 | | |||
833 | void StrutsTest::testWindowMoveWithPanelBetweenScreens() | ||||
834 | { | ||||
835 | // this test verifies the condition of BUG | ||||
836 | // when moving a window with decorations in a restricted way it should pass from one screen | ||||
837 | // to the other even if there is a panel in between. | ||||
838 | | ||||
839 | // left screen must be smaller than right screen | ||||
840 | const QVector<QRect> geometries{QRect(0, 282, 1366, 768), QRect(1366, 0, 1680, 1050)}; | ||||
841 | QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged", | ||||
842 | Qt::DirectConnection, | ||||
843 | Q_ARG(QVector<QRect>, geometries)); | ||||
844 | QCOMPARE(screens()->geometry(0), geometries.at(0)); | ||||
845 | QCOMPARE(screens()->geometry(1), geometries.at(1)); | ||||
846 | QCOMPARE(screens()->geometry(), QRect(0, 0, 3046, 1050)); | ||||
847 | | ||||
848 | // create the panel on the right screen, left edge | ||||
849 | QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr)); | ||||
850 | QVERIFY(!xcb_connection_has_error(c.data())); | ||||
851 | | ||||
852 | xcb_window_t w = xcb_generate_id(c.data()); | ||||
853 | const QRect windowGeometry(1366, 0, 24, 1050); | ||||
854 | xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(), | ||||
855 | windowGeometry.x(), | ||||
856 | windowGeometry.y(), | ||||
857 | windowGeometry.width(), | ||||
858 | windowGeometry.height(), | ||||
859 | 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); | ||||
860 | xcb_size_hints_t hints; | ||||
861 | memset(&hints, 0, sizeof(hints)); | ||||
862 | xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y()); | ||||
863 | xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height()); | ||||
864 | xcb_icccm_set_wm_normal_hints(c.data(), w, &hints); | ||||
865 | NETWinInfo info(c.data(), w, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties); | ||||
866 | info.setWindowType(NET::Dock); | ||||
867 | NETExtendedStrut strut; | ||||
868 | strut.left_start = 0; | ||||
869 | strut.left_end = 1050; | ||||
870 | strut.left_width = 1366+24; | ||||
871 | strut.right_start = 0; | ||||
872 | strut.right_end = 0; | ||||
873 | strut.right_width = 0; | ||||
874 | strut.top_start = 0; | ||||
875 | strut.top_end = 0; | ||||
876 | strut.top_width = 0; | ||||
877 | strut.bottom_start = 0; | ||||
878 | strut.bottom_end = 0; | ||||
879 | strut.bottom_width = 0; | ||||
880 | info.setExtendedStrut(strut); | ||||
881 | xcb_map_window(c.data(), w); | ||||
882 | xcb_flush(c.data()); | ||||
883 | | ||||
884 | // we should get a client for it | ||||
885 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||||
886 | QVERIFY(windowCreatedSpy.isValid()); | ||||
887 | QVERIFY(windowCreatedSpy.wait()); | ||||
888 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | ||||
889 | QVERIFY(client); | ||||
890 | QCOMPARE(client->window(), w); | ||||
891 | QVERIFY(!client->isDecorated()); | ||||
892 | QCOMPARE(client->windowType(), NET::Dock); | ||||
893 | QCOMPARE(client->geometry(), windowGeometry); | ||||
894 | | ||||
895 | // now verify the actual updated client areas | ||||
896 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 282, 1366, 768)); | ||||
897 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 282, 1366, 768)); | ||||
898 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1390, 0, 1656, 1050)); | ||||
899 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1390, 0, 1656, 1050)); | ||||
900 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 3046, 1050)); | ||||
901 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion(1366, 0, 24, 1050)); | ||||
902 | | ||||
903 | // create another window and try to move it | ||||
904 | | ||||
905 | xcb_window_t w2 = xcb_generate_id(c.data()); | ||||
906 | const QRect windowGeometry2(1500, 400, 200, 300); | ||||
907 | xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w2, rootWindow(), | ||||
908 | windowGeometry2.x(), | ||||
909 | windowGeometry2.y(), | ||||
910 | windowGeometry2.width(), | ||||
911 | windowGeometry2.height(), | ||||
912 | 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); | ||||
913 | xcb_size_hints_t hints2; | ||||
914 | memset(&hints2, 0, sizeof(hints2)); | ||||
915 | xcb_icccm_size_hints_set_position(&hints2, 1, windowGeometry2.x(), windowGeometry2.y()); | ||||
916 | xcb_icccm_size_hints_set_min_size(&hints2, 200, 300); | ||||
917 | xcb_icccm_set_wm_normal_hints(c.data(), w2, &hints2); | ||||
918 | xcb_map_window(c.data(), w2); | ||||
919 | xcb_flush(c.data()); | ||||
920 | QVERIFY(windowCreatedSpy.wait()); | ||||
921 | Client *client2 = windowCreatedSpy.last().first().value<Client*>(); | ||||
922 | QVERIFY(client2); | ||||
923 | QVERIFY(client2 != client); | ||||
924 | QVERIFY(client2->isDecorated()); | ||||
925 | QCOMPARE(client2->clientSize(), QSize(200, 300)); | ||||
926 | QCOMPARE(client2->pos(), QPoint(1500, 400)); | ||||
927 | | ||||
928 | const QRect origGeo = client2->geometry(); | ||||
929 | Cursor::setPos(origGeo.center()); | ||||
930 | workspace()->performWindowOperation(client2, Options::MoveOp); | ||||
931 | QTRY_COMPARE(workspace()->getMovingClient(), client2); | ||||
932 | QVERIFY(client2->isMove()); | ||||
933 | // move to next screen - step is 8 pixel, so 800 pixel | ||||
934 | for (int i = 0; i < 100; i++) { | ||||
935 | client2->keyPressEvent(Qt::Key_Left); | ||||
936 | } | ||||
937 | client2->keyPressEvent(Qt::Key_Enter); | ||||
938 | QCOMPARE(client2->isMove(), false); | ||||
939 | QVERIFY(workspace()->getMovingClient() == nullptr); | ||||
940 | QCOMPARE(client2->geometry(), QRect(origGeo.translated(-800, 0))); | ||||
941 | } | ||||
942 | | ||||
811 | } | 943 | } | ||
812 | 944 | | |||
813 | WAYLANDTEST_MAIN(KWin::StrutsTest) | 945 | WAYLANDTEST_MAIN(KWin::StrutsTest) | ||
814 | #include "struts_test.moc" | 946 | #include "struts_test.moc" |