mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kduei: testing build fix
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e13f945e89
commit
eb0b79bfca
5 changed files with 18 additions and 52 deletions
|
@ -85,13 +85,8 @@ void tst_KActionCollection::writeSettings()
|
||||||
{
|
{
|
||||||
KConfigGroup cfg = clearConfig();
|
KConfigGroup cfg = clearConfig();
|
||||||
|
|
||||||
KShortcut defaultShortcut;
|
QKeySequence defaultShortcut = QKeySequence(Qt::Key_A, Qt::Key_B);
|
||||||
defaultShortcut.setPrimary(Qt::Key_A);
|
QKeySequence temporaryShortcut = QKeySequence(Qt::Key_C, Qt::Key_D);
|
||||||
defaultShortcut.setAlternate(Qt::Key_B);
|
|
||||||
|
|
||||||
KShortcut temporaryShortcut;
|
|
||||||
temporaryShortcut.setPrimary(Qt::Key_C);
|
|
||||||
temporaryShortcut.setAlternate(Qt::Key_D);
|
|
||||||
|
|
||||||
KAction *actionWithDifferentShortcut = new KAction(this);
|
KAction *actionWithDifferentShortcut = new KAction(this);
|
||||||
actionWithDifferentShortcut->setShortcut(defaultShortcut, KAction::DefaultShortcut);
|
actionWithDifferentShortcut->setShortcut(defaultShortcut, KAction::DefaultShortcut);
|
||||||
|
@ -117,7 +112,7 @@ void tst_KActionCollection::writeSettings()
|
||||||
|
|
||||||
collection->writeSettings(&cfg);
|
collection->writeSettings(&cfg);
|
||||||
|
|
||||||
QCOMPARE(cfg.readEntry("actionWithDifferentShortcut", QString()), KShortcut(actionWithDifferentShortcut->shortcut()).toString());
|
QCOMPARE(cfg.readEntry("actionWithDifferentShortcut", QString()), actionWithDifferentShortcut->shortcut().toString());
|
||||||
QCOMPARE(cfg.readEntry("immutableAction", QString()), QString());
|
QCOMPARE(cfg.readEntry("immutableAction", QString()), QString());
|
||||||
QCOMPARE(cfg.readEntry("actionWithSameShortcut", QString()), QString());
|
QCOMPARE(cfg.readEntry("actionWithSameShortcut", QString()), QString());
|
||||||
QCOMPARE(cfg.readEntry("actionToDelete", QString()), QString());
|
QCOMPARE(cfg.readEntry("actionToDelete", QString()), QString());
|
||||||
|
@ -129,13 +124,8 @@ void tst_KActionCollection::readSettings()
|
||||||
{
|
{
|
||||||
KConfigGroup cfg = clearConfig();
|
KConfigGroup cfg = clearConfig();
|
||||||
|
|
||||||
KShortcut defaultShortcut;
|
QKeySequence defaultShortcut = QKeySequence(Qt::Key_A, Qt::Key_B);
|
||||||
defaultShortcut.setPrimary(Qt::Key_A);
|
QKeySequence temporaryShortcut = QKeySequence(Qt::Key_C, Qt::Key_D);
|
||||||
defaultShortcut.setAlternate(Qt::Key_B);
|
|
||||||
|
|
||||||
KShortcut temporaryShortcut;
|
|
||||||
temporaryShortcut.setPrimary(Qt::Key_C);
|
|
||||||
temporaryShortcut.setAlternate(Qt::Key_D);
|
|
||||||
|
|
||||||
cfg.writeEntry("normalAction", defaultShortcut.toString());
|
cfg.writeEntry("normalAction", defaultShortcut.toString());
|
||||||
cfg.writeEntry("immutable", defaultShortcut.toString());
|
cfg.writeEntry("immutable", defaultShortcut.toString());
|
||||||
|
@ -154,14 +144,14 @@ void tst_KActionCollection::readSettings()
|
||||||
collection->addAction("empty", empty);
|
collection->addAction("empty", empty);
|
||||||
empty->setShortcut(temporaryShortcut, KAction::ActiveShortcut);
|
empty->setShortcut(temporaryShortcut, KAction::ActiveShortcut);
|
||||||
empty->setShortcut(defaultShortcut, KAction::DefaultShortcut);
|
empty->setShortcut(defaultShortcut, KAction::DefaultShortcut);
|
||||||
QCOMPARE(KShortcut(empty->shortcut()).toString(), temporaryShortcut.toString());
|
QCOMPARE(empty->shortcut().toString(), temporaryShortcut.toString());
|
||||||
|
|
||||||
collection->readSettings(&cfg);
|
collection->readSettings(&cfg);
|
||||||
|
|
||||||
QCOMPARE(KShortcut(normal->shortcut()).toString(), defaultShortcut.toString());
|
QCOMPARE(normal->shortcut().toString(), defaultShortcut.toString());
|
||||||
QCOMPARE(KShortcut(empty->shortcut()).toString(), defaultShortcut.toString());
|
QCOMPARE(empty->shortcut().toString(), defaultShortcut.toString());
|
||||||
|
|
||||||
QCOMPARE(KShortcut(immutable->shortcut()).toString(), temporaryShortcut.toString());
|
QCOMPARE(immutable->shortcut().toString(), temporaryShortcut.toString());
|
||||||
|
|
||||||
qDeleteAll(collection->actions());
|
qDeleteAll(collection->actions());
|
||||||
}
|
}
|
||||||
|
@ -225,16 +215,10 @@ void tst_KActionCollection::testSetShortcuts()
|
||||||
KAction *action = new KAction(i18n("Next Unread &Folder"), this);
|
KAction *action = new KAction(i18n("Next Unread &Folder"), this);
|
||||||
collection->addAction("go_next_unread_folder", action);
|
collection->addAction("go_next_unread_folder", action);
|
||||||
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Plus));
|
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Plus));
|
||||||
KShortcut shortcut = KShortcut(action->shortcut());
|
QKeySequence shortcut = action->shortcut();
|
||||||
shortcut.setAlternate( QKeySequence( Qt::CTRL+Qt::Key_Plus ) );
|
shortcut = QKeySequence(shortcut[0], Qt::CTRL + Qt::Key_Plus);
|
||||||
action->setShortcut( shortcut );
|
action->setShortcut( shortcut );
|
||||||
QCOMPARE(action->shortcut().toString(), QString("Alt++; Ctrl++"));
|
QCOMPARE(action->shortcut().toString(), QString("Alt++, Ctrl++"));
|
||||||
|
|
||||||
// Simpler way:
|
|
||||||
KShortcut shortcut2;
|
|
||||||
shortcut2.setPrimary( QKeySequence( Qt::ALT+Qt::Key_Plus ) );
|
|
||||||
shortcut2.setAlternate( QKeySequence( Qt::CTRL+Qt::Key_Plus ) );
|
|
||||||
QCOMPARE(shortcut2.toString(), QString("Alt++; Ctrl++"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_KDEMAIN(tst_KActionCollection, GUI)
|
QTEST_KDEMAIN(tst_KActionCollection, GUI)
|
||||||
|
|
|
@ -44,18 +44,16 @@ void tst_KStandardAction::implicitInsertionUsingCut()
|
||||||
|
|
||||||
void tst_KStandardAction::shortcutForActionId()
|
void tst_KStandardAction::shortcutForActionId()
|
||||||
{
|
{
|
||||||
KShortcut stdShortcut = KStandardShortcut::shortcut(KStandardShortcut::Cut);
|
QKeySequence stdShortcut = KStandardShortcut::shortcut(KStandardShortcut::Cut);
|
||||||
|
|
||||||
KAction *cut = KStandardAction::cut(NULL);
|
KAction *cut = KStandardAction::cut(NULL);
|
||||||
KShortcut actShortcut = cut->shortcut();
|
QKeySequence actShortcut = cut->shortcut();
|
||||||
QVERIFY(stdShortcut.primary() == actShortcut.primary());
|
QCOMPARE(stdShortcut.toString(), actShortcut.toString());
|
||||||
QVERIFY(actShortcut.alternate() == actShortcut.alternate());
|
|
||||||
delete cut;
|
delete cut;
|
||||||
|
|
||||||
cut = KStandardAction::create(KStandardAction::Cut, NULL, NULL, NULL);
|
cut = KStandardAction::create(KStandardAction::Cut, NULL, NULL, NULL);
|
||||||
actShortcut = cut->shortcut();
|
actShortcut = cut->shortcut();
|
||||||
QVERIFY(stdShortcut.primary() == actShortcut.primary());
|
QCOMPARE(stdShortcut.toString(), actShortcut.toString());
|
||||||
QVERIFY(actShortcut.alternate() == actShortcut.alternate());
|
|
||||||
delete cut;
|
delete cut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,18 +58,3 @@ void KStandardShortcutTest::testFindStdAccel()
|
||||||
QCOMPARE( KStandardShortcut::find( QString( "Ctrl+F" ) ), KStandardShortcut::Find );
|
QCOMPARE( KStandardShortcut::find( QString( "Ctrl+F" ) ), KStandardShortcut::Find );
|
||||||
QCOMPARE( KStandardShortcut::find( QString( "Ctrl+Shift+Alt+G" ) ), KStandardShortcut::AccelNone );
|
QCOMPARE( KStandardShortcut::find( QString( "Ctrl+Shift+Alt+G" ) ), KStandardShortcut::AccelNone );
|
||||||
}
|
}
|
||||||
|
|
||||||
void KStandardShortcutTest::testRemoveShortcut()
|
|
||||||
{
|
|
||||||
KShortcut cutShortCut = KStandardShortcut::shortcut( KStandardShortcut::Cut );
|
|
||||||
cutShortCut.remove( Qt::SHIFT + Qt::Key_Delete, KShortcut::KeepEmpty );
|
|
||||||
cutShortCut.remove( Qt::CTRL + Qt::Key_X, KShortcut::KeepEmpty );
|
|
||||||
//qDebug( "%s", qPrintable( cutShortCut.toString() ) );
|
|
||||||
QVERIFY( cutShortCut.isEmpty() );
|
|
||||||
|
|
||||||
cutShortCut = KStandardShortcut::shortcut( KStandardShortcut::Cut );
|
|
||||||
//remove primary shortcut. We expect the alternate to become primary.
|
|
||||||
cutShortCut.remove( Qt::CTRL + Qt::Key_X, KShortcut::RemoveEmpty );
|
|
||||||
QVERIFY( cutShortCut.primary() == QKeySequence(Qt::SHIFT + Qt::Key_Delete) );
|
|
||||||
QVERIFY( cutShortCut.alternate().isEmpty() );
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ private Q_SLOTS:
|
||||||
void testLabel();
|
void testLabel();
|
||||||
void testShortcut();
|
void testShortcut();
|
||||||
void testFindStdAccel();
|
void testFindStdAccel();
|
||||||
void testRemoveShortcut();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ void KXmlGui_UnitTest::testActionListAndSeparator()
|
||||||
|
|
||||||
KAction* action1 = new KAction(this);
|
KAction* action1 = new KAction(this);
|
||||||
action1->setObjectName("action1");
|
action1->setObjectName("action1");
|
||||||
action1->setShortcut(KShortcut("Ctrl+2"));
|
action1->setShortcut(QKeySequence("Ctrl+2"));
|
||||||
QList<QAction*> actionList;
|
QList<QAction*> actionList;
|
||||||
actionList << action1;
|
actionList << action1;
|
||||||
client.plugActionList("view_groups_list", actionList);
|
client.plugActionList("view_groups_list", actionList);
|
||||||
|
|
Loading…
Add table
Reference in a new issue