D19027: Fix "Invalid URL: QUrl("some.txt")" warnings in Save dialog
Peter Wu
noreply at phabricator.kde.org
Fri Feb 15 01:46:08 GMT 2019
Lekensteyn created this revision.
Lekensteyn added reviewers: ngraham, dfaure, fvogt.
Lekensteyn added a project: Frameworks.
Lekensteyn requested review of this revision.
REVISION SUMMARY
When the Save File dialog is in use with filters, any relative path
would trigger warnings due to KIO::stat receiving an invalid URL in
KFileWidgetPrivate::updateLocationEditExtension. Fix the warning by
ensuring that relative paths are valid file URLs.
Add a bunch of tests to check the expected properties while at it. These
tests pass regardless of the fix but after the fix, warnings are gone.
BUG: 373119
TEST PLAN
Before the kfilewidget.cpp change:
$ ninja bin/kfilewidgettest && bin/kfilewidgettest testFilterChange testSetFilterForSave
Config: Using QtTest library 5.12.0, Qt 5.12.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 8.2.1 20181127)
PASS : KFileWidgetTest::initTestCase()
QWARN : KFileWidgetTest::testFilterChange() kf5.kio.core: Invalid URL: QUrl("some.txt")
QWARN : KFileWidgetTest::testFilterChange() kf5.kio.core: Invalid URL: QUrl("some.txt")
QWARN : KFileWidgetTest::testFilterChange() kf5.kio.core: Invalid URL: QUrl("some.txt")
Qt: Session management error: networkIdsList argument is NULL
PASS : KFileWidgetTest::testFilterChange()
QWARN : KFileWidgetTest::testSetFilterForSave(some.txt) kf5.kio.core: Invalid URL: QUrl("some.txt")
QWARN : KFileWidgetTest::testSetFilterForSave(some.txt) kf5.kio.core: Invalid URL: QUrl("some.txt")
PASS : KFileWidgetTest::testSetFilterForSave(some.txt)
PASS : KFileWidgetTest::testSetFilterForSave(extensionless name)
PASS : KFileWidgetTest::testSetFilterForSave(existing file)
QWARN : KFileWidgetTest::testSetFilterForSave(some.2019) kf5.kio.core: Invalid URL: QUrl("some.2019")
QWARN : KFileWidgetTest::testSetFilterForSave(some.2019) kf5.kio.core: Invalid URL: QUrl("some.txt")
PASS : KFileWidgetTest::testSetFilterForSave(some.2019)
QWARN : KFileWidgetTest::testSetFilterForSave(some.html) kf5.kio.core: Invalid URL: QUrl("some.html")
QWARN : KFileWidgetTest::testSetFilterForSave(some.html) kf5.kio.core: Invalid URL: QUrl("some.txt")
PASS : KFileWidgetTest::testSetFilterForSave(some.html)
PASS : KFileWidgetTest::cleanupTestCase()
After the change, all `QWARN` lines are gone.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D19027
AFFECTED FILES
autotests/kfilewidgettest.cpp
src/filewidgets/kfilewidget.cpp
To: Lekensteyn, ngraham, dfaure, fvogt
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190215/3c2b012b/attachment.html>
More information about the Kde-frameworks-devel
mailing list