diff options
author | David Faure <david.faure@kdab.com> | 2014-07-09 15:03:35 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2014-07-26 09:49:33 +0200 |
commit | fd331a5b3a122393cd697a8b856dd52cfd31d698 (patch) | |
tree | 8743ce9b26863cbd5091624e8168257e1d7f6f01 /tests | |
parent | 63efdf9851915ce3b81bffe089fcd1995d6750f8 (diff) |
QUrl: fromLocalFile(QString()) should lead to an empty URL.
This is much more useful than the URL "file:", it allows to use
"empty path" and "empty URL" for the same meaning (e.g. not set).
QFileDialog actually uses "file:" though, as the URL for the
"My Computer" item in the sidebar. This patch preserves that.
[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL
if the input string is empty.
Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 28b68dc750..ac4be31d0e 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -237,6 +237,11 @@ void tst_QUrl::constructing() QVERIFY(url == url); QVERIFY(!(url < url)); + QUrl fromLocal = QUrl::fromLocalFile(QString()); + QVERIFY(!fromLocal.isValid()); + QVERIFY(fromLocal.isEmpty()); + QCOMPARE(fromLocal.toString(), QString()); + QUrl justHost("qt-project.org"); QVERIFY(!justHost.isEmpty()); QVERIFY(justHost.host().isEmpty()); |