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

List:       kde-commits
Subject:    branches/kdepim/enterprise4/kdelibs-4.0.83/kdecore/tests
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2008-07-09 12:54:04
Message-ID: 1215608044.586177.4898.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 829943 by staniek:

backport of r829939 from trunk:
fix testFindExe() on Windows: one path can be c:/... and second C:/



 M  +25 -6     kstandarddirstest.cpp  


--- branches/kdepim/enterprise4/kdelibs-4.0.83/kdecore/tests/kstandarddirstest.cpp #829942:829943
@@ -70,12 +70,14 @@
 
 #ifdef Q_WS_WIN
 #define EXT ".exe"
+#define KIOSLAVE "bin/kioslave.exe"
 #else
 #define EXT ""
+#define KIOSLAVE "kde4/libexec/kioslave"
 #endif
     const QString bin = KGlobal::dirs()->findResource( "exe", "kioslave" EXT );
     QVERIFY( !bin.isEmpty() );
-    QVERIFY( bin.endsWith( "kde4/libexec/kioslave" EXT ) );
+    QVERIFY( bin.endsWith( KIOSLAVE ) );
     QVERIFY( !QDir::isRelativePath(bin) );
 
     const QString data = KGlobal::dirs()->findResource( "data", "katepart/syntax/sql.xml" );
@@ -167,18 +169,26 @@
     QVERIFY( !kdeinit.isEmpty() );
     QVERIFY( kdeinit.endsWith( "bin/kdeinit4" EXT ) );
 
+#ifdef Q_OS_UNIX
     // findExe with a result in libexec
     const QString lnusertemp = KGlobal::dirs()->findExe( "lnusertemp" );
     QVERIFY( !lnusertemp.isEmpty() );
     QVERIFY( lnusertemp.endsWith( "lib" KDELIBSUFF "/kde4/libexec/lnusertemp" EXT ) );
+#endif
 
     // Check the "exe" resource too
-    QCOMPARE( KGlobal::dirs()->realFilePath(kdeinit),
-              KGlobal::dirs()->locate( "exe", "kdeinit4" ) );
+    QString kdeinitPath1 = KGlobal::dirs()->realFilePath(kdeinit);
+    QString kdeinitPath2 = KGlobal::dirs()->locate( "exe", "kdeinit4" );
+#ifdef Q_WS_WIN // one path can be c:/... and second C:/...
+    kdeinitPath1 = kdeinitPath1.toLower();
+    kdeinitPath2 = kdeinitPath2.toLower();
+#endif
+    QCOMPARE( kdeinitPath1, kdeinitPath2 );
+
+#ifdef Q_OS_UNIX
     QCOMPARE( KGlobal::dirs()->realFilePath(lnusertemp),
               KGlobal::dirs()->locate( "exe", "lnusertemp" ) );
 
-#ifdef Q_OS_UNIX
     // findExe with relative path
     const QString pwd = QDir::currentPath();
     QDir::setCurrent("/bin");
@@ -211,8 +221,14 @@
 
 void KStandarddirsTest::testLocate()
 {
-    const QString textPlain = "/usr/share/mime/text/x-patch.xml";
-    if (!QFile::exists(textPlain))
+    QString textPlain = "text/x-patch.xml";
+    Q_FOREACH( const QString &path, KGlobal::dirs()->resourceDirs("xdgdata-mime") ) {
+        if (QFile::exists(path + textPlain)) {
+            textPlain = path + textPlain;
+            break;
+        }
+    }
+    if( textPlain == "text/x-patch.xml" )
         QSKIP("xdg-share-mime not installed", SkipAll);
 
     const QString res = KGlobal::dirs()->locate("xdgdata-mime", "text/x-patch.xml");
@@ -237,6 +253,9 @@
     KGlobal::dirs()->addResourceType("dtd", "data", "ksgmltools2/");
     ret = KStandardDirs::locate( "dtd", "customization/catalog.xml" );
     QVERIFY(!ret.isEmpty());
+
+    ret = KStandardDirs::locate("dtd", "customization/kde-chunk.xsl");
+    QVERIFY(!ret.isEmpty());
 }
 
 void KStandarddirsTest::testAddResourceDir()
[prev in list] [next in list] [prev in thread] [next in thread] 

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