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
|
|
|
|
*/
|
2016-09-08 13:08:45 +00:00
|
|
|
#include "../testutils.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "mock_tabboxhandler.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "tabbox/clientmodel.h"
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtTest>
|
2022-03-09 16:25:44 +00:00
|
|
|
#include <private/qtx11extras_p.h>
|
2012-08-08 20:28:22 +00:00
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
|
|
|
|
class TestTabBoxHandler : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2021-06-08 07:02:14 +00:00
|
|
|
private Q_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()
|
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
qApp->setProperty("x11Connection", QVariant::fromValue<void *>(QX11Info::connection()));
|
2015-02-18 10:19:04 +00:00
|
|
|
}
|
|
|
|
|
2012-08-08 20:28:22 +00:00
|
|
|
void TestTabBoxHandler::testDontCrashUpdateOutlineNullClient()
|
|
|
|
{
|
|
|
|
MockTabBoxHandler tabboxhandler;
|
|
|
|
TabBox::TabBoxConfig config;
|
|
|
|
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"
|