add a test for "contentsPrefixPaths() == QStringList() is ultimately the same as contentsPrefixPaths() == QStringList() << QString()"; proved that this worked as expected (which i knew) but exposed a bug in PackageStructure. huzzah for unit tests.
svn path=/trunk/KDE/kdelibs/; revision=1206643
This commit is contained in:
parent
65d5227bec
commit
03a4645d5a
@ -23,9 +23,22 @@
|
||||
#include <kconfiggroup.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "plasma/package.h"
|
||||
#include "plasma/packagestructure.h"
|
||||
#include "plasma/applet.h"
|
||||
|
||||
class NoPrefixes : public Plasma::PackageStructure
|
||||
{
|
||||
public:
|
||||
explicit NoPrefixes()
|
||||
: Plasma::PackageStructure(0, "StructureLess")
|
||||
{
|
||||
setContentsPrefixPaths(QStringList());
|
||||
addDirectoryDefinition("bin", "bin", "bin");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void PackageStructureTest::init()
|
||||
{
|
||||
ps = Plasma::Applet::packageStructure();
|
||||
@ -35,6 +48,15 @@ void PackageStructureTest::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void PackageStructureTest::emptyContentsPrefix()
|
||||
{
|
||||
Plasma::PackageStructure::Ptr structure(new NoPrefixes);
|
||||
Plasma::Package package("/", structure);
|
||||
QString path(package.filePath("bin", "ls"));
|
||||
qDebug() << path;
|
||||
QCOMPARE(path, QString("/bin/ls"));
|
||||
}
|
||||
|
||||
void PackageStructureTest::type()
|
||||
{
|
||||
QCOMPARE(ps->type(), QString("Plasmoid"));
|
||||
|
@ -32,6 +32,7 @@ public Q_SLOTS:
|
||||
void cleanup();
|
||||
|
||||
private Q_SLOTS:
|
||||
void emptyContentsPrefix();
|
||||
void type();
|
||||
void directories();
|
||||
void requiredDirectories();
|
||||
|
Loading…
Reference in New Issue
Block a user