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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2007-11-25 16:51:08
Message-ID: 1196009468.522048.29645.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 741412 by chehrlic:

fix the tests. Only QUrl::toEncoded() returns the encoded url

CCMAIL: faure@kde.org

 M  +2 -5      io/kurl.cpp  
 M  +3 -3      tests/kurltest.cpp  


--- trunk/KDE/kdelibs/kdecore/io/kurl.cpp #741411:741412
@@ -315,16 +315,13 @@
     int len = str.length();
     QString pathToSet;
     kDebug(126) << "KUrl::KUrl ( const QString &str = " << str.toAscii().data() << " \
                )";
-    if ( str.startsWith( QLatin1String( "file:///" ) ) )
-      pathToSet = QUrl::fromPercentEncoding( str.mid(8).toLatin1() );
-    else if ( len > 9 && str.startsWith("file://") && str[7].isLetter() && str[8] == \
                QLatin1Char(':') )
-      pathToSet = QUrl::fromPercentEncoding( str.mid(7).toLatin1() );
+    if ( len > 9 && str.startsWith( QLatin1String( "file://" ) ) && \
str[7].isLetter() && str[8] == QLatin1Char(':') ) +      pathToSet = str.mid(7);
     else if ( len > 2 && str[0] == QLatin1Char('/') && str[1].isLetter() && str[2] \
== QLatin1Char(':') )  pathToSet = str.mid(1);
     else if ( len >= 2 && str[0].isLetter() && str[1] == QLatin1Char(':') )
       pathToSet = str;
     if ( !pathToSet.isEmpty() ) {
-      setScheme( "file" );
       setPath( QDir::fromNativeSeparators( pathToSet ) );
     }
 #else
--- trunk/KDE/kdelibs/kdecore/tests/kurltest.cpp #741411:741412
@@ -1447,7 +1447,7 @@
 {
   // passing path or url to the constructor: both work
   KUrl uloc( "/home/dfaure/konqtests/Mat%C3%A9riel" );
-  QCOMPARE( uloc.path(), QString("/home/dfaure/konqtests/Mat%C3%A9riel") );
+  QCOMPARE( uloc.toEncoded(), QByteArray("/home/dfaure/konqtests/Mat%C3%A9riel") );
   uloc = KUrl( "http://www.kde.org" );
   QCOMPARE( uloc.pathOrUrl(), uloc.url() );
   uloc = KUrl( QString("www.kde.org" ) );
@@ -1488,10 +1488,10 @@
   // passing path or url to the constructor: both work
   KUrl uloc;
   uloc = "/home/dfaure/konqtests/Mat%C3%A9riel";
-  QCOMPARE( uloc.path(), QString("/home/dfaure/konqtests/Mat%C3%A9riel") );
+  QCOMPARE( uloc.toEncoded(), QByteArray("/home/dfaure/konqtests/Mat%C3%A9riel") );
   KUrl u2;
   u2 = uloc;
-  QCOMPARE( u2.path(), QString("/home/dfaure/konqtests/Mat%C3%A9riel") );
+  QCOMPARE( u2.toEncoded(), QByteArray("/home/dfaure/konqtests/Mat%C3%A9riel") );
   uloc = "http://www.kde.org";
   QCOMPARE( uloc.pathOrUrl(), uloc.url() );
   uloc = QString("www.kde.org" );


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

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