Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/virtual_desktop_test.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
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 "abstract_client.h" | ||||
21 | #include "main.h" | 22 | #include "main.h" | ||
22 | #include "platform.h" | 23 | #include "platform.h" | ||
23 | #include "screens.h" | 24 | #include "screens.h" | ||
24 | #include "xdgshellclient.h" | | |||
25 | #include "wayland_server.h" | 25 | #include "wayland_server.h" | ||
26 | #include "virtualdesktops.h" | 26 | #include "virtualdesktops.h" | ||
27 | 27 | | |||
28 | #include <KWayland/Client/surface.h> | 28 | #include <KWayland/Client/surface.h> | ||
29 | 29 | | |||
30 | using namespace KWin; | 30 | using namespace KWin; | ||
31 | using namespace KWayland::Client; | 31 | using namespace KWayland::Client; | ||
32 | 32 | | |||
Show All 13 Lines | 38 | private Q_SLOTS: | |||
46 | void testWindowOnMultipleDesktops_data(); | 46 | void testWindowOnMultipleDesktops_data(); | ||
47 | void testWindowOnMultipleDesktops(); | 47 | void testWindowOnMultipleDesktops(); | ||
48 | void testRemoveDesktopWithWindow_data(); | 48 | void testRemoveDesktopWithWindow_data(); | ||
49 | void testRemoveDesktopWithWindow(); | 49 | void testRemoveDesktopWithWindow(); | ||
50 | }; | 50 | }; | ||
51 | 51 | | |||
52 | void VirtualDesktopTest::initTestCase() | 52 | void VirtualDesktopTest::initTestCase() | ||
53 | { | 53 | { | ||
54 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
55 | qRegisterMetaType<KWin::AbstractClient*>(); | 54 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
56 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 55 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
57 | QVERIFY(workspaceCreatedSpy.isValid()); | 56 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
58 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 57 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
59 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 58 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
60 | 59 | | |||
61 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | 60 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | ||
62 | qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); | 61 | qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 141 | { | |||
152 | // now create a window on this desktop | 151 | // now create a window on this desktop | ||
153 | QScopedPointer<Surface> surface(Test::createSurface()); | 152 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
154 | QFETCH(Test::XdgShellSurfaceType, type); | 153 | QFETCH(Test::XdgShellSurfaceType, type); | ||
155 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 154 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
156 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 155 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
157 | 156 | | |||
158 | QVERIFY(client); | 157 | QVERIFY(client); | ||
159 | QCOMPARE(client->desktop(), 2); | 158 | QCOMPARE(client->desktop(), 2); | ||
160 | QSignalSpy desktopPresenceChangedSpy(client, &XdgShellClient::desktopPresenceChanged); | 159 | QSignalSpy desktopPresenceChangedSpy(client, &AbstractClient::desktopPresenceChanged); | ||
161 | QVERIFY(desktopPresenceChangedSpy.isValid()); | 160 | QVERIFY(desktopPresenceChangedSpy.isValid()); | ||
162 | 161 | | |||
163 | QCOMPARE(client->desktops().count(), 1u); | 162 | QCOMPARE(client->desktops().count(), 1u); | ||
164 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | 163 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | ||
165 | 164 | | |||
166 | // and remove last desktop | 165 | // and remove last desktop | ||
167 | VirtualDesktopManager::self()->setCount(1); | 166 | VirtualDesktopManager::self()->setCount(1); | ||
168 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | 167 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | ||
Show All 27 Lines | 185 | { | |||
196 | // now create a window on this desktop | 195 | // now create a window on this desktop | ||
197 | QScopedPointer<Surface> surface(Test::createSurface()); | 196 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
198 | QFETCH(Test::XdgShellSurfaceType, type); | 197 | QFETCH(Test::XdgShellSurfaceType, type); | ||
199 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 198 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
200 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 199 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
201 | 200 | | |||
202 | QVERIFY(client); | 201 | QVERIFY(client); | ||
203 | QCOMPARE(client->desktop(), 3u); | 202 | QCOMPARE(client->desktop(), 3u); | ||
204 | QSignalSpy desktopPresenceChangedSpy(client, &XdgShellClient::desktopPresenceChanged); | 203 | QSignalSpy desktopPresenceChangedSpy(client, &AbstractClient::desktopPresenceChanged); | ||
205 | QVERIFY(desktopPresenceChangedSpy.isValid()); | 204 | QVERIFY(desktopPresenceChangedSpy.isValid()); | ||
206 | 205 | | |||
207 | QCOMPARE(client->desktops().count(), 1u); | 206 | QCOMPARE(client->desktops().count(), 1u); | ||
208 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | 207 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | ||
209 | 208 | | |||
210 | //Set the window on desktop 2 as well | 209 | //Set the window on desktop 2 as well | ||
211 | client->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(2)); | 210 | client->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(2)); | ||
212 | QCOMPARE(client->desktops().count(), 2u); | 211 | QCOMPARE(client->desktops().count(), 2u); | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 273 | { | |||
284 | // now create a window on this desktop | 283 | // now create a window on this desktop | ||
285 | QScopedPointer<Surface> surface(Test::createSurface()); | 284 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
286 | QFETCH(Test::XdgShellSurfaceType, type); | 285 | QFETCH(Test::XdgShellSurfaceType, type); | ||
287 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 286 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
288 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 287 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
289 | 288 | | |||
290 | QVERIFY(client); | 289 | QVERIFY(client); | ||
291 | QCOMPARE(client->desktop(), 3u); | 290 | QCOMPARE(client->desktop(), 3u); | ||
292 | QSignalSpy desktopPresenceChangedSpy(client, &XdgShellClient::desktopPresenceChanged); | 291 | QSignalSpy desktopPresenceChangedSpy(client, &AbstractClient::desktopPresenceChanged); | ||
293 | QVERIFY(desktopPresenceChangedSpy.isValid()); | 292 | QVERIFY(desktopPresenceChangedSpy.isValid()); | ||
294 | 293 | | |||
295 | QCOMPARE(client->desktops().count(), 1u); | 294 | QCOMPARE(client->desktops().count(), 1u); | ||
296 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | 295 | QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); | ||
297 | 296 | | |||
298 | //Set the window on desktop 2 as well | 297 | //Set the window on desktop 2 as well | ||
299 | client->enterDesktop(VirtualDesktopManager::self()->desktops()[1]); | 298 | client->enterDesktop(VirtualDesktopManager::self()->desktops()[1]); | ||
300 | QCOMPARE(client->desktops().count(), 2u); | 299 | QCOMPARE(client->desktops().count(), 2u); | ||
Show All 29 Lines |