generic: misc cleanups

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-12 11:07:40 +00:00
parent 17bdb396ea
commit 383d2cd332
4 changed files with 18 additions and 20 deletions

View file

@ -19,7 +19,6 @@
#ifndef QTEST_KDE_H
#define QTEST_KDE_H
#include <QtTest/QtTest>
#include <stdlib.h>
#include <assert.h>
#include <kaboutdata.h>
@ -30,6 +29,7 @@
#include <QtGui/QApplication>
#include <QtCore/QEventLoop>
#include <QtTest/QSignalSpy>
#include <QtTest/QtTest>
#include <QTimer>
#include <QtCore/qfile.h>
#include <QtCore/qdir.h>

View file

@ -467,8 +467,6 @@ void KBuildSycoca::save(QDataStream* str)
str->device()->seek(0);
(*str) << (qint32) KSycoca::version();
KSycocaFactory * servicetypeFactory = 0;
KBuildMimeTypeFactory * mimeTypeFactory = 0;
KBuildServiceFactory * serviceFactory = 0;
for(KSycocaFactoryList::Iterator factory = factories()->begin();
factory != factories()->end();
@ -477,11 +475,7 @@ void KBuildSycoca::save(QDataStream* str)
qint32 aId;
qint32 aOffset;
aId = (*factory)->factoryId();
if ( aId == KST_KServiceTypeFactory )
servicetypeFactory = *factory;
else if ( aId == KST_KMimeTypeFactory )
mimeTypeFactory = static_cast<KBuildMimeTypeFactory *>( *factory );
else if ( aId == KST_KServiceFactory )
if ( aId == KST_KServiceFactory )
serviceFactory = static_cast<KBuildServiceFactory *>( *factory );
aOffset = (*factory)->offset(); // not set yet, so always 0
(*str) << aId;

View file

@ -68,6 +68,7 @@ void KGlobalShortcutTest::setupTest(QString id)
// Ensure that the previous test did cleanup correctly
KGlobalAccel *kga = KGlobalAccel::self();
Q_UNUSED(kga);
m_actionA = new KAction("Text For Action A", this);
m_actionA->setObjectName("Action A:" + id);
@ -235,6 +236,7 @@ void KGlobalShortcutTest::testListActions()
// As in kdebase/workspace/kcontrol/keys/globalshortcuts.cpp
KGlobalAccel *kga = KGlobalAccel::self();
Q_UNUSED(kga);
}
@ -366,6 +368,7 @@ void KGlobalShortcutTest::testForgetGlobalShortcut()
sleep(1);
KGlobalAccel *kga = KGlobalAccel::self();
Q_UNUSED(kga);
}

View file

@ -172,28 +172,29 @@ void KRunUnitTest::testProcessDesktopExecNoFile_data()
QVERIFY(!kmailservice.isEmpty());
}
// NOTE: using QString() for concats to avoid QStringBuilder metatype, which is not valid
QTest::newRow("%U l0") << "kdeinit4 %U" << l0 << false << kdeinit;
QTest::newRow("%U l1") << "kdeinit4 %U" << l1 << false << kdeinit + " /tmp";
QTest::newRow("%U l2") << "kdeinit4 %U" << l2 << false << kdeinit + " http://localhost/foo";
QTest::newRow("%U l3") << "kdeinit4 %U" << l3 << false << kdeinit + " /local/file http://remotehost.org/bar";
QTest::newRow("%U l1") << "kdeinit4 %U" << l1 << false << QString(kdeinit + " /tmp");
QTest::newRow("%U l2") << "kdeinit4 %U" << l2 << false << QString(kdeinit + " http://localhost/foo");
QTest::newRow("%U l3") << "kdeinit4 %U" << l3 << false << QString(kdeinit + " /local/file http://remotehost.org/bar");
//QTest::newRow("%u l0") << "kdeinit4 %u" << l0 << false << kdeinit; // gives runtime warning
QTest::newRow("%u l1") << "kdeinit4 %u" << l1 << false << kdeinit + " /tmp";
QTest::newRow("%u l2") << "kdeinit4 %u" << l2 << false << kdeinit + " http://localhost/foo";
QTest::newRow("%u l1") << "kdeinit4 %u" << l1 << false << QString(kdeinit + " /tmp");
QTest::newRow("%u l2") << "kdeinit4 %u" << l2 << false << QString(kdeinit + " http://localhost/foo");
//QTest::newRow("%u l3") << "kdeinit4 %u" << l3 << false << kdeinit; // gives runtime warning
QTest::newRow("%F l0") << "kdeinit4 %F" << l0 << false << kdeinit;
QTest::newRow("%F l1") << "kdeinit4 %F" << l1 << false << kdeinit + " /tmp";
QTest::newRow("%F l2") << "kdeinit4 %F" << l2 << false << kioexec + " 'kdeinit4 %F' http://localhost/foo";
QTest::newRow("%F l3") << "kdeinit4 %F" << l3 << false << kioexec + " 'kdeinit4 %F' file:///local/file http://remotehost.org/bar";
QTest::newRow("%F l1") << "kdeinit4 %F" << l1 << false << QString(kdeinit + " /tmp");
QTest::newRow("%F l2") << "kdeinit4 %F" << l2 << false << QString(kioexec + " 'kdeinit4 %F' http://localhost/foo");
QTest::newRow("%F l3") << "kdeinit4 %F" << l3 << false << QString(kioexec + " 'kdeinit4 %F' file:///local/file http://remotehost.org/bar");
QTest::newRow("%F l1 tempfile") << "kdeinit4 %F" << l1 << true << kioexec + " --tempfiles 'kdeinit4 %F' file:///tmp";
QTest::newRow("%F l1 tempfile") << "kdeinit4 %F" << l1 << true << QString(kioexec + " --tempfiles 'kdeinit4 %F' file:///tmp");
QTest::newRow("sh -c kdeinit4 %F") << "sh -c \"kdeinit4 \"'\\\"'\"%F\"'\\\"'"
<< l1 << false << m_sh + " -c 'kdeinit4 \\\"/tmp\\\"'";
<< l1 << false << QString(m_sh + " -c 'kdeinit4 \\\"/tmp\\\"'");
QTest::newRow("kmailservice %u l1") << "kmailservice %u" << l1 << false << kmailservice + " /tmp";
QTest::newRow("kmailservice %u l4") << "kmailservice %u" << l4 << false << kmailservice + " http://login:password@www.kde.org";
QTest::newRow("kmailservice %u l1") << "kmailservice %u" << l1 << false << QString(kmailservice + " /tmp");
QTest::newRow("kmailservice %u l4") << "kmailservice %u" << l4 << false << QString(kmailservice + " http://login:password@www.kde.org");
}
void KRunUnitTest::testProcessDesktopExecNoFile()