Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/struts_test.cpp
Show All 13 Lines | |||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
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 "client.h" | 22 | #include "x11client.h" | ||
23 | #include "cursor.h" | 23 | #include "cursor.h" | ||
24 | #include "deleted.h" | 24 | #include "deleted.h" | ||
25 | #include "screenedge.h" | 25 | #include "screenedge.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | #include "xdgshellclient.h" | 29 | #include "xdgshellclient.h" | ||
30 | #include <kwineffects.h> | 30 | #include <kwineffects.h> | ||
▲ Show 20 Lines • Show All 564 Lines • ▼ Show 20 Line(s) | 527 | { | |||
595 | info.setExtendedStrut(strut); | 595 | info.setExtendedStrut(strut); | ||
596 | xcb_map_window(c.data(), w); | 596 | xcb_map_window(c.data(), w); | ||
597 | xcb_flush(c.data()); | 597 | xcb_flush(c.data()); | ||
598 | 598 | | |||
599 | // we should get a client for it | 599 | // we should get a client for it | ||
600 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 600 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
601 | QVERIFY(windowCreatedSpy.isValid()); | 601 | QVERIFY(windowCreatedSpy.isValid()); | ||
602 | QVERIFY(windowCreatedSpy.wait()); | 602 | QVERIFY(windowCreatedSpy.wait()); | ||
603 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 603 | X11Client *client = windowCreatedSpy.first().first().value<X11Client *>(); | ||
604 | QVERIFY(client); | 604 | QVERIFY(client); | ||
605 | QCOMPARE(client->window(), w); | 605 | QCOMPARE(client->window(), w); | ||
606 | QVERIFY(!client->isDecorated()); | 606 | QVERIFY(!client->isDecorated()); | ||
607 | QCOMPARE(client->windowType(), NET::Dock); | 607 | QCOMPARE(client->windowType(), NET::Dock); | ||
608 | QCOMPARE(client->geometry(), windowGeometry); | 608 | QCOMPARE(client->geometry(), windowGeometry); | ||
609 | 609 | | |||
610 | // this should have affected the client area | 610 | // this should have affected the client area | ||
611 | // some props are independent of struts - those first | 611 | // some props are independent of struts - those first | ||
Show All 19 Lines | |||||
631 | QTEST(workspace()->restrictedMoveArea(-1), "restrictedMoveArea"); | 631 | QTEST(workspace()->restrictedMoveArea(-1), "restrictedMoveArea"); | ||
632 | 632 | | |||
633 | // and destroy the window again | 633 | // and destroy the window again | ||
634 | xcb_unmap_window(c.data(), w); | 634 | xcb_unmap_window(c.data(), w); | ||
635 | xcb_destroy_window(c.data(), w); | 635 | xcb_destroy_window(c.data(), w); | ||
636 | xcb_flush(c.data()); | 636 | xcb_flush(c.data()); | ||
637 | c.reset(); | 637 | c.reset(); | ||
638 | 638 | | |||
639 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 639 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
640 | QVERIFY(windowClosedSpy.isValid()); | 640 | QVERIFY(windowClosedSpy.isValid()); | ||
641 | QVERIFY(windowClosedSpy.wait()); | 641 | QVERIFY(windowClosedSpy.wait()); | ||
642 | 642 | | |||
643 | // now struts should be removed again | 643 | // now struts should be removed again | ||
644 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1024)); | 644 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
645 | QCOMPARE(workspace()->clientArea(MovementArea, 0, 1), QRect(0, 0, 1280, 1024)); | 645 | QCOMPARE(workspace()->clientArea(MovementArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
646 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1024)); | 646 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
647 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 0, 1), QRect(0, 0, 1280, 1024)); | 647 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 664 | { | |||
708 | info.setExtendedStrut(strut); | 708 | info.setExtendedStrut(strut); | ||
709 | xcb_map_window(c.data(), w); | 709 | xcb_map_window(c.data(), w); | ||
710 | xcb_flush(c.data()); | 710 | xcb_flush(c.data()); | ||
711 | 711 | | |||
712 | // we should get a client for it | 712 | // we should get a client for it | ||
713 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 713 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
714 | QVERIFY(windowCreatedSpy.isValid()); | 714 | QVERIFY(windowCreatedSpy.isValid()); | ||
715 | QVERIFY(windowCreatedSpy.wait()); | 715 | QVERIFY(windowCreatedSpy.wait()); | ||
716 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 716 | X11Client *client = windowCreatedSpy.first().first().value<X11Client *>(); | ||
717 | QVERIFY(client); | 717 | QVERIFY(client); | ||
718 | QCOMPARE(client->window(), w); | 718 | QCOMPARE(client->window(), w); | ||
719 | QVERIFY(!client->isDecorated()); | 719 | QVERIFY(!client->isDecorated()); | ||
720 | QCOMPARE(client->windowType(), NET::Dock); | 720 | QCOMPARE(client->windowType(), NET::Dock); | ||
721 | QCOMPARE(client->geometry(), windowGeometry); | 721 | QCOMPARE(client->geometry(), windowGeometry); | ||
722 | 722 | | |||
723 | // now verify the actual updated client areas | 723 | // now verify the actual updated client areas | ||
724 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), geometries.at(0)); | 724 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), geometries.at(0)); | ||
725 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), geometries.at(0)); | 725 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), geometries.at(0)); | ||
726 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(554, 1080, 1366, 732)); | 726 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(554, 1080, 1366, 732)); | ||
727 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(554, 1080, 1366, 732)); | 727 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(554, 1080, 1366, 732)); | ||
728 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 1920, 1812)); | 728 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 1920, 1812)); | ||
729 | 729 | | |||
730 | // and destroy the window again | 730 | // and destroy the window again | ||
731 | xcb_unmap_window(c.data(), w); | 731 | xcb_unmap_window(c.data(), w); | ||
732 | xcb_destroy_window(c.data(), w); | 732 | xcb_destroy_window(c.data(), w); | ||
733 | xcb_flush(c.data()); | 733 | xcb_flush(c.data()); | ||
734 | c.reset(); | 734 | c.reset(); | ||
735 | 735 | | |||
736 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 736 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
737 | QVERIFY(windowClosedSpy.isValid()); | 737 | QVERIFY(windowClosedSpy.isValid()); | ||
738 | QVERIFY(windowClosedSpy.wait()); | 738 | QVERIFY(windowClosedSpy.wait()); | ||
739 | } | 739 | } | ||
740 | 740 | | |||
741 | void StrutsTest::testLeftScreenSmallerBottomAligned() | 741 | void StrutsTest::testLeftScreenSmallerBottomAligned() | ||
742 | { | 742 | { | ||
743 | // this test verifies a two screen setup with the left screen smaller than the right and bottom aligned | 743 | // this test verifies a two screen setup with the left screen smaller than the right and bottom aligned | ||
744 | // the panel is on the top of the left screen, thus not at 0/0 | 744 | // the panel is on the top of the left screen, thus not at 0/0 | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
788 | info.setExtendedStrut(strut); | 788 | info.setExtendedStrut(strut); | ||
789 | xcb_map_window(c.data(), w); | 789 | xcb_map_window(c.data(), w); | ||
790 | xcb_flush(c.data()); | 790 | xcb_flush(c.data()); | ||
791 | 791 | | |||
792 | // we should get a client for it | 792 | // we should get a client for it | ||
793 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 793 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
794 | QVERIFY(windowCreatedSpy.isValid()); | 794 | QVERIFY(windowCreatedSpy.isValid()); | ||
795 | QVERIFY(windowCreatedSpy.wait()); | 795 | QVERIFY(windowCreatedSpy.wait()); | ||
796 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 796 | X11Client *client = windowCreatedSpy.first().first().value<X11Client *>(); | ||
797 | QVERIFY(client); | 797 | QVERIFY(client); | ||
798 | QCOMPARE(client->window(), w); | 798 | QCOMPARE(client->window(), w); | ||
799 | QVERIFY(!client->isDecorated()); | 799 | QVERIFY(!client->isDecorated()); | ||
800 | QCOMPARE(client->windowType(), NET::Dock); | 800 | QCOMPARE(client->windowType(), NET::Dock); | ||
801 | QCOMPARE(client->geometry(), windowGeometry); | 801 | QCOMPARE(client->geometry(), windowGeometry); | ||
802 | 802 | | |||
803 | // now verify the actual updated client areas | 803 | // now verify the actual updated client areas | ||
804 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 306, 1366, 744)); | 804 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 306, 1366, 744)); | ||
Show All 14 Lines | 814 | xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w2, rootWindow(), | |||
819 | 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); | 819 | 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); | ||
820 | xcb_size_hints_t hints2; | 820 | xcb_size_hints_t hints2; | ||
821 | memset(&hints2, 0, sizeof(hints2)); | 821 | memset(&hints2, 0, sizeof(hints2)); | ||
822 | xcb_icccm_size_hints_set_min_size(&hints2, 868, 431); | 822 | xcb_icccm_size_hints_set_min_size(&hints2, 868, 431); | ||
823 | xcb_icccm_set_wm_normal_hints(c.data(), w2, &hints2); | 823 | xcb_icccm_set_wm_normal_hints(c.data(), w2, &hints2); | ||
824 | xcb_map_window(c.data(), w2); | 824 | xcb_map_window(c.data(), w2); | ||
825 | xcb_flush(c.data()); | 825 | xcb_flush(c.data()); | ||
826 | QVERIFY(windowCreatedSpy.wait()); | 826 | QVERIFY(windowCreatedSpy.wait()); | ||
827 | Client *client2 = windowCreatedSpy.last().first().value<Client*>(); | 827 | X11Client *client2 = windowCreatedSpy.last().first().value<X11Client *>(); | ||
828 | QVERIFY(client2); | 828 | QVERIFY(client2); | ||
829 | QVERIFY(client2 != client); | 829 | QVERIFY(client2 != client); | ||
830 | QVERIFY(client2->isDecorated()); | 830 | QVERIFY(client2->isDecorated()); | ||
831 | QCOMPARE(client2->geometry(), QRect(0, 306, 1366, 744)); | 831 | QCOMPARE(client2->geometry(), QRect(0, 306, 1366, 744)); | ||
832 | QCOMPARE(client2->maximizeMode(), KWin::MaximizeFull); | 832 | QCOMPARE(client2->maximizeMode(), KWin::MaximizeFull); | ||
833 | // destroy window again | 833 | // destroy window again | ||
834 | QSignalSpy normalWindowClosedSpy(client2, &Client::windowClosed); | 834 | QSignalSpy normalWindowClosedSpy(client2, &X11Client::windowClosed); | ||
835 | QVERIFY(normalWindowClosedSpy.isValid()); | 835 | QVERIFY(normalWindowClosedSpy.isValid()); | ||
836 | xcb_unmap_window(c.data(), w2); | 836 | xcb_unmap_window(c.data(), w2); | ||
837 | xcb_destroy_window(c.data(), w2); | 837 | xcb_destroy_window(c.data(), w2); | ||
838 | xcb_flush(c.data()); | 838 | xcb_flush(c.data()); | ||
839 | QVERIFY(normalWindowClosedSpy.wait()); | 839 | QVERIFY(normalWindowClosedSpy.wait()); | ||
840 | 840 | | |||
841 | // and destroy the window again | 841 | // and destroy the window again | ||
842 | xcb_unmap_window(c.data(), w); | 842 | xcb_unmap_window(c.data(), w); | ||
843 | xcb_destroy_window(c.data(), w); | 843 | xcb_destroy_window(c.data(), w); | ||
844 | xcb_flush(c.data()); | 844 | xcb_flush(c.data()); | ||
845 | c.reset(); | 845 | c.reset(); | ||
846 | 846 | | |||
847 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 847 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
848 | QVERIFY(windowClosedSpy.isValid()); | 848 | QVERIFY(windowClosedSpy.isValid()); | ||
849 | QVERIFY(windowClosedSpy.wait()); | 849 | QVERIFY(windowClosedSpy.wait()); | ||
850 | } | 850 | } | ||
851 | 851 | | |||
852 | void StrutsTest::testWindowMoveWithPanelBetweenScreens() | 852 | void StrutsTest::testWindowMoveWithPanelBetweenScreens() | ||
853 | { | 853 | { | ||
854 | // this test verifies the condition of BUG | 854 | // this test verifies the condition of BUG | ||
855 | // when moving a window with decorations in a restricted way it should pass from one screen | 855 | // when moving a window with decorations in a restricted way it should pass from one screen | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
900 | info.setExtendedStrut(strut); | 900 | info.setExtendedStrut(strut); | ||
901 | xcb_map_window(c.data(), w); | 901 | xcb_map_window(c.data(), w); | ||
902 | xcb_flush(c.data()); | 902 | xcb_flush(c.data()); | ||
903 | 903 | | |||
904 | // we should get a client for it | 904 | // we should get a client for it | ||
905 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 905 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
906 | QVERIFY(windowCreatedSpy.isValid()); | 906 | QVERIFY(windowCreatedSpy.isValid()); | ||
907 | QVERIFY(windowCreatedSpy.wait()); | 907 | QVERIFY(windowCreatedSpy.wait()); | ||
908 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 908 | X11Client *client = windowCreatedSpy.first().first().value<X11Client *>(); | ||
909 | QVERIFY(client); | 909 | QVERIFY(client); | ||
910 | QCOMPARE(client->window(), w); | 910 | QCOMPARE(client->window(), w); | ||
911 | QVERIFY(!client->isDecorated()); | 911 | QVERIFY(!client->isDecorated()); | ||
912 | QCOMPARE(client->windowType(), NET::Dock); | 912 | QCOMPARE(client->windowType(), NET::Dock); | ||
913 | QCOMPARE(client->geometry(), windowGeometry); | 913 | QCOMPARE(client->geometry(), windowGeometry); | ||
914 | 914 | | |||
915 | // now verify the actual updated client areas | 915 | // now verify the actual updated client areas | ||
916 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 282, 1366, 768)); | 916 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 282, 1366, 768)); | ||
Show All 16 Lines | |||||
933 | xcb_size_hints_t hints2; | 933 | xcb_size_hints_t hints2; | ||
934 | memset(&hints2, 0, sizeof(hints2)); | 934 | memset(&hints2, 0, sizeof(hints2)); | ||
935 | xcb_icccm_size_hints_set_position(&hints2, 1, windowGeometry2.x(), windowGeometry2.y()); | 935 | xcb_icccm_size_hints_set_position(&hints2, 1, windowGeometry2.x(), windowGeometry2.y()); | ||
936 | xcb_icccm_size_hints_set_min_size(&hints2, 200, 300); | 936 | xcb_icccm_size_hints_set_min_size(&hints2, 200, 300); | ||
937 | xcb_icccm_set_wm_normal_hints(c.data(), w2, &hints2); | 937 | xcb_icccm_set_wm_normal_hints(c.data(), w2, &hints2); | ||
938 | xcb_map_window(c.data(), w2); | 938 | xcb_map_window(c.data(), w2); | ||
939 | xcb_flush(c.data()); | 939 | xcb_flush(c.data()); | ||
940 | QVERIFY(windowCreatedSpy.wait()); | 940 | QVERIFY(windowCreatedSpy.wait()); | ||
941 | Client *client2 = windowCreatedSpy.last().first().value<Client*>(); | 941 | X11Client *client2 = windowCreatedSpy.last().first().value<X11Client *>(); | ||
942 | QVERIFY(client2); | 942 | QVERIFY(client2); | ||
943 | QVERIFY(client2 != client); | 943 | QVERIFY(client2 != client); | ||
944 | QVERIFY(client2->isDecorated()); | 944 | QVERIFY(client2->isDecorated()); | ||
945 | QCOMPARE(client2->clientSize(), QSize(200, 300)); | 945 | QCOMPARE(client2->clientSize(), QSize(200, 300)); | ||
946 | QCOMPARE(client2->pos(), QPoint(1500, 400)); | 946 | QCOMPARE(client2->pos(), QPoint(1500, 400)); | ||
947 | 947 | | |||
948 | const QRect origGeo = client2->geometry(); | 948 | const QRect origGeo = client2->geometry(); | ||
949 | Cursor::setPos(origGeo.center()); | 949 | Cursor::setPos(origGeo.center()); | ||
Show All 18 Lines |