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

List:       kde-commits
Subject:    KDE/kdelibs/plasma/tests
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-12-15 7:14:43
Message-ID: 20101215071443.92A66AC8A8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206643 by aseigo:

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.


 M  +22 -0     packagestructuretest.cpp  
 M  +1 -0      packagestructuretest.h  


--- trunk/KDE/kdelibs/plasma/tests/packagestructuretest.cpp #1206642:1206643
@@ -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::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"));
--- trunk/KDE/kdelibs/plasma/tests/packagestructuretest.h #1206642:1206643
@@ -32,6 +32,7 @@
     void cleanup();
 
 private Q_SLOTS:
+    void emptyContentsPrefix();
     void type();
     void directories();
     void requiredDirectories();


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

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