not much point in having tests if they aren't build
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=821607
This commit is contained in:
parent
aa733dd6ee
commit
67a38e23e8
@ -3,7 +3,7 @@ include (KDE4Defaults)
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}/.. ${KDE4_INCLUDES} ${OPENGL_INCLUDE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}/.. ${KDE4_INCLUDES} ${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
#add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1209)
|
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1209)
|
||||||
|
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
@ -63,7 +63,7 @@ void PackageMetadataTest::read()
|
|||||||
{
|
{
|
||||||
pm->read("packagemetadatatest.desktop");
|
pm->read("packagemetadatatest.desktop");
|
||||||
|
|
||||||
QVERIFY(pm->isComplete());
|
QVERIFY(pm->isValid());
|
||||||
|
|
||||||
QCOMPARE(pm->name(), QString("test"));
|
QCOMPARE(pm->name(), QString("test"));
|
||||||
QCOMPARE(pm->description(), QString("Some fancy test description"));
|
QCOMPARE(pm->description(), QString("Some fancy test description"));
|
||||||
|
@ -142,7 +142,7 @@ void PackageStructureTest::read()
|
|||||||
|
|
||||||
// compare directories
|
// compare directories
|
||||||
QList <const char *> dirs;
|
QList <const char *> dirs;
|
||||||
dirs << "config" << "configui" << "images" << "scripts" << "ui";
|
dirs << "config" << "configui" << "images" << "scripts";
|
||||||
QList <const char *> psDirs = structure.directories();
|
QList <const char *> psDirs = structure.directories();
|
||||||
QCOMPARE(psDirs.count(), dirs.count());
|
QCOMPARE(psDirs.count(), dirs.count());
|
||||||
for (int i = 0; i < dirs.count(); i++) {
|
for (int i = 0; i < dirs.count(); i++) {
|
||||||
|
@ -29,23 +29,20 @@
|
|||||||
void PlasmoidPackageTest::init()
|
void PlasmoidPackageTest::init()
|
||||||
{
|
{
|
||||||
mPackage = QString("Package");
|
mPackage = QString("Package");
|
||||||
mPackageRoot = QDir::homePath() + "/.kde-unit-test/packageRoot";
|
mPackageRoot = QDir::homePath() + "/.kde-unit-test/packageRoot/";
|
||||||
|
|
||||||
ps = Plasma::Applet::packageStructure();
|
ps = Plasma::Applet::packageStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmoidPackageTest::cleanup()
|
void PlasmoidPackageTest::cleanup()
|
||||||
{
|
{
|
||||||
if( p )
|
if (p) {
|
||||||
{
|
|
||||||
delete p;
|
delete p;
|
||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean things up.
|
// Clean things up.
|
||||||
QDir local = QDir::homePath() + QLatin1String("/.kde-unit-test/packageRoot/");
|
QDir local = QDir::homePath() + QLatin1String("/.kde-unit-test/packageRoot/");
|
||||||
foreach(const QString &dir, local.entryList(QDir::Dirs))
|
foreach(const QString &dir, local.entryList(QDir::Dirs)) {
|
||||||
{
|
|
||||||
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents/code"));
|
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents/code"));
|
||||||
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents/images"));
|
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents/images"));
|
||||||
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents"));
|
removeDir(QLatin1String("packageRoot/" + dir.toLatin1() + "/contents"));
|
||||||
@ -246,20 +243,20 @@ void PlasmoidPackageTest::knownPackages()
|
|||||||
QDir pRoot = QDir(mPackageRoot + "blah");
|
QDir pRoot = QDir(mPackageRoot + "blah");
|
||||||
QVERIFY(!pRoot.exists());
|
QVERIFY(!pRoot.exists());
|
||||||
p = new Plasma::Package(mPackageRoot + "blah", mPackage, ps);
|
p = new Plasma::Package(mPackageRoot + "blah", mPackage, ps);
|
||||||
QCOMPARE(p->knownPackages(mPackageRoot), QStringList());
|
QCOMPARE(Plasma::Package::listInstalled(mPackageRoot), QStringList());
|
||||||
delete p;
|
delete p;
|
||||||
|
|
||||||
// Don't do strange things when an empty package root exists
|
// Don't do strange things when an empty package root exists
|
||||||
QVERIFY(QDir().mkpath(mPackageRoot));
|
QVERIFY(QDir().mkpath(mPackageRoot));
|
||||||
//QVERIFY(pRoot.exists());
|
//QVERIFY(pRoot.exists());
|
||||||
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
||||||
QCOMPARE(p->knownPackages(mPackageRoot), QStringList());
|
QCOMPARE(Plasma::Package::listInstalled(mPackageRoot), QStringList());
|
||||||
delete p;
|
delete p;
|
||||||
|
|
||||||
// Do not return a directory as package if it has no metadata.desktop file
|
// Do not return a directory as package if it has no metadata.desktop file
|
||||||
QVERIFY(QDir().mkpath(mPackageRoot + "/invalid_plasmoid"));
|
QVERIFY(QDir().mkpath(mPackageRoot + "/invalid_plasmoid"));
|
||||||
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
||||||
QCOMPARE(p->knownPackages(mPackageRoot), QStringList());
|
QCOMPARE(Plasma::Package::listInstalled(mPackageRoot), QStringList());
|
||||||
delete p;
|
delete p;
|
||||||
|
|
||||||
// Let's add a valid package and see what happens.
|
// Let's add a valid package and see what happens.
|
||||||
@ -267,16 +264,16 @@ void PlasmoidPackageTest::knownPackages()
|
|||||||
createTestPackage(plamoid1);
|
createTestPackage(plamoid1);
|
||||||
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
||||||
|
|
||||||
QStringList packages = p->knownPackages(mPackageRoot);
|
QStringList packages = Plasma::Package::listInstalled(mPackageRoot);
|
||||||
QCOMPARE(packages.size(), 1);
|
QCOMPARE(packages.size(), 1);
|
||||||
QVERIFY(packages.contains(plamoid1));
|
QVERIFY(packages.contains(plamoid1));
|
||||||
|
|
||||||
// Ok.... one more valid package.
|
// Ok.... one more valid package.
|
||||||
QString plamoid2("anoter_valid_plasmoid");
|
QString plamoid2("another_valid_plasmoid");
|
||||||
createTestPackage(plamoid2);
|
createTestPackage(plamoid2);
|
||||||
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
p = new Plasma::Package(mPackageRoot, mPackage, ps);
|
||||||
|
|
||||||
packages = p->knownPackages(mPackageRoot);
|
packages = Plasma::Package::listInstalled(mPackageRoot);
|
||||||
QCOMPARE(packages.size(), 2);
|
QCOMPARE(packages.size(), 2);
|
||||||
QVERIFY(packages.contains(plamoid1));
|
QVERIFY(packages.contains(plamoid1));
|
||||||
QVERIFY(packages.contains(plamoid2));
|
QVERIFY(packages.contains(plamoid2));
|
||||||
@ -303,8 +300,8 @@ void PlasmoidPackageTest::createAndInstallPackage()
|
|||||||
Plasma::PackageMetadata metadata(
|
Plasma::PackageMetadata metadata(
|
||||||
QString(KDESRCDIR) + "/packagemetadatatest.desktop");
|
QString(KDESRCDIR) + "/packagemetadatatest.desktop");
|
||||||
QVERIFY(Plasma::Package::createPackage(metadata,
|
QVERIFY(Plasma::Package::createPackage(metadata,
|
||||||
mPackageRoot + '/' + plasmoid + "/contents",
|
mPackageRoot + '/' + plasmoid + "/contents",
|
||||||
packagePath));
|
packagePath));
|
||||||
QVERIFY(QFile::exists(packagePath));
|
QVERIFY(QFile::exists(packagePath));
|
||||||
|
|
||||||
KZip package(packagePath);
|
KZip package(packagePath);
|
||||||
@ -320,7 +317,7 @@ void PlasmoidPackageTest::createAndInstallPackage()
|
|||||||
QVERIFY(contents->entry("code"));
|
QVERIFY(contents->entry("code"));
|
||||||
QVERIFY(contents->entry("images"));
|
QVERIFY(contents->entry("images"));
|
||||||
|
|
||||||
Plasma::Package::installPackage(packagePath, mPackageRoot);
|
QVERIFY(Plasma::Package::installPackage(packagePath, mPackageRoot));
|
||||||
QString installedPackage = mPackageRoot + "/test";
|
QString installedPackage = mPackageRoot + "/test";
|
||||||
|
|
||||||
QVERIFY(QFile::exists(installedPackage));
|
QVERIFY(QFile::exists(installedPackage));
|
||||||
|
Loading…
Reference in New Issue
Block a user