Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/window_rules_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 "atoms.h" | 22 | #include "atoms.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 "rules.h" | 28 | #include "rules.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | #include "workspace.h" | 30 | #include "workspace.h" | ||
31 | #include "xdgshellclient.h" | 31 | #include "xdgshellclient.h" | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 103 | { | |||
137 | NETWinInfo info(c.data(), w, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties); | 137 | NETWinInfo info(c.data(), w, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties); | ||
138 | info.setWindowType(NET::Normal); | 138 | info.setWindowType(NET::Normal); | ||
139 | xcb_map_window(c.data(), w); | 139 | xcb_map_window(c.data(), w); | ||
140 | xcb_flush(c.data()); | 140 | xcb_flush(c.data()); | ||
141 | 141 | | |||
142 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 142 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
143 | QVERIFY(windowCreatedSpy.isValid()); | 143 | QVERIFY(windowCreatedSpy.isValid()); | ||
144 | QVERIFY(windowCreatedSpy.wait()); | 144 | QVERIFY(windowCreatedSpy.wait()); | ||
145 | Client *client = windowCreatedSpy.last().first().value<Client*>(); | 145 | X11Client *client = windowCreatedSpy.last().first().value<X11Client *>(); | ||
146 | QVERIFY(client); | 146 | QVERIFY(client); | ||
147 | QVERIFY(client->isDecorated()); | 147 | QVERIFY(client->isDecorated()); | ||
148 | QVERIFY(!client->hasStrut()); | 148 | QVERIFY(!client->hasStrut()); | ||
149 | QVERIFY(!client->isHiddenInternal()); | 149 | QVERIFY(!client->isHiddenInternal()); | ||
150 | QVERIFY(!client->readyForPainting()); | 150 | QVERIFY(!client->readyForPainting()); | ||
151 | QMetaObject::invokeMethod(client, "setReadyForPainting"); | 151 | QMetaObject::invokeMethod(client, "setReadyForPainting"); | ||
152 | QVERIFY(client->readyForPainting()); | 152 | QVERIFY(client->readyForPainting()); | ||
153 | QVERIFY(!client->surface()); | 153 | QVERIFY(!client->surface()); | ||
154 | QSignalSpy surfaceChangedSpy(client, &Toplevel::surfaceChanged); | 154 | QSignalSpy surfaceChangedSpy(client, &Toplevel::surfaceChanged); | ||
155 | QVERIFY(surfaceChangedSpy.isValid()); | 155 | QVERIFY(surfaceChangedSpy.isValid()); | ||
156 | QVERIFY(surfaceChangedSpy.wait()); | 156 | QVERIFY(surfaceChangedSpy.wait()); | ||
157 | QVERIFY(client->surface()); | 157 | QVERIFY(client->surface()); | ||
158 | QCOMPARE(client->maximizeMode(), MaximizeVertical); | 158 | QCOMPARE(client->maximizeMode(), MaximizeVertical); | ||
159 | 159 | | |||
160 | // destroy window again | 160 | // destroy window again | ||
161 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 161 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
162 | QVERIFY(windowClosedSpy.isValid()); | 162 | QVERIFY(windowClosedSpy.isValid()); | ||
163 | xcb_unmap_window(c.data(), w); | 163 | xcb_unmap_window(c.data(), w); | ||
164 | xcb_destroy_window(c.data(), w); | 164 | xcb_destroy_window(c.data(), w); | ||
165 | xcb_flush(c.data()); | 165 | xcb_flush(c.data()); | ||
166 | QVERIFY(windowClosedSpy.wait()); | 166 | QVERIFY(windowClosedSpy.wait()); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | void WindowRuleTest::testWindowClassChange() | 169 | void WindowRuleTest::testWindowClassChange() | ||
Show All 38 Lines | 170 | { | |||
208 | NETWinInfo info(c.data(), w, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties); | 208 | NETWinInfo info(c.data(), w, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties); | ||
209 | info.setWindowType(NET::Normal); | 209 | info.setWindowType(NET::Normal); | ||
210 | xcb_map_window(c.data(), w); | 210 | xcb_map_window(c.data(), w); | ||
211 | xcb_flush(c.data()); | 211 | xcb_flush(c.data()); | ||
212 | 212 | | |||
213 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 213 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
214 | QVERIFY(windowCreatedSpy.isValid()); | 214 | QVERIFY(windowCreatedSpy.isValid()); | ||
215 | QVERIFY(windowCreatedSpy.wait()); | 215 | QVERIFY(windowCreatedSpy.wait()); | ||
216 | Client *client = windowCreatedSpy.last().first().value<Client*>(); | 216 | X11Client *client = windowCreatedSpy.last().first().value<X11Client *>(); | ||
217 | QVERIFY(client); | 217 | QVERIFY(client); | ||
218 | QVERIFY(client->isDecorated()); | 218 | QVERIFY(client->isDecorated()); | ||
219 | QVERIFY(!client->hasStrut()); | 219 | QVERIFY(!client->hasStrut()); | ||
220 | QVERIFY(!client->isHiddenInternal()); | 220 | QVERIFY(!client->isHiddenInternal()); | ||
221 | QVERIFY(!client->readyForPainting()); | 221 | QVERIFY(!client->readyForPainting()); | ||
222 | QMetaObject::invokeMethod(client, "setReadyForPainting"); | 222 | QMetaObject::invokeMethod(client, "setReadyForPainting"); | ||
223 | QVERIFY(client->readyForPainting()); | 223 | QVERIFY(client->readyForPainting()); | ||
224 | QVERIFY(!client->surface()); | 224 | QVERIFY(!client->surface()); | ||
225 | QSignalSpy surfaceChangedSpy(client, &Toplevel::surfaceChanged); | 225 | QSignalSpy surfaceChangedSpy(client, &Toplevel::surfaceChanged); | ||
226 | QVERIFY(surfaceChangedSpy.isValid()); | 226 | QVERIFY(surfaceChangedSpy.isValid()); | ||
227 | QVERIFY(surfaceChangedSpy.wait()); | 227 | QVERIFY(surfaceChangedSpy.wait()); | ||
228 | QVERIFY(client->surface()); | 228 | QVERIFY(client->surface()); | ||
229 | QCOMPARE(client->keepAbove(), false); | 229 | QCOMPARE(client->keepAbove(), false); | ||
230 | 230 | | |||
231 | // now change class | 231 | // now change class | ||
232 | QSignalSpy windowClassChangedSpy{client, &Client::windowClassChanged}; | 232 | QSignalSpy windowClassChangedSpy{client, &X11Client::windowClassChanged}; | ||
233 | QVERIFY(windowClassChangedSpy.isValid()); | 233 | QVERIFY(windowClassChangedSpy.isValid()); | ||
234 | xcb_icccm_set_wm_class(c.data(), w, 23, "org.kde.foo\0org.kde.foo"); | 234 | xcb_icccm_set_wm_class(c.data(), w, 23, "org.kde.foo\0org.kde.foo"); | ||
235 | xcb_flush(c.data()); | 235 | xcb_flush(c.data()); | ||
236 | QVERIFY(windowClassChangedSpy.wait()); | 236 | QVERIFY(windowClassChangedSpy.wait()); | ||
237 | QCOMPARE(client->keepAbove(), true); | 237 | QCOMPARE(client->keepAbove(), true); | ||
238 | 238 | | |||
239 | // destroy window | 239 | // destroy window | ||
240 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 240 | QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); | ||
241 | QVERIFY(windowClosedSpy.isValid()); | 241 | QVERIFY(windowClosedSpy.isValid()); | ||
242 | xcb_unmap_window(c.data(), w); | 242 | xcb_unmap_window(c.data(), w); | ||
243 | xcb_destroy_window(c.data(), w); | 243 | xcb_destroy_window(c.data(), w); | ||
244 | xcb_flush(c.data()); | 244 | xcb_flush(c.data()); | ||
245 | QVERIFY(windowClosedSpy.wait()); | 245 | QVERIFY(windowClosedSpy.wait()); | ||
246 | } | 246 | } | ||
247 | 247 | | |||
248 | } | 248 | } | ||
249 | 249 | | |||
250 | WAYLANDTEST_MAIN(KWin::WindowRuleTest) | 250 | WAYLANDTEST_MAIN(KWin::WindowRuleTest) | ||
251 | #include "window_rules_test.moc" | 251 | #include "window_rules_test.moc" |