diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-01-12 09:35:26 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-01-12 09:38:50 (GMT) |
commit | a1ec686734e105228ff539c0e3bfc7850c66dc04 (patch) | |
tree | a394e08f481d13858340ca6c90e21004a10b60d6 /tests/auto/qfiledialog2 | |
parent | 7abb2cfdea14fa71aabcd79635aa8f407ed96186 (diff) | |
download | Qt-a1ec686734e105228ff539c0e3bfc7850c66dc04.zip Qt-a1ec686734e105228ff539c0e3bfc7850c66dc04.tar.gz Qt-a1ec686734e105228ff539c0e3bfc7850c66dc04.tar.bz2 |
Fix completion in QFileDialog.
Completing under the root directory was "eating" the first letter. On
windows under C:\ the completion was not working at all.
Task-number: QTBUG-4933
Reviewed-by:janarve
Reviewed-by:gabi
Diffstat (limited to 'tests/auto/qfiledialog2')
-rw-r--r-- | tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index c3f88c4..f1fac17 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -116,6 +116,7 @@ private slots: #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void task226366_lowerCaseHardDriveWindows(); #endif + void completionOnLevelAfterRoot(); void task233037_selectingDirectory(); void task235069_hideOnEscape(); void task236402_dontWatchDeletedDir(); @@ -202,7 +203,7 @@ void tst_QFiledialog::heapCorruption() qDeleteAll(dialogs); } -struct FriendlyQFileDialog : public QFileDialog +struct FriendlyQFileDialog : public QNonNativeFileDialog { friend class tst_QFileDialog; Q_DECLARE_PRIVATE(QFileDialog) @@ -552,6 +553,45 @@ void tst_QFiledialog::task226366_lowerCaseHardDriveWindows() } #endif +void tst_QFiledialog::completionOnLevelAfterRoot() +{ + QNonNativeFileDialog fd; +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + fd.setDirectory("C:"); + QDir current = fd.directory(); + current.mkdir("completionOnLevelAfterRootTest"); +#else + fd.setFilter(QDir::Hidden | QDir::AllDirs | QDir::Files | QDir::System); + fd.setDirectory("/"); + QDir etc("/etc"); + if (!etc.exists()) + QSKIP("This test requires to have an etc directory under /", SkipAll); +#endif + fd.show(); + QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit"); + QTest::qWait(2000); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + //I love testlib :D + QTest::keyClick(edit, Qt::Key_C); + QTest::keyClick(edit, Qt::Key_O); + QTest::keyClick(edit, Qt::Key_M); + QTest::keyClick(edit, Qt::Key_P); + QTest::keyClick(edit, Qt::Key_L); +#else + QTest::keyClick(edit, Qt::Key_E); + QTest::keyClick(edit, Qt::Key_T); +#endif + QTest::qWait(200); + QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); + QTest::qWait(200); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + QCOMPARE(edit->text(), QString("completionOnLevelAfterRootTest")); + current.rmdir("completionOnLevelAfterRootTest"); +#else + QCOMPARE(edit->text(), QString("etc")); +#endif +} + void tst_QFiledialog::task233037_selectingDirectory() { QDir current = QDir::currentPath(); |