[kwin] Fix TestVirtualDesktops
* enable compilation * Remove KActionCollection
This commit is contained in:
parent
f1a9dc4d25
commit
50987a6ddc
2 changed files with 18 additions and 26 deletions
|
@ -22,20 +22,20 @@ target_link_libraries( testWindowPaintData kwineffects Qt5::Widgets Qt5::Test )
|
||||||
########################################################
|
########################################################
|
||||||
# Test VirtualDesktopManager
|
# Test VirtualDesktopManager
|
||||||
########################################################
|
########################################################
|
||||||
# set( testVirtualDesktops_SRCS
|
set( testVirtualDesktops_SRCS
|
||||||
# test_virtual_desktops.cpp
|
test_virtual_desktops.cpp
|
||||||
# ../virtualdesktops.cpp
|
../virtualdesktops.cpp
|
||||||
# )
|
)
|
||||||
# kde4_add_unit_test( testVirtualDesktops TESTNAME kwin-TestVirtualDesktops ${testVirtualDesktops_SRCS} )
|
kde4_add_unit_test( testVirtualDesktops TESTNAME kwin-TestVirtualDesktops ${testVirtualDesktops_SRCS} )
|
||||||
#
|
|
||||||
# target_link_libraries( testVirtualDesktops
|
target_link_libraries( testVirtualDesktops
|
||||||
# Qt5::Test
|
Qt5::Test
|
||||||
# Qt5::Widgets
|
Qt5::Widgets
|
||||||
# KF5::I18n
|
KF5::I18n
|
||||||
# KF5::GlobalAccel
|
KF5::GlobalAccel
|
||||||
# KF5::ConfigCore
|
KF5::ConfigCore
|
||||||
# KF5::WindowSystem
|
KF5::WindowSystem
|
||||||
# )
|
)
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
# Test ClientMachine
|
# Test ClientMachine
|
||||||
|
|
|
@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "../virtualdesktops.h"
|
#include "../virtualdesktops.h"
|
||||||
// KDE
|
// KDE
|
||||||
#include <KDE/KActionCollection>
|
|
||||||
#include <KDE/KConfigGroup>
|
#include <KDE/KConfigGroup>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
@ -274,9 +273,8 @@ void TestVirtualDesktops::testDirection(const QString &actionName)
|
||||||
QCOMPARE(functor(0, wrap), result);
|
QCOMPARE(functor(0, wrap), result);
|
||||||
|
|
||||||
vds->setNavigationWrappingAround(wrap);
|
vds->setNavigationWrappingAround(wrap);
|
||||||
QScopedPointer<KActionCollection> keys(new KActionCollection(this));
|
vds->initShortcuts();
|
||||||
vds->initShortcuts(keys.data());
|
QAction *action = vds->findChild<QAction*>(actionName);
|
||||||
QAction *action = keys->action(actionName);
|
|
||||||
QVERIFY(action);
|
QVERIFY(action);
|
||||||
action->trigger();
|
action->trigger();
|
||||||
QCOMPARE(vds->current(), result);
|
QCOMPARE(vds->current(), result);
|
||||||
|
@ -551,25 +549,19 @@ void TestVirtualDesktops::name()
|
||||||
|
|
||||||
void TestVirtualDesktops::switchToShortcuts()
|
void TestVirtualDesktops::switchToShortcuts()
|
||||||
{
|
{
|
||||||
QScopedPointer<KActionCollection> keys(new KActionCollection(this));
|
|
||||||
VirtualDesktopManager *vds = VirtualDesktopManager::self();
|
VirtualDesktopManager *vds = VirtualDesktopManager::self();
|
||||||
vds->setCount(vds->maximum());
|
vds->setCount(vds->maximum());
|
||||||
vds->setCurrent(vds->maximum());
|
vds->setCurrent(vds->maximum());
|
||||||
QCOMPARE(vds->current(), vds->maximum());
|
QCOMPARE(vds->current(), vds->maximum());
|
||||||
vds->initShortcuts(keys.data());
|
vds->initShortcuts();
|
||||||
const QString toDesktop = QStringLiteral("Switch to Desktop %1");
|
const QString toDesktop = QStringLiteral("Switch to Desktop %1");
|
||||||
for (uint i=1; i<=vds->maximum(); ++i) {
|
for (uint i=1; i<=vds->maximum(); ++i) {
|
||||||
const QString desktop(toDesktop.arg(i));
|
const QString desktop(toDesktop.arg(i));
|
||||||
QAction *action = keys->action(desktop);
|
QAction *action = vds->findChild<QAction*>(desktop);
|
||||||
QVERIFY2(action, desktop.toUtf8().constData());
|
QVERIFY2(action, desktop.toUtf8().constData());
|
||||||
action->trigger();
|
action->trigger();
|
||||||
QCOMPARE(vds->current(), i);
|
QCOMPARE(vds->current(), i);
|
||||||
}
|
}
|
||||||
// test switchTo with incorrect data in QAction
|
|
||||||
QAction *action = keys->addAction(QStringLiteral("wrong"), vds, SLOT(slotSwitchTo()));
|
|
||||||
action->trigger();
|
|
||||||
// should still be on max
|
|
||||||
QCOMPARE(vds->current(), vds->maximum());
|
|
||||||
// invoke switchTo not from a QAction
|
// invoke switchTo not from a QAction
|
||||||
QMetaObject::invokeMethod(vds, "slotSwitchTo");
|
QMetaObject::invokeMethod(vds, "slotSwitchTo");
|
||||||
// should still be on max
|
// should still be on max
|
||||||
|
|
Loading…
Reference in a new issue