68c675d00d
Occasionally, I see complaints about the file organization of kwin, which is fair enough. This change makes the source code more relocatable by removing relative paths from includes. CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories of kwin library. This means that as long as you link against kwin target, the real location of the source code of the library doesn't matter. With autotests, things are not as convenient as with kwin target. Some tests use cpp files from kwin core. If we move all source code in a src/ directory, they will need to be adjusted, but mostly only in build scripts.
74 lines
3.4 KiB
C++
74 lines
3.4 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
#include "tabbox/tabboxconfig.h"
|
|
#include <QtTest>
|
|
using namespace KWin;
|
|
using namespace KWin::TabBox;
|
|
|
|
class TestTabBoxConfig : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private Q_SLOTS:
|
|
void testDefaultCtor();
|
|
void testAssignmentOperator();
|
|
};
|
|
|
|
void TestTabBoxConfig::testDefaultCtor()
|
|
{
|
|
TabBoxConfig config;
|
|
QCOMPARE(config.isShowTabBox(), TabBoxConfig::defaultShowTabBox());
|
|
QCOMPARE(config.isHighlightWindows(), TabBoxConfig::defaultHighlightWindow());
|
|
QCOMPARE(config.tabBoxMode(), TabBoxConfig::ClientTabBox);
|
|
QCOMPARE(config.clientDesktopMode(), TabBoxConfig::defaultDesktopMode());
|
|
QCOMPARE(config.clientActivitiesMode(), TabBoxConfig::defaultActivitiesMode());
|
|
QCOMPARE(config.clientApplicationsMode(), TabBoxConfig::defaultApplicationsMode());
|
|
QCOMPARE(config.clientMinimizedMode(), TabBoxConfig::defaultMinimizedMode());
|
|
QCOMPARE(config.showDesktopMode(), TabBoxConfig::defaultShowDesktopMode());
|
|
QCOMPARE(config.clientMultiScreenMode(), TabBoxConfig::defaultMultiScreenMode());
|
|
QCOMPARE(config.clientSwitchingMode(), TabBoxConfig::defaultSwitchingMode());
|
|
QCOMPARE(config.desktopSwitchingMode(), TabBoxConfig::MostRecentlyUsedDesktopSwitching);
|
|
QCOMPARE(config.layoutName(), TabBoxConfig::defaultLayoutName());
|
|
}
|
|
|
|
void TestTabBoxConfig::testAssignmentOperator()
|
|
{
|
|
TabBoxConfig config;
|
|
// changing all values of the config object
|
|
config.setShowTabBox(!TabBoxConfig::defaultShowTabBox());
|
|
config.setHighlightWindows(!TabBoxConfig::defaultHighlightWindow());
|
|
config.setTabBoxMode(TabBoxConfig::DesktopTabBox);
|
|
config.setClientDesktopMode(TabBoxConfig::AllDesktopsClients);
|
|
config.setClientActivitiesMode(TabBoxConfig::AllActivitiesClients);
|
|
config.setClientApplicationsMode(TabBoxConfig::OneWindowPerApplication);
|
|
config.setClientMinimizedMode(TabBoxConfig::ExcludeMinimizedClients);
|
|
config.setShowDesktopMode(TabBoxConfig::ShowDesktopClient);
|
|
config.setClientMultiScreenMode(TabBoxConfig::ExcludeCurrentScreenClients);
|
|
config.setClientSwitchingMode(TabBoxConfig::StackingOrderSwitching);
|
|
config.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching);
|
|
config.setLayoutName(QStringLiteral("grid"));
|
|
TabBoxConfig config2;
|
|
config2 = config;
|
|
// verify the config2 values
|
|
QCOMPARE(config2.isShowTabBox(), !TabBoxConfig::defaultShowTabBox());
|
|
QCOMPARE(config2.isHighlightWindows(), !TabBoxConfig::defaultHighlightWindow());
|
|
QCOMPARE(config2.tabBoxMode(), TabBoxConfig::DesktopTabBox);
|
|
QCOMPARE(config2.clientDesktopMode(), TabBoxConfig::AllDesktopsClients);
|
|
QCOMPARE(config2.clientActivitiesMode(), TabBoxConfig::AllActivitiesClients);
|
|
QCOMPARE(config2.clientApplicationsMode(), TabBoxConfig::OneWindowPerApplication);
|
|
QCOMPARE(config2.clientMinimizedMode(), TabBoxConfig::ExcludeMinimizedClients);
|
|
QCOMPARE(config2.showDesktopMode(), TabBoxConfig::ShowDesktopClient);
|
|
QCOMPARE(config2.clientMultiScreenMode(), TabBoxConfig::ExcludeCurrentScreenClients);
|
|
QCOMPARE(config2.clientSwitchingMode(), TabBoxConfig::StackingOrderSwitching);
|
|
QCOMPARE(config2.desktopSwitchingMode(), TabBoxConfig::StaticDesktopSwitching);
|
|
QCOMPARE(config2.layoutName(), QStringLiteral("grid"));
|
|
}
|
|
|
|
QTEST_MAIN(TestTabBoxConfig)
|
|
|
|
#include "test_tabbox_config.moc"
|