diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-05-26 14:50:48 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-05-26 14:52:27 (GMT) |
commit | 8bf5a6986db852525582713cc2f2a760df4fdc60 (patch) | |
tree | ffb7877cf44aa29d122929a9e578467aceb30812 /tests | |
parent | 36159004508d145646e0755debf5564ce29a8649 (diff) | |
download | Qt-8bf5a6986db852525582713cc2f2a760df4fdc60.zip Qt-8bf5a6986db852525582713cc2f2a760df4fdc60.tar.gz Qt-8bf5a6986db852525582713cc2f2a760df4fdc60.tar.bz2 |
QFileDialog selection bug when calling it multiple times.
The problem was that we don't clear the selection model if the previous
selection was valid.
Task-number:251341
Reviewed-by:jasplin
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 689f73d..16c84d8 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -159,6 +159,7 @@ private slots: void task218353_relativePaths(); void task251321_sideBarHiddenEntries(); void task251341_sideBarRemoveEntries(); + void task254490_selectFileMultipleTimes(); private: QByteArray userSettings; @@ -1981,5 +1982,37 @@ void tst_QFiledialog::task251341_sideBarRemoveEntries() current.rmdir("testDir"); } +void tst_QFiledialog::task254490_selectFileMultipleTimes() +{ + QString tempPath = QDir::tempPath(); + QTemporaryFile *t; + t = new QTemporaryFile; + t->open(); + QNonNativeFileDialog fd(0, "TestFileDialog"); + + fd.setDirectory(tempPath); + fd.setViewMode(QFileDialog::List); + fd.setAcceptMode(QFileDialog::AcceptSave); + fd.setFileMode(QFileDialog::AnyFile); + + //This should select the file in the QFileDialog + fd.selectFile(t->fileName()); + + //This should clear the selection and write it into the filename line edit + fd.selectFile("new_file.txt"); + + fd.show(); + QTest::qWait(250); + + QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text(),QLatin1String("new_file.txt")); + QListView *list = qFindChild<QListView*>(&fd, "listView"); + QVERIFY(list); + QCOMPARE(list->selectionModel()->selectedRows(0).count(), 0); + + t->deleteLater(); +} + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" |