[autotests/integration] Add a test case for closing DebugConsole

This test simulates closing the DebugConsole through the window
decoration. Which unlike the dedicated button does not destroy the
DebugConsole.

CCBUG: 369858
This commit is contained in:
Martin Gräßlin 2016-10-04 13:37:25 +02:00
parent b2bed00c82
commit 4d47f6d831
2 changed files with 26 additions and 1 deletions

View file

@ -52,6 +52,7 @@ private Q_SLOTS:
void testWaylandClient_data();
void testWaylandClient();
void testInternalWindow();
void testClosingDebugConsole();
};
void DebugConsoleTest::initTestCase()
@ -502,6 +503,30 @@ void DebugConsoleTest::testInternalWindow()
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
}
void DebugConsoleTest::testClosingDebugConsole()
{
// this test verifies that the DebugConsole gets destroyed when closing the window
// BUG: 369858
DebugConsole *console = new DebugConsole;
QSignalSpy destroyedSpy(console, &QObject::destroyed);
QVERIFY(destroyedSpy.isValid());
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QVERIFY(clientAddedSpy.isValid());
console->show();
QCOMPARE(console->windowHandle()->isVisible(), true);
QTRY_COMPARE(clientAddedSpy.count(), 1);
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
QVERIFY(c->isInternal());
QCOMPARE(c->internalWindow(), console->windowHandle());
QVERIFY(c->isDecorated());
c->closeWindow();
QEXPECT_FAIL("", "BUG 369858", Continue);
QVERIFY(destroyedSpy.wait());
QCOMPARE(console->windowHandle()->isVisible(), false);
}
}
WAYLANDTEST_MAIN(KWin::DebugConsoleTest)

View file

@ -94,7 +94,7 @@ public:
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class DebugConsole : public QWidget
class KWIN_EXPORT DebugConsole : public QWidget
{
Q_OBJECT
public: