Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/xdgshellclient_rules_test.cpp
- This file was moved from autotests/integration/shell_client_rules_test.cpp.
Show All 19 Lines | |||||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | 21 | | |||
22 | #include "kwin_wayland_test.h" | 22 | #include "kwin_wayland_test.h" | ||
23 | 23 | | |||
24 | #include "cursor.h" | 24 | #include "cursor.h" | ||
25 | #include "platform.h" | 25 | #include "platform.h" | ||
26 | #include "rules.h" | 26 | #include "rules.h" | ||
27 | #include "screens.h" | 27 | #include "screens.h" | ||
28 | #include "shell_client.h" | 28 | #include "xdgshellclient.h" | ||
29 | #include "virtualdesktops.h" | 29 | #include "virtualdesktops.h" | ||
30 | #include "wayland_server.h" | 30 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 31 | #include "workspace.h" | ||
32 | 32 | | |||
33 | #include <KWayland/Client/surface.h> | 33 | #include <KWayland/Client/surface.h> | ||
34 | #include <KWayland/Client/xdgshell.h> | 34 | #include <KWayland/Client/xdgshell.h> | ||
35 | 35 | | |||
36 | #include <linux/input.h> | 36 | #include <linux/input.h> | ||
37 | 37 | | |||
38 | using namespace KWin; | 38 | using namespace KWin; | ||
39 | using namespace KWayland::Client; | 39 | using namespace KWayland::Client; | ||
40 | 40 | | |||
41 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_shell_client_rules-0"); | 41 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellclient_rules-0"); | ||
42 | 42 | | |||
43 | class TestShellClientRules : public QObject | 43 | class TestXdgShellClientRules : public QObject | ||
44 | { | 44 | { | ||
45 | Q_OBJECT | 45 | Q_OBJECT | ||
46 | 46 | | |||
47 | private Q_SLOTS: | 47 | private Q_SLOTS: | ||
48 | void initTestCase(); | 48 | void initTestCase(); | ||
49 | void init(); | 49 | void init(); | ||
50 | void cleanup(); | 50 | void cleanup(); | ||
51 | 51 | | |||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Line(s) | |||||
217 | void testInactiveOpacityForce_data(); | 217 | void testInactiveOpacityForce_data(); | ||
218 | void testInactiveOpacityForce(); | 218 | void testInactiveOpacityForce(); | ||
219 | void testInactiveOpacityForceTemporarily_data(); | 219 | void testInactiveOpacityForceTemporarily_data(); | ||
220 | void testInactiveOpacityForceTemporarily(); | 220 | void testInactiveOpacityForceTemporarily(); | ||
221 | 221 | | |||
222 | void testMatchAfterNameChange(); | 222 | void testMatchAfterNameChange(); | ||
223 | }; | 223 | }; | ||
224 | 224 | | |||
225 | void TestShellClientRules::initTestCase() | 225 | void TestXdgShellClientRules::initTestCase() | ||
226 | { | 226 | { | ||
227 | qRegisterMetaType<KWin::ShellClient *>(); | 227 | qRegisterMetaType<KWin::XdgShellClient *>(); | ||
228 | qRegisterMetaType<KWin::AbstractClient *>(); | 228 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
229 | 229 | | |||
230 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 230 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
231 | QVERIFY(workspaceCreatedSpy.isValid()); | 231 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
232 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 232 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
233 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 233 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
234 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 234 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
235 | 235 | | |||
236 | kwinApp()->start(); | 236 | kwinApp()->start(); | ||
237 | QVERIFY(workspaceCreatedSpy.wait()); | 237 | QVERIFY(workspaceCreatedSpy.wait()); | ||
238 | QCOMPARE(screens()->count(), 2); | 238 | QCOMPARE(screens()->count(), 2); | ||
239 | QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024)); | 239 | QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024)); | ||
240 | QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024)); | 240 | QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024)); | ||
241 | waylandServer()->initWorkspace(); | 241 | waylandServer()->initWorkspace(); | ||
242 | } | 242 | } | ||
243 | 243 | | |||
244 | void TestShellClientRules::init() | 244 | void TestXdgShellClientRules::init() | ||
245 | { | 245 | { | ||
246 | VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first()); | 246 | VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first()); | ||
247 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration)); | 247 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration)); | ||
248 | 248 | | |||
249 | screens()->setCurrent(0); | 249 | screens()->setCurrent(0); | ||
250 | } | 250 | } | ||
251 | 251 | | |||
252 | void TestShellClientRules::cleanup() | 252 | void TestXdgShellClientRules::cleanup() | ||
253 | { | 253 | { | ||
254 | Test::destroyWaylandConnection(); | 254 | Test::destroyWaylandConnection(); | ||
255 | 255 | | |||
256 | // Unreference the previous config. | 256 | // Unreference the previous config. | ||
257 | RuleBook::self()->setConfig({}); | 257 | RuleBook::self()->setConfig({}); | ||
258 | workspace()->slotReconfigure(); | 258 | workspace()->slotReconfigure(); | ||
259 | 259 | | |||
260 | // Restore virtual desktops to the initial state. | 260 | // Restore virtual desktops to the initial state. | ||
261 | VirtualDesktopManager::self()->setCount(1); | 261 | VirtualDesktopManager::self()->setCount(1); | ||
262 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | 262 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | ||
263 | } | 263 | } | ||
264 | 264 | | |||
265 | #define TEST_DATA(name) \ | 265 | #define TEST_DATA(name) \ | ||
266 | void TestShellClientRules::name##_data() \ | 266 | void TestXdgShellClientRules::name##_data() \ | ||
267 | { \ | 267 | { \ | ||
268 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); \ | 268 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); \ | ||
269 | QTest::newRow("XdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; \ | 269 | QTest::newRow("XdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; \ | ||
270 | QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; \ | 270 | QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; \ | ||
271 | } | 271 | } | ||
272 | 272 | | |||
273 | std::tuple<ShellClient *, Surface *, XdgShellSurface *> createWindow(Test::XdgShellSurfaceType type, const QByteArray &appId) | 273 | std::tuple<XdgShellClient *, Surface *, XdgShellSurface *> createWindow(Test::XdgShellSurfaceType type, const QByteArray &appId) | ||
274 | { | 274 | { | ||
275 | // Create an xdg surface. | 275 | // Create an xdg surface. | ||
276 | Surface *surface = Test::createSurface(); | 276 | Surface *surface = Test::createSurface(); | ||
277 | XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface, Test::CreationSetup::CreateOnly); | 277 | XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface, Test::CreationSetup::CreateOnly); | ||
278 | 278 | | |||
279 | // Assign the desired app id. | 279 | // Assign the desired app id. | ||
280 | shellSurface->setAppId(appId); | 280 | shellSurface->setAppId(appId); | ||
281 | 281 | | |||
282 | // Wait for the initial configure event. | 282 | // Wait for the initial configure event. | ||
283 | QSignalSpy configureRequestedSpy(shellSurface, &XdgShellSurface::configureRequested); | 283 | QSignalSpy configureRequestedSpy(shellSurface, &XdgShellSurface::configureRequested); | ||
284 | surface->commit(Surface::CommitFlag::None); | 284 | surface->commit(Surface::CommitFlag::None); | ||
285 | configureRequestedSpy.wait(); | 285 | configureRequestedSpy.wait(); | ||
286 | 286 | | |||
287 | // Draw content of the surface. | 287 | // Draw content of the surface. | ||
288 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 288 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
289 | ShellClient *client = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | 289 | XdgShellClient *client = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | ||
290 | 290 | | |||
291 | return {client, surface, shellSurface}; | 291 | return {client, surface, shellSurface}; | ||
292 | } | 292 | } | ||
293 | 293 | | |||
294 | TEST_DATA(testPositionDontAffect) | 294 | TEST_DATA(testPositionDontAffect) | ||
295 | 295 | | |||
296 | void TestShellClientRules::testPositionDontAffect() | 296 | void TestXdgShellClientRules::testPositionDontAffect() | ||
297 | { | 297 | { | ||
298 | // Initialize RuleBook with the test rule. | 298 | // Initialize RuleBook with the test rule. | ||
299 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 299 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
300 | config->group("General").writeEntry("count", 1); | 300 | config->group("General").writeEntry("count", 1); | ||
301 | KConfigGroup group = config->group("1"); | 301 | KConfigGroup group = config->group("1"); | ||
302 | group.writeEntry("position", QPoint(42, 42)); | 302 | group.writeEntry("position", QPoint(42, 42)); | ||
303 | group.writeEntry("positionrule", int(Rules::DontAffect)); | 303 | group.writeEntry("positionrule", int(Rules::DontAffect)); | ||
304 | group.writeEntry("wmclass", "org.kde.foo"); | 304 | group.writeEntry("wmclass", "org.kde.foo"); | ||
305 | group.writeEntry("wmclasscomplete", false); | 305 | group.writeEntry("wmclasscomplete", false); | ||
306 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 306 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
307 | group.sync(); | 307 | group.sync(); | ||
308 | RuleBook::self()->setConfig(config); | 308 | RuleBook::self()->setConfig(config); | ||
309 | workspace()->slotReconfigure(); | 309 | workspace()->slotReconfigure(); | ||
310 | 310 | | |||
311 | // Create the test client. | 311 | // Create the test client. | ||
312 | QFETCH(Test::XdgShellSurfaceType, type); | 312 | QFETCH(Test::XdgShellSurfaceType, type); | ||
313 | ShellClient *client; | 313 | XdgShellClient *client; | ||
314 | Surface *surface; | 314 | Surface *surface; | ||
315 | XdgShellSurface *shellSurface; | 315 | XdgShellSurface *shellSurface; | ||
316 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 316 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
317 | QVERIFY(client); | 317 | QVERIFY(client); | ||
318 | QVERIFY(client->isActive()); | 318 | QVERIFY(client->isActive()); | ||
319 | 319 | | |||
320 | // The position of the client should not be affected by the rule. The default | 320 | // The position of the client should not be affected by the rule. The default | ||
321 | // placement policy will put the client in the top-left corner of the screen. | 321 | // placement policy will put the client in the top-left corner of the screen. | ||
322 | QVERIFY(client->isMovable()); | 322 | QVERIFY(client->isMovable()); | ||
323 | QVERIFY(client->isMovableAcrossScreens()); | 323 | QVERIFY(client->isMovableAcrossScreens()); | ||
324 | QCOMPARE(client->pos(), QPoint(0, 0)); | 324 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||
325 | 325 | | |||
326 | // Destroy the client. | 326 | // Destroy the client. | ||
327 | delete shellSurface; | 327 | delete shellSurface; | ||
328 | delete surface; | 328 | delete surface; | ||
329 | QVERIFY(Test::waitForWindowDestroyed(client)); | 329 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
330 | } | 330 | } | ||
331 | 331 | | |||
332 | TEST_DATA(testPositionApply) | 332 | TEST_DATA(testPositionApply) | ||
333 | 333 | | |||
334 | void TestShellClientRules::testPositionApply() | 334 | void TestXdgShellClientRules::testPositionApply() | ||
335 | { | 335 | { | ||
336 | // Initialize RuleBook with the test rule. | 336 | // Initialize RuleBook with the test rule. | ||
337 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 337 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
338 | config->group("General").writeEntry("count", 1); | 338 | config->group("General").writeEntry("count", 1); | ||
339 | KConfigGroup group = config->group("1"); | 339 | KConfigGroup group = config->group("1"); | ||
340 | group.writeEntry("position", QPoint(42, 42)); | 340 | group.writeEntry("position", QPoint(42, 42)); | ||
341 | group.writeEntry("positionrule", int(Rules::Apply)); | 341 | group.writeEntry("positionrule", int(Rules::Apply)); | ||
342 | group.writeEntry("wmclass", "org.kde.foo"); | 342 | group.writeEntry("wmclass", "org.kde.foo"); | ||
343 | group.writeEntry("wmclasscomplete", false); | 343 | group.writeEntry("wmclasscomplete", false); | ||
344 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 344 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
345 | group.sync(); | 345 | group.sync(); | ||
346 | RuleBook::self()->setConfig(config); | 346 | RuleBook::self()->setConfig(config); | ||
347 | workspace()->slotReconfigure(); | 347 | workspace()->slotReconfigure(); | ||
348 | 348 | | |||
349 | // Create the test client. | 349 | // Create the test client. | ||
350 | QFETCH(Test::XdgShellSurfaceType, type); | 350 | QFETCH(Test::XdgShellSurfaceType, type); | ||
351 | ShellClient *client; | 351 | XdgShellClient *client; | ||
352 | Surface *surface; | 352 | Surface *surface; | ||
353 | XdgShellSurface *shellSurface; | 353 | XdgShellSurface *shellSurface; | ||
354 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 354 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
355 | QVERIFY(client); | 355 | QVERIFY(client); | ||
356 | QVERIFY(client->isActive()); | 356 | QVERIFY(client->isActive()); | ||
357 | 357 | | |||
358 | // The client should be moved to the position specified by the rule. | 358 | // The client should be moved to the position specified by the rule. | ||
359 | QVERIFY(client->isMovable()); | 359 | QVERIFY(client->isMovable()); | ||
Show All 38 Lines | |||||
398 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 398 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
399 | QVERIFY(client); | 399 | QVERIFY(client); | ||
400 | QVERIFY(client->isActive()); | 400 | QVERIFY(client->isActive()); | ||
401 | QVERIFY(client->isMovable()); | 401 | QVERIFY(client->isMovable()); | ||
402 | QVERIFY(client->isMovableAcrossScreens()); | 402 | QVERIFY(client->isMovableAcrossScreens()); | ||
403 | QCOMPARE(client->pos(), QPoint(42, 42)); | 403 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
404 | 404 | | |||
405 | // Destroy the client. | 405 | // Destroy the client. | ||
406 | delete shellSurface; | 406 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
407 | delete surface; | 407 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
408 | QVERIFY(Test::waitForWindowDestroyed(client)); | 408 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
409 | } | 409 | } | ||
410 | 410 | | |||
411 | TEST_DATA(testPositionRemember) | 411 | TEST_DATA(testPositionRemember) | ||
412 | 412 | | |||
413 | void TestShellClientRules::testPositionRemember() | 413 | void TestXdgShellClientRules::testPositionRemember() | ||
414 | { | 414 | { | ||
415 | // Initialize RuleBook with the test rule. | 415 | // Initialize RuleBook with the test rule. | ||
416 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 416 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
417 | config->group("General").writeEntry("count", 1); | 417 | config->group("General").writeEntry("count", 1); | ||
418 | KConfigGroup group = config->group("1"); | 418 | KConfigGroup group = config->group("1"); | ||
419 | group.writeEntry("position", QPoint(42, 42)); | 419 | group.writeEntry("position", QPoint(42, 42)); | ||
420 | group.writeEntry("positionrule", int(Rules::Remember)); | 420 | group.writeEntry("positionrule", int(Rules::Remember)); | ||
421 | group.writeEntry("wmclass", "org.kde.foo"); | 421 | group.writeEntry("wmclass", "org.kde.foo"); | ||
422 | group.writeEntry("wmclasscomplete", false); | 422 | group.writeEntry("wmclasscomplete", false); | ||
423 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 423 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
424 | group.sync(); | 424 | group.sync(); | ||
425 | RuleBook::self()->setConfig(config); | 425 | RuleBook::self()->setConfig(config); | ||
426 | workspace()->slotReconfigure(); | 426 | workspace()->slotReconfigure(); | ||
427 | 427 | | |||
428 | // Create the test client. | 428 | // Create the test client. | ||
429 | QFETCH(Test::XdgShellSurfaceType, type); | 429 | QFETCH(Test::XdgShellSurfaceType, type); | ||
430 | ShellClient *client; | 430 | XdgShellClient *client; | ||
431 | Surface *surface; | 431 | Surface *surface; | ||
432 | XdgShellSurface *shellSurface; | 432 | XdgShellSurface *shellSurface; | ||
433 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 433 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
434 | QVERIFY(client); | 434 | QVERIFY(client); | ||
435 | QVERIFY(client->isActive()); | 435 | QVERIFY(client->isActive()); | ||
436 | 436 | | |||
437 | // The client should be moved to the position specified by the rule. | 437 | // The client should be moved to the position specified by the rule. | ||
438 | QVERIFY(client->isMovable()); | 438 | QVERIFY(client->isMovable()); | ||
Show All 38 Lines | |||||
477 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 477 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
478 | QVERIFY(client); | 478 | QVERIFY(client); | ||
479 | QVERIFY(client->isActive()); | 479 | QVERIFY(client->isActive()); | ||
480 | QVERIFY(client->isMovable()); | 480 | QVERIFY(client->isMovable()); | ||
481 | QVERIFY(client->isMovableAcrossScreens()); | 481 | QVERIFY(client->isMovableAcrossScreens()); | ||
482 | QCOMPARE(client->pos(), QPoint(50, 42)); | 482 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||
483 | 483 | | |||
484 | // Destroy the client. | 484 | // Destroy the client. | ||
485 | delete shellSurface; | 485 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
486 | delete surface; | 486 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
487 | QVERIFY(Test::waitForWindowDestroyed(client)); | 487 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
488 | } | 488 | } | ||
489 | 489 | | |||
490 | TEST_DATA(testPositionForce) | 490 | TEST_DATA(testPositionForce) | ||
491 | 491 | | |||
492 | void TestShellClientRules::testPositionForce() | 492 | void TestXdgShellClientRules::testPositionForce() | ||
493 | { | 493 | { | ||
494 | // Initialize RuleBook with the test rule. | 494 | // Initialize RuleBook with the test rule. | ||
495 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 495 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
496 | config->group("General").writeEntry("count", 1); | 496 | config->group("General").writeEntry("count", 1); | ||
497 | KConfigGroup group = config->group("1"); | 497 | KConfigGroup group = config->group("1"); | ||
498 | group.writeEntry("position", QPoint(42, 42)); | 498 | group.writeEntry("position", QPoint(42, 42)); | ||
499 | group.writeEntry("positionrule", int(Rules::Force)); | 499 | group.writeEntry("positionrule", int(Rules::Force)); | ||
500 | group.writeEntry("wmclass", "org.kde.foo"); | 500 | group.writeEntry("wmclass", "org.kde.foo"); | ||
501 | group.writeEntry("wmclasscomplete", false); | 501 | group.writeEntry("wmclasscomplete", false); | ||
502 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 502 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
503 | group.sync(); | 503 | group.sync(); | ||
504 | RuleBook::self()->setConfig(config); | 504 | RuleBook::self()->setConfig(config); | ||
505 | workspace()->slotReconfigure(); | 505 | workspace()->slotReconfigure(); | ||
506 | 506 | | |||
507 | // Create the test client. | 507 | // Create the test client. | ||
508 | QFETCH(Test::XdgShellSurfaceType, type); | 508 | QFETCH(Test::XdgShellSurfaceType, type); | ||
509 | ShellClient *client; | 509 | XdgShellClient *client; | ||
510 | Surface *surface; | 510 | Surface *surface; | ||
511 | XdgShellSurface *shellSurface; | 511 | XdgShellSurface *shellSurface; | ||
512 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 512 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
513 | QVERIFY(client); | 513 | QVERIFY(client); | ||
514 | QVERIFY(client->isActive()); | 514 | QVERIFY(client->isActive()); | ||
515 | 515 | | |||
516 | // The client should be moved to the position specified by the rule. | 516 | // The client should be moved to the position specified by the rule. | ||
517 | QVERIFY(!client->isMovable()); | 517 | QVERIFY(!client->isMovable()); | ||
Show All 19 Lines | |||||
537 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 537 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
538 | QVERIFY(client); | 538 | QVERIFY(client); | ||
539 | QVERIFY(client->isActive()); | 539 | QVERIFY(client->isActive()); | ||
540 | QVERIFY(!client->isMovable()); | 540 | QVERIFY(!client->isMovable()); | ||
541 | QVERIFY(!client->isMovableAcrossScreens()); | 541 | QVERIFY(!client->isMovableAcrossScreens()); | ||
542 | QCOMPARE(client->pos(), QPoint(42, 42)); | 542 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
543 | 543 | | |||
544 | // Destroy the client. | 544 | // Destroy the client. | ||
545 | delete shellSurface; | 545 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
546 | delete surface; | 546 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
547 | QVERIFY(Test::waitForWindowDestroyed(client)); | 547 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
548 | } | 548 | } | ||
549 | 549 | | |||
550 | TEST_DATA(testPositionApplyNow) | 550 | TEST_DATA(testPositionApplyNow) | ||
551 | 551 | | |||
552 | void TestShellClientRules::testPositionApplyNow() | 552 | void TestXdgShellClientRules::testPositionApplyNow() | ||
553 | { | 553 | { | ||
554 | // Create the test client. | 554 | // Create the test client. | ||
555 | QFETCH(Test::XdgShellSurfaceType, type); | 555 | QFETCH(Test::XdgShellSurfaceType, type); | ||
556 | ShellClient *client; | 556 | XdgShellClient *client; | ||
557 | Surface *surface; | 557 | Surface *surface; | ||
558 | QObject *shellSurface; | 558 | QObject *shellSurface; | ||
559 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 559 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
560 | QVERIFY(client); | 560 | QVERIFY(client); | ||
561 | QVERIFY(client->isActive()); | 561 | QVERIFY(client->isActive()); | ||
562 | 562 | | |||
563 | // The position of the client isn't set by any rule, thus the default placement | 563 | // The position of the client isn't set by any rule, thus the default placement | ||
564 | // policy will try to put the client in the top-left corner of the screen. | 564 | // policy will try to put the client in the top-left corner of the screen. | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
625 | // Destroy the client. | 625 | // Destroy the client. | ||
626 | delete shellSurface; | 626 | delete shellSurface; | ||
627 | delete surface; | 627 | delete surface; | ||
628 | QVERIFY(Test::waitForWindowDestroyed(client)); | 628 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
629 | } | 629 | } | ||
630 | 630 | | |||
631 | TEST_DATA(testPositionForceTemporarily) | 631 | TEST_DATA(testPositionForceTemporarily) | ||
632 | 632 | | |||
633 | void TestShellClientRules::testPositionForceTemporarily() | 633 | void TestXdgShellClientRules::testPositionForceTemporarily() | ||
634 | { | 634 | { | ||
635 | // Initialize RuleBook with the test rule. | 635 | // Initialize RuleBook with the test rule. | ||
636 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 636 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
637 | config->group("General").writeEntry("count", 1); | 637 | config->group("General").writeEntry("count", 1); | ||
638 | KConfigGroup group = config->group("1"); | 638 | KConfigGroup group = config->group("1"); | ||
639 | group.writeEntry("position", QPoint(42, 42)); | 639 | group.writeEntry("position", QPoint(42, 42)); | ||
640 | group.writeEntry("positionrule", int(Rules::ForceTemporarily)); | 640 | group.writeEntry("positionrule", int(Rules::ForceTemporarily)); | ||
641 | group.writeEntry("wmclass", "org.kde.foo"); | 641 | group.writeEntry("wmclass", "org.kde.foo"); | ||
642 | group.writeEntry("wmclasscomplete", false); | 642 | group.writeEntry("wmclasscomplete", false); | ||
643 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 643 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
644 | group.sync(); | 644 | group.sync(); | ||
645 | RuleBook::self()->setConfig(config); | 645 | RuleBook::self()->setConfig(config); | ||
646 | workspace()->slotReconfigure(); | 646 | workspace()->slotReconfigure(); | ||
647 | 647 | | |||
648 | // Create the test client. | 648 | // Create the test client. | ||
649 | QFETCH(Test::XdgShellSurfaceType, type); | 649 | QFETCH(Test::XdgShellSurfaceType, type); | ||
650 | ShellClient *client; | 650 | XdgShellClient *client; | ||
651 | Surface *surface; | 651 | Surface *surface; | ||
652 | XdgShellSurface *shellSurface; | 652 | XdgShellSurface *shellSurface; | ||
653 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 653 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
654 | QVERIFY(client); | 654 | QVERIFY(client); | ||
655 | QVERIFY(client->isActive()); | 655 | QVERIFY(client->isActive()); | ||
656 | 656 | | |||
657 | // The client should be moved to the position specified by the rule. | 657 | // The client should be moved to the position specified by the rule. | ||
658 | QVERIFY(!client->isMovable()); | 658 | QVERIFY(!client->isMovable()); | ||
Show All 19 Lines | |||||
678 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 678 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
679 | QVERIFY(client); | 679 | QVERIFY(client); | ||
680 | QVERIFY(client->isActive()); | 680 | QVERIFY(client->isActive()); | ||
681 | QVERIFY(client->isMovable()); | 681 | QVERIFY(client->isMovable()); | ||
682 | QVERIFY(client->isMovableAcrossScreens()); | 682 | QVERIFY(client->isMovableAcrossScreens()); | ||
683 | QCOMPARE(client->pos(), QPoint(0, 0)); | 683 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||
684 | 684 | | |||
685 | // Destroy the client. | 685 | // Destroy the client. | ||
686 | delete shellSurface; | 686 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
687 | delete surface; | 687 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
688 | QVERIFY(Test::waitForWindowDestroyed(client)); | 688 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
689 | } | 689 | } | ||
690 | 690 | | |||
691 | TEST_DATA(testSizeDontAffect) | 691 | TEST_DATA(testSizeDontAffect) | ||
692 | 692 | | |||
693 | void TestShellClientRules::testSizeDontAffect() | 693 | void TestXdgShellClientRules::testSizeDontAffect() | ||
694 | { | 694 | { | ||
695 | // Initialize RuleBook with the test rule. | 695 | // Initialize RuleBook with the test rule. | ||
696 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 696 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
697 | config->group("General").writeEntry("count", 1); | 697 | config->group("General").writeEntry("count", 1); | ||
698 | KConfigGroup group = config->group("1"); | 698 | KConfigGroup group = config->group("1"); | ||
699 | group.writeEntry("size", QSize(480, 640)); | 699 | group.writeEntry("size", QSize(480, 640)); | ||
700 | group.writeEntry("sizerule", int(Rules::DontAffect)); | 700 | group.writeEntry("sizerule", int(Rules::DontAffect)); | ||
701 | group.writeEntry("wmclass", "org.kde.foo"); | 701 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 16 Lines | |||||
718 | 718 | | |||
719 | // The window size shouldn't be enforced by the rule. | 719 | // The window size shouldn't be enforced by the rule. | ||
720 | QVERIFY(configureRequestedSpy->wait()); | 720 | QVERIFY(configureRequestedSpy->wait()); | ||
721 | QCOMPARE(configureRequestedSpy->count(), 1); | 721 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
722 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | 722 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||
723 | 723 | | |||
724 | // Map the client. | 724 | // Map the client. | ||
725 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 725 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
726 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 726 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
727 | QVERIFY(client); | 727 | QVERIFY(client); | ||
728 | QVERIFY(client->isActive()); | 728 | QVERIFY(client->isActive()); | ||
729 | QVERIFY(client->isResizable()); | 729 | QVERIFY(client->isResizable()); | ||
730 | QCOMPARE(client->size(), QSize(100, 50)); | 730 | QCOMPARE(client->size(), QSize(100, 50)); | ||
731 | 731 | | |||
732 | // We should receive a configure event when the client becomes active. | 732 | // We should receive a configure event when the client becomes active. | ||
733 | QVERIFY(configureRequestedSpy->wait()); | 733 | QVERIFY(configureRequestedSpy->wait()); | ||
734 | QCOMPARE(configureRequestedSpy->count(), 2); | 734 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
735 | 735 | | |||
736 | // Destroy the client. | 736 | // Destroy the client. | ||
737 | shellSurface.reset(); | 737 | shellSurface.reset(); | ||
738 | surface.reset(); | 738 | surface.reset(); | ||
739 | QVERIFY(Test::waitForWindowDestroyed(client)); | 739 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
740 | } | 740 | } | ||
741 | 741 | | |||
742 | TEST_DATA(testSizeApply) | 742 | TEST_DATA(testSizeApply) | ||
743 | 743 | | |||
744 | void TestShellClientRules::testSizeApply() | 744 | void TestXdgShellClientRules::testSizeApply() | ||
745 | { | 745 | { | ||
746 | // Initialize RuleBook with the test rule. | 746 | // Initialize RuleBook with the test rule. | ||
747 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 747 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
748 | config->group("General").writeEntry("count", 1); | 748 | config->group("General").writeEntry("count", 1); | ||
749 | KConfigGroup group = config->group("1"); | 749 | KConfigGroup group = config->group("1"); | ||
750 | group.writeEntry("size", QSize(480, 640)); | 750 | group.writeEntry("size", QSize(480, 640)); | ||
751 | group.writeEntry("sizerule", int(Rules::Apply)); | 751 | group.writeEntry("sizerule", int(Rules::Apply)); | ||
752 | group.writeEntry("wmclass", "org.kde.foo"); | 752 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 20 Lines | |||||
773 | QCOMPARE(configureRequestedSpy->count(), 1); | 773 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
774 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(480, 640)); | 774 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(480, 640)); | ||
775 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 775 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
776 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 776 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
777 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | 777 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||
778 | 778 | | |||
779 | // Map the client. | 779 | // Map the client. | ||
780 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 780 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
781 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | 781 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||
782 | QVERIFY(client); | 782 | QVERIFY(client); | ||
783 | QVERIFY(client->isActive()); | 783 | QVERIFY(client->isActive()); | ||
784 | QVERIFY(client->isResizable()); | 784 | QVERIFY(client->isResizable()); | ||
785 | QCOMPARE(client->size(), QSize(480, 640)); | 785 | QCOMPARE(client->size(), QSize(480, 640)); | ||
786 | 786 | | |||
787 | // We should receive a configure event when the client becomes active. | 787 | // We should receive a configure event when the client becomes active. | ||
788 | QVERIFY(configureRequestedSpy->wait()); | 788 | QVERIFY(configureRequestedSpy->wait()); | ||
789 | QCOMPARE(configureRequestedSpy->count(), 2); | 789 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | |||||
874 | // Destroy the client. | 874 | // Destroy the client. | ||
875 | shellSurface.reset(); | 875 | shellSurface.reset(); | ||
876 | surface.reset(); | 876 | surface.reset(); | ||
877 | QVERIFY(Test::waitForWindowDestroyed(client)); | 877 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
878 | } | 878 | } | ||
879 | 879 | | |||
880 | TEST_DATA(testSizeRemember) | 880 | TEST_DATA(testSizeRemember) | ||
881 | 881 | | |||
882 | void TestShellClientRules::testSizeRemember() | 882 | void TestXdgShellClientRules::testSizeRemember() | ||
883 | { | 883 | { | ||
884 | // Initialize RuleBook with the test rule. | 884 | // Initialize RuleBook with the test rule. | ||
885 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 885 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
886 | config->group("General").writeEntry("count", 1); | 886 | config->group("General").writeEntry("count", 1); | ||
887 | KConfigGroup group = config->group("1"); | 887 | KConfigGroup group = config->group("1"); | ||
888 | group.writeEntry("size", QSize(480, 640)); | 888 | group.writeEntry("size", QSize(480, 640)); | ||
889 | group.writeEntry("sizerule", int(Rules::Remember)); | 889 | group.writeEntry("sizerule", int(Rules::Remember)); | ||
890 | group.writeEntry("wmclass", "org.kde.foo"); | 890 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 20 Lines | |||||
911 | QCOMPARE(configureRequestedSpy->count(), 1); | 911 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
912 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | 912 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||
913 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 913 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
914 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 914 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
915 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | 915 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||
916 | 916 | | |||
917 | // Map the client. | 917 | // Map the client. | ||
918 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 918 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
919 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | 919 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||
920 | QVERIFY(client); | 920 | QVERIFY(client); | ||
921 | QVERIFY(client->isActive()); | 921 | QVERIFY(client->isActive()); | ||
922 | QVERIFY(client->isResizable()); | 922 | QVERIFY(client->isResizable()); | ||
923 | QCOMPARE(client->size(), QSize(480, 640)); | 923 | QCOMPARE(client->size(), QSize(480, 640)); | ||
924 | 924 | | |||
925 | // We should receive a configure event when the client becomes active. | 925 | // We should receive a configure event when the client becomes active. | ||
926 | QVERIFY(configureRequestedSpy->wait()); | 926 | QVERIFY(configureRequestedSpy->wait()); | ||
927 | QCOMPARE(configureRequestedSpy->count(), 2); | 927 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | |||||
1012 | // Destroy the client. | 1012 | // Destroy the client. | ||
1013 | shellSurface.reset(); | 1013 | shellSurface.reset(); | ||
1014 | surface.reset(); | 1014 | surface.reset(); | ||
1015 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1015 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1016 | } | 1016 | } | ||
1017 | 1017 | | |||
1018 | TEST_DATA(testSizeForce) | 1018 | TEST_DATA(testSizeForce) | ||
1019 | 1019 | | |||
1020 | void TestShellClientRules::testSizeForce() | 1020 | void TestXdgShellClientRules::testSizeForce() | ||
1021 | { | 1021 | { | ||
1022 | // Initialize RuleBook with the test rule. | 1022 | // Initialize RuleBook with the test rule. | ||
1023 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1023 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1024 | config->group("General").writeEntry("count", 1); | 1024 | config->group("General").writeEntry("count", 1); | ||
1025 | KConfigGroup group = config->group("1"); | 1025 | KConfigGroup group = config->group("1"); | ||
1026 | group.writeEntry("size", QSize(480, 640)); | 1026 | group.writeEntry("size", QSize(480, 640)); | ||
1027 | group.writeEntry("sizerule", int(Rules::Force)); | 1027 | group.writeEntry("sizerule", int(Rules::Force)); | ||
1028 | group.writeEntry("wmclass", "org.kde.foo"); | 1028 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 16 Lines | |||||
1045 | 1045 | | |||
1046 | // The initial configure event should contain size hint set by the rule. | 1046 | // The initial configure event should contain size hint set by the rule. | ||
1047 | QVERIFY(configureRequestedSpy->wait()); | 1047 | QVERIFY(configureRequestedSpy->wait()); | ||
1048 | QCOMPARE(configureRequestedSpy->count(), 1); | 1048 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1049 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | 1049 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||
1050 | 1050 | | |||
1051 | // Map the client. | 1051 | // Map the client. | ||
1052 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1052 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1053 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | 1053 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||
1054 | QVERIFY(client); | 1054 | QVERIFY(client); | ||
1055 | QVERIFY(client->isActive()); | 1055 | QVERIFY(client->isActive()); | ||
1056 | QVERIFY(!client->isResizable()); | 1056 | QVERIFY(!client->isResizable()); | ||
1057 | QCOMPARE(client->size(), QSize(480, 640)); | 1057 | QCOMPARE(client->size(), QSize(480, 640)); | ||
1058 | 1058 | | |||
1059 | // We should receive a configure event when the client becomes active. | 1059 | // We should receive a configure event when the client becomes active. | ||
1060 | QVERIFY(configureRequestedSpy->wait()); | 1060 | QVERIFY(configureRequestedSpy->wait()); | ||
1061 | QCOMPARE(configureRequestedSpy->count(), 2); | 1061 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
Show All 38 Lines | |||||
1100 | // Destroy the client. | 1100 | // Destroy the client. | ||
1101 | shellSurface.reset(); | 1101 | shellSurface.reset(); | ||
1102 | surface.reset(); | 1102 | surface.reset(); | ||
1103 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1103 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1104 | } | 1104 | } | ||
1105 | 1105 | | |||
1106 | TEST_DATA(testSizeApplyNow) | 1106 | TEST_DATA(testSizeApplyNow) | ||
1107 | 1107 | | |||
1108 | void TestShellClientRules::testSizeApplyNow() | 1108 | void TestXdgShellClientRules::testSizeApplyNow() | ||
1109 | { | 1109 | { | ||
1110 | // Create the test client. | 1110 | // Create the test client. | ||
1111 | QFETCH(Test::XdgShellSurfaceType, type); | 1111 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1112 | QScopedPointer<Surface> surface; | 1112 | QScopedPointer<Surface> surface; | ||
1113 | surface.reset(Test::createSurface()); | 1113 | surface.reset(Test::createSurface()); | ||
1114 | QScopedPointer<XdgShellSurface> shellSurface; | 1114 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1115 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1115 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1116 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1116 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1117 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1117 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1118 | shellSurface->setAppId("org.kde.foo"); | 1118 | shellSurface->setAppId("org.kde.foo"); | ||
1119 | surface->commit(Surface::CommitFlag::None); | 1119 | surface->commit(Surface::CommitFlag::None); | ||
1120 | 1120 | | |||
1121 | // The expected surface dimensions should be set by the rule. | 1121 | // The expected surface dimensions should be set by the rule. | ||
1122 | QVERIFY(configureRequestedSpy->wait()); | 1122 | QVERIFY(configureRequestedSpy->wait()); | ||
1123 | QCOMPARE(configureRequestedSpy->count(), 1); | 1123 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1124 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | 1124 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||
1125 | 1125 | | |||
1126 | // Map the client. | 1126 | // Map the client. | ||
1127 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1127 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1128 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 1128 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
1129 | QVERIFY(client); | 1129 | QVERIFY(client); | ||
1130 | QVERIFY(client->isActive()); | 1130 | QVERIFY(client->isActive()); | ||
1131 | QVERIFY(client->isResizable()); | 1131 | QVERIFY(client->isResizable()); | ||
1132 | QCOMPARE(client->size(), QSize(100, 50)); | 1132 | QCOMPARE(client->size(), QSize(100, 50)); | ||
1133 | 1133 | | |||
1134 | // We should receive a configure event when the client becomes active. | 1134 | // We should receive a configure event when the client becomes active. | ||
1135 | QVERIFY(configureRequestedSpy->wait()); | 1135 | QVERIFY(configureRequestedSpy->wait()); | ||
1136 | QCOMPARE(configureRequestedSpy->count(), 2); | 1136 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
Show All 32 Lines | |||||
1169 | // Destroy the client. | 1169 | // Destroy the client. | ||
1170 | shellSurface.reset(); | 1170 | shellSurface.reset(); | ||
1171 | surface.reset(); | 1171 | surface.reset(); | ||
1172 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1172 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1173 | } | 1173 | } | ||
1174 | 1174 | | |||
1175 | TEST_DATA(testSizeForceTemporarily) | 1175 | TEST_DATA(testSizeForceTemporarily) | ||
1176 | 1176 | | |||
1177 | void TestShellClientRules::testSizeForceTemporarily() | 1177 | void TestXdgShellClientRules::testSizeForceTemporarily() | ||
1178 | { | 1178 | { | ||
1179 | // Initialize RuleBook with the test rule. | 1179 | // Initialize RuleBook with the test rule. | ||
1180 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1180 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1181 | config->group("General").writeEntry("count", 1); | 1181 | config->group("General").writeEntry("count", 1); | ||
1182 | KConfigGroup group = config->group("1"); | 1182 | KConfigGroup group = config->group("1"); | ||
1183 | group.writeEntry("size", QSize(480, 640)); | 1183 | group.writeEntry("size", QSize(480, 640)); | ||
1184 | group.writeEntry("sizerule", int(Rules::ForceTemporarily)); | 1184 | group.writeEntry("sizerule", int(Rules::ForceTemporarily)); | ||
1185 | group.writeEntry("wmclass", "org.kde.foo"); | 1185 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 16 Lines | |||||
1202 | 1202 | | |||
1203 | // The initial configure event should contain size hint set by the rule. | 1203 | // The initial configure event should contain size hint set by the rule. | ||
1204 | QVERIFY(configureRequestedSpy->wait()); | 1204 | QVERIFY(configureRequestedSpy->wait()); | ||
1205 | QCOMPARE(configureRequestedSpy->count(), 1); | 1205 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1206 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | 1206 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||
1207 | 1207 | | |||
1208 | // Map the client. | 1208 | // Map the client. | ||
1209 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1209 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1210 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | 1210 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||
1211 | QVERIFY(client); | 1211 | QVERIFY(client); | ||
1212 | QVERIFY(client->isActive()); | 1212 | QVERIFY(client->isActive()); | ||
1213 | QVERIFY(!client->isResizable()); | 1213 | QVERIFY(!client->isResizable()); | ||
1214 | QCOMPARE(client->size(), QSize(480, 640)); | 1214 | QCOMPARE(client->size(), QSize(480, 640)); | ||
1215 | 1215 | | |||
1216 | // We should receive a configure event when the client becomes active. | 1216 | // We should receive a configure event when the client becomes active. | ||
1217 | QVERIFY(configureRequestedSpy->wait()); | 1217 | QVERIFY(configureRequestedSpy->wait()); | ||
1218 | QCOMPARE(configureRequestedSpy->count(), 2); | 1218 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
Show All 38 Lines | |||||
1257 | // Destroy the client. | 1257 | // Destroy the client. | ||
1258 | shellSurface.reset(); | 1258 | shellSurface.reset(); | ||
1259 | surface.reset(); | 1259 | surface.reset(); | ||
1260 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1260 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1261 | } | 1261 | } | ||
1262 | 1262 | | |||
1263 | TEST_DATA(testMaximizeDontAffect) | 1263 | TEST_DATA(testMaximizeDontAffect) | ||
1264 | 1264 | | |||
1265 | void TestShellClientRules::testMaximizeDontAffect() | 1265 | void TestXdgShellClientRules::testMaximizeDontAffect() | ||
1266 | { | 1266 | { | ||
1267 | // Initialize RuleBook with the test rule. | 1267 | // Initialize RuleBook with the test rule. | ||
1268 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1268 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1269 | config->group("General").writeEntry("count", 1); | 1269 | config->group("General").writeEntry("count", 1); | ||
1270 | KConfigGroup group = config->group("1"); | 1270 | KConfigGroup group = config->group("1"); | ||
1271 | group.writeEntry("maximizehoriz", true); | 1271 | group.writeEntry("maximizehoriz", true); | ||
1272 | group.writeEntry("maximizehorizrule", int(Rules::DontAffect)); | 1272 | group.writeEntry("maximizehorizrule", int(Rules::DontAffect)); | ||
1273 | group.writeEntry("maximizevert", true); | 1273 | group.writeEntry("maximizevert", true); | ||
Show All 22 Lines | |||||
1296 | QCOMPARE(configureRequestedSpy->count(), 1); | 1296 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1297 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | 1297 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||
1298 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1298 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1299 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1299 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1300 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 1300 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
1301 | 1301 | | |||
1302 | // Map the client. | 1302 | // Map the client. | ||
1303 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1303 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1304 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 1304 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
1305 | QVERIFY(client); | 1305 | QVERIFY(client); | ||
1306 | QVERIFY(client->isActive()); | 1306 | QVERIFY(client->isActive()); | ||
1307 | QVERIFY(client->isMaximizable()); | 1307 | QVERIFY(client->isMaximizable()); | ||
1308 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | 1308 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||
1309 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | 1309 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||
1310 | QCOMPARE(client->size(), QSize(100, 50)); | 1310 | QCOMPARE(client->size(), QSize(100, 50)); | ||
1311 | 1311 | | |||
1312 | // We should receive a configure event when the client becomes active. | 1312 | // We should receive a configure event when the client becomes active. | ||
1313 | QVERIFY(configureRequestedSpy->wait()); | 1313 | QVERIFY(configureRequestedSpy->wait()); | ||
1314 | QCOMPARE(configureRequestedSpy->count(), 2); | 1314 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
1315 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1315 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1316 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | 1316 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||
1317 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 1317 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
1318 | 1318 | | |||
1319 | // Destroy the client. | 1319 | // Destroy the client. | ||
1320 | shellSurface.reset(); | 1320 | shellSurface.reset(); | ||
1321 | surface.reset(); | 1321 | surface.reset(); | ||
1322 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1322 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1323 | } | 1323 | } | ||
1324 | 1324 | | |||
1325 | TEST_DATA(testMaximizeApply) | 1325 | TEST_DATA(testMaximizeApply) | ||
1326 | 1326 | | |||
1327 | void TestShellClientRules::testMaximizeApply() | 1327 | void TestXdgShellClientRules::testMaximizeApply() | ||
1328 | { | 1328 | { | ||
1329 | // Initialize RuleBook with the test rule. | 1329 | // Initialize RuleBook with the test rule. | ||
1330 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1330 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1331 | config->group("General").writeEntry("count", 1); | 1331 | config->group("General").writeEntry("count", 1); | ||
1332 | KConfigGroup group = config->group("1"); | 1332 | KConfigGroup group = config->group("1"); | ||
1333 | group.writeEntry("maximizehoriz", true); | 1333 | group.writeEntry("maximizehoriz", true); | ||
1334 | group.writeEntry("maximizehorizrule", int(Rules::Apply)); | 1334 | group.writeEntry("maximizehorizrule", int(Rules::Apply)); | ||
1335 | group.writeEntry("maximizevert", true); | 1335 | group.writeEntry("maximizevert", true); | ||
Show All 22 Lines | |||||
1358 | QCOMPARE(configureRequestedSpy->count(), 1); | 1358 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1359 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | 1359 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||
1360 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1360 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1361 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1361 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1362 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 1362 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
1363 | 1363 | | |||
1364 | // Map the client. | 1364 | // Map the client. | ||
1365 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1365 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1366 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | 1366 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1367 | QVERIFY(client); | 1367 | QVERIFY(client); | ||
1368 | QVERIFY(client->isActive()); | 1368 | QVERIFY(client->isActive()); | ||
1369 | QVERIFY(client->isMaximizable()); | 1369 | QVERIFY(client->isMaximizable()); | ||
1370 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | 1370 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||
1371 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | 1371 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||
1372 | QCOMPARE(client->size(), QSize(1280, 1024)); | 1372 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||
1373 | 1373 | | |||
1374 | // We should receive a configure event when the client becomes active. | 1374 | // We should receive a configure event when the client becomes active. | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
1431 | // Destroy the client. | 1431 | // Destroy the client. | ||
1432 | shellSurface.reset(); | 1432 | shellSurface.reset(); | ||
1433 | surface.reset(); | 1433 | surface.reset(); | ||
1434 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1434 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1435 | } | 1435 | } | ||
1436 | 1436 | | |||
1437 | TEST_DATA(testMaximizeRemember) | 1437 | TEST_DATA(testMaximizeRemember) | ||
1438 | 1438 | | |||
1439 | void TestShellClientRules::testMaximizeRemember() | 1439 | void TestXdgShellClientRules::testMaximizeRemember() | ||
1440 | { | 1440 | { | ||
1441 | // Initialize RuleBook with the test rule. | 1441 | // Initialize RuleBook with the test rule. | ||
1442 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1442 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1443 | config->group("General").writeEntry("count", 1); | 1443 | config->group("General").writeEntry("count", 1); | ||
1444 | KConfigGroup group = config->group("1"); | 1444 | KConfigGroup group = config->group("1"); | ||
1445 | group.writeEntry("maximizehoriz", true); | 1445 | group.writeEntry("maximizehoriz", true); | ||
1446 | group.writeEntry("maximizehorizrule", int(Rules::Remember)); | 1446 | group.writeEntry("maximizehorizrule", int(Rules::Remember)); | ||
1447 | group.writeEntry("maximizevert", true); | 1447 | group.writeEntry("maximizevert", true); | ||
Show All 22 Lines | |||||
1470 | QCOMPARE(configureRequestedSpy->count(), 1); | 1470 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1471 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | 1471 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||
1472 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1472 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1473 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1473 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1474 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 1474 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
1475 | 1475 | | |||
1476 | // Map the client. | 1476 | // Map the client. | ||
1477 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1477 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1478 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | 1478 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1479 | QVERIFY(client); | 1479 | QVERIFY(client); | ||
1480 | QVERIFY(client->isActive()); | 1480 | QVERIFY(client->isActive()); | ||
1481 | QVERIFY(client->isMaximizable()); | 1481 | QVERIFY(client->isMaximizable()); | ||
1482 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | 1482 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||
1483 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | 1483 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||
1484 | QCOMPARE(client->size(), QSize(1280, 1024)); | 1484 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||
1485 | 1485 | | |||
1486 | // We should receive a configure event when the client becomes active. | 1486 | // We should receive a configure event when the client becomes active. | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
1543 | // Destroy the client. | 1543 | // Destroy the client. | ||
1544 | shellSurface.reset(); | 1544 | shellSurface.reset(); | ||
1545 | surface.reset(); | 1545 | surface.reset(); | ||
1546 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1546 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1547 | } | 1547 | } | ||
1548 | 1548 | | |||
1549 | TEST_DATA(testMaximizeForce) | 1549 | TEST_DATA(testMaximizeForce) | ||
1550 | 1550 | | |||
1551 | void TestShellClientRules::testMaximizeForce() | 1551 | void TestXdgShellClientRules::testMaximizeForce() | ||
1552 | { | 1552 | { | ||
1553 | // Initialize RuleBook with the test rule. | 1553 | // Initialize RuleBook with the test rule. | ||
1554 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1554 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1555 | config->group("General").writeEntry("count", 1); | 1555 | config->group("General").writeEntry("count", 1); | ||
1556 | KConfigGroup group = config->group("1"); | 1556 | KConfigGroup group = config->group("1"); | ||
1557 | group.writeEntry("maximizehoriz", true); | 1557 | group.writeEntry("maximizehoriz", true); | ||
1558 | group.writeEntry("maximizehorizrule", int(Rules::Force)); | 1558 | group.writeEntry("maximizehorizrule", int(Rules::Force)); | ||
1559 | group.writeEntry("maximizevert", true); | 1559 | group.writeEntry("maximizevert", true); | ||
Show All 22 Lines | |||||
1582 | QCOMPARE(configureRequestedSpy->count(), 1); | 1582 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1583 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | 1583 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||
1584 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1584 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1585 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1585 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1586 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 1586 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
1587 | 1587 | | |||
1588 | // Map the client. | 1588 | // Map the client. | ||
1589 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1589 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1590 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | 1590 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1591 | QVERIFY(client); | 1591 | QVERIFY(client); | ||
1592 | QVERIFY(client->isActive()); | 1592 | QVERIFY(client->isActive()); | ||
1593 | QVERIFY(!client->isMaximizable()); | 1593 | QVERIFY(!client->isMaximizable()); | ||
1594 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | 1594 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||
1595 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | 1595 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||
1596 | QCOMPARE(client->size(), QSize(1280, 1024)); | 1596 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||
1597 | 1597 | | |||
1598 | // We should receive a configure event when the client becomes active. | 1598 | // We should receive a configure event when the client becomes active. | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
1645 | // Destroy the client. | 1645 | // Destroy the client. | ||
1646 | shellSurface.reset(); | 1646 | shellSurface.reset(); | ||
1647 | surface.reset(); | 1647 | surface.reset(); | ||
1648 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1648 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1649 | } | 1649 | } | ||
1650 | 1650 | | |||
1651 | TEST_DATA(testMaximizeApplyNow) | 1651 | TEST_DATA(testMaximizeApplyNow) | ||
1652 | 1652 | | |||
1653 | void TestShellClientRules::testMaximizeApplyNow() | 1653 | void TestXdgShellClientRules::testMaximizeApplyNow() | ||
1654 | { | 1654 | { | ||
1655 | // Create the test client. | 1655 | // Create the test client. | ||
1656 | QFETCH(Test::XdgShellSurfaceType, type); | 1656 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1657 | QScopedPointer<Surface> surface; | 1657 | QScopedPointer<Surface> surface; | ||
1658 | surface.reset(Test::createSurface()); | 1658 | surface.reset(Test::createSurface()); | ||
1659 | QScopedPointer<XdgShellSurface> shellSurface; | 1659 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1660 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1660 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1661 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1661 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1662 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1662 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1663 | shellSurface->setAppId("org.kde.foo"); | 1663 | shellSurface->setAppId("org.kde.foo"); | ||
1664 | surface->commit(Surface::CommitFlag::None); | 1664 | surface->commit(Surface::CommitFlag::None); | ||
1665 | 1665 | | |||
1666 | // Wait for the initial configure event. | 1666 | // Wait for the initial configure event. | ||
1667 | XdgShellSurface::States states; | 1667 | XdgShellSurface::States states; | ||
1668 | QVERIFY(configureRequestedSpy->wait()); | 1668 | QVERIFY(configureRequestedSpy->wait()); | ||
1669 | QCOMPARE(configureRequestedSpy->count(), 1); | 1669 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1670 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | 1670 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||
1671 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1671 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1672 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1672 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1673 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 1673 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
1674 | 1674 | | |||
1675 | // Map the client. | 1675 | // Map the client. | ||
1676 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1676 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1677 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 1677 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
1678 | QVERIFY(client); | 1678 | QVERIFY(client); | ||
1679 | QVERIFY(client->isActive()); | 1679 | QVERIFY(client->isActive()); | ||
1680 | QVERIFY(client->isMaximizable()); | 1680 | QVERIFY(client->isMaximizable()); | ||
1681 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | 1681 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||
1682 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | 1682 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||
1683 | QCOMPARE(client->size(), QSize(100, 50)); | 1683 | QCOMPARE(client->size(), QSize(100, 50)); | ||
1684 | 1684 | | |||
1685 | // We should receive a configure event when the client becomes active. | 1685 | // We should receive a configure event when the client becomes active. | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
1752 | // Destroy the client. | 1752 | // Destroy the client. | ||
1753 | shellSurface.reset(); | 1753 | shellSurface.reset(); | ||
1754 | surface.reset(); | 1754 | surface.reset(); | ||
1755 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1755 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1756 | } | 1756 | } | ||
1757 | 1757 | | |||
1758 | TEST_DATA(testMaximizeForceTemporarily) | 1758 | TEST_DATA(testMaximizeForceTemporarily) | ||
1759 | 1759 | | |||
1760 | void TestShellClientRules::testMaximizeForceTemporarily() | 1760 | void TestXdgShellClientRules::testMaximizeForceTemporarily() | ||
1761 | { | 1761 | { | ||
1762 | // Initialize RuleBook with the test rule. | 1762 | // Initialize RuleBook with the test rule. | ||
1763 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1763 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1764 | config->group("General").writeEntry("count", 1); | 1764 | config->group("General").writeEntry("count", 1); | ||
1765 | KConfigGroup group = config->group("1"); | 1765 | KConfigGroup group = config->group("1"); | ||
1766 | group.writeEntry("maximizehoriz", true); | 1766 | group.writeEntry("maximizehoriz", true); | ||
1767 | group.writeEntry("maximizehorizrule", int(Rules::ForceTemporarily)); | 1767 | group.writeEntry("maximizehorizrule", int(Rules::ForceTemporarily)); | ||
1768 | group.writeEntry("maximizevert", true); | 1768 | group.writeEntry("maximizevert", true); | ||
Show All 22 Lines | |||||
1791 | QCOMPARE(configureRequestedSpy->count(), 1); | 1791 | QCOMPARE(configureRequestedSpy->count(), 1); | ||
1792 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | 1792 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||
1793 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | 1793 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||
1794 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 1794 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
1795 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 1795 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
1796 | 1796 | | |||
1797 | // Map the client. | 1797 | // Map the client. | ||
1798 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | 1798 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||
1799 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | 1799 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1800 | QVERIFY(client); | 1800 | QVERIFY(client); | ||
1801 | QVERIFY(client->isActive()); | 1801 | QVERIFY(client->isActive()); | ||
1802 | QVERIFY(!client->isMaximizable()); | 1802 | QVERIFY(!client->isMaximizable()); | ||
1803 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | 1803 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||
1804 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | 1804 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||
1805 | QCOMPARE(client->size(), QSize(1280, 1024)); | 1805 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||
1806 | 1806 | | |||
1807 | // We should receive a configure event when the client becomes active. | 1807 | // We should receive a configure event when the client becomes active. | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
1854 | // Destroy the client. | 1854 | // Destroy the client. | ||
1855 | shellSurface.reset(); | 1855 | shellSurface.reset(); | ||
1856 | surface.reset(); | 1856 | surface.reset(); | ||
1857 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1857 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1858 | } | 1858 | } | ||
1859 | 1859 | | |||
1860 | TEST_DATA(testDesktopDontAffect) | 1860 | TEST_DATA(testDesktopDontAffect) | ||
1861 | 1861 | | |||
1862 | void TestShellClientRules::testDesktopDontAffect() | 1862 | void TestXdgShellClientRules::testDesktopDontAffect() | ||
1863 | { | 1863 | { | ||
1864 | // Initialize RuleBook with the test rule. | 1864 | // Initialize RuleBook with the test rule. | ||
1865 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1865 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1866 | config->group("General").writeEntry("count", 1); | 1866 | config->group("General").writeEntry("count", 1); | ||
1867 | KConfigGroup group = config->group("1"); | 1867 | KConfigGroup group = config->group("1"); | ||
1868 | group.writeEntry("desktop", 2); | 1868 | group.writeEntry("desktop", 2); | ||
1869 | group.writeEntry("desktoprule", int(Rules::DontAffect)); | 1869 | group.writeEntry("desktoprule", int(Rules::DontAffect)); | ||
1870 | group.writeEntry("wmclass", "org.kde.foo"); | 1870 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1871 | group.writeEntry("wmclasscomplete", false); | 1871 | group.writeEntry("wmclasscomplete", false); | ||
1872 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1872 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1873 | group.sync(); | 1873 | group.sync(); | ||
1874 | RuleBook::self()->setConfig(config); | 1874 | RuleBook::self()->setConfig(config); | ||
1875 | workspace()->slotReconfigure(); | 1875 | workspace()->slotReconfigure(); | ||
1876 | 1876 | | |||
1877 | // We need at least two virtual desktop for this test. | 1877 | // We need at least two virtual desktop for this test. | ||
1878 | VirtualDesktopManager::self()->setCount(2); | 1878 | VirtualDesktopManager::self()->setCount(2); | ||
1879 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1879 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1880 | VirtualDesktopManager::self()->setCurrent(1); | 1880 | VirtualDesktopManager::self()->setCurrent(1); | ||
1881 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1881 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1882 | 1882 | | |||
1883 | // Create the test client. | 1883 | // Create the test client. | ||
1884 | QFETCH(Test::XdgShellSurfaceType, type); | 1884 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1885 | ShellClient *client; | 1885 | XdgShellClient *client; | ||
1886 | Surface *surface; | 1886 | Surface *surface; | ||
1887 | XdgShellSurface *shellSurface; | 1887 | XdgShellSurface *shellSurface; | ||
1888 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1888 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1889 | QVERIFY(client); | 1889 | QVERIFY(client); | ||
1890 | 1890 | | |||
1891 | // The client should appear on the current virtual desktop. | 1891 | // The client should appear on the current virtual desktop. | ||
1892 | QCOMPARE(client->desktop(), 1); | 1892 | QCOMPARE(client->desktop(), 1); | ||
1893 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1893 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1894 | 1894 | | |||
1895 | // Destroy the client. | 1895 | // Destroy the client. | ||
1896 | delete shellSurface; | 1896 | delete shellSurface; | ||
1897 | delete surface; | 1897 | delete surface; | ||
1898 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1898 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1899 | } | 1899 | } | ||
1900 | 1900 | | |||
1901 | TEST_DATA(testDesktopApply) | 1901 | TEST_DATA(testDesktopApply) | ||
1902 | 1902 | | |||
1903 | void TestShellClientRules::testDesktopApply() | 1903 | void TestXdgShellClientRules::testDesktopApply() | ||
1904 | { | 1904 | { | ||
1905 | // Initialize RuleBook with the test rule. | 1905 | // Initialize RuleBook with the test rule. | ||
1906 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1906 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1907 | config->group("General").writeEntry("count", 1); | 1907 | config->group("General").writeEntry("count", 1); | ||
1908 | KConfigGroup group = config->group("1"); | 1908 | KConfigGroup group = config->group("1"); | ||
1909 | group.writeEntry("desktop", 2); | 1909 | group.writeEntry("desktop", 2); | ||
1910 | group.writeEntry("desktoprule", int(Rules::Apply)); | 1910 | group.writeEntry("desktoprule", int(Rules::Apply)); | ||
1911 | group.writeEntry("wmclass", "org.kde.foo"); | 1911 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1912 | group.writeEntry("wmclasscomplete", false); | 1912 | group.writeEntry("wmclasscomplete", false); | ||
1913 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1913 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1914 | group.sync(); | 1914 | group.sync(); | ||
1915 | RuleBook::self()->setConfig(config); | 1915 | RuleBook::self()->setConfig(config); | ||
1916 | workspace()->slotReconfigure(); | 1916 | workspace()->slotReconfigure(); | ||
1917 | 1917 | | |||
1918 | // We need at least two virtual desktop for this test. | 1918 | // We need at least two virtual desktop for this test. | ||
1919 | VirtualDesktopManager::self()->setCount(2); | 1919 | VirtualDesktopManager::self()->setCount(2); | ||
1920 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1920 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1921 | VirtualDesktopManager::self()->setCurrent(1); | 1921 | VirtualDesktopManager::self()->setCurrent(1); | ||
1922 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1922 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1923 | 1923 | | |||
1924 | // Create the test client. | 1924 | // Create the test client. | ||
1925 | QFETCH(Test::XdgShellSurfaceType, type); | 1925 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1926 | ShellClient *client; | 1926 | XdgShellClient *client; | ||
1927 | Surface *surface; | 1927 | Surface *surface; | ||
1928 | XdgShellSurface *shellSurface; | 1928 | XdgShellSurface *shellSurface; | ||
1929 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1929 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1930 | QVERIFY(client); | 1930 | QVERIFY(client); | ||
1931 | 1931 | | |||
1932 | // The client should appear on the second virtual desktop. | 1932 | // The client should appear on the second virtual desktop. | ||
1933 | QCOMPARE(client->desktop(), 2); | 1933 | QCOMPARE(client->desktop(), 2); | ||
1934 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1934 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
Show All 10 Lines | |||||
1945 | VirtualDesktopManager::self()->setCurrent(1); | 1945 | VirtualDesktopManager::self()->setCurrent(1); | ||
1946 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1946 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1947 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1947 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1948 | QVERIFY(client); | 1948 | QVERIFY(client); | ||
1949 | QCOMPARE(client->desktop(), 2); | 1949 | QCOMPARE(client->desktop(), 2); | ||
1950 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1950 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1951 | 1951 | | |||
1952 | // Destroy the client. | 1952 | // Destroy the client. | ||
1953 | delete shellSurface; | 1953 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1954 | delete surface; | 1954 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1955 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1955 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1956 | } | 1956 | } | ||
1957 | 1957 | | |||
1958 | TEST_DATA(testDesktopRemember) | 1958 | TEST_DATA(testDesktopRemember) | ||
1959 | 1959 | | |||
1960 | void TestShellClientRules::testDesktopRemember() | 1960 | void TestXdgShellClientRules::testDesktopRemember() | ||
1961 | { | 1961 | { | ||
1962 | // Initialize RuleBook with the test rule. | 1962 | // Initialize RuleBook with the test rule. | ||
1963 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1963 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1964 | config->group("General").writeEntry("count", 1); | 1964 | config->group("General").writeEntry("count", 1); | ||
1965 | KConfigGroup group = config->group("1"); | 1965 | KConfigGroup group = config->group("1"); | ||
1966 | group.writeEntry("desktop", 2); | 1966 | group.writeEntry("desktop", 2); | ||
1967 | group.writeEntry("desktoprule", int(Rules::Remember)); | 1967 | group.writeEntry("desktoprule", int(Rules::Remember)); | ||
1968 | group.writeEntry("wmclass", "org.kde.foo"); | 1968 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1969 | group.writeEntry("wmclasscomplete", false); | 1969 | group.writeEntry("wmclasscomplete", false); | ||
1970 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1970 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1971 | group.sync(); | 1971 | group.sync(); | ||
1972 | RuleBook::self()->setConfig(config); | 1972 | RuleBook::self()->setConfig(config); | ||
1973 | workspace()->slotReconfigure(); | 1973 | workspace()->slotReconfigure(); | ||
1974 | 1974 | | |||
1975 | // We need at least two virtual desktop for this test. | 1975 | // We need at least two virtual desktop for this test. | ||
1976 | VirtualDesktopManager::self()->setCount(2); | 1976 | VirtualDesktopManager::self()->setCount(2); | ||
1977 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1977 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1978 | VirtualDesktopManager::self()->setCurrent(1); | 1978 | VirtualDesktopManager::self()->setCurrent(1); | ||
1979 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1979 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1980 | 1980 | | |||
1981 | // Create the test client. | 1981 | // Create the test client. | ||
1982 | QFETCH(Test::XdgShellSurfaceType, type); | 1982 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1983 | ShellClient *client; | 1983 | XdgShellClient *client; | ||
1984 | Surface *surface; | 1984 | Surface *surface; | ||
1985 | XdgShellSurface *shellSurface; | 1985 | XdgShellSurface *shellSurface; | ||
1986 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1986 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1987 | QVERIFY(client); | 1987 | QVERIFY(client); | ||
1988 | QCOMPARE(client->desktop(), 2); | 1988 | QCOMPARE(client->desktop(), 2); | ||
1989 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1989 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1990 | 1990 | | |||
1991 | // Move the client to the first virtual desktop. | 1991 | // Move the client to the first virtual desktop. | ||
1992 | workspace()->sendClientToDesktop(client, 1, true); | 1992 | workspace()->sendClientToDesktop(client, 1, true); | ||
1993 | QCOMPARE(client->desktop(), 1); | 1993 | QCOMPARE(client->desktop(), 1); | ||
1994 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1994 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1995 | 1995 | | |||
1996 | // If we create the client again, it should appear on the first virtual desktop. | 1996 | // If we create the client again, it should appear on the first virtual desktop. | ||
1997 | delete shellSurface; | 1997 | delete shellSurface; | ||
1998 | delete surface; | 1998 | delete surface; | ||
1999 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1999 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2000 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2000 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2001 | QVERIFY(client); | 2001 | QVERIFY(client); | ||
2002 | QCOMPARE(client->desktop(), 1); | 2002 | QCOMPARE(client->desktop(), 1); | ||
2003 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2003 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2004 | 2004 | | |||
2005 | // Destroy the client. | 2005 | // Destroy the client. | ||
2006 | delete shellSurface; | 2006 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2007 | delete surface; | 2007 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2008 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2008 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2009 | } | 2009 | } | ||
2010 | 2010 | | |||
2011 | TEST_DATA(testDesktopForce) | 2011 | TEST_DATA(testDesktopForce) | ||
2012 | 2012 | | |||
2013 | void TestShellClientRules::testDesktopForce() | 2013 | void TestXdgShellClientRules::testDesktopForce() | ||
2014 | { | 2014 | { | ||
2015 | // Initialize RuleBook with the test rule. | 2015 | // Initialize RuleBook with the test rule. | ||
2016 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2016 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2017 | config->group("General").writeEntry("count", 1); | 2017 | config->group("General").writeEntry("count", 1); | ||
2018 | KConfigGroup group = config->group("1"); | 2018 | KConfigGroup group = config->group("1"); | ||
2019 | group.writeEntry("desktop", 2); | 2019 | group.writeEntry("desktop", 2); | ||
2020 | group.writeEntry("desktoprule", int(Rules::Force)); | 2020 | group.writeEntry("desktoprule", int(Rules::Force)); | ||
2021 | group.writeEntry("wmclass", "org.kde.foo"); | 2021 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2022 | group.writeEntry("wmclasscomplete", false); | 2022 | group.writeEntry("wmclasscomplete", false); | ||
2023 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2023 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2024 | group.sync(); | 2024 | group.sync(); | ||
2025 | RuleBook::self()->setConfig(config); | 2025 | RuleBook::self()->setConfig(config); | ||
2026 | workspace()->slotReconfigure(); | 2026 | workspace()->slotReconfigure(); | ||
2027 | 2027 | | |||
2028 | // We need at least two virtual desktop for this test. | 2028 | // We need at least two virtual desktop for this test. | ||
2029 | VirtualDesktopManager::self()->setCount(2); | 2029 | VirtualDesktopManager::self()->setCount(2); | ||
2030 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2030 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2031 | VirtualDesktopManager::self()->setCurrent(1); | 2031 | VirtualDesktopManager::self()->setCurrent(1); | ||
2032 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2032 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2033 | 2033 | | |||
2034 | // Create the test client. | 2034 | // Create the test client. | ||
2035 | QFETCH(Test::XdgShellSurfaceType, type); | 2035 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2036 | ShellClient *client; | 2036 | XdgShellClient *client; | ||
2037 | Surface *surface; | 2037 | Surface *surface; | ||
2038 | XdgShellSurface *shellSurface; | 2038 | XdgShellSurface *shellSurface; | ||
2039 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2039 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2040 | QVERIFY(client); | 2040 | QVERIFY(client); | ||
2041 | 2041 | | |||
2042 | // The client should appear on the second virtual desktop. | 2042 | // The client should appear on the second virtual desktop. | ||
2043 | QCOMPARE(client->desktop(), 2); | 2043 | QCOMPARE(client->desktop(), 2); | ||
2044 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 2044 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
Show All 10 Lines | |||||
2055 | VirtualDesktopManager::self()->setCurrent(1); | 2055 | VirtualDesktopManager::self()->setCurrent(1); | ||
2056 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2056 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2057 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2057 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2058 | QVERIFY(client); | 2058 | QVERIFY(client); | ||
2059 | QCOMPARE(client->desktop(), 2); | 2059 | QCOMPARE(client->desktop(), 2); | ||
2060 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 2060 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
2061 | 2061 | | |||
2062 | // Destroy the client. | 2062 | // Destroy the client. | ||
2063 | delete shellSurface; | 2063 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2064 | delete surface; | 2064 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2065 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2065 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2066 | } | 2066 | } | ||
2067 | 2067 | | |||
2068 | TEST_DATA(testDesktopApplyNow) | 2068 | TEST_DATA(testDesktopApplyNow) | ||
2069 | 2069 | | |||
2070 | void TestShellClientRules::testDesktopApplyNow() | 2070 | void TestXdgShellClientRules::testDesktopApplyNow() | ||
2071 | { | 2071 | { | ||
2072 | // We need at least two virtual desktop for this test. | 2072 | // We need at least two virtual desktop for this test. | ||
2073 | VirtualDesktopManager::self()->setCount(2); | 2073 | VirtualDesktopManager::self()->setCount(2); | ||
2074 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2074 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2075 | VirtualDesktopManager::self()->setCurrent(1); | 2075 | VirtualDesktopManager::self()->setCurrent(1); | ||
2076 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2076 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2077 | 2077 | | |||
2078 | // Create the test client. | 2078 | // Create the test client. | ||
2079 | QFETCH(Test::XdgShellSurfaceType, type); | 2079 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2080 | ShellClient *client; | 2080 | XdgShellClient *client; | ||
2081 | Surface *surface; | 2081 | Surface *surface; | ||
2082 | XdgShellSurface *shellSurface; | 2082 | XdgShellSurface *shellSurface; | ||
2083 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2083 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2084 | QVERIFY(client); | 2084 | QVERIFY(client); | ||
2085 | QCOMPARE(client->desktop(), 1); | 2085 | QCOMPARE(client->desktop(), 1); | ||
2086 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2086 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2087 | 2087 | | |||
2088 | // Initialize RuleBook with the test rule. | 2088 | // Initialize RuleBook with the test rule. | ||
Show All 26 Lines | |||||
2115 | // Destroy the client. | 2115 | // Destroy the client. | ||
2116 | delete shellSurface; | 2116 | delete shellSurface; | ||
2117 | delete surface; | 2117 | delete surface; | ||
2118 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2118 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2119 | } | 2119 | } | ||
2120 | 2120 | | |||
2121 | TEST_DATA(testDesktopForceTemporarily) | 2121 | TEST_DATA(testDesktopForceTemporarily) | ||
2122 | 2122 | | |||
2123 | void TestShellClientRules::testDesktopForceTemporarily() | 2123 | void TestXdgShellClientRules::testDesktopForceTemporarily() | ||
2124 | { | 2124 | { | ||
2125 | // Initialize RuleBook with the test rule. | 2125 | // Initialize RuleBook with the test rule. | ||
2126 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2126 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2127 | config->group("General").writeEntry("count", 1); | 2127 | config->group("General").writeEntry("count", 1); | ||
2128 | KConfigGroup group = config->group("1"); | 2128 | KConfigGroup group = config->group("1"); | ||
2129 | group.writeEntry("desktop", 2); | 2129 | group.writeEntry("desktop", 2); | ||
2130 | group.writeEntry("desktoprule", int(Rules::ForceTemporarily)); | 2130 | group.writeEntry("desktoprule", int(Rules::ForceTemporarily)); | ||
2131 | group.writeEntry("wmclass", "org.kde.foo"); | 2131 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2132 | group.writeEntry("wmclasscomplete", false); | 2132 | group.writeEntry("wmclasscomplete", false); | ||
2133 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2133 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2134 | group.sync(); | 2134 | group.sync(); | ||
2135 | RuleBook::self()->setConfig(config); | 2135 | RuleBook::self()->setConfig(config); | ||
2136 | workspace()->slotReconfigure(); | 2136 | workspace()->slotReconfigure(); | ||
2137 | 2137 | | |||
2138 | // We need at least two virtual desktop for this test. | 2138 | // We need at least two virtual desktop for this test. | ||
2139 | VirtualDesktopManager::self()->setCount(2); | 2139 | VirtualDesktopManager::self()->setCount(2); | ||
2140 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2140 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2141 | VirtualDesktopManager::self()->setCurrent(1); | 2141 | VirtualDesktopManager::self()->setCurrent(1); | ||
2142 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2142 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2143 | 2143 | | |||
2144 | // Create the test client. | 2144 | // Create the test client. | ||
2145 | QFETCH(Test::XdgShellSurfaceType, type); | 2145 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2146 | ShellClient *client; | 2146 | XdgShellClient *client; | ||
2147 | Surface *surface; | 2147 | Surface *surface; | ||
2148 | XdgShellSurface *shellSurface; | 2148 | XdgShellSurface *shellSurface; | ||
2149 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2149 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2150 | QVERIFY(client); | 2150 | QVERIFY(client); | ||
2151 | 2151 | | |||
2152 | // The client should appear on the second virtual desktop. | 2152 | // The client should appear on the second virtual desktop. | ||
2153 | QCOMPARE(client->desktop(), 2); | 2153 | QCOMPARE(client->desktop(), 2); | ||
2154 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 2154 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
Show All 18 Lines | |||||
2173 | workspace()->sendClientToDesktop(client, 2, true); | 2173 | workspace()->sendClientToDesktop(client, 2, true); | ||
2174 | QCOMPARE(client->desktop(), 2); | 2174 | QCOMPARE(client->desktop(), 2); | ||
2175 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2175 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2176 | workspace()->sendClientToDesktop(client, 1, true); | 2176 | workspace()->sendClientToDesktop(client, 1, true); | ||
2177 | QCOMPARE(client->desktop(), 1); | 2177 | QCOMPARE(client->desktop(), 1); | ||
2178 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2178 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2179 | 2179 | | |||
2180 | // Destroy the client. | 2180 | // Destroy the client. | ||
2181 | delete shellSurface; | 2181 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2182 | delete surface; | 2182 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2183 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2183 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2184 | } | 2184 | } | ||
2185 | 2185 | | |||
2186 | TEST_DATA(testMinimizeDontAffect) | 2186 | TEST_DATA(testMinimizeDontAffect) | ||
2187 | 2187 | | |||
2188 | void TestShellClientRules::testMinimizeDontAffect() | 2188 | void TestXdgShellClientRules::testMinimizeDontAffect() | ||
2189 | { | 2189 | { | ||
2190 | // Initialize RuleBook with the test rule. | 2190 | // Initialize RuleBook with the test rule. | ||
2191 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2191 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2192 | config->group("General").writeEntry("count", 1); | 2192 | config->group("General").writeEntry("count", 1); | ||
2193 | KConfigGroup group = config->group("1"); | 2193 | KConfigGroup group = config->group("1"); | ||
2194 | group.writeEntry("minimize", true); | 2194 | group.writeEntry("minimize", true); | ||
2195 | group.writeEntry("minimizerule", int(Rules::DontAffect)); | 2195 | group.writeEntry("minimizerule", int(Rules::DontAffect)); | ||
2196 | group.writeEntry("wmclass", "org.kde.foo"); | 2196 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2197 | group.writeEntry("wmclasscomplete", false); | 2197 | group.writeEntry("wmclasscomplete", false); | ||
2198 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2198 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2199 | group.sync(); | 2199 | group.sync(); | ||
2200 | RuleBook::self()->setConfig(config); | 2200 | RuleBook::self()->setConfig(config); | ||
2201 | workspace()->slotReconfigure(); | 2201 | workspace()->slotReconfigure(); | ||
2202 | 2202 | | |||
2203 | // Create the test client. | 2203 | // Create the test client. | ||
2204 | QFETCH(Test::XdgShellSurfaceType, type); | 2204 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2205 | ShellClient *client; | 2205 | XdgShellClient *client; | ||
2206 | Surface *surface; | 2206 | Surface *surface; | ||
2207 | XdgShellSurface *shellSurface; | 2207 | XdgShellSurface *shellSurface; | ||
2208 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2208 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2209 | QVERIFY(client); | 2209 | QVERIFY(client); | ||
2210 | QVERIFY(client->isMinimizable()); | 2210 | QVERIFY(client->isMinimizable()); | ||
2211 | 2211 | | |||
2212 | // The client should not be minimized. | 2212 | // The client should not be minimized. | ||
2213 | QVERIFY(!client->isMinimized()); | 2213 | QVERIFY(!client->isMinimized()); | ||
2214 | 2214 | | |||
2215 | // Destroy the client. | 2215 | // Destroy the client. | ||
2216 | delete shellSurface; | 2216 | delete shellSurface; | ||
2217 | delete surface; | 2217 | delete surface; | ||
2218 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2218 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2219 | } | 2219 | } | ||
2220 | 2220 | | |||
2221 | TEST_DATA(testMinimizeApply) | 2221 | TEST_DATA(testMinimizeApply) | ||
2222 | 2222 | | |||
2223 | void TestShellClientRules::testMinimizeApply() | 2223 | void TestXdgShellClientRules::testMinimizeApply() | ||
2224 | { | 2224 | { | ||
2225 | // Initialize RuleBook with the test rule. | 2225 | // Initialize RuleBook with the test rule. | ||
2226 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2226 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2227 | config->group("General").writeEntry("count", 1); | 2227 | config->group("General").writeEntry("count", 1); | ||
2228 | KConfigGroup group = config->group("1"); | 2228 | KConfigGroup group = config->group("1"); | ||
2229 | group.writeEntry("minimize", true); | 2229 | group.writeEntry("minimize", true); | ||
2230 | group.writeEntry("minimizerule", int(Rules::Apply)); | 2230 | group.writeEntry("minimizerule", int(Rules::Apply)); | ||
2231 | group.writeEntry("wmclass", "org.kde.foo"); | 2231 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2232 | group.writeEntry("wmclasscomplete", false); | 2232 | group.writeEntry("wmclasscomplete", false); | ||
2233 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2233 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2234 | group.sync(); | 2234 | group.sync(); | ||
2235 | RuleBook::self()->setConfig(config); | 2235 | RuleBook::self()->setConfig(config); | ||
2236 | workspace()->slotReconfigure(); | 2236 | workspace()->slotReconfigure(); | ||
2237 | 2237 | | |||
2238 | // Create the test client. | 2238 | // Create the test client. | ||
2239 | QFETCH(Test::XdgShellSurfaceType, type); | 2239 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2240 | ShellClient *client; | 2240 | XdgShellClient *client; | ||
2241 | Surface *surface; | 2241 | Surface *surface; | ||
2242 | XdgShellSurface *shellSurface; | 2242 | XdgShellSurface *shellSurface; | ||
2243 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2243 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2244 | QVERIFY(client); | 2244 | QVERIFY(client); | ||
2245 | QVERIFY(client->isMinimizable()); | 2245 | QVERIFY(client->isMinimizable()); | ||
2246 | 2246 | | |||
2247 | // The client should be minimized. | 2247 | // The client should be minimized. | ||
2248 | QVERIFY(client->isMinimized()); | 2248 | QVERIFY(client->isMinimized()); | ||
2249 | 2249 | | |||
2250 | // We should still be able to unminimize the client. | 2250 | // We should still be able to unminimize the client. | ||
2251 | client->unminimize(); | 2251 | client->unminimize(); | ||
2252 | QVERIFY(!client->isMinimized()); | 2252 | QVERIFY(!client->isMinimized()); | ||
2253 | 2253 | | |||
2254 | // If we re-open the client, it should be minimized back again. | 2254 | // If we re-open the client, it should be minimized back again. | ||
2255 | delete shellSurface; | 2255 | delete shellSurface; | ||
2256 | delete surface; | 2256 | delete surface; | ||
2257 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2257 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2258 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2258 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2259 | QVERIFY(client); | 2259 | QVERIFY(client); | ||
2260 | QVERIFY(client->isMinimizable()); | 2260 | QVERIFY(client->isMinimizable()); | ||
2261 | QVERIFY(client->isMinimized()); | 2261 | QVERIFY(client->isMinimized()); | ||
2262 | 2262 | | |||
2263 | // Destroy the client. | 2263 | // Destroy the client. | ||
2264 | delete shellSurface; | 2264 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2265 | delete surface; | 2265 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2266 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2266 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2267 | } | 2267 | } | ||
2268 | 2268 | | |||
2269 | TEST_DATA(testMinimizeRemember) | 2269 | TEST_DATA(testMinimizeRemember) | ||
2270 | 2270 | | |||
2271 | void TestShellClientRules::testMinimizeRemember() | 2271 | void TestXdgShellClientRules::testMinimizeRemember() | ||
2272 | { | 2272 | { | ||
2273 | // Initialize RuleBook with the test rule. | 2273 | // Initialize RuleBook with the test rule. | ||
2274 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2274 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2275 | config->group("General").writeEntry("count", 1); | 2275 | config->group("General").writeEntry("count", 1); | ||
2276 | KConfigGroup group = config->group("1"); | 2276 | KConfigGroup group = config->group("1"); | ||
2277 | group.writeEntry("minimize", false); | 2277 | group.writeEntry("minimize", false); | ||
2278 | group.writeEntry("minimizerule", int(Rules::Remember)); | 2278 | group.writeEntry("minimizerule", int(Rules::Remember)); | ||
2279 | group.writeEntry("wmclass", "org.kde.foo"); | 2279 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2280 | group.writeEntry("wmclasscomplete", false); | 2280 | group.writeEntry("wmclasscomplete", false); | ||
2281 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2281 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2282 | group.sync(); | 2282 | group.sync(); | ||
2283 | RuleBook::self()->setConfig(config); | 2283 | RuleBook::self()->setConfig(config); | ||
2284 | workspace()->slotReconfigure(); | 2284 | workspace()->slotReconfigure(); | ||
2285 | 2285 | | |||
2286 | // Create the test client. | 2286 | // Create the test client. | ||
2287 | QFETCH(Test::XdgShellSurfaceType, type); | 2287 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2288 | ShellClient *client; | 2288 | XdgShellClient *client; | ||
2289 | Surface *surface; | 2289 | Surface *surface; | ||
2290 | XdgShellSurface *shellSurface; | 2290 | XdgShellSurface *shellSurface; | ||
2291 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2291 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2292 | QVERIFY(client); | 2292 | QVERIFY(client); | ||
2293 | QVERIFY(client->isMinimizable()); | 2293 | QVERIFY(client->isMinimizable()); | ||
2294 | QVERIFY(!client->isMinimized()); | 2294 | QVERIFY(!client->isMinimized()); | ||
2295 | 2295 | | |||
2296 | // Minimize the client. | 2296 | // Minimize the client. | ||
2297 | client->minimize(); | 2297 | client->minimize(); | ||
2298 | QVERIFY(client->isMinimized()); | 2298 | QVERIFY(client->isMinimized()); | ||
2299 | 2299 | | |||
2300 | // If we open the client again, it should be minimized. | 2300 | // If we open the client again, it should be minimized. | ||
2301 | delete shellSurface; | 2301 | delete shellSurface; | ||
2302 | delete surface; | 2302 | delete surface; | ||
2303 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2303 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2304 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2304 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2305 | QVERIFY(client); | 2305 | QVERIFY(client); | ||
2306 | QVERIFY(client->isMinimizable()); | 2306 | QVERIFY(client->isMinimizable()); | ||
2307 | QVERIFY(client->isMinimized()); | 2307 | QVERIFY(client->isMinimized()); | ||
2308 | 2308 | | |||
2309 | // Destroy the client. | 2309 | // Destroy the client. | ||
2310 | delete shellSurface; | 2310 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2311 | delete surface; | 2311 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2312 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2312 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2313 | } | 2313 | } | ||
2314 | 2314 | | |||
2315 | TEST_DATA(testMinimizeForce) | 2315 | TEST_DATA(testMinimizeForce) | ||
2316 | 2316 | | |||
2317 | void TestShellClientRules::testMinimizeForce() | 2317 | void TestXdgShellClientRules::testMinimizeForce() | ||
2318 | { | 2318 | { | ||
2319 | // Initialize RuleBook with the test rule. | 2319 | // Initialize RuleBook with the test rule. | ||
2320 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2320 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2321 | config->group("General").writeEntry("count", 1); | 2321 | config->group("General").writeEntry("count", 1); | ||
2322 | KConfigGroup group = config->group("1"); | 2322 | KConfigGroup group = config->group("1"); | ||
2323 | group.writeEntry("minimize", false); | 2323 | group.writeEntry("minimize", false); | ||
2324 | group.writeEntry("minimizerule", int(Rules::Force)); | 2324 | group.writeEntry("minimizerule", int(Rules::Force)); | ||
2325 | group.writeEntry("wmclass", "org.kde.foo"); | 2325 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2326 | group.writeEntry("wmclasscomplete", false); | 2326 | group.writeEntry("wmclasscomplete", false); | ||
2327 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2327 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2328 | group.sync(); | 2328 | group.sync(); | ||
2329 | RuleBook::self()->setConfig(config); | 2329 | RuleBook::self()->setConfig(config); | ||
2330 | workspace()->slotReconfigure(); | 2330 | workspace()->slotReconfigure(); | ||
2331 | 2331 | | |||
2332 | // Create the test client. | 2332 | // Create the test client. | ||
2333 | QFETCH(Test::XdgShellSurfaceType, type); | 2333 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2334 | ShellClient *client; | 2334 | XdgShellClient *client; | ||
2335 | Surface *surface; | 2335 | Surface *surface; | ||
2336 | XdgShellSurface *shellSurface; | 2336 | XdgShellSurface *shellSurface; | ||
2337 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2337 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2338 | QVERIFY(client); | 2338 | QVERIFY(client); | ||
2339 | QVERIFY(!client->isMinimizable()); | 2339 | QVERIFY(!client->isMinimizable()); | ||
2340 | QVERIFY(!client->isMinimized()); | 2340 | QVERIFY(!client->isMinimized()); | ||
2341 | 2341 | | |||
2342 | // Any attempt to minimize the client should fail. | 2342 | // Any attempt to minimize the client should fail. | ||
2343 | client->minimize(); | 2343 | client->minimize(); | ||
2344 | QVERIFY(!client->isMinimized()); | 2344 | QVERIFY(!client->isMinimized()); | ||
2345 | 2345 | | |||
2346 | // If we re-open the client, the minimized state should still be forced. | 2346 | // If we re-open the client, the minimized state should still be forced. | ||
2347 | delete shellSurface; | 2347 | delete shellSurface; | ||
2348 | delete surface; | 2348 | delete surface; | ||
2349 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2349 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2350 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2350 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2351 | QVERIFY(client); | 2351 | QVERIFY(client); | ||
2352 | QVERIFY(!client->isMinimizable()); | 2352 | QVERIFY(!client->isMinimizable()); | ||
2353 | QVERIFY(!client->isMinimized()); | 2353 | QVERIFY(!client->isMinimized()); | ||
2354 | client->minimize(); | 2354 | client->minimize(); | ||
2355 | QVERIFY(!client->isMinimized()); | 2355 | QVERIFY(!client->isMinimized()); | ||
2356 | 2356 | | |||
2357 | // Destroy the client. | 2357 | // Destroy the client. | ||
2358 | delete shellSurface; | 2358 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2359 | delete surface; | 2359 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2360 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2360 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2361 | } | 2361 | } | ||
2362 | 2362 | | |||
2363 | TEST_DATA(testMinimizeApplyNow) | 2363 | TEST_DATA(testMinimizeApplyNow) | ||
2364 | 2364 | | |||
2365 | void TestShellClientRules::testMinimizeApplyNow() | 2365 | void TestXdgShellClientRules::testMinimizeApplyNow() | ||
2366 | { | 2366 | { | ||
2367 | // Create the test client. | 2367 | // Create the test client. | ||
2368 | QFETCH(Test::XdgShellSurfaceType, type); | 2368 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2369 | ShellClient *client; | 2369 | XdgShellClient *client; | ||
2370 | Surface *surface; | 2370 | Surface *surface; | ||
2371 | XdgShellSurface *shellSurface; | 2371 | XdgShellSurface *shellSurface; | ||
2372 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2372 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2373 | QVERIFY(client); | 2373 | QVERIFY(client); | ||
2374 | QVERIFY(client->isMinimizable()); | 2374 | QVERIFY(client->isMinimizable()); | ||
2375 | QVERIFY(!client->isMinimized()); | 2375 | QVERIFY(!client->isMinimized()); | ||
2376 | 2376 | | |||
2377 | // Initialize RuleBook with the test rule. | 2377 | // Initialize RuleBook with the test rule. | ||
Show All 25 Lines | |||||
2403 | // Destroy the client. | 2403 | // Destroy the client. | ||
2404 | delete shellSurface; | 2404 | delete shellSurface; | ||
2405 | delete surface; | 2405 | delete surface; | ||
2406 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2406 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2407 | } | 2407 | } | ||
2408 | 2408 | | |||
2409 | TEST_DATA(testMinimizeForceTemporarily) | 2409 | TEST_DATA(testMinimizeForceTemporarily) | ||
2410 | 2410 | | |||
2411 | void TestShellClientRules::testMinimizeForceTemporarily() | 2411 | void TestXdgShellClientRules::testMinimizeForceTemporarily() | ||
2412 | { | 2412 | { | ||
2413 | // Initialize RuleBook with the test rule. | 2413 | // Initialize RuleBook with the test rule. | ||
2414 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2414 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2415 | config->group("General").writeEntry("count", 1); | 2415 | config->group("General").writeEntry("count", 1); | ||
2416 | KConfigGroup group = config->group("1"); | 2416 | KConfigGroup group = config->group("1"); | ||
2417 | group.writeEntry("minimize", false); | 2417 | group.writeEntry("minimize", false); | ||
2418 | group.writeEntry("minimizerule", int(Rules::ForceTemporarily)); | 2418 | group.writeEntry("minimizerule", int(Rules::ForceTemporarily)); | ||
2419 | group.writeEntry("wmclass", "org.kde.foo"); | 2419 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2420 | group.writeEntry("wmclasscomplete", false); | 2420 | group.writeEntry("wmclasscomplete", false); | ||
2421 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2421 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2422 | group.sync(); | 2422 | group.sync(); | ||
2423 | RuleBook::self()->setConfig(config); | 2423 | RuleBook::self()->setConfig(config); | ||
2424 | workspace()->slotReconfigure(); | 2424 | workspace()->slotReconfigure(); | ||
2425 | 2425 | | |||
2426 | // Create the test client. | 2426 | // Create the test client. | ||
2427 | QFETCH(Test::XdgShellSurfaceType, type); | 2427 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2428 | ShellClient *client; | 2428 | XdgShellClient *client; | ||
2429 | Surface *surface; | 2429 | Surface *surface; | ||
2430 | XdgShellSurface *shellSurface; | 2430 | XdgShellSurface *shellSurface; | ||
2431 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2431 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2432 | QVERIFY(client); | 2432 | QVERIFY(client); | ||
2433 | QVERIFY(!client->isMinimizable()); | 2433 | QVERIFY(!client->isMinimizable()); | ||
2434 | QVERIFY(!client->isMinimized()); | 2434 | QVERIFY(!client->isMinimized()); | ||
2435 | 2435 | | |||
2436 | // Any attempt to minimize the client should fail until the client is closed. | 2436 | // Any attempt to minimize the client should fail until the client is closed. | ||
2437 | client->minimize(); | 2437 | client->minimize(); | ||
2438 | QVERIFY(!client->isMinimized()); | 2438 | QVERIFY(!client->isMinimized()); | ||
2439 | 2439 | | |||
2440 | // The rule should be discarded when the client is closed. | 2440 | // The rule should be discarded when the client is closed. | ||
2441 | delete shellSurface; | 2441 | delete shellSurface; | ||
2442 | delete surface; | 2442 | delete surface; | ||
2443 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2443 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2444 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2444 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2445 | QVERIFY(client); | 2445 | QVERIFY(client); | ||
2446 | QVERIFY(client->isMinimizable()); | 2446 | QVERIFY(client->isMinimizable()); | ||
2447 | QVERIFY(!client->isMinimized()); | 2447 | QVERIFY(!client->isMinimized()); | ||
2448 | client->minimize(); | 2448 | client->minimize(); | ||
2449 | QVERIFY(client->isMinimized()); | 2449 | QVERIFY(client->isMinimized()); | ||
2450 | 2450 | | |||
2451 | // Destroy the client. | 2451 | // Destroy the client. | ||
2452 | delete shellSurface; | 2452 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2453 | delete surface; | 2453 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2454 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2454 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2455 | } | 2455 | } | ||
2456 | 2456 | | |||
2457 | TEST_DATA(testSkipTaskbarDontAffect) | 2457 | TEST_DATA(testSkipTaskbarDontAffect) | ||
2458 | 2458 | | |||
2459 | void TestShellClientRules::testSkipTaskbarDontAffect() | 2459 | void TestXdgShellClientRules::testSkipTaskbarDontAffect() | ||
2460 | { | 2460 | { | ||
2461 | // Initialize RuleBook with the test rule. | 2461 | // Initialize RuleBook with the test rule. | ||
2462 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2462 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2463 | config->group("General").writeEntry("count", 1); | 2463 | config->group("General").writeEntry("count", 1); | ||
2464 | KConfigGroup group = config->group("1"); | 2464 | KConfigGroup group = config->group("1"); | ||
2465 | group.writeEntry("skiptaskbar", true); | 2465 | group.writeEntry("skiptaskbar", true); | ||
2466 | group.writeEntry("skiptaskbarrule", int(Rules::DontAffect)); | 2466 | group.writeEntry("skiptaskbarrule", int(Rules::DontAffect)); | ||
2467 | group.writeEntry("wmclass", "org.kde.foo"); | 2467 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2468 | group.writeEntry("wmclasscomplete", false); | 2468 | group.writeEntry("wmclasscomplete", false); | ||
2469 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2469 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2470 | group.sync(); | 2470 | group.sync(); | ||
2471 | RuleBook::self()->setConfig(config); | 2471 | RuleBook::self()->setConfig(config); | ||
2472 | workspace()->slotReconfigure(); | 2472 | workspace()->slotReconfigure(); | ||
2473 | 2473 | | |||
2474 | // Create the test client. | 2474 | // Create the test client. | ||
2475 | QFETCH(Test::XdgShellSurfaceType, type); | 2475 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2476 | ShellClient *client; | 2476 | XdgShellClient *client; | ||
2477 | Surface *surface; | 2477 | Surface *surface; | ||
2478 | XdgShellSurface *shellSurface; | 2478 | XdgShellSurface *shellSurface; | ||
2479 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2479 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2480 | QVERIFY(client); | 2480 | QVERIFY(client); | ||
2481 | 2481 | | |||
2482 | // The client should not be affected by the rule. | 2482 | // The client should not be affected by the rule. | ||
2483 | QVERIFY(!client->skipTaskbar()); | 2483 | QVERIFY(!client->skipTaskbar()); | ||
2484 | 2484 | | |||
2485 | // Destroy the client. | 2485 | // Destroy the client. | ||
2486 | delete shellSurface; | 2486 | delete shellSurface; | ||
2487 | delete surface; | 2487 | delete surface; | ||
2488 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2488 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2489 | } | 2489 | } | ||
2490 | 2490 | | |||
2491 | TEST_DATA(testSkipTaskbarApply) | 2491 | TEST_DATA(testSkipTaskbarApply) | ||
2492 | 2492 | | |||
2493 | void TestShellClientRules::testSkipTaskbarApply() | 2493 | void TestXdgShellClientRules::testSkipTaskbarApply() | ||
2494 | { | 2494 | { | ||
2495 | // Initialize RuleBook with the test rule. | 2495 | // Initialize RuleBook with the test rule. | ||
2496 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2496 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2497 | config->group("General").writeEntry("count", 1); | 2497 | config->group("General").writeEntry("count", 1); | ||
2498 | KConfigGroup group = config->group("1"); | 2498 | KConfigGroup group = config->group("1"); | ||
2499 | group.writeEntry("skiptaskbar", true); | 2499 | group.writeEntry("skiptaskbar", true); | ||
2500 | group.writeEntry("skiptaskbarrule", int(Rules::Apply)); | 2500 | group.writeEntry("skiptaskbarrule", int(Rules::Apply)); | ||
2501 | group.writeEntry("wmclass", "org.kde.foo"); | 2501 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2502 | group.writeEntry("wmclasscomplete", false); | 2502 | group.writeEntry("wmclasscomplete", false); | ||
2503 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2503 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2504 | group.sync(); | 2504 | group.sync(); | ||
2505 | RuleBook::self()->setConfig(config); | 2505 | RuleBook::self()->setConfig(config); | ||
2506 | workspace()->slotReconfigure(); | 2506 | workspace()->slotReconfigure(); | ||
2507 | 2507 | | |||
2508 | // Create the test client. | 2508 | // Create the test client. | ||
2509 | QFETCH(Test::XdgShellSurfaceType, type); | 2509 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2510 | ShellClient *client; | 2510 | XdgShellClient *client; | ||
2511 | Surface *surface; | 2511 | Surface *surface; | ||
2512 | XdgShellSurface *shellSurface; | 2512 | XdgShellSurface *shellSurface; | ||
2513 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2513 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2514 | QVERIFY(client); | 2514 | QVERIFY(client); | ||
2515 | 2515 | | |||
2516 | // The client should not be included on a taskbar. | 2516 | // The client should not be included on a taskbar. | ||
2517 | QVERIFY(client->skipTaskbar()); | 2517 | QVERIFY(client->skipTaskbar()); | ||
2518 | 2518 | | |||
2519 | // Though one can change that. | 2519 | // Though one can change that. | ||
2520 | client->setOriginalSkipTaskbar(false); | 2520 | client->setOriginalSkipTaskbar(false); | ||
2521 | QVERIFY(!client->skipTaskbar()); | 2521 | QVERIFY(!client->skipTaskbar()); | ||
2522 | 2522 | | |||
2523 | // Reopen the client, the rule should be applied again. | 2523 | // Reopen the client, the rule should be applied again. | ||
2524 | delete shellSurface; | 2524 | delete shellSurface; | ||
2525 | delete surface; | 2525 | delete surface; | ||
2526 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2526 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2527 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2527 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2528 | QVERIFY(client); | 2528 | QVERIFY(client); | ||
2529 | QVERIFY(client->skipTaskbar()); | 2529 | QVERIFY(client->skipTaskbar()); | ||
2530 | 2530 | | |||
2531 | // Destroy the client. | 2531 | // Destroy the client. | ||
2532 | delete shellSurface; | 2532 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2533 | delete surface; | 2533 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2534 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2534 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2535 | } | 2535 | } | ||
2536 | 2536 | | |||
2537 | TEST_DATA(testSkipTaskbarRemember) | 2537 | TEST_DATA(testSkipTaskbarRemember) | ||
2538 | 2538 | | |||
2539 | void TestShellClientRules::testSkipTaskbarRemember() | 2539 | void TestXdgShellClientRules::testSkipTaskbarRemember() | ||
2540 | { | 2540 | { | ||
2541 | // Initialize RuleBook with the test rule. | 2541 | // Initialize RuleBook with the test rule. | ||
2542 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2542 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2543 | config->group("General").writeEntry("count", 1); | 2543 | config->group("General").writeEntry("count", 1); | ||
2544 | KConfigGroup group = config->group("1"); | 2544 | KConfigGroup group = config->group("1"); | ||
2545 | group.writeEntry("skiptaskbar", true); | 2545 | group.writeEntry("skiptaskbar", true); | ||
2546 | group.writeEntry("skiptaskbarrule", int(Rules::Remember)); | 2546 | group.writeEntry("skiptaskbarrule", int(Rules::Remember)); | ||
2547 | group.writeEntry("wmclass", "org.kde.foo"); | 2547 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2548 | group.writeEntry("wmclasscomplete", false); | 2548 | group.writeEntry("wmclasscomplete", false); | ||
2549 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2549 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2550 | group.sync(); | 2550 | group.sync(); | ||
2551 | RuleBook::self()->setConfig(config); | 2551 | RuleBook::self()->setConfig(config); | ||
2552 | workspace()->slotReconfigure(); | 2552 | workspace()->slotReconfigure(); | ||
2553 | 2553 | | |||
2554 | // Create the test client. | 2554 | // Create the test client. | ||
2555 | QFETCH(Test::XdgShellSurfaceType, type); | 2555 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2556 | ShellClient *client; | 2556 | XdgShellClient *client; | ||
2557 | Surface *surface; | 2557 | Surface *surface; | ||
2558 | XdgShellSurface *shellSurface; | 2558 | XdgShellSurface *shellSurface; | ||
2559 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2559 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2560 | QVERIFY(client); | 2560 | QVERIFY(client); | ||
2561 | 2561 | | |||
2562 | // The client should not be included on a taskbar. | 2562 | // The client should not be included on a taskbar. | ||
2563 | QVERIFY(client->skipTaskbar()); | 2563 | QVERIFY(client->skipTaskbar()); | ||
2564 | 2564 | | |||
2565 | // Change the skip-taskbar state. | 2565 | // Change the skip-taskbar state. | ||
2566 | client->setOriginalSkipTaskbar(false); | 2566 | client->setOriginalSkipTaskbar(false); | ||
2567 | QVERIFY(!client->skipTaskbar()); | 2567 | QVERIFY(!client->skipTaskbar()); | ||
2568 | 2568 | | |||
2569 | // Reopen the client. | 2569 | // Reopen the client. | ||
2570 | delete shellSurface; | 2570 | delete shellSurface; | ||
2571 | delete surface; | 2571 | delete surface; | ||
2572 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2572 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2573 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2573 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2574 | QVERIFY(client); | 2574 | QVERIFY(client); | ||
2575 | 2575 | | |||
2576 | // The client should be included on a taskbar. | 2576 | // The client should be included on a taskbar. | ||
2577 | QVERIFY(!client->skipTaskbar()); | 2577 | QVERIFY(!client->skipTaskbar()); | ||
2578 | 2578 | | |||
2579 | // Destroy the client. | 2579 | // Destroy the client. | ||
2580 | delete shellSurface; | 2580 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2581 | delete surface; | 2581 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2582 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2582 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2583 | } | 2583 | } | ||
2584 | 2584 | | |||
2585 | TEST_DATA(testSkipTaskbarForce) | 2585 | TEST_DATA(testSkipTaskbarForce) | ||
2586 | 2586 | | |||
2587 | void TestShellClientRules::testSkipTaskbarForce() | 2587 | void TestXdgShellClientRules::testSkipTaskbarForce() | ||
2588 | { | 2588 | { | ||
2589 | // Initialize RuleBook with the test rule. | 2589 | // Initialize RuleBook with the test rule. | ||
2590 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2590 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2591 | config->group("General").writeEntry("count", 1); | 2591 | config->group("General").writeEntry("count", 1); | ||
2592 | KConfigGroup group = config->group("1"); | 2592 | KConfigGroup group = config->group("1"); | ||
2593 | group.writeEntry("skiptaskbar", true); | 2593 | group.writeEntry("skiptaskbar", true); | ||
2594 | group.writeEntry("skiptaskbarrule", int(Rules::Force)); | 2594 | group.writeEntry("skiptaskbarrule", int(Rules::Force)); | ||
2595 | group.writeEntry("wmclass", "org.kde.foo"); | 2595 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2596 | group.writeEntry("wmclasscomplete", false); | 2596 | group.writeEntry("wmclasscomplete", false); | ||
2597 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2597 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2598 | group.sync(); | 2598 | group.sync(); | ||
2599 | RuleBook::self()->setConfig(config); | 2599 | RuleBook::self()->setConfig(config); | ||
2600 | workspace()->slotReconfigure(); | 2600 | workspace()->slotReconfigure(); | ||
2601 | 2601 | | |||
2602 | // Create the test client. | 2602 | // Create the test client. | ||
2603 | QFETCH(Test::XdgShellSurfaceType, type); | 2603 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2604 | ShellClient *client; | 2604 | XdgShellClient *client; | ||
2605 | Surface *surface; | 2605 | Surface *surface; | ||
2606 | XdgShellSurface *shellSurface; | 2606 | XdgShellSurface *shellSurface; | ||
2607 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2607 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2608 | QVERIFY(client); | 2608 | QVERIFY(client); | ||
2609 | 2609 | | |||
2610 | // The client should not be included on a taskbar. | 2610 | // The client should not be included on a taskbar. | ||
2611 | QVERIFY(client->skipTaskbar()); | 2611 | QVERIFY(client->skipTaskbar()); | ||
2612 | 2612 | | |||
2613 | // Any attempt to change the skip-taskbar state should not succeed. | 2613 | // Any attempt to change the skip-taskbar state should not succeed. | ||
2614 | client->setOriginalSkipTaskbar(false); | 2614 | client->setOriginalSkipTaskbar(false); | ||
2615 | QVERIFY(client->skipTaskbar()); | 2615 | QVERIFY(client->skipTaskbar()); | ||
2616 | 2616 | | |||
2617 | // Reopen the client. | 2617 | // Reopen the client. | ||
2618 | delete shellSurface; | 2618 | delete shellSurface; | ||
2619 | delete surface; | 2619 | delete surface; | ||
2620 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2620 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2621 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2621 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2622 | QVERIFY(client); | 2622 | QVERIFY(client); | ||
2623 | 2623 | | |||
2624 | // The skip-taskbar state should be still forced. | 2624 | // The skip-taskbar state should be still forced. | ||
2625 | QVERIFY(client->skipTaskbar()); | 2625 | QVERIFY(client->skipTaskbar()); | ||
2626 | 2626 | | |||
2627 | // Destroy the client. | 2627 | // Destroy the client. | ||
2628 | delete shellSurface; | 2628 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2629 | delete surface; | 2629 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2630 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2630 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2631 | } | 2631 | } | ||
2632 | 2632 | | |||
2633 | TEST_DATA(testSkipTaskbarApplyNow) | 2633 | TEST_DATA(testSkipTaskbarApplyNow) | ||
2634 | 2634 | | |||
2635 | void TestShellClientRules::testSkipTaskbarApplyNow() | 2635 | void TestXdgShellClientRules::testSkipTaskbarApplyNow() | ||
2636 | { | 2636 | { | ||
2637 | // Create the test client. | 2637 | // Create the test client. | ||
2638 | QFETCH(Test::XdgShellSurfaceType, type); | 2638 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2639 | ShellClient *client; | 2639 | XdgShellClient *client; | ||
2640 | Surface *surface; | 2640 | Surface *surface; | ||
2641 | XdgShellSurface *shellSurface; | 2641 | XdgShellSurface *shellSurface; | ||
2642 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2642 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2643 | QVERIFY(client); | 2643 | QVERIFY(client); | ||
2644 | QVERIFY(!client->skipTaskbar()); | 2644 | QVERIFY(!client->skipTaskbar()); | ||
2645 | 2645 | | |||
2646 | // Initialize RuleBook with the test rule. | 2646 | // Initialize RuleBook with the test rule. | ||
2647 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2647 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
Show All 22 Lines | |||||
2670 | // Destroy the client. | 2670 | // Destroy the client. | ||
2671 | delete shellSurface; | 2671 | delete shellSurface; | ||
2672 | delete surface; | 2672 | delete surface; | ||
2673 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2673 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2674 | } | 2674 | } | ||
2675 | 2675 | | |||
2676 | TEST_DATA(testSkipTaskbarForceTemporarily) | 2676 | TEST_DATA(testSkipTaskbarForceTemporarily) | ||
2677 | 2677 | | |||
2678 | void TestShellClientRules::testSkipTaskbarForceTemporarily() | 2678 | void TestXdgShellClientRules::testSkipTaskbarForceTemporarily() | ||
2679 | { | 2679 | { | ||
2680 | // Initialize RuleBook with the test rule. | 2680 | // Initialize RuleBook with the test rule. | ||
2681 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2681 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2682 | config->group("General").writeEntry("count", 1); | 2682 | config->group("General").writeEntry("count", 1); | ||
2683 | KConfigGroup group = config->group("1"); | 2683 | KConfigGroup group = config->group("1"); | ||
2684 | group.writeEntry("skiptaskbar", true); | 2684 | group.writeEntry("skiptaskbar", true); | ||
2685 | group.writeEntry("skiptaskbarrule", int(Rules::ForceTemporarily)); | 2685 | group.writeEntry("skiptaskbarrule", int(Rules::ForceTemporarily)); | ||
2686 | group.writeEntry("wmclass", "org.kde.foo"); | 2686 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2687 | group.writeEntry("wmclasscomplete", false); | 2687 | group.writeEntry("wmclasscomplete", false); | ||
2688 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2688 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2689 | group.sync(); | 2689 | group.sync(); | ||
2690 | RuleBook::self()->setConfig(config); | 2690 | RuleBook::self()->setConfig(config); | ||
2691 | workspace()->slotReconfigure(); | 2691 | workspace()->slotReconfigure(); | ||
2692 | 2692 | | |||
2693 | // Create the test client. | 2693 | // Create the test client. | ||
2694 | QFETCH(Test::XdgShellSurfaceType, type); | 2694 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2695 | ShellClient *client; | 2695 | XdgShellClient *client; | ||
2696 | Surface *surface; | 2696 | Surface *surface; | ||
2697 | XdgShellSurface *shellSurface; | 2697 | XdgShellSurface *shellSurface; | ||
2698 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2698 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2699 | QVERIFY(client); | 2699 | QVERIFY(client); | ||
2700 | 2700 | | |||
2701 | // The client should not be included on a taskbar. | 2701 | // The client should not be included on a taskbar. | ||
2702 | QVERIFY(client->skipTaskbar()); | 2702 | QVERIFY(client->skipTaskbar()); | ||
2703 | 2703 | | |||
Show All 9 Lines | |||||
2713 | QVERIFY(client); | 2713 | QVERIFY(client); | ||
2714 | QVERIFY(!client->skipTaskbar()); | 2714 | QVERIFY(!client->skipTaskbar()); | ||
2715 | 2715 | | |||
2716 | // The skip-taskbar state is no longer forced. | 2716 | // The skip-taskbar state is no longer forced. | ||
2717 | client->setOriginalSkipTaskbar(true); | 2717 | client->setOriginalSkipTaskbar(true); | ||
2718 | QVERIFY(client->skipTaskbar()); | 2718 | QVERIFY(client->skipTaskbar()); | ||
2719 | 2719 | | |||
2720 | // Destroy the client. | 2720 | // Destroy the client. | ||
2721 | delete shellSurface; | 2721 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2722 | delete surface; | 2722 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2723 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2723 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2724 | } | 2724 | } | ||
2725 | 2725 | | |||
2726 | TEST_DATA(testSkipPagerDontAffect) | 2726 | TEST_DATA(testSkipPagerDontAffect) | ||
2727 | 2727 | | |||
2728 | void TestShellClientRules::testSkipPagerDontAffect() | 2728 | void TestXdgShellClientRules::testSkipPagerDontAffect() | ||
2729 | { | 2729 | { | ||
2730 | // Initialize RuleBook with the test rule. | 2730 | // Initialize RuleBook with the test rule. | ||
2731 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2731 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2732 | config->group("General").writeEntry("count", 1); | 2732 | config->group("General").writeEntry("count", 1); | ||
2733 | KConfigGroup group = config->group("1"); | 2733 | KConfigGroup group = config->group("1"); | ||
2734 | group.writeEntry("skippager", true); | 2734 | group.writeEntry("skippager", true); | ||
2735 | group.writeEntry("skippagerrule", int(Rules::DontAffect)); | 2735 | group.writeEntry("skippagerrule", int(Rules::DontAffect)); | ||
2736 | group.writeEntry("wmclass", "org.kde.foo"); | 2736 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2737 | group.writeEntry("wmclasscomplete", false); | 2737 | group.writeEntry("wmclasscomplete", false); | ||
2738 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2738 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2739 | group.sync(); | 2739 | group.sync(); | ||
2740 | RuleBook::self()->setConfig(config); | 2740 | RuleBook::self()->setConfig(config); | ||
2741 | workspace()->slotReconfigure(); | 2741 | workspace()->slotReconfigure(); | ||
2742 | 2742 | | |||
2743 | // Create the test client. | 2743 | // Create the test client. | ||
2744 | QFETCH(Test::XdgShellSurfaceType, type); | 2744 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2745 | ShellClient *client; | 2745 | XdgShellClient *client; | ||
2746 | Surface *surface; | 2746 | Surface *surface; | ||
2747 | XdgShellSurface *shellSurface; | 2747 | XdgShellSurface *shellSurface; | ||
2748 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2748 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2749 | QVERIFY(client); | 2749 | QVERIFY(client); | ||
2750 | 2750 | | |||
2751 | // The client should not be affected by the rule. | 2751 | // The client should not be affected by the rule. | ||
2752 | QVERIFY(!client->skipPager()); | 2752 | QVERIFY(!client->skipPager()); | ||
2753 | 2753 | | |||
2754 | // Destroy the client. | 2754 | // Destroy the client. | ||
2755 | delete shellSurface; | 2755 | delete shellSurface; | ||
2756 | delete surface; | 2756 | delete surface; | ||
2757 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2757 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2758 | } | 2758 | } | ||
2759 | 2759 | | |||
2760 | TEST_DATA(testSkipPagerApply) | 2760 | TEST_DATA(testSkipPagerApply) | ||
2761 | 2761 | | |||
2762 | void TestShellClientRules::testSkipPagerApply() | 2762 | void TestXdgShellClientRules::testSkipPagerApply() | ||
2763 | { | 2763 | { | ||
2764 | // Initialize RuleBook with the test rule. | 2764 | // Initialize RuleBook with the test rule. | ||
2765 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2765 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2766 | config->group("General").writeEntry("count", 1); | 2766 | config->group("General").writeEntry("count", 1); | ||
2767 | KConfigGroup group = config->group("1"); | 2767 | KConfigGroup group = config->group("1"); | ||
2768 | group.writeEntry("skippager", true); | 2768 | group.writeEntry("skippager", true); | ||
2769 | group.writeEntry("skippagerrule", int(Rules::Apply)); | 2769 | group.writeEntry("skippagerrule", int(Rules::Apply)); | ||
2770 | group.writeEntry("wmclass", "org.kde.foo"); | 2770 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2771 | group.writeEntry("wmclasscomplete", false); | 2771 | group.writeEntry("wmclasscomplete", false); | ||
2772 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2772 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2773 | group.sync(); | 2773 | group.sync(); | ||
2774 | RuleBook::self()->setConfig(config); | 2774 | RuleBook::self()->setConfig(config); | ||
2775 | workspace()->slotReconfigure(); | 2775 | workspace()->slotReconfigure(); | ||
2776 | 2776 | | |||
2777 | // Create the test client. | 2777 | // Create the test client. | ||
2778 | QFETCH(Test::XdgShellSurfaceType, type); | 2778 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2779 | ShellClient *client; | 2779 | XdgShellClient *client; | ||
2780 | Surface *surface; | 2780 | Surface *surface; | ||
2781 | XdgShellSurface *shellSurface; | 2781 | XdgShellSurface *shellSurface; | ||
2782 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2782 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2783 | QVERIFY(client); | 2783 | QVERIFY(client); | ||
2784 | 2784 | | |||
2785 | // The client should not be included on a pager. | 2785 | // The client should not be included on a pager. | ||
2786 | QVERIFY(client->skipPager()); | 2786 | QVERIFY(client->skipPager()); | ||
2787 | 2787 | | |||
2788 | // Though one can change that. | 2788 | // Though one can change that. | ||
2789 | client->setSkipPager(false); | 2789 | client->setSkipPager(false); | ||
2790 | QVERIFY(!client->skipPager()); | 2790 | QVERIFY(!client->skipPager()); | ||
2791 | 2791 | | |||
2792 | // Reopen the client, the rule should be applied again. | 2792 | // Reopen the client, the rule should be applied again. | ||
2793 | delete shellSurface; | 2793 | delete shellSurface; | ||
2794 | delete surface; | 2794 | delete surface; | ||
2795 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2795 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2796 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2796 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2797 | QVERIFY(client); | 2797 | QVERIFY(client); | ||
2798 | QVERIFY(client->skipPager()); | 2798 | QVERIFY(client->skipPager()); | ||
2799 | 2799 | | |||
2800 | // Destroy the client. | 2800 | // Destroy the client. | ||
2801 | delete shellSurface; | 2801 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2802 | delete surface; | 2802 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2803 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2803 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2804 | } | 2804 | } | ||
2805 | 2805 | | |||
2806 | TEST_DATA(testSkipPagerRemember) | 2806 | TEST_DATA(testSkipPagerRemember) | ||
2807 | 2807 | | |||
2808 | void TestShellClientRules::testSkipPagerRemember() | 2808 | void TestXdgShellClientRules::testSkipPagerRemember() | ||
2809 | { | 2809 | { | ||
2810 | // Initialize RuleBook with the test rule. | 2810 | // Initialize RuleBook with the test rule. | ||
2811 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2811 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2812 | config->group("General").writeEntry("count", 1); | 2812 | config->group("General").writeEntry("count", 1); | ||
2813 | KConfigGroup group = config->group("1"); | 2813 | KConfigGroup group = config->group("1"); | ||
2814 | group.writeEntry("skippager", true); | 2814 | group.writeEntry("skippager", true); | ||
2815 | group.writeEntry("skippagerrule", int(Rules::Remember)); | 2815 | group.writeEntry("skippagerrule", int(Rules::Remember)); | ||
2816 | group.writeEntry("wmclass", "org.kde.foo"); | 2816 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2817 | group.writeEntry("wmclasscomplete", false); | 2817 | group.writeEntry("wmclasscomplete", false); | ||
2818 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2818 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2819 | group.sync(); | 2819 | group.sync(); | ||
2820 | RuleBook::self()->setConfig(config); | 2820 | RuleBook::self()->setConfig(config); | ||
2821 | workspace()->slotReconfigure(); | 2821 | workspace()->slotReconfigure(); | ||
2822 | 2822 | | |||
2823 | // Create the test client. | 2823 | // Create the test client. | ||
2824 | QFETCH(Test::XdgShellSurfaceType, type); | 2824 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2825 | ShellClient *client; | 2825 | XdgShellClient *client; | ||
2826 | Surface *surface; | 2826 | Surface *surface; | ||
2827 | XdgShellSurface *shellSurface; | 2827 | XdgShellSurface *shellSurface; | ||
2828 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2828 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2829 | QVERIFY(client); | 2829 | QVERIFY(client); | ||
2830 | 2830 | | |||
2831 | // The client should not be included on a pager. | 2831 | // The client should not be included on a pager. | ||
2832 | QVERIFY(client->skipPager()); | 2832 | QVERIFY(client->skipPager()); | ||
2833 | 2833 | | |||
2834 | // Change the skip-pager state. | 2834 | // Change the skip-pager state. | ||
2835 | client->setSkipPager(false); | 2835 | client->setSkipPager(false); | ||
2836 | QVERIFY(!client->skipPager()); | 2836 | QVERIFY(!client->skipPager()); | ||
2837 | 2837 | | |||
2838 | // Reopen the client. | 2838 | // Reopen the client. | ||
2839 | delete shellSurface; | 2839 | delete shellSurface; | ||
2840 | delete surface; | 2840 | delete surface; | ||
2841 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2841 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2842 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2842 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2843 | QVERIFY(client); | 2843 | QVERIFY(client); | ||
2844 | 2844 | | |||
2845 | // The client should be included on a pager. | 2845 | // The client should be included on a pager. | ||
2846 | QVERIFY(!client->skipPager()); | 2846 | QVERIFY(!client->skipPager()); | ||
2847 | 2847 | | |||
2848 | // Destroy the client. | 2848 | // Destroy the client. | ||
2849 | delete shellSurface; | 2849 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2850 | delete surface; | 2850 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2851 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2851 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2852 | } | 2852 | } | ||
2853 | 2853 | | |||
2854 | TEST_DATA(testSkipPagerForce) | 2854 | TEST_DATA(testSkipPagerForce) | ||
2855 | 2855 | | |||
2856 | void TestShellClientRules::testSkipPagerForce() | 2856 | void TestXdgShellClientRules::testSkipPagerForce() | ||
2857 | { | 2857 | { | ||
2858 | // Initialize RuleBook with the test rule. | 2858 | // Initialize RuleBook with the test rule. | ||
2859 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2859 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2860 | config->group("General").writeEntry("count", 1); | 2860 | config->group("General").writeEntry("count", 1); | ||
2861 | KConfigGroup group = config->group("1"); | 2861 | KConfigGroup group = config->group("1"); | ||
2862 | group.writeEntry("skippager", true); | 2862 | group.writeEntry("skippager", true); | ||
2863 | group.writeEntry("skippagerrule", int(Rules::Force)); | 2863 | group.writeEntry("skippagerrule", int(Rules::Force)); | ||
2864 | group.writeEntry("wmclass", "org.kde.foo"); | 2864 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2865 | group.writeEntry("wmclasscomplete", false); | 2865 | group.writeEntry("wmclasscomplete", false); | ||
2866 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2866 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2867 | group.sync(); | 2867 | group.sync(); | ||
2868 | RuleBook::self()->setConfig(config); | 2868 | RuleBook::self()->setConfig(config); | ||
2869 | workspace()->slotReconfigure(); | 2869 | workspace()->slotReconfigure(); | ||
2870 | 2870 | | |||
2871 | // Create the test client. | 2871 | // Create the test client. | ||
2872 | QFETCH(Test::XdgShellSurfaceType, type); | 2872 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2873 | ShellClient *client; | 2873 | XdgShellClient *client; | ||
2874 | Surface *surface; | 2874 | Surface *surface; | ||
2875 | XdgShellSurface *shellSurface; | 2875 | XdgShellSurface *shellSurface; | ||
2876 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2876 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2877 | QVERIFY(client); | 2877 | QVERIFY(client); | ||
2878 | 2878 | | |||
2879 | // The client should not be included on a pager. | 2879 | // The client should not be included on a pager. | ||
2880 | QVERIFY(client->skipPager()); | 2880 | QVERIFY(client->skipPager()); | ||
2881 | 2881 | | |||
2882 | // Any attempt to change the skip-pager state should not succeed. | 2882 | // Any attempt to change the skip-pager state should not succeed. | ||
2883 | client->setSkipPager(false); | 2883 | client->setSkipPager(false); | ||
2884 | QVERIFY(client->skipPager()); | 2884 | QVERIFY(client->skipPager()); | ||
2885 | 2885 | | |||
2886 | // Reopen the client. | 2886 | // Reopen the client. | ||
2887 | delete shellSurface; | 2887 | delete shellSurface; | ||
2888 | delete surface; | 2888 | delete surface; | ||
2889 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2889 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2890 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2890 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2891 | QVERIFY(client); | 2891 | QVERIFY(client); | ||
2892 | 2892 | | |||
2893 | // The skip-pager state should be still forced. | 2893 | // The skip-pager state should be still forced. | ||
2894 | QVERIFY(client->skipPager()); | 2894 | QVERIFY(client->skipPager()); | ||
2895 | 2895 | | |||
2896 | // Destroy the client. | 2896 | // Destroy the client. | ||
2897 | delete shellSurface; | 2897 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2898 | delete surface; | 2898 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2899 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2899 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2900 | } | 2900 | } | ||
2901 | 2901 | | |||
2902 | TEST_DATA(testSkipPagerApplyNow) | 2902 | TEST_DATA(testSkipPagerApplyNow) | ||
2903 | 2903 | | |||
2904 | void TestShellClientRules::testSkipPagerApplyNow() | 2904 | void TestXdgShellClientRules::testSkipPagerApplyNow() | ||
2905 | { | 2905 | { | ||
2906 | // Create the test client. | 2906 | // Create the test client. | ||
2907 | QFETCH(Test::XdgShellSurfaceType, type); | 2907 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2908 | ShellClient *client; | 2908 | XdgShellClient *client; | ||
2909 | Surface *surface; | 2909 | Surface *surface; | ||
2910 | XdgShellSurface *shellSurface; | 2910 | XdgShellSurface *shellSurface; | ||
2911 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2911 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2912 | QVERIFY(client); | 2912 | QVERIFY(client); | ||
2913 | QVERIFY(!client->skipPager()); | 2913 | QVERIFY(!client->skipPager()); | ||
2914 | 2914 | | |||
2915 | // Initialize RuleBook with the test rule. | 2915 | // Initialize RuleBook with the test rule. | ||
2916 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2916 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
Show All 22 Lines | |||||
2939 | // Destroy the client. | 2939 | // Destroy the client. | ||
2940 | delete shellSurface; | 2940 | delete shellSurface; | ||
2941 | delete surface; | 2941 | delete surface; | ||
2942 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2942 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2943 | } | 2943 | } | ||
2944 | 2944 | | |||
2945 | TEST_DATA(testSkipPagerForceTemporarily) | 2945 | TEST_DATA(testSkipPagerForceTemporarily) | ||
2946 | 2946 | | |||
2947 | void TestShellClientRules::testSkipPagerForceTemporarily() | 2947 | void TestXdgShellClientRules::testSkipPagerForceTemporarily() | ||
2948 | { | 2948 | { | ||
2949 | // Initialize RuleBook with the test rule. | 2949 | // Initialize RuleBook with the test rule. | ||
2950 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2950 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2951 | config->group("General").writeEntry("count", 1); | 2951 | config->group("General").writeEntry("count", 1); | ||
2952 | KConfigGroup group = config->group("1"); | 2952 | KConfigGroup group = config->group("1"); | ||
2953 | group.writeEntry("skippager", true); | 2953 | group.writeEntry("skippager", true); | ||
2954 | group.writeEntry("skippagerrule", int(Rules::ForceTemporarily)); | 2954 | group.writeEntry("skippagerrule", int(Rules::ForceTemporarily)); | ||
2955 | group.writeEntry("wmclass", "org.kde.foo"); | 2955 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2956 | group.writeEntry("wmclasscomplete", false); | 2956 | group.writeEntry("wmclasscomplete", false); | ||
2957 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2957 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2958 | group.sync(); | 2958 | group.sync(); | ||
2959 | RuleBook::self()->setConfig(config); | 2959 | RuleBook::self()->setConfig(config); | ||
2960 | workspace()->slotReconfigure(); | 2960 | workspace()->slotReconfigure(); | ||
2961 | 2961 | | |||
2962 | // Create the test client. | 2962 | // Create the test client. | ||
2963 | QFETCH(Test::XdgShellSurfaceType, type); | 2963 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2964 | ShellClient *client; | 2964 | XdgShellClient *client; | ||
2965 | Surface *surface; | 2965 | Surface *surface; | ||
2966 | XdgShellSurface *shellSurface; | 2966 | XdgShellSurface *shellSurface; | ||
2967 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2967 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2968 | QVERIFY(client); | 2968 | QVERIFY(client); | ||
2969 | 2969 | | |||
2970 | // The client should not be included on a pager. | 2970 | // The client should not be included on a pager. | ||
2971 | QVERIFY(client->skipPager()); | 2971 | QVERIFY(client->skipPager()); | ||
2972 | 2972 | | |||
Show All 9 Lines | |||||
2982 | QVERIFY(client); | 2982 | QVERIFY(client); | ||
2983 | QVERIFY(!client->skipPager()); | 2983 | QVERIFY(!client->skipPager()); | ||
2984 | 2984 | | |||
2985 | // The skip-pager state is no longer forced. | 2985 | // The skip-pager state is no longer forced. | ||
2986 | client->setSkipPager(true); | 2986 | client->setSkipPager(true); | ||
2987 | QVERIFY(client->skipPager()); | 2987 | QVERIFY(client->skipPager()); | ||
2988 | 2988 | | |||
2989 | // Destroy the client. | 2989 | // Destroy the client. | ||
2990 | delete shellSurface; | 2990 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2991 | delete surface; | 2991 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2992 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2992 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2993 | } | 2993 | } | ||
2994 | 2994 | | |||
2995 | TEST_DATA(testSkipSwitcherDontAffect) | 2995 | TEST_DATA(testSkipSwitcherDontAffect) | ||
2996 | 2996 | | |||
2997 | void TestShellClientRules::testSkipSwitcherDontAffect() | 2997 | void TestXdgShellClientRules::testSkipSwitcherDontAffect() | ||
2998 | { | 2998 | { | ||
2999 | // Initialize RuleBook with the test rule. | 2999 | // Initialize RuleBook with the test rule. | ||
3000 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3000 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3001 | config->group("General").writeEntry("count", 1); | 3001 | config->group("General").writeEntry("count", 1); | ||
3002 | KConfigGroup group = config->group("1"); | 3002 | KConfigGroup group = config->group("1"); | ||
3003 | group.writeEntry("skipswitcher", true); | 3003 | group.writeEntry("skipswitcher", true); | ||
3004 | group.writeEntry("skipswitcherrule", int(Rules::DontAffect)); | 3004 | group.writeEntry("skipswitcherrule", int(Rules::DontAffect)); | ||
3005 | group.writeEntry("wmclass", "org.kde.foo"); | 3005 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3006 | group.writeEntry("wmclasscomplete", false); | 3006 | group.writeEntry("wmclasscomplete", false); | ||
3007 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3007 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3008 | group.sync(); | 3008 | group.sync(); | ||
3009 | RuleBook::self()->setConfig(config); | 3009 | RuleBook::self()->setConfig(config); | ||
3010 | workspace()->slotReconfigure(); | 3010 | workspace()->slotReconfigure(); | ||
3011 | 3011 | | |||
3012 | // Create the test client. | 3012 | // Create the test client. | ||
3013 | QFETCH(Test::XdgShellSurfaceType, type); | 3013 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3014 | ShellClient *client; | 3014 | XdgShellClient *client; | ||
3015 | Surface *surface; | 3015 | Surface *surface; | ||
3016 | XdgShellSurface *shellSurface; | 3016 | XdgShellSurface *shellSurface; | ||
3017 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3017 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3018 | QVERIFY(client); | 3018 | QVERIFY(client); | ||
3019 | 3019 | | |||
3020 | // The client should not be affected by the rule. | 3020 | // The client should not be affected by the rule. | ||
3021 | QVERIFY(!client->skipSwitcher()); | 3021 | QVERIFY(!client->skipSwitcher()); | ||
3022 | 3022 | | |||
3023 | // Destroy the client. | 3023 | // Destroy the client. | ||
3024 | delete shellSurface; | 3024 | delete shellSurface; | ||
3025 | delete surface; | 3025 | delete surface; | ||
3026 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3026 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3027 | } | 3027 | } | ||
3028 | 3028 | | |||
3029 | TEST_DATA(testSkipSwitcherApply) | 3029 | TEST_DATA(testSkipSwitcherApply) | ||
3030 | 3030 | | |||
3031 | void TestShellClientRules::testSkipSwitcherApply() | 3031 | void TestXdgShellClientRules::testSkipSwitcherApply() | ||
3032 | { | 3032 | { | ||
3033 | // Initialize RuleBook with the test rule. | 3033 | // Initialize RuleBook with the test rule. | ||
3034 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3034 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3035 | config->group("General").writeEntry("count", 1); | 3035 | config->group("General").writeEntry("count", 1); | ||
3036 | KConfigGroup group = config->group("1"); | 3036 | KConfigGroup group = config->group("1"); | ||
3037 | group.writeEntry("skipswitcher", true); | 3037 | group.writeEntry("skipswitcher", true); | ||
3038 | group.writeEntry("skipswitcherrule", int(Rules::Apply)); | 3038 | group.writeEntry("skipswitcherrule", int(Rules::Apply)); | ||
3039 | group.writeEntry("wmclass", "org.kde.foo"); | 3039 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3040 | group.writeEntry("wmclasscomplete", false); | 3040 | group.writeEntry("wmclasscomplete", false); | ||
3041 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3041 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3042 | group.sync(); | 3042 | group.sync(); | ||
3043 | RuleBook::self()->setConfig(config); | 3043 | RuleBook::self()->setConfig(config); | ||
3044 | workspace()->slotReconfigure(); | 3044 | workspace()->slotReconfigure(); | ||
3045 | 3045 | | |||
3046 | // Create the test client. | 3046 | // Create the test client. | ||
3047 | QFETCH(Test::XdgShellSurfaceType, type); | 3047 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3048 | ShellClient *client; | 3048 | XdgShellClient *client; | ||
3049 | Surface *surface; | 3049 | Surface *surface; | ||
3050 | XdgShellSurface *shellSurface; | 3050 | XdgShellSurface *shellSurface; | ||
3051 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3051 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3052 | QVERIFY(client); | 3052 | QVERIFY(client); | ||
3053 | 3053 | | |||
3054 | // The client should be excluded from window switching effects. | 3054 | // The client should be excluded from window switching effects. | ||
3055 | QVERIFY(client->skipSwitcher()); | 3055 | QVERIFY(client->skipSwitcher()); | ||
3056 | 3056 | | |||
3057 | // Though one can change that. | 3057 | // Though one can change that. | ||
3058 | client->setSkipSwitcher(false); | 3058 | client->setSkipSwitcher(false); | ||
3059 | QVERIFY(!client->skipSwitcher()); | 3059 | QVERIFY(!client->skipSwitcher()); | ||
3060 | 3060 | | |||
3061 | // Reopen the client, the rule should be applied again. | 3061 | // Reopen the client, the rule should be applied again. | ||
3062 | delete shellSurface; | 3062 | delete shellSurface; | ||
3063 | delete surface; | 3063 | delete surface; | ||
3064 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3064 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3065 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3065 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3066 | QVERIFY(client); | 3066 | QVERIFY(client); | ||
3067 | QVERIFY(client->skipSwitcher()); | 3067 | QVERIFY(client->skipSwitcher()); | ||
3068 | 3068 | | |||
3069 | // Destroy the client. | 3069 | // Destroy the client. | ||
3070 | delete shellSurface; | 3070 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3071 | delete surface; | 3071 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3072 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3072 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3073 | } | 3073 | } | ||
3074 | 3074 | | |||
3075 | TEST_DATA(testSkipSwitcherRemember) | 3075 | TEST_DATA(testSkipSwitcherRemember) | ||
3076 | 3076 | | |||
3077 | void TestShellClientRules::testSkipSwitcherRemember() | 3077 | void TestXdgShellClientRules::testSkipSwitcherRemember() | ||
3078 | { | 3078 | { | ||
3079 | // Initialize RuleBook with the test rule. | 3079 | // Initialize RuleBook with the test rule. | ||
3080 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3080 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3081 | config->group("General").writeEntry("count", 1); | 3081 | config->group("General").writeEntry("count", 1); | ||
3082 | KConfigGroup group = config->group("1"); | 3082 | KConfigGroup group = config->group("1"); | ||
3083 | group.writeEntry("skipswitcher", true); | 3083 | group.writeEntry("skipswitcher", true); | ||
3084 | group.writeEntry("skipswitcherrule", int(Rules::Remember)); | 3084 | group.writeEntry("skipswitcherrule", int(Rules::Remember)); | ||
3085 | group.writeEntry("wmclass", "org.kde.foo"); | 3085 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3086 | group.writeEntry("wmclasscomplete", false); | 3086 | group.writeEntry("wmclasscomplete", false); | ||
3087 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3087 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3088 | group.sync(); | 3088 | group.sync(); | ||
3089 | RuleBook::self()->setConfig(config); | 3089 | RuleBook::self()->setConfig(config); | ||
3090 | workspace()->slotReconfigure(); | 3090 | workspace()->slotReconfigure(); | ||
3091 | 3091 | | |||
3092 | // Create the test client. | 3092 | // Create the test client. | ||
3093 | QFETCH(Test::XdgShellSurfaceType, type); | 3093 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3094 | ShellClient *client; | 3094 | XdgShellClient *client; | ||
3095 | Surface *surface; | 3095 | Surface *surface; | ||
3096 | XdgShellSurface *shellSurface; | 3096 | XdgShellSurface *shellSurface; | ||
3097 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3097 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3098 | QVERIFY(client); | 3098 | QVERIFY(client); | ||
3099 | 3099 | | |||
3100 | // The client should be excluded from window switching effects. | 3100 | // The client should be excluded from window switching effects. | ||
3101 | QVERIFY(client->skipSwitcher()); | 3101 | QVERIFY(client->skipSwitcher()); | ||
3102 | 3102 | | |||
3103 | // Change the skip-switcher state. | 3103 | // Change the skip-switcher state. | ||
3104 | client->setSkipSwitcher(false); | 3104 | client->setSkipSwitcher(false); | ||
3105 | QVERIFY(!client->skipSwitcher()); | 3105 | QVERIFY(!client->skipSwitcher()); | ||
3106 | 3106 | | |||
3107 | // Reopen the client. | 3107 | // Reopen the client. | ||
3108 | delete shellSurface; | 3108 | delete shellSurface; | ||
3109 | delete surface; | 3109 | delete surface; | ||
3110 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3110 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3111 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3111 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3112 | QVERIFY(client); | 3112 | QVERIFY(client); | ||
3113 | 3113 | | |||
3114 | // The client should be included in window switching effects. | 3114 | // The client should be included in window switching effects. | ||
3115 | QVERIFY(!client->skipSwitcher()); | 3115 | QVERIFY(!client->skipSwitcher()); | ||
3116 | 3116 | | |||
3117 | // Destroy the client. | 3117 | // Destroy the client. | ||
3118 | delete shellSurface; | 3118 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3119 | delete surface; | 3119 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3120 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3120 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3121 | } | 3121 | } | ||
3122 | 3122 | | |||
3123 | TEST_DATA(testSkipSwitcherForce) | 3123 | TEST_DATA(testSkipSwitcherForce) | ||
3124 | 3124 | | |||
3125 | void TestShellClientRules::testSkipSwitcherForce() | 3125 | void TestXdgShellClientRules::testSkipSwitcherForce() | ||
3126 | { | 3126 | { | ||
3127 | // Initialize RuleBook with the test rule. | 3127 | // Initialize RuleBook with the test rule. | ||
3128 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3128 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3129 | config->group("General").writeEntry("count", 1); | 3129 | config->group("General").writeEntry("count", 1); | ||
3130 | KConfigGroup group = config->group("1"); | 3130 | KConfigGroup group = config->group("1"); | ||
3131 | group.writeEntry("skipswitcher", true); | 3131 | group.writeEntry("skipswitcher", true); | ||
3132 | group.writeEntry("skipswitcherrule", int(Rules::Force)); | 3132 | group.writeEntry("skipswitcherrule", int(Rules::Force)); | ||
3133 | group.writeEntry("wmclass", "org.kde.foo"); | 3133 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3134 | group.writeEntry("wmclasscomplete", false); | 3134 | group.writeEntry("wmclasscomplete", false); | ||
3135 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3135 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3136 | group.sync(); | 3136 | group.sync(); | ||
3137 | RuleBook::self()->setConfig(config); | 3137 | RuleBook::self()->setConfig(config); | ||
3138 | workspace()->slotReconfigure(); | 3138 | workspace()->slotReconfigure(); | ||
3139 | 3139 | | |||
3140 | // Create the test client. | 3140 | // Create the test client. | ||
3141 | QFETCH(Test::XdgShellSurfaceType, type); | 3141 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3142 | ShellClient *client; | 3142 | XdgShellClient *client; | ||
3143 | Surface *surface; | 3143 | Surface *surface; | ||
3144 | XdgShellSurface *shellSurface; | 3144 | XdgShellSurface *shellSurface; | ||
3145 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3145 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3146 | QVERIFY(client); | 3146 | QVERIFY(client); | ||
3147 | 3147 | | |||
3148 | // The client should be excluded from window switching effects. | 3148 | // The client should be excluded from window switching effects. | ||
3149 | QVERIFY(client->skipSwitcher()); | 3149 | QVERIFY(client->skipSwitcher()); | ||
3150 | 3150 | | |||
3151 | // Any attempt to change the skip-switcher state should not succeed. | 3151 | // Any attempt to change the skip-switcher state should not succeed. | ||
3152 | client->setSkipSwitcher(false); | 3152 | client->setSkipSwitcher(false); | ||
3153 | QVERIFY(client->skipSwitcher()); | 3153 | QVERIFY(client->skipSwitcher()); | ||
3154 | 3154 | | |||
3155 | // Reopen the client. | 3155 | // Reopen the client. | ||
3156 | delete shellSurface; | 3156 | delete shellSurface; | ||
3157 | delete surface; | 3157 | delete surface; | ||
3158 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3158 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3159 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3159 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3160 | QVERIFY(client); | 3160 | QVERIFY(client); | ||
3161 | 3161 | | |||
3162 | // The skip-switcher state should be still forced. | 3162 | // The skip-switcher state should be still forced. | ||
3163 | QVERIFY(client->skipSwitcher()); | 3163 | QVERIFY(client->skipSwitcher()); | ||
3164 | 3164 | | |||
3165 | // Destroy the client. | 3165 | // Destroy the client. | ||
3166 | delete shellSurface; | 3166 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3167 | delete surface; | 3167 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3168 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3168 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3169 | } | 3169 | } | ||
3170 | 3170 | | |||
3171 | TEST_DATA(testSkipSwitcherApplyNow) | 3171 | TEST_DATA(testSkipSwitcherApplyNow) | ||
3172 | 3172 | | |||
3173 | void TestShellClientRules::testSkipSwitcherApplyNow() | 3173 | void TestXdgShellClientRules::testSkipSwitcherApplyNow() | ||
3174 | { | 3174 | { | ||
3175 | // Create the test client. | 3175 | // Create the test client. | ||
3176 | QFETCH(Test::XdgShellSurfaceType, type); | 3176 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3177 | ShellClient *client; | 3177 | XdgShellClient *client; | ||
3178 | Surface *surface; | 3178 | Surface *surface; | ||
3179 | XdgShellSurface *shellSurface; | 3179 | XdgShellSurface *shellSurface; | ||
3180 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3180 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3181 | QVERIFY(client); | 3181 | QVERIFY(client); | ||
3182 | QVERIFY(!client->skipSwitcher()); | 3182 | QVERIFY(!client->skipSwitcher()); | ||
3183 | 3183 | | |||
3184 | // Initialize RuleBook with the test rule. | 3184 | // Initialize RuleBook with the test rule. | ||
3185 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3185 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
Show All 22 Lines | |||||
3208 | // Destroy the client. | 3208 | // Destroy the client. | ||
3209 | delete shellSurface; | 3209 | delete shellSurface; | ||
3210 | delete surface; | 3210 | delete surface; | ||
3211 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3211 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3212 | } | 3212 | } | ||
3213 | 3213 | | |||
3214 | TEST_DATA(testSkipSwitcherForceTemporarily) | 3214 | TEST_DATA(testSkipSwitcherForceTemporarily) | ||
3215 | 3215 | | |||
3216 | void TestShellClientRules::testSkipSwitcherForceTemporarily() | 3216 | void TestXdgShellClientRules::testSkipSwitcherForceTemporarily() | ||
3217 | { | 3217 | { | ||
3218 | // Initialize RuleBook with the test rule. | 3218 | // Initialize RuleBook with the test rule. | ||
3219 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3219 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3220 | config->group("General").writeEntry("count", 1); | 3220 | config->group("General").writeEntry("count", 1); | ||
3221 | KConfigGroup group = config->group("1"); | 3221 | KConfigGroup group = config->group("1"); | ||
3222 | group.writeEntry("skipswitcher", true); | 3222 | group.writeEntry("skipswitcher", true); | ||
3223 | group.writeEntry("skipswitcherrule", int(Rules::ForceTemporarily)); | 3223 | group.writeEntry("skipswitcherrule", int(Rules::ForceTemporarily)); | ||
3224 | group.writeEntry("wmclass", "org.kde.foo"); | 3224 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3225 | group.writeEntry("wmclasscomplete", false); | 3225 | group.writeEntry("wmclasscomplete", false); | ||
3226 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3226 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3227 | group.sync(); | 3227 | group.sync(); | ||
3228 | RuleBook::self()->setConfig(config); | 3228 | RuleBook::self()->setConfig(config); | ||
3229 | workspace()->slotReconfigure(); | 3229 | workspace()->slotReconfigure(); | ||
3230 | 3230 | | |||
3231 | // Create the test client. | 3231 | // Create the test client. | ||
3232 | QFETCH(Test::XdgShellSurfaceType, type); | 3232 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3233 | ShellClient *client; | 3233 | XdgShellClient *client; | ||
3234 | Surface *surface; | 3234 | Surface *surface; | ||
3235 | XdgShellSurface *shellSurface; | 3235 | XdgShellSurface *shellSurface; | ||
3236 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3236 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3237 | QVERIFY(client); | 3237 | QVERIFY(client); | ||
3238 | 3238 | | |||
3239 | // The client should be excluded from window switching effects. | 3239 | // The client should be excluded from window switching effects. | ||
3240 | QVERIFY(client->skipSwitcher()); | 3240 | QVERIFY(client->skipSwitcher()); | ||
3241 | 3241 | | |||
Show All 9 Lines | |||||
3251 | QVERIFY(client); | 3251 | QVERIFY(client); | ||
3252 | QVERIFY(!client->skipSwitcher()); | 3252 | QVERIFY(!client->skipSwitcher()); | ||
3253 | 3253 | | |||
3254 | // The skip-switcher state is no longer forced. | 3254 | // The skip-switcher state is no longer forced. | ||
3255 | client->setSkipSwitcher(true); | 3255 | client->setSkipSwitcher(true); | ||
3256 | QVERIFY(client->skipSwitcher()); | 3256 | QVERIFY(client->skipSwitcher()); | ||
3257 | 3257 | | |||
3258 | // Destroy the client. | 3258 | // Destroy the client. | ||
3259 | delete shellSurface; | 3259 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3260 | delete surface; | 3260 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3261 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3261 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3262 | } | 3262 | } | ||
3263 | 3263 | | |||
3264 | TEST_DATA(testKeepAboveDontAffect) | 3264 | TEST_DATA(testKeepAboveDontAffect) | ||
3265 | 3265 | | |||
3266 | void TestShellClientRules::testKeepAboveDontAffect() | 3266 | void TestXdgShellClientRules::testKeepAboveDontAffect() | ||
3267 | { | 3267 | { | ||
3268 | // Initialize RuleBook with the test rule. | 3268 | // Initialize RuleBook with the test rule. | ||
3269 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3269 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3270 | config->group("General").writeEntry("count", 1); | 3270 | config->group("General").writeEntry("count", 1); | ||
3271 | KConfigGroup group = config->group("1"); | 3271 | KConfigGroup group = config->group("1"); | ||
3272 | group.writeEntry("above", true); | 3272 | group.writeEntry("above", true); | ||
3273 | group.writeEntry("aboverule", int(Rules::DontAffect)); | 3273 | group.writeEntry("aboverule", int(Rules::DontAffect)); | ||
3274 | group.writeEntry("wmclass", "org.kde.foo"); | 3274 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3275 | group.writeEntry("wmclasscomplete", false); | 3275 | group.writeEntry("wmclasscomplete", false); | ||
3276 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3276 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3277 | group.sync(); | 3277 | group.sync(); | ||
3278 | RuleBook::self()->setConfig(config); | 3278 | RuleBook::self()->setConfig(config); | ||
3279 | workspace()->slotReconfigure(); | 3279 | workspace()->slotReconfigure(); | ||
3280 | 3280 | | |||
3281 | // Create the test client. | 3281 | // Create the test client. | ||
3282 | QFETCH(Test::XdgShellSurfaceType, type); | 3282 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3283 | ShellClient *client; | 3283 | XdgShellClient *client; | ||
3284 | Surface *surface; | 3284 | Surface *surface; | ||
3285 | XdgShellSurface *shellSurface; | 3285 | XdgShellSurface *shellSurface; | ||
3286 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3286 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3287 | QVERIFY(client); | 3287 | QVERIFY(client); | ||
3288 | 3288 | | |||
3289 | // The keep-above state of the client should not be affected by the rule. | 3289 | // The keep-above state of the client should not be affected by the rule. | ||
3290 | QVERIFY(!client->keepAbove()); | 3290 | QVERIFY(!client->keepAbove()); | ||
3291 | 3291 | | |||
3292 | // Destroy the client. | 3292 | // Destroy the client. | ||
3293 | delete shellSurface; | 3293 | delete shellSurface; | ||
3294 | delete surface; | 3294 | delete surface; | ||
3295 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3295 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3296 | } | 3296 | } | ||
3297 | 3297 | | |||
3298 | TEST_DATA(testKeepAboveApply) | 3298 | TEST_DATA(testKeepAboveApply) | ||
3299 | 3299 | | |||
3300 | void TestShellClientRules::testKeepAboveApply() | 3300 | void TestXdgShellClientRules::testKeepAboveApply() | ||
3301 | { | 3301 | { | ||
3302 | // Initialize RuleBook with the test rule. | 3302 | // Initialize RuleBook with the test rule. | ||
3303 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3303 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3304 | config->group("General").writeEntry("count", 1); | 3304 | config->group("General").writeEntry("count", 1); | ||
3305 | KConfigGroup group = config->group("1"); | 3305 | KConfigGroup group = config->group("1"); | ||
3306 | group.writeEntry("above", true); | 3306 | group.writeEntry("above", true); | ||
3307 | group.writeEntry("aboverule", int(Rules::Apply)); | 3307 | group.writeEntry("aboverule", int(Rules::Apply)); | ||
3308 | group.writeEntry("wmclass", "org.kde.foo"); | 3308 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3309 | group.writeEntry("wmclasscomplete", false); | 3309 | group.writeEntry("wmclasscomplete", false); | ||
3310 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3310 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3311 | group.sync(); | 3311 | group.sync(); | ||
3312 | RuleBook::self()->setConfig(config); | 3312 | RuleBook::self()->setConfig(config); | ||
3313 | workspace()->slotReconfigure(); | 3313 | workspace()->slotReconfigure(); | ||
3314 | 3314 | | |||
3315 | // Create the test client. | 3315 | // Create the test client. | ||
3316 | QFETCH(Test::XdgShellSurfaceType, type); | 3316 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3317 | ShellClient *client; | 3317 | XdgShellClient *client; | ||
3318 | Surface *surface; | 3318 | Surface *surface; | ||
3319 | XdgShellSurface *shellSurface; | 3319 | XdgShellSurface *shellSurface; | ||
3320 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3320 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3321 | QVERIFY(client); | 3321 | QVERIFY(client); | ||
3322 | 3322 | | |||
3323 | // Initially, the client should be kept above. | 3323 | // Initially, the client should be kept above. | ||
3324 | QVERIFY(client->keepAbove()); | 3324 | QVERIFY(client->keepAbove()); | ||
3325 | 3325 | | |||
3326 | // One should also be able to alter the keep-above state. | 3326 | // One should also be able to alter the keep-above state. | ||
3327 | client->setKeepAbove(false); | 3327 | client->setKeepAbove(false); | ||
3328 | QVERIFY(!client->keepAbove()); | 3328 | QVERIFY(!client->keepAbove()); | ||
3329 | 3329 | | |||
3330 | // If one re-opens the client, it should be kept above back again. | 3330 | // If one re-opens the client, it should be kept above back again. | ||
3331 | delete shellSurface; | 3331 | delete shellSurface; | ||
3332 | delete surface; | 3332 | delete surface; | ||
3333 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3333 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3334 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3334 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3335 | QVERIFY(client); | 3335 | QVERIFY(client); | ||
3336 | QVERIFY(client->keepAbove()); | 3336 | QVERIFY(client->keepAbove()); | ||
3337 | 3337 | | |||
3338 | // Destroy the client. | 3338 | // Destroy the client. | ||
3339 | delete shellSurface; | 3339 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3340 | delete surface; | 3340 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3341 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3341 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3342 | } | 3342 | } | ||
3343 | 3343 | | |||
3344 | TEST_DATA(testKeepAboveRemember) | 3344 | TEST_DATA(testKeepAboveRemember) | ||
3345 | 3345 | | |||
3346 | void TestShellClientRules::testKeepAboveRemember() | 3346 | void TestXdgShellClientRules::testKeepAboveRemember() | ||
3347 | { | 3347 | { | ||
3348 | // Initialize RuleBook with the test rule. | 3348 | // Initialize RuleBook with the test rule. | ||
3349 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3349 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3350 | config->group("General").writeEntry("count", 1); | 3350 | config->group("General").writeEntry("count", 1); | ||
3351 | KConfigGroup group = config->group("1"); | 3351 | KConfigGroup group = config->group("1"); | ||
3352 | group.writeEntry("above", true); | 3352 | group.writeEntry("above", true); | ||
3353 | group.writeEntry("aboverule", int(Rules::Remember)); | 3353 | group.writeEntry("aboverule", int(Rules::Remember)); | ||
3354 | group.writeEntry("wmclass", "org.kde.foo"); | 3354 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3355 | group.writeEntry("wmclasscomplete", false); | 3355 | group.writeEntry("wmclasscomplete", false); | ||
3356 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3356 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3357 | group.sync(); | 3357 | group.sync(); | ||
3358 | RuleBook::self()->setConfig(config); | 3358 | RuleBook::self()->setConfig(config); | ||
3359 | workspace()->slotReconfigure(); | 3359 | workspace()->slotReconfigure(); | ||
3360 | 3360 | | |||
3361 | // Create the test client. | 3361 | // Create the test client. | ||
3362 | QFETCH(Test::XdgShellSurfaceType, type); | 3362 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3363 | ShellClient *client; | 3363 | XdgShellClient *client; | ||
3364 | Surface *surface; | 3364 | Surface *surface; | ||
3365 | XdgShellSurface *shellSurface; | 3365 | XdgShellSurface *shellSurface; | ||
3366 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3366 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3367 | QVERIFY(client); | 3367 | QVERIFY(client); | ||
3368 | 3368 | | |||
3369 | // Initially, the client should be kept above. | 3369 | // Initially, the client should be kept above. | ||
3370 | QVERIFY(client->keepAbove()); | 3370 | QVERIFY(client->keepAbove()); | ||
3371 | 3371 | | |||
3372 | // Unset the keep-above state. | 3372 | // Unset the keep-above state. | ||
3373 | client->setKeepAbove(false); | 3373 | client->setKeepAbove(false); | ||
3374 | QVERIFY(!client->keepAbove()); | 3374 | QVERIFY(!client->keepAbove()); | ||
3375 | delete shellSurface; | 3375 | delete shellSurface; | ||
3376 | delete surface; | 3376 | delete surface; | ||
3377 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3377 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3378 | 3378 | | |||
3379 | // Re-open the client, it should not be kept above. | 3379 | // Re-open the client, it should not be kept above. | ||
3380 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3380 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3381 | QVERIFY(client); | 3381 | QVERIFY(client); | ||
3382 | QVERIFY(!client->keepAbove()); | 3382 | QVERIFY(!client->keepAbove()); | ||
3383 | 3383 | | |||
3384 | // Destroy the client. | 3384 | // Destroy the client. | ||
3385 | delete shellSurface; | 3385 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3386 | delete surface; | 3386 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3387 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3387 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3388 | } | 3388 | } | ||
3389 | 3389 | | |||
3390 | TEST_DATA(testKeepAboveForce) | 3390 | TEST_DATA(testKeepAboveForce) | ||
3391 | 3391 | | |||
3392 | void TestShellClientRules::testKeepAboveForce() | 3392 | void TestXdgShellClientRules::testKeepAboveForce() | ||
3393 | { | 3393 | { | ||
3394 | // Initialize RuleBook with the test rule. | 3394 | // Initialize RuleBook with the test rule. | ||
3395 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3395 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3396 | config->group("General").writeEntry("count", 1); | 3396 | config->group("General").writeEntry("count", 1); | ||
3397 | KConfigGroup group = config->group("1"); | 3397 | KConfigGroup group = config->group("1"); | ||
3398 | group.writeEntry("above", true); | 3398 | group.writeEntry("above", true); | ||
3399 | group.writeEntry("aboverule", int(Rules::Force)); | 3399 | group.writeEntry("aboverule", int(Rules::Force)); | ||
3400 | group.writeEntry("wmclass", "org.kde.foo"); | 3400 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3401 | group.writeEntry("wmclasscomplete", false); | 3401 | group.writeEntry("wmclasscomplete", false); | ||
3402 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3402 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3403 | group.sync(); | 3403 | group.sync(); | ||
3404 | RuleBook::self()->setConfig(config); | 3404 | RuleBook::self()->setConfig(config); | ||
3405 | workspace()->slotReconfigure(); | 3405 | workspace()->slotReconfigure(); | ||
3406 | 3406 | | |||
3407 | // Create the test client. | 3407 | // Create the test client. | ||
3408 | QFETCH(Test::XdgShellSurfaceType, type); | 3408 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3409 | ShellClient *client; | 3409 | XdgShellClient *client; | ||
3410 | Surface *surface; | 3410 | Surface *surface; | ||
3411 | XdgShellSurface *shellSurface; | 3411 | XdgShellSurface *shellSurface; | ||
3412 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3412 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3413 | QVERIFY(client); | 3413 | QVERIFY(client); | ||
3414 | 3414 | | |||
3415 | // Initially, the client should be kept above. | 3415 | // Initially, the client should be kept above. | ||
3416 | QVERIFY(client->keepAbove()); | 3416 | QVERIFY(client->keepAbove()); | ||
3417 | 3417 | | |||
3418 | // Any attemt to unset the keep-above should not succeed. | 3418 | // Any attemt to unset the keep-above should not succeed. | ||
3419 | client->setKeepAbove(false); | 3419 | client->setKeepAbove(false); | ||
3420 | QVERIFY(client->keepAbove()); | 3420 | QVERIFY(client->keepAbove()); | ||
3421 | 3421 | | |||
3422 | // If we re-open the client, it should still be kept above. | 3422 | // If we re-open the client, it should still be kept above. | ||
3423 | delete shellSurface; | 3423 | delete shellSurface; | ||
3424 | delete surface; | 3424 | delete surface; | ||
3425 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3425 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3426 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3426 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3427 | QVERIFY(client); | 3427 | QVERIFY(client); | ||
3428 | QVERIFY(client->keepAbove()); | 3428 | QVERIFY(client->keepAbove()); | ||
3429 | 3429 | | |||
3430 | // Destroy the client. | 3430 | // Destroy the client. | ||
3431 | delete shellSurface; | 3431 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3432 | delete surface; | 3432 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3433 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3433 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3434 | } | 3434 | } | ||
3435 | 3435 | | |||
3436 | TEST_DATA(testKeepAboveApplyNow) | 3436 | TEST_DATA(testKeepAboveApplyNow) | ||
3437 | 3437 | | |||
3438 | void TestShellClientRules::testKeepAboveApplyNow() | 3438 | void TestXdgShellClientRules::testKeepAboveApplyNow() | ||
3439 | { | 3439 | { | ||
3440 | // Create the test client. | 3440 | // Create the test client. | ||
3441 | QFETCH(Test::XdgShellSurfaceType, type); | 3441 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3442 | ShellClient *client; | 3442 | XdgShellClient *client; | ||
3443 | Surface *surface; | 3443 | Surface *surface; | ||
3444 | XdgShellSurface *shellSurface; | 3444 | XdgShellSurface *shellSurface; | ||
3445 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3445 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3446 | QVERIFY(client); | 3446 | QVERIFY(client); | ||
3447 | QVERIFY(!client->keepAbove()); | 3447 | QVERIFY(!client->keepAbove()); | ||
3448 | 3448 | | |||
3449 | // Initialize RuleBook with the test rule. | 3449 | // Initialize RuleBook with the test rule. | ||
3450 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3450 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
Show All 22 Lines | |||||
3473 | // Destroy the client. | 3473 | // Destroy the client. | ||
3474 | delete shellSurface; | 3474 | delete shellSurface; | ||
3475 | delete surface; | 3475 | delete surface; | ||
3476 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3476 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3477 | } | 3477 | } | ||
3478 | 3478 | | |||
3479 | TEST_DATA(testKeepAboveForceTemporarily) | 3479 | TEST_DATA(testKeepAboveForceTemporarily) | ||
3480 | 3480 | | |||
3481 | void TestShellClientRules::testKeepAboveForceTemporarily() | 3481 | void TestXdgShellClientRules::testKeepAboveForceTemporarily() | ||
3482 | { | 3482 | { | ||
3483 | // Initialize RuleBook with the test rule. | 3483 | // Initialize RuleBook with the test rule. | ||
3484 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3484 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3485 | config->group("General").writeEntry("count", 1); | 3485 | config->group("General").writeEntry("count", 1); | ||
3486 | KConfigGroup group = config->group("1"); | 3486 | KConfigGroup group = config->group("1"); | ||
3487 | group.writeEntry("above", true); | 3487 | group.writeEntry("above", true); | ||
3488 | group.writeEntry("aboverule", int(Rules::ForceTemporarily)); | 3488 | group.writeEntry("aboverule", int(Rules::ForceTemporarily)); | ||
3489 | group.writeEntry("wmclass", "org.kde.foo"); | 3489 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3490 | group.writeEntry("wmclasscomplete", false); | 3490 | group.writeEntry("wmclasscomplete", false); | ||
3491 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3491 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3492 | group.sync(); | 3492 | group.sync(); | ||
3493 | RuleBook::self()->setConfig(config); | 3493 | RuleBook::self()->setConfig(config); | ||
3494 | workspace()->slotReconfigure(); | 3494 | workspace()->slotReconfigure(); | ||
3495 | 3495 | | |||
3496 | // Create the test client. | 3496 | // Create the test client. | ||
3497 | QFETCH(Test::XdgShellSurfaceType, type); | 3497 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3498 | ShellClient *client; | 3498 | XdgShellClient *client; | ||
3499 | Surface *surface; | 3499 | Surface *surface; | ||
3500 | XdgShellSurface *shellSurface; | 3500 | XdgShellSurface *shellSurface; | ||
3501 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3501 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3502 | QVERIFY(client); | 3502 | QVERIFY(client); | ||
3503 | 3503 | | |||
3504 | // Initially, the client should be kept above. | 3504 | // Initially, the client should be kept above. | ||
3505 | QVERIFY(client->keepAbove()); | 3505 | QVERIFY(client->keepAbove()); | ||
3506 | 3506 | | |||
Show All 11 Lines | |||||
3518 | 3518 | | |||
3519 | // The keep-above state is no longer forced. | 3519 | // The keep-above state is no longer forced. | ||
3520 | client->setKeepAbove(true); | 3520 | client->setKeepAbove(true); | ||
3521 | QVERIFY(client->keepAbove()); | 3521 | QVERIFY(client->keepAbove()); | ||
3522 | client->setKeepAbove(false); | 3522 | client->setKeepAbove(false); | ||
3523 | QVERIFY(!client->keepAbove()); | 3523 | QVERIFY(!client->keepAbove()); | ||
3524 | 3524 | | |||
3525 | // Destroy the client. | 3525 | // Destroy the client. | ||
3526 | delete shellSurface; | 3526 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3527 | delete surface; | 3527 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3528 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3528 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3529 | } | 3529 | } | ||
3530 | 3530 | | |||
3531 | TEST_DATA(testKeepBelowDontAffect) | 3531 | TEST_DATA(testKeepBelowDontAffect) | ||
3532 | 3532 | | |||
3533 | void TestShellClientRules::testKeepBelowDontAffect() | 3533 | void TestXdgShellClientRules::testKeepBelowDontAffect() | ||
3534 | { | 3534 | { | ||
3535 | // Initialize RuleBook with the test rule. | 3535 | // Initialize RuleBook with the test rule. | ||
3536 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3536 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3537 | config->group("General").writeEntry("count", 1); | 3537 | config->group("General").writeEntry("count", 1); | ||
3538 | KConfigGroup group = config->group("1"); | 3538 | KConfigGroup group = config->group("1"); | ||
3539 | group.writeEntry("below", true); | 3539 | group.writeEntry("below", true); | ||
3540 | group.writeEntry("belowrule", int(Rules::DontAffect)); | 3540 | group.writeEntry("belowrule", int(Rules::DontAffect)); | ||
3541 | group.writeEntry("wmclass", "org.kde.foo"); | 3541 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3542 | group.writeEntry("wmclasscomplete", false); | 3542 | group.writeEntry("wmclasscomplete", false); | ||
3543 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3543 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3544 | group.sync(); | 3544 | group.sync(); | ||
3545 | RuleBook::self()->setConfig(config); | 3545 | RuleBook::self()->setConfig(config); | ||
3546 | workspace()->slotReconfigure(); | 3546 | workspace()->slotReconfigure(); | ||
3547 | 3547 | | |||
3548 | // Create the test client. | 3548 | // Create the test client. | ||
3549 | QFETCH(Test::XdgShellSurfaceType, type); | 3549 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3550 | ShellClient *client; | 3550 | XdgShellClient *client; | ||
3551 | Surface *surface; | 3551 | Surface *surface; | ||
3552 | XdgShellSurface *shellSurface; | 3552 | XdgShellSurface *shellSurface; | ||
3553 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3553 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3554 | QVERIFY(client); | 3554 | QVERIFY(client); | ||
3555 | 3555 | | |||
3556 | // The keep-below state of the client should not be affected by the rule. | 3556 | // The keep-below state of the client should not be affected by the rule. | ||
3557 | QVERIFY(!client->keepBelow()); | 3557 | QVERIFY(!client->keepBelow()); | ||
3558 | 3558 | | |||
3559 | // Destroy the client. | 3559 | // Destroy the client. | ||
3560 | delete shellSurface; | 3560 | delete shellSurface; | ||
3561 | delete surface; | 3561 | delete surface; | ||
3562 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3562 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3563 | } | 3563 | } | ||
3564 | 3564 | | |||
3565 | TEST_DATA(testKeepBelowApply) | 3565 | TEST_DATA(testKeepBelowApply) | ||
3566 | 3566 | | |||
3567 | void TestShellClientRules::testKeepBelowApply() | 3567 | void TestXdgShellClientRules::testKeepBelowApply() | ||
3568 | { | 3568 | { | ||
3569 | // Initialize RuleBook with the test rule. | 3569 | // Initialize RuleBook with the test rule. | ||
3570 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3570 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3571 | config->group("General").writeEntry("count", 1); | 3571 | config->group("General").writeEntry("count", 1); | ||
3572 | KConfigGroup group = config->group("1"); | 3572 | KConfigGroup group = config->group("1"); | ||
3573 | group.writeEntry("below", true); | 3573 | group.writeEntry("below", true); | ||
3574 | group.writeEntry("belowrule", int(Rules::Apply)); | 3574 | group.writeEntry("belowrule", int(Rules::Apply)); | ||
3575 | group.writeEntry("wmclass", "org.kde.foo"); | 3575 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3576 | group.writeEntry("wmclasscomplete", false); | 3576 | group.writeEntry("wmclasscomplete", false); | ||
3577 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3577 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3578 | group.sync(); | 3578 | group.sync(); | ||
3579 | RuleBook::self()->setConfig(config); | 3579 | RuleBook::self()->setConfig(config); | ||
3580 | workspace()->slotReconfigure(); | 3580 | workspace()->slotReconfigure(); | ||
3581 | 3581 | | |||
3582 | // Create the test client. | 3582 | // Create the test client. | ||
3583 | QFETCH(Test::XdgShellSurfaceType, type); | 3583 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3584 | ShellClient *client; | 3584 | XdgShellClient *client; | ||
3585 | Surface *surface; | 3585 | Surface *surface; | ||
3586 | XdgShellSurface *shellSurface; | 3586 | XdgShellSurface *shellSurface; | ||
3587 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3587 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3588 | QVERIFY(client); | 3588 | QVERIFY(client); | ||
3589 | 3589 | | |||
3590 | // Initially, the client should be kept below. | 3590 | // Initially, the client should be kept below. | ||
3591 | QVERIFY(client->keepBelow()); | 3591 | QVERIFY(client->keepBelow()); | ||
3592 | 3592 | | |||
3593 | // One should also be able to alter the keep-below state. | 3593 | // One should also be able to alter the keep-below state. | ||
3594 | client->setKeepBelow(false); | 3594 | client->setKeepBelow(false); | ||
3595 | QVERIFY(!client->keepBelow()); | 3595 | QVERIFY(!client->keepBelow()); | ||
3596 | 3596 | | |||
3597 | // If one re-opens the client, it should be kept above back again. | 3597 | // If one re-opens the client, it should be kept above back again. | ||
3598 | delete shellSurface; | 3598 | delete shellSurface; | ||
3599 | delete surface; | 3599 | delete surface; | ||
3600 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3600 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3601 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3601 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3602 | QVERIFY(client); | 3602 | QVERIFY(client); | ||
3603 | QVERIFY(client->keepBelow()); | 3603 | QVERIFY(client->keepBelow()); | ||
3604 | 3604 | | |||
3605 | // Destroy the client. | 3605 | // Destroy the client. | ||
3606 | delete shellSurface; | 3606 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3607 | delete surface; | 3607 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3608 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3608 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3609 | } | 3609 | } | ||
3610 | 3610 | | |||
3611 | TEST_DATA(testKeepBelowRemember) | 3611 | TEST_DATA(testKeepBelowRemember) | ||
3612 | 3612 | | |||
3613 | void TestShellClientRules::testKeepBelowRemember() | 3613 | void TestXdgShellClientRules::testKeepBelowRemember() | ||
3614 | { | 3614 | { | ||
3615 | // Initialize RuleBook with the test rule. | 3615 | // Initialize RuleBook with the test rule. | ||
3616 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3616 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3617 | config->group("General").writeEntry("count", 1); | 3617 | config->group("General").writeEntry("count", 1); | ||
3618 | KConfigGroup group = config->group("1"); | 3618 | KConfigGroup group = config->group("1"); | ||
3619 | group.writeEntry("below", true); | 3619 | group.writeEntry("below", true); | ||
3620 | group.writeEntry("belowrule", int(Rules::Remember)); | 3620 | group.writeEntry("belowrule", int(Rules::Remember)); | ||
3621 | group.writeEntry("wmclass", "org.kde.foo"); | 3621 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3622 | group.writeEntry("wmclasscomplete", false); | 3622 | group.writeEntry("wmclasscomplete", false); | ||
3623 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3623 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3624 | group.sync(); | 3624 | group.sync(); | ||
3625 | RuleBook::self()->setConfig(config); | 3625 | RuleBook::self()->setConfig(config); | ||
3626 | workspace()->slotReconfigure(); | 3626 | workspace()->slotReconfigure(); | ||
3627 | 3627 | | |||
3628 | // Create the test client. | 3628 | // Create the test client. | ||
3629 | QFETCH(Test::XdgShellSurfaceType, type); | 3629 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3630 | ShellClient *client; | 3630 | XdgShellClient *client; | ||
3631 | Surface *surface; | 3631 | Surface *surface; | ||
3632 | XdgShellSurface *shellSurface; | 3632 | XdgShellSurface *shellSurface; | ||
3633 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3633 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3634 | QVERIFY(client); | 3634 | QVERIFY(client); | ||
3635 | 3635 | | |||
3636 | // Initially, the client should be kept below. | 3636 | // Initially, the client should be kept below. | ||
3637 | QVERIFY(client->keepBelow()); | 3637 | QVERIFY(client->keepBelow()); | ||
3638 | 3638 | | |||
3639 | // Unset the keep-below state. | 3639 | // Unset the keep-below state. | ||
3640 | client->setKeepBelow(false); | 3640 | client->setKeepBelow(false); | ||
3641 | QVERIFY(!client->keepBelow()); | 3641 | QVERIFY(!client->keepBelow()); | ||
3642 | delete shellSurface; | 3642 | delete shellSurface; | ||
3643 | delete surface; | 3643 | delete surface; | ||
3644 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3644 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3645 | 3645 | | |||
3646 | // Re-open the client, it should not be kept below. | 3646 | // Re-open the client, it should not be kept below. | ||
3647 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3647 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3648 | QVERIFY(client); | 3648 | QVERIFY(client); | ||
3649 | QVERIFY(!client->keepBelow()); | 3649 | QVERIFY(!client->keepBelow()); | ||
3650 | 3650 | | |||
3651 | // Destroy the client. | 3651 | // Destroy the client. | ||
3652 | delete shellSurface; | 3652 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3653 | delete surface; | 3653 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3654 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3654 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3655 | } | 3655 | } | ||
3656 | 3656 | | |||
3657 | TEST_DATA(testKeepBelowForce) | 3657 | TEST_DATA(testKeepBelowForce) | ||
3658 | 3658 | | |||
3659 | void TestShellClientRules::testKeepBelowForce() | 3659 | void TestXdgShellClientRules::testKeepBelowForce() | ||
3660 | { | 3660 | { | ||
3661 | // Initialize RuleBook with the test rule. | 3661 | // Initialize RuleBook with the test rule. | ||
3662 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3662 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3663 | config->group("General").writeEntry("count", 1); | 3663 | config->group("General").writeEntry("count", 1); | ||
3664 | KConfigGroup group = config->group("1"); | 3664 | KConfigGroup group = config->group("1"); | ||
3665 | group.writeEntry("below", true); | 3665 | group.writeEntry("below", true); | ||
3666 | group.writeEntry("belowrule", int(Rules::Force)); | 3666 | group.writeEntry("belowrule", int(Rules::Force)); | ||
3667 | group.writeEntry("wmclass", "org.kde.foo"); | 3667 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3668 | group.writeEntry("wmclasscomplete", false); | 3668 | group.writeEntry("wmclasscomplete", false); | ||
3669 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3669 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3670 | group.sync(); | 3670 | group.sync(); | ||
3671 | RuleBook::self()->setConfig(config); | 3671 | RuleBook::self()->setConfig(config); | ||
3672 | workspace()->slotReconfigure(); | 3672 | workspace()->slotReconfigure(); | ||
3673 | 3673 | | |||
3674 | // Create the test client. | 3674 | // Create the test client. | ||
3675 | QFETCH(Test::XdgShellSurfaceType, type); | 3675 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3676 | ShellClient *client; | 3676 | XdgShellClient *client; | ||
3677 | Surface *surface; | 3677 | Surface *surface; | ||
3678 | XdgShellSurface *shellSurface; | 3678 | XdgShellSurface *shellSurface; | ||
3679 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3679 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3680 | QVERIFY(client); | 3680 | QVERIFY(client); | ||
3681 | 3681 | | |||
3682 | // Initially, the client should be kept below. | 3682 | // Initially, the client should be kept below. | ||
3683 | QVERIFY(client->keepBelow()); | 3683 | QVERIFY(client->keepBelow()); | ||
3684 | 3684 | | |||
3685 | // Any attemt to unset the keep-below should not succeed. | 3685 | // Any attemt to unset the keep-below should not succeed. | ||
3686 | client->setKeepBelow(false); | 3686 | client->setKeepBelow(false); | ||
3687 | QVERIFY(client->keepBelow()); | 3687 | QVERIFY(client->keepBelow()); | ||
3688 | 3688 | | |||
3689 | // If we re-open the client, it should still be kept below. | 3689 | // If we re-open the client, it should still be kept below. | ||
3690 | delete shellSurface; | 3690 | delete shellSurface; | ||
3691 | delete surface; | 3691 | delete surface; | ||
3692 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3692 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3693 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3693 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3694 | QVERIFY(client); | 3694 | QVERIFY(client); | ||
3695 | QVERIFY(client->keepBelow()); | 3695 | QVERIFY(client->keepBelow()); | ||
3696 | 3696 | | |||
3697 | // Destroy the client. | 3697 | // Destroy the client. | ||
3698 | delete shellSurface; | 3698 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3699 | delete surface; | 3699 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3700 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3700 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3701 | } | 3701 | } | ||
3702 | 3702 | | |||
3703 | TEST_DATA(testKeepBelowApplyNow) | 3703 | TEST_DATA(testKeepBelowApplyNow) | ||
3704 | 3704 | | |||
3705 | void TestShellClientRules::testKeepBelowApplyNow() | 3705 | void TestXdgShellClientRules::testKeepBelowApplyNow() | ||
3706 | { | 3706 | { | ||
3707 | // Create the test client. | 3707 | // Create the test client. | ||
3708 | QFETCH(Test::XdgShellSurfaceType, type); | 3708 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3709 | ShellClient *client; | 3709 | XdgShellClient *client; | ||
3710 | Surface *surface; | 3710 | Surface *surface; | ||
3711 | XdgShellSurface *shellSurface; | 3711 | XdgShellSurface *shellSurface; | ||
3712 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3712 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3713 | QVERIFY(client); | 3713 | QVERIFY(client); | ||
3714 | QVERIFY(!client->keepBelow()); | 3714 | QVERIFY(!client->keepBelow()); | ||
3715 | 3715 | | |||
3716 | // Initialize RuleBook with the test rule. | 3716 | // Initialize RuleBook with the test rule. | ||
3717 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3717 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
Show All 22 Lines | |||||
3740 | // Destroy the client. | 3740 | // Destroy the client. | ||
3741 | delete shellSurface; | 3741 | delete shellSurface; | ||
3742 | delete surface; | 3742 | delete surface; | ||
3743 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3743 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3744 | } | 3744 | } | ||
3745 | 3745 | | |||
3746 | TEST_DATA(testKeepBelowForceTemporarily) | 3746 | TEST_DATA(testKeepBelowForceTemporarily) | ||
3747 | 3747 | | |||
3748 | void TestShellClientRules::testKeepBelowForceTemporarily() | 3748 | void TestXdgShellClientRules::testKeepBelowForceTemporarily() | ||
3749 | { | 3749 | { | ||
3750 | // Initialize RuleBook with the test rule. | 3750 | // Initialize RuleBook with the test rule. | ||
3751 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3751 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3752 | config->group("General").writeEntry("count", 1); | 3752 | config->group("General").writeEntry("count", 1); | ||
3753 | KConfigGroup group = config->group("1"); | 3753 | KConfigGroup group = config->group("1"); | ||
3754 | group.writeEntry("below", true); | 3754 | group.writeEntry("below", true); | ||
3755 | group.writeEntry("belowrule", int(Rules::ForceTemporarily)); | 3755 | group.writeEntry("belowrule", int(Rules::ForceTemporarily)); | ||
3756 | group.writeEntry("wmclass", "org.kde.foo"); | 3756 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3757 | group.writeEntry("wmclasscomplete", false); | 3757 | group.writeEntry("wmclasscomplete", false); | ||
3758 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3758 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3759 | group.sync(); | 3759 | group.sync(); | ||
3760 | RuleBook::self()->setConfig(config); | 3760 | RuleBook::self()->setConfig(config); | ||
3761 | workspace()->slotReconfigure(); | 3761 | workspace()->slotReconfigure(); | ||
3762 | 3762 | | |||
3763 | // Create the test client. | 3763 | // Create the test client. | ||
3764 | QFETCH(Test::XdgShellSurfaceType, type); | 3764 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3765 | ShellClient *client; | 3765 | XdgShellClient *client; | ||
3766 | Surface *surface; | 3766 | Surface *surface; | ||
3767 | XdgShellSurface *shellSurface; | 3767 | XdgShellSurface *shellSurface; | ||
3768 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3768 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3769 | QVERIFY(client); | 3769 | QVERIFY(client); | ||
3770 | 3770 | | |||
3771 | // Initially, the client should be kept below. | 3771 | // Initially, the client should be kept below. | ||
3772 | QVERIFY(client->keepBelow()); | 3772 | QVERIFY(client->keepBelow()); | ||
3773 | 3773 | | |||
Show All 11 Lines | |||||
3785 | 3785 | | |||
3786 | // The keep-below state is no longer forced. | 3786 | // The keep-below state is no longer forced. | ||
3787 | client->setKeepBelow(true); | 3787 | client->setKeepBelow(true); | ||
3788 | QVERIFY(client->keepBelow()); | 3788 | QVERIFY(client->keepBelow()); | ||
3789 | client->setKeepBelow(false); | 3789 | client->setKeepBelow(false); | ||
3790 | QVERIFY(!client->keepBelow()); | 3790 | QVERIFY(!client->keepBelow()); | ||
3791 | 3791 | | |||
3792 | // Destroy the client. | 3792 | // Destroy the client. | ||
3793 | delete shellSurface; | 3793 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3794 | delete surface; | 3794 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3795 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3795 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3796 | } | 3796 | } | ||
3797 | 3797 | | |||
3798 | TEST_DATA(testShortcutDontAffect) | 3798 | TEST_DATA(testShortcutDontAffect) | ||
3799 | 3799 | | |||
3800 | void TestShellClientRules::testShortcutDontAffect() | 3800 | void TestXdgShellClientRules::testShortcutDontAffect() | ||
3801 | { | 3801 | { | ||
3802 | // Initialize RuleBook with the test rule. | 3802 | // Initialize RuleBook with the test rule. | ||
3803 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3803 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3804 | config->group("General").writeEntry("count", 1); | 3804 | config->group("General").writeEntry("count", 1); | ||
3805 | KConfigGroup group = config->group("1"); | 3805 | KConfigGroup group = config->group("1"); | ||
3806 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 3806 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
3807 | group.writeEntry("shortcutrule", int(Rules::DontAffect)); | 3807 | group.writeEntry("shortcutrule", int(Rules::DontAffect)); | ||
3808 | group.writeEntry("wmclass", "org.kde.foo"); | 3808 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3809 | group.writeEntry("wmclasscomplete", false); | 3809 | group.writeEntry("wmclasscomplete", false); | ||
3810 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3810 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3811 | group.sync(); | 3811 | group.sync(); | ||
3812 | RuleBook::self()->setConfig(config); | 3812 | RuleBook::self()->setConfig(config); | ||
3813 | workspace()->slotReconfigure(); | 3813 | workspace()->slotReconfigure(); | ||
3814 | 3814 | | |||
3815 | // Create the test client. | 3815 | // Create the test client. | ||
3816 | QFETCH(Test::XdgShellSurfaceType, type); | 3816 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3817 | ShellClient *client; | 3817 | XdgShellClient *client; | ||
3818 | Surface *surface; | 3818 | Surface *surface; | ||
3819 | XdgShellSurface *shellSurface; | 3819 | XdgShellSurface *shellSurface; | ||
3820 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3820 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3821 | QVERIFY(client); | 3821 | QVERIFY(client); | ||
3822 | QCOMPARE(client->shortcut(), QKeySequence()); | 3822 | QCOMPARE(client->shortcut(), QKeySequence()); | ||
3823 | client->minimize(); | 3823 | client->minimize(); | ||
3824 | QVERIFY(client->isMinimized()); | 3824 | QVERIFY(client->isMinimized()); | ||
3825 | 3825 | | |||
Show All 13 Lines | |||||
3839 | // Destroy the client. | 3839 | // Destroy the client. | ||
3840 | delete shellSurface; | 3840 | delete shellSurface; | ||
3841 | delete surface; | 3841 | delete surface; | ||
3842 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3842 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3843 | } | 3843 | } | ||
3844 | 3844 | | |||
3845 | TEST_DATA(testShortcutApply) | 3845 | TEST_DATA(testShortcutApply) | ||
3846 | 3846 | | |||
3847 | void TestShellClientRules::testShortcutApply() | 3847 | void TestXdgShellClientRules::testShortcutApply() | ||
3848 | { | 3848 | { | ||
3849 | // Initialize RuleBook with the test rule. | 3849 | // Initialize RuleBook with the test rule. | ||
3850 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3850 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3851 | config->group("General").writeEntry("count", 1); | 3851 | config->group("General").writeEntry("count", 1); | ||
3852 | KConfigGroup group = config->group("1"); | 3852 | KConfigGroup group = config->group("1"); | ||
3853 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 3853 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
3854 | group.writeEntry("shortcutrule", int(Rules::Apply)); | 3854 | group.writeEntry("shortcutrule", int(Rules::Apply)); | ||
3855 | group.writeEntry("wmclass", "org.kde.foo"); | 3855 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3856 | group.writeEntry("wmclasscomplete", false); | 3856 | group.writeEntry("wmclasscomplete", false); | ||
3857 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3857 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3858 | group.sync(); | 3858 | group.sync(); | ||
3859 | RuleBook::self()->setConfig(config); | 3859 | RuleBook::self()->setConfig(config); | ||
3860 | workspace()->slotReconfigure(); | 3860 | workspace()->slotReconfigure(); | ||
3861 | 3861 | | |||
3862 | // Create the test client. | 3862 | // Create the test client. | ||
3863 | QFETCH(Test::XdgShellSurfaceType, type); | 3863 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3864 | ShellClient *client; | 3864 | XdgShellClient *client; | ||
3865 | Surface *surface; | 3865 | Surface *surface; | ||
3866 | XdgShellSurface *shellSurface; | 3866 | XdgShellSurface *shellSurface; | ||
3867 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3867 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3868 | QVERIFY(client); | 3868 | QVERIFY(client); | ||
3869 | 3869 | | |||
3870 | // If we press the window shortcut, the window should be brought back to user. | 3870 | // If we press the window shortcut, the window should be brought back to user. | ||
3871 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 3871 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
3872 | QVERIFY(clientUnminimizedSpy.isValid()); | 3872 | QVERIFY(clientUnminimizedSpy.isValid()); | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
3915 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3915 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3916 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3916 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3917 | QVERIFY(client); | 3917 | QVERIFY(client); | ||
3918 | 3918 | | |||
3919 | // The window shortcut should be set back to Ctrl+Alt+1. | 3919 | // The window shortcut should be set back to Ctrl+Alt+1. | ||
3920 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3920 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
3921 | 3921 | | |||
3922 | // Destroy the client. | 3922 | // Destroy the client. | ||
3923 | delete shellSurface; | 3923 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3924 | delete surface; | 3924 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3925 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3925 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3926 | } | 3926 | } | ||
3927 | 3927 | | |||
3928 | TEST_DATA(testShortcutRemember) | 3928 | TEST_DATA(testShortcutRemember) | ||
3929 | 3929 | | |||
3930 | void TestShellClientRules::testShortcutRemember() | 3930 | void TestXdgShellClientRules::testShortcutRemember() | ||
3931 | { | 3931 | { | ||
3932 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | 3932 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | ||
3933 | 3933 | | |||
3934 | // Initialize RuleBook with the test rule. | 3934 | // Initialize RuleBook with the test rule. | ||
3935 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3935 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3936 | config->group("General").writeEntry("count", 1); | 3936 | config->group("General").writeEntry("count", 1); | ||
3937 | KConfigGroup group = config->group("1"); | 3937 | KConfigGroup group = config->group("1"); | ||
3938 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 3938 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
3939 | group.writeEntry("shortcutrule", int(Rules::Remember)); | 3939 | group.writeEntry("shortcutrule", int(Rules::Remember)); | ||
3940 | group.writeEntry("wmclass", "org.kde.foo"); | 3940 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3941 | group.writeEntry("wmclasscomplete", false); | 3941 | group.writeEntry("wmclasscomplete", false); | ||
3942 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3942 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3943 | group.sync(); | 3943 | group.sync(); | ||
3944 | RuleBook::self()->setConfig(config); | 3944 | RuleBook::self()->setConfig(config); | ||
3945 | workspace()->slotReconfigure(); | 3945 | workspace()->slotReconfigure(); | ||
3946 | 3946 | | |||
3947 | // Create the test client. | 3947 | // Create the test client. | ||
3948 | QFETCH(Test::XdgShellSurfaceType, type); | 3948 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3949 | ShellClient *client; | 3949 | XdgShellClient *client; | ||
3950 | Surface *surface; | 3950 | Surface *surface; | ||
3951 | XdgShellSurface *shellSurface; | 3951 | XdgShellSurface *shellSurface; | ||
3952 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3952 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3953 | QVERIFY(client); | 3953 | QVERIFY(client); | ||
3954 | 3954 | | |||
3955 | // If we press the window shortcut, the window should be brought back to user. | 3955 | // If we press the window shortcut, the window should be brought back to user. | ||
3956 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 3956 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
3957 | QVERIFY(clientUnminimizedSpy.isValid()); | 3957 | QVERIFY(clientUnminimizedSpy.isValid()); | ||
Show All 30 Lines | |||||
3988 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3988 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3989 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3989 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3990 | QVERIFY(client); | 3990 | QVERIFY(client); | ||
3991 | 3991 | | |||
3992 | // The window shortcut should be set to the last known value. | 3992 | // The window shortcut should be set to the last known value. | ||
3993 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | 3993 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | ||
3994 | 3994 | | |||
3995 | // Destroy the client. | 3995 | // Destroy the client. | ||
3996 | delete shellSurface; | 3996 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3997 | delete surface; | 3997 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3998 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3998 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3999 | } | 3999 | } | ||
4000 | 4000 | | |||
4001 | TEST_DATA(testShortcutForce) | 4001 | TEST_DATA(testShortcutForce) | ||
4002 | 4002 | | |||
4003 | void TestShellClientRules::testShortcutForce() | 4003 | void TestXdgShellClientRules::testShortcutForce() | ||
4004 | { | 4004 | { | ||
4005 | QSKIP("KWin core can't release forced window shortcuts"); | 4005 | QSKIP("KWin core can't release forced window shortcuts"); | ||
4006 | 4006 | | |||
4007 | // Initialize RuleBook with the test rule. | 4007 | // Initialize RuleBook with the test rule. | ||
4008 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4008 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4009 | config->group("General").writeEntry("count", 1); | 4009 | config->group("General").writeEntry("count", 1); | ||
4010 | KConfigGroup group = config->group("1"); | 4010 | KConfigGroup group = config->group("1"); | ||
4011 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 4011 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
4012 | group.writeEntry("shortcutrule", int(Rules::Force)); | 4012 | group.writeEntry("shortcutrule", int(Rules::Force)); | ||
4013 | group.writeEntry("wmclass", "org.kde.foo"); | 4013 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4014 | group.writeEntry("wmclasscomplete", false); | 4014 | group.writeEntry("wmclasscomplete", false); | ||
4015 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4015 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4016 | group.sync(); | 4016 | group.sync(); | ||
4017 | RuleBook::self()->setConfig(config); | 4017 | RuleBook::self()->setConfig(config); | ||
4018 | workspace()->slotReconfigure(); | 4018 | workspace()->slotReconfigure(); | ||
4019 | 4019 | | |||
4020 | // Create the test client. | 4020 | // Create the test client. | ||
4021 | QFETCH(Test::XdgShellSurfaceType, type); | 4021 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4022 | ShellClient *client; | 4022 | XdgShellClient *client; | ||
4023 | Surface *surface; | 4023 | Surface *surface; | ||
4024 | XdgShellSurface *shellSurface; | 4024 | XdgShellSurface *shellSurface; | ||
4025 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4025 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4026 | QVERIFY(client); | 4026 | QVERIFY(client); | ||
4027 | 4027 | | |||
4028 | // If we press the window shortcut, the window should be brought back to user. | 4028 | // If we press the window shortcut, the window should be brought back to user. | ||
4029 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 4029 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
4030 | QVERIFY(clientUnminimizedSpy.isValid()); | 4030 | QVERIFY(clientUnminimizedSpy.isValid()); | ||
Show All 30 Lines | |||||
4061 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4061 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4062 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4062 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4063 | QVERIFY(client); | 4063 | QVERIFY(client); | ||
4064 | 4064 | | |||
4065 | // The window shortcut should still be forced. | 4065 | // The window shortcut should still be forced. | ||
4066 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 4066 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
4067 | 4067 | | |||
4068 | // Destroy the client. | 4068 | // Destroy the client. | ||
4069 | delete shellSurface; | 4069 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4070 | delete surface; | 4070 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4071 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4071 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4072 | } | 4072 | } | ||
4073 | 4073 | | |||
4074 | TEST_DATA(testShortcutApplyNow) | 4074 | TEST_DATA(testShortcutApplyNow) | ||
4075 | 4075 | | |||
4076 | void TestShellClientRules::testShortcutApplyNow() | 4076 | void TestXdgShellClientRules::testShortcutApplyNow() | ||
4077 | { | 4077 | { | ||
4078 | // Create the test client. | 4078 | // Create the test client. | ||
4079 | QFETCH(Test::XdgShellSurfaceType, type); | 4079 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4080 | ShellClient *client; | 4080 | XdgShellClient *client; | ||
4081 | Surface *surface; | 4081 | Surface *surface; | ||
4082 | XdgShellSurface *shellSurface; | 4082 | XdgShellSurface *shellSurface; | ||
4083 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4083 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4084 | QVERIFY(client); | 4084 | QVERIFY(client); | ||
4085 | QVERIFY(client->shortcut().isEmpty()); | 4085 | QVERIFY(client->shortcut().isEmpty()); | ||
4086 | 4086 | | |||
4087 | // Initialize RuleBook with the test rule. | 4087 | // Initialize RuleBook with the test rule. | ||
4088 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4088 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
4134 | // Destroy the client. | 4134 | // Destroy the client. | ||
4135 | delete shellSurface; | 4135 | delete shellSurface; | ||
4136 | delete surface; | 4136 | delete surface; | ||
4137 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4137 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4138 | } | 4138 | } | ||
4139 | 4139 | | |||
4140 | TEST_DATA(testShortcutForceTemporarily) | 4140 | TEST_DATA(testShortcutForceTemporarily) | ||
4141 | 4141 | | |||
4142 | void TestShellClientRules::testShortcutForceTemporarily() | 4142 | void TestXdgShellClientRules::testShortcutForceTemporarily() | ||
4143 | { | 4143 | { | ||
4144 | QSKIP("KWin core can't release forced window shortcuts"); | 4144 | QSKIP("KWin core can't release forced window shortcuts"); | ||
4145 | 4145 | | |||
4146 | // Initialize RuleBook with the test rule. | 4146 | // Initialize RuleBook with the test rule. | ||
4147 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4147 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4148 | config->group("General").writeEntry("count", 1); | 4148 | config->group("General").writeEntry("count", 1); | ||
4149 | KConfigGroup group = config->group("1"); | 4149 | KConfigGroup group = config->group("1"); | ||
4150 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 4150 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
4151 | group.writeEntry("shortcutrule", int(Rules::ForceTemporarily)); | 4151 | group.writeEntry("shortcutrule", int(Rules::ForceTemporarily)); | ||
4152 | group.writeEntry("wmclass", "org.kde.foo"); | 4152 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4153 | group.writeEntry("wmclasscomplete", false); | 4153 | group.writeEntry("wmclasscomplete", false); | ||
4154 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4154 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4155 | group.sync(); | 4155 | group.sync(); | ||
4156 | RuleBook::self()->setConfig(config); | 4156 | RuleBook::self()->setConfig(config); | ||
4157 | workspace()->slotReconfigure(); | 4157 | workspace()->slotReconfigure(); | ||
4158 | 4158 | | |||
4159 | // Create the test client. | 4159 | // Create the test client. | ||
4160 | QFETCH(Test::XdgShellSurfaceType, type); | 4160 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4161 | ShellClient *client; | 4161 | XdgShellClient *client; | ||
4162 | Surface *surface; | 4162 | Surface *surface; | ||
4163 | XdgShellSurface *shellSurface; | 4163 | XdgShellSurface *shellSurface; | ||
4164 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4164 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4165 | QVERIFY(client); | 4165 | QVERIFY(client); | ||
4166 | 4166 | | |||
4167 | // If we press the window shortcut, the window should be brought back to user. | 4167 | // If we press the window shortcut, the window should be brought back to user. | ||
4168 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 4168 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
4169 | QVERIFY(clientUnminimizedSpy.isValid()); | 4169 | QVERIFY(clientUnminimizedSpy.isValid()); | ||
Show All 28 Lines | |||||
4198 | delete shellSurface; | 4198 | delete shellSurface; | ||
4199 | delete surface; | 4199 | delete surface; | ||
4200 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4200 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4201 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4201 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4202 | QVERIFY(client); | 4202 | QVERIFY(client); | ||
4203 | QVERIFY(client->shortcut().isEmpty()); | 4203 | QVERIFY(client->shortcut().isEmpty()); | ||
4204 | 4204 | | |||
4205 | // Destroy the client. | 4205 | // Destroy the client. | ||
4206 | delete shellSurface; | 4206 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4207 | delete surface; | 4207 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4208 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4208 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4209 | } | 4209 | } | ||
4210 | 4210 | | |||
4211 | TEST_DATA(testDesktopFileDontAffect) | 4211 | TEST_DATA(testDesktopFileDontAffect) | ||
4212 | 4212 | | |||
4213 | void TestShellClientRules::testDesktopFileDontAffect() | 4213 | void TestXdgShellClientRules::testDesktopFileDontAffect() | ||
4214 | { | 4214 | { | ||
4215 | // Currently, the desktop file name is derived from the app id. If the app id is | 4215 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4216 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4216 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4217 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4217 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4218 | QSKIP("Needs changes in KWin core to pass"); | 4218 | QSKIP("Needs changes in KWin core to pass"); | ||
4219 | } | 4219 | } | ||
4220 | 4220 | | |||
4221 | TEST_DATA(testDesktopFileApply) | 4221 | TEST_DATA(testDesktopFileApply) | ||
4222 | 4222 | | |||
4223 | void TestShellClientRules::testDesktopFileApply() | 4223 | void TestXdgShellClientRules::testDesktopFileApply() | ||
4224 | { | 4224 | { | ||
4225 | // Currently, the desktop file name is derived from the app id. If the app id is | 4225 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4226 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4226 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4227 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4227 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4228 | QSKIP("Needs changes in KWin core to pass"); | 4228 | QSKIP("Needs changes in KWin core to pass"); | ||
4229 | } | 4229 | } | ||
4230 | 4230 | | |||
4231 | TEST_DATA(testDesktopFileRemember) | 4231 | TEST_DATA(testDesktopFileRemember) | ||
4232 | 4232 | | |||
4233 | void TestShellClientRules::testDesktopFileRemember() | 4233 | void TestXdgShellClientRules::testDesktopFileRemember() | ||
4234 | { | 4234 | { | ||
4235 | // Currently, the desktop file name is derived from the app id. If the app id is | 4235 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4236 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4236 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4237 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4237 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4238 | QSKIP("Needs changes in KWin core to pass"); | 4238 | QSKIP("Needs changes in KWin core to pass"); | ||
4239 | } | 4239 | } | ||
4240 | 4240 | | |||
4241 | TEST_DATA(testDesktopFileForce) | 4241 | TEST_DATA(testDesktopFileForce) | ||
4242 | 4242 | | |||
4243 | void TestShellClientRules::testDesktopFileForce() | 4243 | void TestXdgShellClientRules::testDesktopFileForce() | ||
4244 | { | 4244 | { | ||
4245 | // Currently, the desktop file name is derived from the app id. If the app id is | 4245 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4246 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4246 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4247 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4247 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4248 | QSKIP("Needs changes in KWin core to pass"); | 4248 | QSKIP("Needs changes in KWin core to pass"); | ||
4249 | } | 4249 | } | ||
4250 | 4250 | | |||
4251 | TEST_DATA(testDesktopFileApplyNow) | 4251 | TEST_DATA(testDesktopFileApplyNow) | ||
4252 | 4252 | | |||
4253 | void TestShellClientRules::testDesktopFileApplyNow() | 4253 | void TestXdgShellClientRules::testDesktopFileApplyNow() | ||
4254 | { | 4254 | { | ||
4255 | // Currently, the desktop file name is derived from the app id. If the app id is | 4255 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4256 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4256 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4257 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4257 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4258 | QSKIP("Needs changes in KWin core to pass"); | 4258 | QSKIP("Needs changes in KWin core to pass"); | ||
4259 | } | 4259 | } | ||
4260 | 4260 | | |||
4261 | TEST_DATA(testDesktopFileForceTemporarily) | 4261 | TEST_DATA(testDesktopFileForceTemporarily) | ||
4262 | 4262 | | |||
4263 | void TestShellClientRules::testDesktopFileForceTemporarily() | 4263 | void TestXdgShellClientRules::testDesktopFileForceTemporarily() | ||
4264 | { | 4264 | { | ||
4265 | // Currently, the desktop file name is derived from the app id. If the app id is | 4265 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
4266 | // changed, then the old rules will be lost. Either setDesktopFileName should | 4266 | // changed, then the old rules will be lost. Either setDesktopFileName should | ||
4267 | // be exposed or the desktop file name rule should be removed for wayland clients. | 4267 | // be exposed or the desktop file name rule should be removed for wayland clients. | ||
4268 | QSKIP("Needs changes in KWin core to pass"); | 4268 | QSKIP("Needs changes in KWin core to pass"); | ||
4269 | } | 4269 | } | ||
4270 | 4270 | | |||
4271 | TEST_DATA(testActiveOpacityDontAffect) | 4271 | TEST_DATA(testActiveOpacityDontAffect) | ||
4272 | 4272 | | |||
4273 | void TestShellClientRules::testActiveOpacityDontAffect() | 4273 | void TestXdgShellClientRules::testActiveOpacityDontAffect() | ||
4274 | { | 4274 | { | ||
4275 | // Initialize RuleBook with the test rule. | 4275 | // Initialize RuleBook with the test rule. | ||
4276 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4276 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4277 | config->group("General").writeEntry("count", 1); | 4277 | config->group("General").writeEntry("count", 1); | ||
4278 | KConfigGroup group = config->group("1"); | 4278 | KConfigGroup group = config->group("1"); | ||
4279 | group.writeEntry("opacityactive", 90); | 4279 | group.writeEntry("opacityactive", 90); | ||
4280 | group.writeEntry("opacityactiverule", int(Rules::DontAffect)); | 4280 | group.writeEntry("opacityactiverule", int(Rules::DontAffect)); | ||
4281 | group.writeEntry("wmclass", "org.kde.foo"); | 4281 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4282 | group.writeEntry("wmclasscomplete", false); | 4282 | group.writeEntry("wmclasscomplete", false); | ||
4283 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4283 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4284 | group.sync(); | 4284 | group.sync(); | ||
4285 | RuleBook::self()->setConfig(config); | 4285 | RuleBook::self()->setConfig(config); | ||
4286 | workspace()->slotReconfigure(); | 4286 | workspace()->slotReconfigure(); | ||
4287 | 4287 | | |||
4288 | // Create the test client. | 4288 | // Create the test client. | ||
4289 | QFETCH(Test::XdgShellSurfaceType, type); | 4289 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4290 | ShellClient *client; | 4290 | XdgShellClient *client; | ||
4291 | Surface *surface; | 4291 | Surface *surface; | ||
4292 | XdgShellSurface *shellSurface; | 4292 | XdgShellSurface *shellSurface; | ||
4293 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4293 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4294 | QVERIFY(client); | 4294 | QVERIFY(client); | ||
4295 | QVERIFY(client->isActive()); | 4295 | QVERIFY(client->isActive()); | ||
4296 | 4296 | | |||
4297 | // The opacity should not be affected by the rule. | 4297 | // The opacity should not be affected by the rule. | ||
4298 | QCOMPARE(client->opacity(), 1.0); | 4298 | QCOMPARE(client->opacity(), 1.0); | ||
4299 | 4299 | | |||
4300 | // Destroy the client. | 4300 | // Destroy the client. | ||
4301 | delete shellSurface; | 4301 | delete shellSurface; | ||
4302 | delete surface; | 4302 | delete surface; | ||
4303 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4303 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4304 | } | 4304 | } | ||
4305 | 4305 | | |||
4306 | TEST_DATA(testActiveOpacityForce) | 4306 | TEST_DATA(testActiveOpacityForce) | ||
4307 | 4307 | | |||
4308 | void TestShellClientRules::testActiveOpacityForce() | 4308 | void TestXdgShellClientRules::testActiveOpacityForce() | ||
4309 | { | 4309 | { | ||
4310 | // Initialize RuleBook with the test rule. | 4310 | // Initialize RuleBook with the test rule. | ||
4311 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4311 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4312 | config->group("General").writeEntry("count", 1); | 4312 | config->group("General").writeEntry("count", 1); | ||
4313 | KConfigGroup group = config->group("1"); | 4313 | KConfigGroup group = config->group("1"); | ||
4314 | group.writeEntry("opacityactive", 90); | 4314 | group.writeEntry("opacityactive", 90); | ||
4315 | group.writeEntry("opacityactiverule", int(Rules::Force)); | 4315 | group.writeEntry("opacityactiverule", int(Rules::Force)); | ||
4316 | group.writeEntry("wmclass", "org.kde.foo"); | 4316 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4317 | group.writeEntry("wmclasscomplete", false); | 4317 | group.writeEntry("wmclasscomplete", false); | ||
4318 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4318 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4319 | group.sync(); | 4319 | group.sync(); | ||
4320 | RuleBook::self()->setConfig(config); | 4320 | RuleBook::self()->setConfig(config); | ||
4321 | workspace()->slotReconfigure(); | 4321 | workspace()->slotReconfigure(); | ||
4322 | 4322 | | |||
4323 | // Create the test client. | 4323 | // Create the test client. | ||
4324 | QFETCH(Test::XdgShellSurfaceType, type); | 4324 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4325 | ShellClient *client; | 4325 | XdgShellClient *client; | ||
4326 | Surface *surface; | 4326 | Surface *surface; | ||
4327 | XdgShellSurface *shellSurface; | 4327 | XdgShellSurface *shellSurface; | ||
4328 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4328 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4329 | QVERIFY(client); | 4329 | QVERIFY(client); | ||
4330 | QVERIFY(client->isActive()); | 4330 | QVERIFY(client->isActive()); | ||
4331 | QCOMPARE(client->opacity(), 0.9); | 4331 | QCOMPARE(client->opacity(), 0.9); | ||
4332 | 4332 | | |||
4333 | // Destroy the client. | 4333 | // Destroy the client. | ||
4334 | delete shellSurface; | 4334 | delete shellSurface; | ||
4335 | delete surface; | 4335 | delete surface; | ||
4336 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4336 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4337 | } | 4337 | } | ||
4338 | 4338 | | |||
4339 | TEST_DATA(testActiveOpacityForceTemporarily) | 4339 | TEST_DATA(testActiveOpacityForceTemporarily) | ||
4340 | 4340 | | |||
4341 | void TestShellClientRules::testActiveOpacityForceTemporarily() | 4341 | void TestXdgShellClientRules::testActiveOpacityForceTemporarily() | ||
4342 | { | 4342 | { | ||
4343 | // Initialize RuleBook with the test rule. | 4343 | // Initialize RuleBook with the test rule. | ||
4344 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4344 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4345 | config->group("General").writeEntry("count", 1); | 4345 | config->group("General").writeEntry("count", 1); | ||
4346 | KConfigGroup group = config->group("1"); | 4346 | KConfigGroup group = config->group("1"); | ||
4347 | group.writeEntry("opacityactive", 90); | 4347 | group.writeEntry("opacityactive", 90); | ||
4348 | group.writeEntry("opacityactiverule", int(Rules::ForceTemporarily)); | 4348 | group.writeEntry("opacityactiverule", int(Rules::ForceTemporarily)); | ||
4349 | group.writeEntry("wmclass", "org.kde.foo"); | 4349 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4350 | group.writeEntry("wmclasscomplete", false); | 4350 | group.writeEntry("wmclasscomplete", false); | ||
4351 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4351 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4352 | group.sync(); | 4352 | group.sync(); | ||
4353 | RuleBook::self()->setConfig(config); | 4353 | RuleBook::self()->setConfig(config); | ||
4354 | workspace()->slotReconfigure(); | 4354 | workspace()->slotReconfigure(); | ||
4355 | 4355 | | |||
4356 | // Create the test client. | 4356 | // Create the test client. | ||
4357 | QFETCH(Test::XdgShellSurfaceType, type); | 4357 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4358 | ShellClient *client; | 4358 | XdgShellClient *client; | ||
4359 | Surface *surface; | 4359 | Surface *surface; | ||
4360 | XdgShellSurface *shellSurface; | 4360 | XdgShellSurface *shellSurface; | ||
4361 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4361 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4362 | QVERIFY(client); | 4362 | QVERIFY(client); | ||
4363 | QVERIFY(client->isActive()); | 4363 | QVERIFY(client->isActive()); | ||
4364 | QCOMPARE(client->opacity(), 0.9); | 4364 | QCOMPARE(client->opacity(), 0.9); | ||
4365 | 4365 | | |||
4366 | // The rule should be discarded when the client is closed. | 4366 | // The rule should be discarded when the client is closed. | ||
4367 | delete shellSurface; | 4367 | delete shellSurface; | ||
4368 | delete surface; | 4368 | delete surface; | ||
4369 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4369 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4370 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4370 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4371 | QVERIFY(client); | 4371 | QVERIFY(client); | ||
4372 | QVERIFY(client->isActive()); | 4372 | QVERIFY(client->isActive()); | ||
4373 | QCOMPARE(client->opacity(), 1.0); | 4373 | QCOMPARE(client->opacity(), 1.0); | ||
4374 | 4374 | | |||
4375 | // Destroy the client. | 4375 | // Destroy the client. | ||
4376 | delete shellSurface; | 4376 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4377 | delete surface; | 4377 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4378 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4378 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4379 | } | 4379 | } | ||
4380 | 4380 | | |||
4381 | TEST_DATA(testInactiveOpacityDontAffect) | 4381 | TEST_DATA(testInactiveOpacityDontAffect) | ||
4382 | 4382 | | |||
4383 | void TestShellClientRules::testInactiveOpacityDontAffect() | 4383 | void TestXdgShellClientRules::testInactiveOpacityDontAffect() | ||
4384 | { | 4384 | { | ||
4385 | // Initialize RuleBook with the test rule. | 4385 | // Initialize RuleBook with the test rule. | ||
4386 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4386 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4387 | config->group("General").writeEntry("count", 1); | 4387 | config->group("General").writeEntry("count", 1); | ||
4388 | KConfigGroup group = config->group("1"); | 4388 | KConfigGroup group = config->group("1"); | ||
4389 | group.writeEntry("opacityinactive", 80); | 4389 | group.writeEntry("opacityinactive", 80); | ||
4390 | group.writeEntry("opacityinactiverule", int(Rules::DontAffect)); | 4390 | group.writeEntry("opacityinactiverule", int(Rules::DontAffect)); | ||
4391 | group.writeEntry("wmclass", "org.kde.foo"); | 4391 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4392 | group.writeEntry("wmclasscomplete", false); | 4392 | group.writeEntry("wmclasscomplete", false); | ||
4393 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4393 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4394 | group.sync(); | 4394 | group.sync(); | ||
4395 | RuleBook::self()->setConfig(config); | 4395 | RuleBook::self()->setConfig(config); | ||
4396 | workspace()->slotReconfigure(); | 4396 | workspace()->slotReconfigure(); | ||
4397 | 4397 | | |||
4398 | // Create the test client. | 4398 | // Create the test client. | ||
4399 | QFETCH(Test::XdgShellSurfaceType, type); | 4399 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4400 | ShellClient *client; | 4400 | XdgShellClient *client; | ||
4401 | Surface *surface; | 4401 | Surface *surface; | ||
4402 | XdgShellSurface *shellSurface; | 4402 | XdgShellSurface *shellSurface; | ||
4403 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4403 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4404 | QVERIFY(client); | 4404 | QVERIFY(client); | ||
4405 | QVERIFY(client->isActive()); | 4405 | QVERIFY(client->isActive()); | ||
4406 | 4406 | | |||
4407 | // Make the client inactive. | 4407 | // Make the client inactive. | ||
4408 | workspace()->setActiveClient(nullptr); | 4408 | workspace()->setActiveClient(nullptr); | ||
4409 | QVERIFY(!client->isActive()); | 4409 | QVERIFY(!client->isActive()); | ||
4410 | 4410 | | |||
4411 | // The opacity of the client should not be affected by the rule. | 4411 | // The opacity of the client should not be affected by the rule. | ||
4412 | QCOMPARE(client->opacity(), 1.0); | 4412 | QCOMPARE(client->opacity(), 1.0); | ||
4413 | 4413 | | |||
4414 | // Destroy the client. | 4414 | // Destroy the client. | ||
4415 | delete shellSurface; | 4415 | delete shellSurface; | ||
4416 | delete surface; | 4416 | delete surface; | ||
4417 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4417 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4418 | } | 4418 | } | ||
4419 | 4419 | | |||
4420 | TEST_DATA(testInactiveOpacityForce) | 4420 | TEST_DATA(testInactiveOpacityForce) | ||
4421 | 4421 | | |||
4422 | void TestShellClientRules::testInactiveOpacityForce() | 4422 | void TestXdgShellClientRules::testInactiveOpacityForce() | ||
4423 | { | 4423 | { | ||
4424 | // Initialize RuleBook with the test rule. | 4424 | // Initialize RuleBook with the test rule. | ||
4425 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4425 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4426 | config->group("General").writeEntry("count", 1); | 4426 | config->group("General").writeEntry("count", 1); | ||
4427 | KConfigGroup group = config->group("1"); | 4427 | KConfigGroup group = config->group("1"); | ||
4428 | group.writeEntry("opacityinactive", 80); | 4428 | group.writeEntry("opacityinactive", 80); | ||
4429 | group.writeEntry("opacityinactiverule", int(Rules::Force)); | 4429 | group.writeEntry("opacityinactiverule", int(Rules::Force)); | ||
4430 | group.writeEntry("wmclass", "org.kde.foo"); | 4430 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4431 | group.writeEntry("wmclasscomplete", false); | 4431 | group.writeEntry("wmclasscomplete", false); | ||
4432 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4432 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4433 | group.sync(); | 4433 | group.sync(); | ||
4434 | RuleBook::self()->setConfig(config); | 4434 | RuleBook::self()->setConfig(config); | ||
4435 | workspace()->slotReconfigure(); | 4435 | workspace()->slotReconfigure(); | ||
4436 | 4436 | | |||
4437 | // Create the test client. | 4437 | // Create the test client. | ||
4438 | QFETCH(Test::XdgShellSurfaceType, type); | 4438 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4439 | ShellClient *client; | 4439 | XdgShellClient *client; | ||
4440 | Surface *surface; | 4440 | Surface *surface; | ||
4441 | XdgShellSurface *shellSurface; | 4441 | XdgShellSurface *shellSurface; | ||
4442 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4442 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4443 | QVERIFY(client); | 4443 | QVERIFY(client); | ||
4444 | QVERIFY(client->isActive()); | 4444 | QVERIFY(client->isActive()); | ||
4445 | QCOMPARE(client->opacity(), 1.0); | 4445 | QCOMPARE(client->opacity(), 1.0); | ||
4446 | 4446 | | |||
4447 | // Make the client inactive. | 4447 | // Make the client inactive. | ||
4448 | workspace()->setActiveClient(nullptr); | 4448 | workspace()->setActiveClient(nullptr); | ||
4449 | QVERIFY(!client->isActive()); | 4449 | QVERIFY(!client->isActive()); | ||
4450 | 4450 | | |||
4451 | // The opacity should be forced by the rule. | 4451 | // The opacity should be forced by the rule. | ||
4452 | QCOMPARE(client->opacity(), 0.8); | 4452 | QCOMPARE(client->opacity(), 0.8); | ||
4453 | 4453 | | |||
4454 | // Destroy the client. | 4454 | // Destroy the client. | ||
4455 | delete shellSurface; | 4455 | delete shellSurface; | ||
4456 | delete surface; | 4456 | delete surface; | ||
4457 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4457 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4458 | } | 4458 | } | ||
4459 | 4459 | | |||
4460 | TEST_DATA(testInactiveOpacityForceTemporarily) | 4460 | TEST_DATA(testInactiveOpacityForceTemporarily) | ||
4461 | 4461 | | |||
4462 | void TestShellClientRules::testInactiveOpacityForceTemporarily() | 4462 | void TestXdgShellClientRules::testInactiveOpacityForceTemporarily() | ||
4463 | { | 4463 | { | ||
4464 | // Initialize RuleBook with the test rule. | 4464 | // Initialize RuleBook with the test rule. | ||
4465 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4465 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4466 | config->group("General").writeEntry("count", 1); | 4466 | config->group("General").writeEntry("count", 1); | ||
4467 | KConfigGroup group = config->group("1"); | 4467 | KConfigGroup group = config->group("1"); | ||
4468 | group.writeEntry("opacityinactive", 80); | 4468 | group.writeEntry("opacityinactive", 80); | ||
4469 | group.writeEntry("opacityinactiverule", int(Rules::ForceTemporarily)); | 4469 | group.writeEntry("opacityinactiverule", int(Rules::ForceTemporarily)); | ||
4470 | group.writeEntry("wmclass", "org.kde.foo"); | 4470 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4471 | group.writeEntry("wmclasscomplete", false); | 4471 | group.writeEntry("wmclasscomplete", false); | ||
4472 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4472 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4473 | group.sync(); | 4473 | group.sync(); | ||
4474 | RuleBook::self()->setConfig(config); | 4474 | RuleBook::self()->setConfig(config); | ||
4475 | workspace()->slotReconfigure(); | 4475 | workspace()->slotReconfigure(); | ||
4476 | 4476 | | |||
4477 | // Create the test client. | 4477 | // Create the test client. | ||
4478 | QFETCH(Test::XdgShellSurfaceType, type); | 4478 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4479 | ShellClient *client; | 4479 | XdgShellClient *client; | ||
4480 | Surface *surface; | 4480 | Surface *surface; | ||
4481 | XdgShellSurface *shellSurface; | 4481 | XdgShellSurface *shellSurface; | ||
4482 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4482 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4483 | QVERIFY(client); | 4483 | QVERIFY(client); | ||
4484 | QVERIFY(client->isActive()); | 4484 | QVERIFY(client->isActive()); | ||
4485 | QCOMPARE(client->opacity(), 1.0); | 4485 | QCOMPARE(client->opacity(), 1.0); | ||
4486 | 4486 | | |||
4487 | // Make the client inactive. | 4487 | // Make the client inactive. | ||
Show All 10 Lines | |||||
4498 | QVERIFY(client); | 4498 | QVERIFY(client); | ||
4499 | QVERIFY(client->isActive()); | 4499 | QVERIFY(client->isActive()); | ||
4500 | QCOMPARE(client->opacity(), 1.0); | 4500 | QCOMPARE(client->opacity(), 1.0); | ||
4501 | workspace()->setActiveClient(nullptr); | 4501 | workspace()->setActiveClient(nullptr); | ||
4502 | QVERIFY(!client->isActive()); | 4502 | QVERIFY(!client->isActive()); | ||
4503 | QCOMPARE(client->opacity(), 1.0); | 4503 | QCOMPARE(client->opacity(), 1.0); | ||
4504 | 4504 | | |||
4505 | // Destroy the client. | 4505 | // Destroy the client. | ||
4506 | delete shellSurface; | 4506 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4507 | delete surface; | 4507 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4508 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4508 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4509 | } | 4509 | } | ||
4510 | 4510 | | |||
4511 | void TestShellClientRules::testMatchAfterNameChange() | 4511 | void TestXdgShellClientRules::testMatchAfterNameChange() | ||
4512 | { | 4512 | { | ||
4513 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4513 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4514 | config->group("General").writeEntry("count", 1); | 4514 | config->group("General").writeEntry("count", 1); | ||
4515 | 4515 | | |||
4516 | KConfigGroup group = config->group("1"); | 4516 | KConfigGroup group = config->group("1"); | ||
4517 | group.writeEntry("above", true); | 4517 | group.writeEntry("above", true); | ||
4518 | group.writeEntry("aboverule", int(Rules::Force)); | 4518 | group.writeEntry("aboverule", int(Rules::Force)); | ||
4519 | group.writeEntry("wmclass", "org.kde.foo"); | 4519 | group.writeEntry("wmclass", "org.kde.foo"); | ||
Show All 15 Lines | |||||
4535 | QSignalSpy desktopFileNameSpy(c, &AbstractClient::desktopFileNameChanged); | 4535 | QSignalSpy desktopFileNameSpy(c, &AbstractClient::desktopFileNameChanged); | ||
4536 | QVERIFY(desktopFileNameSpy.isValid()); | 4536 | QVERIFY(desktopFileNameSpy.isValid()); | ||
4537 | 4537 | | |||
4538 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | 4538 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | ||
4539 | QVERIFY(desktopFileNameSpy.wait()); | 4539 | QVERIFY(desktopFileNameSpy.wait()); | ||
4540 | QCOMPARE(c->keepAbove(), true); | 4540 | QCOMPARE(c->keepAbove(), true); | ||
4541 | } | 4541 | } | ||
4542 | 4542 | | |||
4543 | WAYLANDTEST_MAIN(TestShellClientRules) | 4543 | WAYLANDTEST_MAIN(TestXdgShellClientRules) | ||
4544 | #include "shell_client_rules_test.moc" | 4544 | #include "xdgshellclient_rules_test.moc" |
Memory pointed to by 'shellSurface' is freed twice.