QFileDialog test: make the right subwidget visible

It makes little sense to give focus to a hidden widget; in order
to make the treeview visible, we need to set the view mode to Detail.

Change-Id: I453111e83593a790a656651b603a9c9b1a78dd9d
Task-number: QTBUG-7690
Reviewed-by: Jan Blumschein <jan@jan-blumschein.de>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Giuseppe D'Angelo 2015-12-09 23:16:22 +01:00
parent 56f6252e72
commit 824af4aac9

View File

@ -774,14 +774,16 @@ void tst_QFileDialog2::task233037_selectingDirectory()
void tst_QFileDialog2::task235069_hideOnEscape_data() void tst_QFileDialog2::task235069_hideOnEscape_data()
{ {
QTest::addColumn<QString>("childName"); QTest::addColumn<QString>("childName");
QTest::newRow("listView") << QStringLiteral("listView"); QTest::addColumn<QFileDialog::ViewMode>("viewMode");
QTest::newRow("fileNameEdit") << QStringLiteral("fileNameEdit"); QTest::newRow("listView") << QStringLiteral("listView") << QFileDialog::List;
QTest::newRow("treeView") << QStringLiteral("treeView"); QTest::newRow("fileNameEdit") << QStringLiteral("fileNameEdit") << QFileDialog::List;
QTest::newRow("treeView") << QStringLiteral("treeView") << QFileDialog::Detail;
} }
void tst_QFileDialog2::task235069_hideOnEscape() void tst_QFileDialog2::task235069_hideOnEscape()
{ {
QFETCH(QString, childName); QFETCH(QString, childName);
QFETCH(QFileDialog::ViewMode, viewMode);
QDir current = QDir::currentPath(); QDir current = QDir::currentPath();
QNonNativeFileDialog fd; QNonNativeFileDialog fd;
@ -789,7 +791,7 @@ void tst_QFileDialog2::task235069_hideOnEscape()
QVERIFY(spyFinished.isValid()); QVERIFY(spyFinished.isValid());
QSignalSpy spyRejected(&fd, &QDialog::rejected); QSignalSpy spyRejected(&fd, &QDialog::rejected);
QVERIFY(spyRejected.isValid()); QVERIFY(spyRejected.isValid());
fd.setViewMode(QFileDialog::List); fd.setViewMode(viewMode);
fd.setDirectory(current.absolutePath()); fd.setDirectory(current.absolutePath());
fd.setAcceptMode(QFileDialog::AcceptSave); fd.setAcceptMode(QFileDialog::AcceptSave);
fd.show(); fd.show();