Review Request 115478: Add QFileDialog unit autotest for filters (which reveals a QPA bug)
Ben Cooksley
bcooksley at kde.org
Wed Feb 19 23:26:35 UTC 2014
> On Feb. 4, 2014, 5:17 p.m., Alex Merry wrote:
> > Has the Qt patch been submitted upstream?
>
> Dominik Haumann wrote:
> Meanwhile yes: https://codereview.qt-project.org/#change,77390
>
> Alex Merry wrote:
> I don't think it's useful to have tests that fail because of upstream issues in the repo, at least not in such a way that it causes the testsuite as a whole to report a failure.
>
> My suggestion is to mark (1) as an expected failure (http://qt-project.org/doc/qt-5/qtest.html#QEXPECT_FAIL), and mark (2) as an expected failure only if the Qt version is too old. With comments about why the failures are expected, of course.
>
> Dominik Haumann wrote:
> I've pushed these changes to the Qt stable branch: https://codereview.qt-project.org/#change,77390
> So if build.kde.org uses a recent enough Qt version, I'd expect this test to pass. What Qt version does build.kde.org use right now?
>
> Alex Merry wrote:
> It's not just build.kde.org, it's also users (or, more likely, packagers and developers). If you know what point-release will get this fix, then just test for that.
The CI system rebuilds Qt once a week.
The latest build log is visible at http://build.kde.org/job/qt5_master_qt5/119/consoleText - it built revision 805c735 of the qt5.git supermodule.
- Ben
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115478/#review48954
-----------------------------------------------------------
On Feb. 4, 2014, 5:07 p.m., Dominik Haumann wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115478/
> -----------------------------------------------------------
>
> (Updated Feb. 4, 2014, 5:07 p.m.)
>
>
> Review request for KDE Frameworks, Àlex Fiestas and Gregor Mi.
>
>
> Repository: frameworkintegration
>
>
> Description
> -------
>
> The following QPA integration does not work as expected:
>
> QStringList nameFilterList = QStringList() << "c (*.cpp)" << "h (*.h)";
> dialog.setNameFilters(nameFilterList);
>
> QString selectNameFilter("h (*.h)");
> dialog.selectNameFilter(selectNameFilter);
> // QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (1) always fails, no matter what
>
> dialog.show();
> QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (2) currently also fails, Qt patch required
>
> The problem is described in detail in:
> http://mail.kde.org/pipermail/kde-frameworks-devel/2014-February/010691.html
>
>
> The Qt patches that make (2) work are as follows:
>
> diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
> index da026d2..72b2310 100644
> --- a/src/widgets/dialogs/qfiledialog.cpp
> +++ b/src/widgets/dialogs/qfiledialog.cpp
> @@ -627,7 +627,8 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
> options->setInitialDirectory(directory.exists() ?
> QUrl::fromLocalFile(directory.absolutePath()) :
> QUrl());
> - options->setInitiallySelectedNameFilter(q->selectedNameFilter());
> + if (options->initiallySelectedNameFilter().isEmpty())
> + options->setInitiallySelectedNameFilter(q->selectedNameFilter());
> if (options->initiallySelectedFiles().isEmpty())
> options->setInitiallySelectedFiles(userSelectedFiles());
> }
> @@ -1447,6 +1448,7 @@ void QFileDialog::selectNameFilter(const QString &filter)
> {
> Q_D(QFileDialog);
> if (!d->usingWidgets()) {
> + d->options->setInitiallySelectedNameFilter(filter);
> d->selectNameFilter_sys(filter);
> return;
> }
>
> However, the QCOMPARE in (1) is still an open issue. And no fix in sight...
>
> Ok to commit this to frameworksintegration (and therewith make it unstable?)
>
>
> Diffs
> -----
>
> autotests/kfiledialog_unittest.cpp PRE-CREATION
> autotests/CMakeLists.txt fb58b3a
>
> Diff: https://git.reviewboard.kde.org/r/115478/diff/
>
>
> Testing
> -------
>
> The attached unit test currently fails due to a bug in the Qt QPA.
>
> With the Qt patch above, (2) in the unit test passes, so one is able to call QFileDialog::selectNameFilter().
> However, (1) remains broken.
>
>
> Thanks,
>
> Dominik Haumann
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140219/42c522dc/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list