KUrl(QString) fix

Ralf Habacker ralf.habacker at freenet.de
Wed Dec 20 16:38:10 GMT 2006


David Faure schrieb:
> On Wednesday 20 December 2006 17:02, Leonardo Stern wrote:
>   
>> Greetings,
>>
>> KUrl kurl("file:///foo/bar")
>> path() == "/foo/bar"  (not "foo/bar).
>>     
> The breakage was on windows only, right?
> Someone should really run kurltest (from kdecore/tests) on windows (it passes fine on unix).
>   
I had run kurltest and saw that one of the problems is laying deeper in 
QUrl. The appended test case show it

F:\daten\test\qurltest>debug\test
case 1: file:/netaccesstest_README -> /netaccesstest_README
case 2: file://netaccesstest_README ->
case 3: file:///netaccesstest_README -> /netaccesstest_README
case 4: file:/C:/netaccesstest_README -> /C:/netaccesstest_README
case 5: file://C:/netaccesstest_README -> /netaccesstest_README
case 6: file:///C:/netaccesstest_README -> /C:/netaccesstest_README

1 and 3. looks as excepted and 2. is ignored because of badly formed 
url. In case 4. and 6. there the path is prefixed by a non expected '/'
case 5 should be ignored but isn't


------- test.cpp -----------
#include <Qurl>
#include <QDir>

void test(QString url)
{
    static int testcount = 1;
    QUrl a(url);
    qDebug("case %d: %s -> 
%s",testcount++,url.toAscii().data(),a.path().toAscii().data());
}

int main(int argc, char **argv)
{
    test("file:/netaccesstest_README");
    test("file://netaccesstest_README" );
    test("file:///netaccesstest_README" );
   
    test("file:/C:/netaccesstest_README");
    test("file://C:/netaccesstest_README" );
    test("file:///C:/netaccesstest_README" );
}

------- test.pro -----------
TEMPLATE=app
CONFIG += qt console
QT += core
SOURCES=test.cpp
-----------------------------

Ralf


>> What Is better : a inline patch or a attachment one ?
>>     
> Inline if you're going to apply it (then it's easier to reply to specific parts of the patch).
> Attachment if you want someone else to apply it (easier for that person to save and apply the patch).
>
>   





More information about the kde-core-devel mailing list