2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2012-08-08 20:28:22 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
|
2012-08-08 20:28:22 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2012-08-08 20:28:22 +00:00
|
|
|
#include "mock_tabboxhandler.h"
|
|
|
|
#include "clientmodel.h"
|
2016-09-08 13:08:45 +00:00
|
|
|
#include "../testutils.h"
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtTest>
|
2015-02-18 10:19:04 +00:00
|
|
|
#include <QX11Info>
|
2012-08-08 20:28:22 +00:00
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
|
|
|
|
class TestTabBoxHandler : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private slots:
|
2015-02-18 10:19:04 +00:00
|
|
|
void initTestCase();
|
2012-08-08 20:28:22 +00:00
|
|
|
/**
|
|
|
|
* Test to verify that update outline does not crash
|
|
|
|
* if the ModelIndex for which the outline should be
|
|
|
|
* shown is not valid. That is accessing the Pointer
|
|
|
|
* to the Client returns an invalid QVariant.
|
|
|
|
* BUG: 304620
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-08 20:28:22 +00:00
|
|
|
void testDontCrashUpdateOutlineNullClient();
|
|
|
|
};
|
|
|
|
|
2015-02-18 10:19:04 +00:00
|
|
|
void TestTabBoxHandler::initTestCase()
|
|
|
|
{
|
|
|
|
qApp->setProperty("x11Connection", QVariant::fromValue<void*>(QX11Info::connection()));
|
|
|
|
}
|
|
|
|
|
2012-08-08 20:28:22 +00:00
|
|
|
void TestTabBoxHandler::testDontCrashUpdateOutlineNullClient()
|
|
|
|
{
|
|
|
|
MockTabBoxHandler tabboxhandler;
|
|
|
|
TabBox::TabBoxConfig config;
|
|
|
|
config.setTabBoxMode(TabBox::TabBoxConfig::ClientTabBox);
|
|
|
|
config.setShowTabBox(false);
|
|
|
|
config.setHighlightWindows(false);
|
|
|
|
tabboxhandler.setConfig(config);
|
|
|
|
// now show the tabbox which will attempt to show the outline
|
|
|
|
tabboxhandler.show();
|
|
|
|
}
|
|
|
|
|
2016-09-08 13:08:45 +00:00
|
|
|
Q_CONSTRUCTOR_FUNCTION(forceXcb)
|
2012-08-08 20:28:22 +00:00
|
|
|
QTEST_MAIN(TestTabBoxHandler)
|
|
|
|
|
|
|
|
#include "test_tabbox_handler.moc"
|