[tabbox] Bring back disabled unit tests
SwitcherItem is disabled for the unit test to reduce pulled in deps.icc-effect-5.14.5
parent
a290209b3d
commit
1f4981fc0b
|
@ -1,3 +1,5 @@
|
|||
include_directories(${KWIN_SOURCE_DIR})
|
||||
add_definitions(-DKWIN_UNIT_TEST)
|
||||
########################################################
|
||||
# Test TabBox::ClientModel
|
||||
########################################################
|
||||
|
@ -7,14 +9,24 @@ set( testTabBoxClientModel_SRCS
|
|||
../tabboxconfig.cpp
|
||||
../tabboxhandler.cpp
|
||||
test_tabbox_clientmodel.cpp
|
||||
mock_declarative.cpp
|
||||
mock_tabboxhandler.cpp
|
||||
mock_tabboxclient.cpp
|
||||
)
|
||||
|
||||
#kde4_add_unit_test( testTabBoxClientModel TESTNAME kwin-testTabBoxClientModel ${testTabBoxClientModel_SRCS} )
|
||||
|
||||
#target_link_libraries( testTabBoxClientModel ${KDE4_KDEUI_LIBS} Qt5::Declarative ${X11_LIBRARIES} Qt5::Test )
|
||||
add_executable( testTabBoxClientModel ${testTabBoxClientModel_SRCS} )
|
||||
target_link_libraries( testTabBoxClientModel
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Quick
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
KF5::I18n
|
||||
KF5::Service
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(kwin-testTabBoxClientModel testTabBoxClientModel)
|
||||
ecm_mark_as_test(testTabBoxClientModel)
|
||||
|
||||
########################################################
|
||||
# Test TabBox::TabBoxHandler
|
||||
|
@ -25,14 +37,24 @@ set( testTabBoxHandler_SRCS
|
|||
../tabboxconfig.cpp
|
||||
../tabboxhandler.cpp
|
||||
test_tabbox_handler.cpp
|
||||
mock_declarative.cpp
|
||||
mock_tabboxhandler.cpp
|
||||
mock_tabboxclient.cpp
|
||||
)
|
||||
|
||||
# kde4_add_unit_test( testTabBoxHandler TESTNAME kwin-testTabBoxHandler ${testTabBoxHandler_SRCS} )
|
||||
|
||||
# target_link_libraries( testTabBoxHandler ${KDE4_KDEUI_LIBS} Qt5::Core Qt5::Gui Qt5::Declarative Qt5::Test ${X11_LIBRARIES} )
|
||||
add_executable( testTabBoxHandler ${testTabBoxHandler_SRCS} )
|
||||
target_link_libraries( testTabBoxHandler
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Quick
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
KF5::I18n
|
||||
KF5::Service
|
||||
KF5::WindowSystem
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(kwin-testTabBoxHandler testTabBoxHandler)
|
||||
ecm_mark_as_test(testTabBoxHandler)
|
||||
|
||||
########################################################
|
||||
# Test TabBox::TabBoxConfig
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "declarative.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
namespace TabBox
|
||||
{
|
||||
DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent)
|
||||
: QQuickView(parent)
|
||||
{
|
||||
Q_UNUSED(model)
|
||||
Q_UNUSED(mode)
|
||||
}
|
||||
|
||||
void DeclarativeView::currentIndexChanged(int row)
|
||||
{
|
||||
Q_UNUSED(row)
|
||||
}
|
||||
|
||||
void DeclarativeView::updateQmlSource(bool force)
|
||||
{
|
||||
Q_UNUSED(force)
|
||||
}
|
||||
|
||||
void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(disableAnimation)
|
||||
}
|
||||
|
||||
bool DeclarativeView::sendKeyEvent(QKeyEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeclarativeView::slotEmbeddedChanged(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
}
|
||||
|
||||
void DeclarativeView::slotUpdateGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
void DeclarativeView::slotWindowChanged(WId wId, unsigned int properties)
|
||||
{
|
||||
Q_UNUSED(wId)
|
||||
Q_UNUSED(properties)
|
||||
}
|
||||
|
||||
void DeclarativeView::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void DeclarativeView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void DeclarativeView::hideEvent(QHideEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
bool DeclarativeView::x11Event(XEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Tabbox
|
||||
} // namespace KWin
|
||||
|
||||
#include "../declarative.moc"
|
|
@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define KWIN_MOCK_TABBOX_CLIENT_H
|
||||
|
||||
#include "../tabboxhandler.h"
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
class MockTabBoxClient : public TabBox::TabBoxClient
|
||||
|
@ -58,6 +61,9 @@ public:
|
|||
virtual int y() const {
|
||||
return 0;
|
||||
}
|
||||
virtual QIcon icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_caption;
|
||||
|
|
|
@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
MockTabBoxHandler::MockTabBoxHandler()
|
||||
: TabBoxHandler()
|
||||
MockTabBoxHandler::MockTabBoxHandler(QObject *parent)
|
||||
: TabBoxHandler(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class MockTabBoxHandler : public TabBox::TabBoxHandler
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MockTabBoxHandler();
|
||||
MockTabBoxHandler(QObject *parent = nullptr);
|
||||
virtual ~MockTabBoxHandler();
|
||||
virtual void activateAndClose() {
|
||||
}
|
||||
|
|
|
@ -136,6 +136,7 @@ QQuickWindow *TabBoxHandlerPrivate::window() const
|
|||
return m_mainItem->findChild<QQuickWindow*>();
|
||||
}
|
||||
|
||||
#ifndef KWIN_UNIT_TEST
|
||||
SwitcherItem *TabBoxHandlerPrivate::switcherItem() const
|
||||
{
|
||||
if (!m_mainItem) {
|
||||
|
@ -148,6 +149,7 @@ SwitcherItem *TabBoxHandlerPrivate::switcherItem() const
|
|||
}
|
||||
return m_mainItem->findChild<SwitcherItem*>();
|
||||
}
|
||||
#endif
|
||||
|
||||
ClientModel* TabBoxHandlerPrivate::clientModel() const
|
||||
{
|
||||
|
@ -226,6 +228,7 @@ void TabBoxHandlerPrivate::endHighlightWindows(bool abort)
|
|||
xcb_delete_property(connection(), config.isShowTabBox() && w ? w->winId() : rootWindow(), m_highlightWindowsAtom);
|
||||
}
|
||||
|
||||
#ifndef KWIN_UNIT_TEST
|
||||
QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
|
||||
{
|
||||
auto findSwitcher = [this, desktopMode] {
|
||||
|
@ -280,9 +283,11 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void TabBoxHandlerPrivate::show()
|
||||
{
|
||||
#ifndef KWIN_UNIT_TEST
|
||||
if (m_qmlContext.isNull()) {
|
||||
qmlRegisterType<SwitcherItem>("org.kde.kwin", 2, 0, "Switcher");
|
||||
m_qmlContext.reset(new QQmlContext(Scripting::self()->qmlEngine()));
|
||||
|
@ -321,6 +326,7 @@ void TabBoxHandlerPrivate::show()
|
|||
// everything is prepared, so let's make the whole thing visible
|
||||
item->setVisible(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
|
@ -379,9 +385,11 @@ void TabBoxHandler::hide(bool abort)
|
|||
if (d->config.isHighlightWindows()) {
|
||||
d->endHighlightWindows(abort);
|
||||
}
|
||||
#ifndef KWIN_UNIT_TEST
|
||||
if (SwitcherItem *item = d->switcherItem()) {
|
||||
item->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
if (QQuickWindow *w = d->window()) {
|
||||
w->hide();
|
||||
w->destroy();
|
||||
|
|
Loading…
Reference in New Issue