Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/activities_test.cpp
Show All 14 Lines | |||||
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 "activities.h" | 22 | #include "activities.h" | ||
23 | #include "client.h" | 23 | #include "x11client.h" | ||
24 | #include "cursor.h" | 24 | #include "cursor.h" | ||
25 | #include "deleted.h" | 25 | #include "deleted.h" | ||
26 | #include "screenedge.h" | 26 | #include "screenedge.h" | ||
27 | #include "screens.h" | 27 | #include "screens.h" | ||
28 | #include "wayland_server.h" | 28 | #include "wayland_server.h" | ||
29 | #include "workspace.h" | 29 | #include "workspace.h" | ||
30 | #include "xdgshellclient.h" | 30 | #include "xdgshellclient.h" | ||
31 | #include "xcbutils.h" | 31 | #include "xcbutils.h" | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 109 | { | |||
130 | xcb_icccm_set_wm_normal_hints(c.data(), w, &hints); | 130 | xcb_icccm_set_wm_normal_hints(c.data(), w, &hints); | ||
131 | xcb_map_window(c.data(), w); | 131 | xcb_map_window(c.data(), w); | ||
132 | xcb_flush(c.data()); | 132 | xcb_flush(c.data()); | ||
133 | 133 | | |||
134 | // we should get a client for it | 134 | // we should get a client for it | ||
135 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 135 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
136 | QVERIFY(windowCreatedSpy.isValid()); | 136 | QVERIFY(windowCreatedSpy.isValid()); | ||
137 | QVERIFY(windowCreatedSpy.wait()); | 137 | QVERIFY(windowCreatedSpy.wait()); | ||
138 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 138 | X11Client *client = windowCreatedSpy.first().first().value<X11Client *>(); | ||
139 | QVERIFY(client); | 139 | QVERIFY(client); | ||
140 | QCOMPARE(client->window(), w); | 140 | QCOMPARE(client->window(), w); | ||
141 | QVERIFY(client->isDecorated()); | 141 | QVERIFY(client->isDecorated()); | ||
142 | 142 | | |||
143 | //verify the test machine doesn't have the following activities used | 143 | //verify the test machine doesn't have the following activities used | ||
144 | QVERIFY(!Activities::self()->all().contains(QStringLiteral("foo"))); | 144 | QVERIFY(!Activities::self()->all().contains(QStringLiteral("foo"))); | ||
145 | QVERIFY(!Activities::self()->all().contains(QStringLiteral("bar"))); | 145 | QVERIFY(!Activities::self()->all().contains(QStringLiteral("bar"))); | ||
146 | 146 | | |||
147 | //setting the client to an invalid activities should result in the client being on all activities | 147 | //setting the client to an invalid activities should result in the client being on all activities | ||
148 | client->setOnActivity(QStringLiteral("foo"), true); | 148 | client->setOnActivity(QStringLiteral("foo"), true); | ||
149 | QVERIFY(client->isOnAllActivities()); | 149 | QVERIFY(client->isOnAllActivities()); | ||
150 | QVERIFY(!client->activities().contains(QLatin1String("foo"))); | 150 | QVERIFY(!client->activities().contains(QLatin1String("foo"))); | ||
151 | 151 | | |||
152 | client->setOnActivities(QStringList{QStringLiteral("foo"), QStringLiteral("bar")}); | 152 | client->setOnActivities(QStringList{QStringLiteral("foo"), QStringLiteral("bar")}); | ||
153 | QVERIFY(client->isOnAllActivities()); | 153 | QVERIFY(client->isOnAllActivities()); | ||
154 | QVERIFY(!client->activities().contains(QLatin1String("foo"))); | 154 | QVERIFY(!client->activities().contains(QLatin1String("foo"))); | ||
155 | QVERIFY(!client->activities().contains(QLatin1String("bar"))); | 155 | QVERIFY(!client->activities().contains(QLatin1String("bar"))); | ||
156 | 156 | | |||
157 | // and destroy the window again | 157 | // and destroy the window again | ||
158 | xcb_unmap_window(c.data(), w); | 158 | xcb_unmap_window(c.data(), w); | ||
159 | xcb_destroy_window(c.data(), w); | 159 | xcb_destroy_window(c.data(), w); | ||
160 | xcb_flush(c.data()); | 160 | xcb_flush(c.data()); | ||
161 | c.reset(); | 161 | c.reset(); | ||
162 | 162 | | |||
163 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 163 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
164 | QVERIFY(windowClosedSpy.isValid()); | 164 | QVERIFY(windowClosedSpy.isValid()); | ||
165 | QVERIFY(windowClosedSpy.wait()); | 165 | QVERIFY(windowClosedSpy.wait()); | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | WAYLANDTEST_MAIN(KWin::ActivitiesTest) | 170 | WAYLANDTEST_MAIN(KWin::ActivitiesTest) | ||
171 | #include "activities_test.moc" | 171 | #include "activities_test.moc" |