Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_test.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 59 | private Q_SLOTS: | |||
---|---|---|---|---|---|
89 | void testUnresponsiveWindow(); | 89 | void testUnresponsiveWindow(); | ||
90 | void testX11WindowId_data(); | 90 | void testX11WindowId_data(); | ||
91 | void testX11WindowId(); | 91 | void testX11WindowId(); | ||
92 | void testAppMenu(); | 92 | void testAppMenu(); | ||
93 | void testNoDecorationModeRequested_data(); | 93 | void testNoDecorationModeRequested_data(); | ||
94 | void testNoDecorationModeRequested(); | 94 | void testNoDecorationModeRequested(); | ||
95 | void testSendClientWithTransientToDesktop_data(); | 95 | void testSendClientWithTransientToDesktop_data(); | ||
96 | void testSendClientWithTransientToDesktop(); | 96 | void testSendClientWithTransientToDesktop(); | ||
97 | void testMinimizeWindowWithTransients_data(); | ||||
98 | void testMinimizeWindowWithTransients(); | ||||
97 | }; | 99 | }; | ||
98 | 100 | | |||
99 | void TestShellClient::initTestCase() | 101 | void TestShellClient::initTestCase() | ||
100 | { | 102 | { | ||
101 | qRegisterMetaType<KWin::Deleted*>(); | 103 | qRegisterMetaType<KWin::Deleted*>(); | ||
102 | qRegisterMetaType<KWin::ShellClient*>(); | 104 | qRegisterMetaType<KWin::ShellClient*>(); | ||
103 | qRegisterMetaType<KWin::AbstractClient*>(); | 105 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
104 | qRegisterMetaType<KWayland::Client::Output*>(); | 106 | qRegisterMetaType<KWayland::Client::Output*>(); | ||
▲ Show 20 Lines • Show All 1035 Lines • ▼ Show 20 Line(s) | 1104 | { | |||
1140 | QCOMPARE(transient->desktop(), 2); | 1142 | QCOMPARE(transient->desktop(), 2); | ||
1141 | workspace()->slotWindowToDesktop(1); | 1143 | workspace()->slotWindowToDesktop(1); | ||
1142 | 1144 | | |||
1143 | // which should move the transient back to the desktop | 1145 | // which should move the transient back to the desktop | ||
1144 | QCOMPARE(c->desktop(), 1); | 1146 | QCOMPARE(c->desktop(), 1); | ||
1145 | QCOMPARE(transient->desktop(), 1); | 1147 | QCOMPARE(transient->desktop(), 1); | ||
1146 | } | 1148 | } | ||
1147 | 1149 | | |||
1150 | void TestShellClient::testMinimizeWindowWithTransients_data() | ||||
1151 | { | ||||
1152 | QTest::addColumn<Test::ShellSurfaceType>("type"); | ||||
1153 | | ||||
1154 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | ||||
1155 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | ||||
1156 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | ||||
1157 | } | ||||
1158 | | ||||
1159 | void TestShellClient::testMinimizeWindowWithTransients() | ||||
1160 | { | ||||
1161 | // this test verifies that when minimizing/unminimizing a window all its | ||||
1162 | // transients will be minimized/unminimized as well | ||||
1163 | | ||||
1164 | // create the main window | ||||
1165 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
1166 | QFETCH(Test::ShellSurfaceType, type); | ||||
1167 | QScopedPointer<XdgShellSurface> shellSurface(qobject_cast<XdgShellSurface *>( | ||||
1168 | Test::createShellSurface(type, surface.data()))); | ||||
1169 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1170 | QVERIFY(c); | ||||
1171 | QVERIFY(!c->isMinimized()); | ||||
1172 | | ||||
1173 | // create a transient window | ||||
1174 | QScopedPointer<Surface> transientSurface(Test::createSurface()); | ||||
1175 | QScopedPointer<XdgShellSurface> transientShellSurface(qobject_cast<XdgShellSurface *>( | ||||
1176 | Test::createShellSurface(type, transientSurface.data()))); | ||||
1177 | transientShellSurface->setTransientFor(shellSurface.data()); | ||||
1178 | auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::red); | ||||
1179 | QVERIFY(transient); | ||||
1180 | QVERIFY(!transient->isMinimized()); | ||||
1181 | QCOMPARE(transient->transientFor(), c); | ||||
1182 | QVERIFY(c->hasTransient(transient, false)); | ||||
1183 | | ||||
1184 | // minimize the main window, the transient should be minimized as well | ||||
1185 | c->minimize(); | ||||
1186 | QVERIFY(c->isMinimized()); | ||||
1187 | QVERIFY(transient->isMinimized()); | ||||
1188 | | ||||
1189 | // unminimize the main window, the transient should be unminimized as well | ||||
1190 | c->unminimize(); | ||||
1191 | QVERIFY(!c->isMinimized()); | ||||
1192 | QVERIFY(!transient->isMinimized()); | ||||
1193 | } | ||||
1194 | | ||||
1148 | WAYLANDTEST_MAIN(TestShellClient) | 1195 | WAYLANDTEST_MAIN(TestShellClient) | ||
1149 | #include "shell_client_test.moc" | 1196 | #include "shell_client_test.moc" |