Port away from qtest_kde.h (and from ~/.kde-unit-test)
Fix missing mkpath before creating sqlite db.
This commit is contained in:
parent
eb992ce047
commit
643df96f63
@ -20,6 +20,7 @@
|
||||
#include "storagethread_p.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlField>
|
||||
@ -68,7 +69,9 @@ void StorageThread::initializeDb(StorageJob *caller)
|
||||
{
|
||||
if (!m_db.open()) {
|
||||
m_db = QSqlDatabase::addDatabase("QSQLITE", QString("plasma-storage-%1").arg((quintptr)this));
|
||||
m_db.setDatabaseName(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "plasma-storage2.db");
|
||||
const QString storageDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
QDir().mkpath(storageDir);
|
||||
m_db.setDatabaseName(storageDir + QLatin1Char('/') + "plasma-storage2.db");
|
||||
}
|
||||
|
||||
if (!m_db.open()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
* Boston, MA 02110-1301, USA. *
|
||||
*********************************************************************************/
|
||||
|
||||
#include <QtTestWidgets>
|
||||
#include "configloadertest.h"
|
||||
|
||||
#include <kconfig.h>
|
||||
@ -207,6 +208,6 @@ void ConfigLoaderTest::ulongLongDefaultValue()
|
||||
}
|
||||
|
||||
|
||||
QTEST_KDEMAIN(ConfigLoaderTest, NoGUI)
|
||||
QTEST_MAIN(ConfigLoaderTest)
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef CONFIGLOADERTEST_H
|
||||
#define CONFIGLOADERTEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
@ -178,6 +178,6 @@ void PackageStructureTest::mimeTypes()
|
||||
QCOMPARE(ps.mimeTypes("images"), mimeTypes);
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN(PackageStructureTest, NoGUI)
|
||||
QTEST_MAIN(PackageStructureTest)
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef PACKAGESTRUCTURETEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "plasma/package.h"
|
||||
|
||||
|
@ -23,19 +23,24 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <kzip.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <kjob.h>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "applet.h"
|
||||
#include "pluginloader.h"
|
||||
|
||||
void PlasmoidPackageTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
}
|
||||
|
||||
void PlasmoidPackageTest::init()
|
||||
{
|
||||
kDebug() << "PlasmoidPackage::init()";
|
||||
m_package = QString("Package");
|
||||
m_packageRoot = QDir::homePath() + "/.kde-unit-test/packageRoot";
|
||||
m_packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/packageRoot";
|
||||
m_defaultPackage = Plasma::PluginLoader::self()->loadPackage("Plasma/Applet");
|
||||
cleanup(); // to prevent previous runs from interfering with this one
|
||||
}
|
||||
@ -44,7 +49,7 @@ void PlasmoidPackageTest::cleanup()
|
||||
{
|
||||
kDebug() << "cleaning up";
|
||||
// Clean things up.
|
||||
KIO::NetAccess::del(KUrl(QDir::homePath() + QLatin1String("/.kde-unit-test/packageRoot")), 0);
|
||||
QDir(m_packageRoot).removeRecursively();
|
||||
}
|
||||
|
||||
void PlasmoidPackageTest::createTestPackage(const QString &packageName)
|
||||
@ -301,5 +306,4 @@ void PlasmoidPackageTest::packageUninstalled(KJob* j)
|
||||
}
|
||||
|
||||
|
||||
//QTEST_KDEMAIN(PlasmoidPackageTest, NoGUI)
|
||||
QTEST_KDEMAIN(PlasmoidPackageTest, GUI)
|
||||
QTEST_MAIN(PlasmoidPackageTest)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef PACKAGETEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "plasma/package.h"
|
||||
#include "plasma/packagestructure.h"
|
||||
@ -29,6 +29,7 @@ class PlasmoidPackageTest : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
|
@ -57,4 +57,4 @@ void RunnerContextTest::typeDetection()
|
||||
QCOMPARE(int(m_context.type()), int(type));
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN(RunnerContextTest, NoGUI)
|
||||
QTEST_MAIN(RunnerContextTest)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef PACKAGEMETADATATEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "plasma/runnercontext.h"
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "applet.h"
|
||||
#include "remote/signing.h"
|
||||
#include "pluginloader.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
static const QString fingerprint("8B8B22090C6F7C47B1EAEE75D6B72EB1A7F1DB43");
|
||||
static const QString shortFingerprint("D6B72EB1A7F1DB43");
|
||||
@ -42,12 +43,9 @@ SigningTest::SigningTest(QObject *parent)
|
||||
m_invalidSig = prefix + "signed.plasmoid.invalid.sig";
|
||||
}
|
||||
|
||||
void SigningTest::init()
|
||||
{
|
||||
}
|
||||
|
||||
void SigningTest::cleanup()
|
||||
void SigningTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
}
|
||||
|
||||
void SigningTest::confirmCtorPerformance()
|
||||
@ -102,5 +100,5 @@ void SigningTest::confirmDtorPerformance()
|
||||
QVERIFY(t.elapsed() < 50);
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN(SigningTest, NoGUI)
|
||||
QTEST_MAIN(SigningTest)
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef SIGNINGTEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "plasma/package.h"
|
||||
|
||||
@ -36,8 +36,7 @@ public:
|
||||
explicit SigningTest(QObject *parent = 0);
|
||||
|
||||
public Q_SLOTS:
|
||||
void init();
|
||||
void cleanup();
|
||||
void initTestCase();
|
||||
|
||||
private Q_SLOTS:
|
||||
void confirmCtorPerformance();
|
||||
|
@ -18,11 +18,14 @@
|
||||
*********************************************************************************/
|
||||
|
||||
#include "storagetest.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "../private/storage_p.h"
|
||||
|
||||
void StorageTest::init()
|
||||
void StorageTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
|
||||
m_data.insert("String 1", "Fork");
|
||||
m_data.insert("String 2", "Spoon");
|
||||
m_data.insert("String 3", "Knife");
|
||||
@ -92,5 +95,5 @@ void StorageTest::deleteEntry()
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN(StorageTest, NoGUI)
|
||||
QTEST_MAIN(StorageTest)
|
||||
|
||||
|
@ -20,14 +20,14 @@
|
||||
#ifndef STORAGETEST_H
|
||||
#define STORAGETEST_H
|
||||
|
||||
#include <qtest_kde.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class StorageTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public Q_SLOTS:
|
||||
void init();
|
||||
void initTestCase();
|
||||
|
||||
private Q_SLOTS:
|
||||
void store();
|
||||
|
Loading…
Reference in New Issue
Block a user