[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/tests
From:       David Faure <faure () kde ! org>
Date:       2010-12-09 12:36:15
Message-ID: 20101209123615.246CDAC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204885 by dfaure:

Skip the tests that need kglobalaccel, if kdebase is not installed.


 M  +19 -0     kglobalshortcuttest.cpp  
 M  +2 -0      kglobalshortcuttest.h  


--- trunk/KDE/kdelibs/kdeui/tests/kglobalshortcuttest.cpp #1204884:1204885
@@ -29,6 +29,7 @@
 #include <kglobal.h>
 #include <kglobalaccel.h>
 #include <kdebug.h>
+#include <kservice.h>
 
 #include <unistd.h>
 
@@ -48,6 +49,11 @@
 //we need a KComponentData and a GUI so that the implementation can grab keys
 QTEST_KDEMAIN( KGlobalShortcutTest, GUI )
 
+void KGlobalShortcutTest::initTestCase()
+{
+    m_daemonInstalled = KService::serviceByDesktopName("kglobalaccel") != 0;
+}
+
 void KGlobalShortcutTest::setupTest(QString id)
 {
     if (m_actionA) {
@@ -90,6 +96,9 @@
 {
     setupTest("testSetShortcut");
 
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
+
     // Just ensure that the desired values are set for both actions
     KShortcut cutA(sequenceA, sequenceB);
     QCOMPARE(m_actionA->globalShortcut(), cutA);
@@ -107,6 +116,8 @@
 {
     // Skip this. The above testcase hasn't changed the actions
     setupTest("testFindActionByKey");
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
 
     QList<KGlobalShortcutInfo> actionId = KGlobalAccel::self()->getGlobalShortcutsByKey(sequenceB);
     QCOMPARE(actionId.size(), 1);
@@ -135,6 +146,8 @@
     // Skip this. The above testcase hasn't changed the actions
     setupTest("testChangeShortcut");
 
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
     // Change the shortcut
     KShortcut newCutA(sequenceC);
     m_actionA->setGlobalShortcut(newCutA, KAction::ActiveShortcut, KAction::NoAutoloading);
@@ -166,6 +179,8 @@
 void KGlobalShortcutTest::testStealShortcut()
 {
     setupTest("testStealShortcut");
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
 
     // Steal a shortcut from an action. First ensure the initial state is
     // correct
@@ -221,6 +236,8 @@
 void KGlobalShortcutTest::testListActions()
 {
     setupTest("testListActions");
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
 
     // As in kdebase/workspace/kcontrol/keys/globalshortcuts.cpp
     KGlobalAccel *kga = KGlobalAccel::self();
@@ -388,6 +405,8 @@
     // Ensure that forgetGlobalShortcut can be called on any action.
     KAction a("Test", NULL);
     a.forgetGlobalShortcut();
+    if (!m_daemonInstalled)
+        QSKIP("kglobalaccel not installed", SkipAll);
 
     // We forget these two shortcuts and check that the component is gone
     // after that. If not it can mean the forgetGlobalShortcut() call is
--- trunk/KDE/kdelibs/kdeui/tests/kglobalshortcuttest.h #1204884:1204885
@@ -30,6 +30,7 @@
 {
     Q_OBJECT
 private Q_SLOTS:
+    void initTestCase();
     void testSetShortcut();
     void testFindActionByKey();
     void testChangeShortcut();
@@ -53,6 +54,7 @@
 
     KAction *m_actionA;
     KAction *m_actionB;
+    bool m_daemonInstalled;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic