Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/dont_crash_cancel_animation.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | class DontCrashCancelAnimationFromAnimationEndedTest : public QObject | 47 | class DontCrashCancelAnimationFromAnimationEndedTest : public QObject | ||
48 | { | 48 | { | ||
49 | Q_OBJECT | 49 | Q_OBJECT | ||
50 | private Q_SLOTS: | 50 | private Q_SLOTS: | ||
51 | void initTestCase(); | 51 | void initTestCase(); | ||
52 | void init(); | 52 | void init(); | ||
53 | void cleanup(); | 53 | void cleanup(); | ||
54 | void testScript(); | 54 | void testScript(); | ||
55 | | ||||
56 | private: | | |||
57 | void unlock(); | | |||
58 | AbstractClient *showWindow(); | | |||
59 | }; | 55 | }; | ||
60 | 56 | | |||
61 | void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase() | 57 | void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase() | ||
62 | { | 58 | { | ||
63 | qRegisterMetaType<KWin::Deleted*>(); | 59 | qRegisterMetaType<KWin::Deleted*>(); | ||
64 | qRegisterMetaType<KWin::ShellClient*>(); | 60 | qRegisterMetaType<KWin::ShellClient*>(); | ||
65 | qRegisterMetaType<KWin::AbstractClient*>(); | 61 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
66 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 62 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
Show All 29 Lines | 89 | for (auto it = children.begin(); it != children.end(); ++it) { | |||
96 | } | 92 | } | ||
97 | QVERIFY(QMetaObject::invokeMethod(*it, "effectLoaded", Q_ARG(KWin::Effect*, effect), Q_ARG(QString, QStringLiteral("crashy")))); | 93 | QVERIFY(QMetaObject::invokeMethod(*it, "effectLoaded", Q_ARG(KWin::Effect*, effect), Q_ARG(QString, QStringLiteral("crashy")))); | ||
98 | break; | 94 | break; | ||
99 | } | 95 | } | ||
100 | QVERIFY(static_cast<EffectsHandlerImpl*>(effects)->isEffectLoaded(QStringLiteral("crashy"))); | 96 | QVERIFY(static_cast<EffectsHandlerImpl*>(effects)->isEffectLoaded(QStringLiteral("crashy"))); | ||
101 | 97 | | |||
102 | using namespace KWayland::Client; | 98 | using namespace KWayland::Client; | ||
103 | // create a window | 99 | // create a window | ||
104 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | | |||
105 | QVERIFY(clientAddedSpy.isValid()); | | |||
106 | | ||||
107 | Surface *surface = Test::createSurface(Test::waylandCompositor()); | 100 | Surface *surface = Test::createSurface(Test::waylandCompositor()); | ||
108 | QVERIFY(surface); | 101 | QVERIFY(surface); | ||
109 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | 102 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | ||
110 | QVERIFY(shellSurface); | 103 | QVERIFY(shellSurface); | ||
111 | // let's render | 104 | // let's render | ||
112 | Test::render(surface, QSize(100, 50), Qt::blue); | 105 | auto c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | ||
113 | | ||||
114 | Test::flushWaylandConnection(); | | |||
115 | QVERIFY(clientAddedSpy.wait()); | | |||
116 | AbstractClient *c = workspace()->activeClient(); | | |||
117 | QVERIFY(c); | 106 | QVERIFY(c); | ||
118 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | 107 | QCOMPARE(workspace()->activeClient(), c); | ||
119 | 108 | | |||
120 | // make sure we animate | 109 | // make sure we animate | ||
121 | QTest::qWait(200); | 110 | QTest::qWait(200); | ||
122 | 111 | | |||
123 | // wait for the window to be passed to Deleted | 112 | // wait for the window to be passed to Deleted | ||
124 | QSignalSpy windowDeletedSpy(c, &AbstractClient::windowClosed); | 113 | QSignalSpy windowDeletedSpy(c, &AbstractClient::windowClosed); | ||
125 | QVERIFY(windowDeletedSpy.isValid()); | 114 | QVERIFY(windowDeletedSpy.isValid()); | ||
126 | 115 | | |||
Show All 11 Lines |