summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 42e2bd09a5..c9de1c54c0 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -68,7 +68,7 @@
#include <unistd.h> // for pathconf() on OS X
#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
-extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0);
+extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path);
QT_END_NAMESPACE
#endif
#endif
@@ -101,16 +101,10 @@ class tst_QFiledialog : public QObject
{
Q_OBJECT
-public:
- tst_QFiledialog();
- virtual ~tst_QFiledialog();
-
-public slots:
+private slots:
void initTestCase();
void init();
void cleanup();
-
-private slots:
void currentChangedSignal();
#ifdef QT_BUILD_INTERNAL
void directoryEnteredSignal();
@@ -171,14 +165,6 @@ private:
void cleanupSettingsFile();
};
-tst_QFiledialog::tst_QFiledialog()
-{
-}
-
-tst_QFiledialog::~tst_QFiledialog()
-{
-}
-
void tst_QFiledialog::cleanupSettingsFile()
{
// clean up the sidebar between each test
@@ -943,7 +929,7 @@ void tst_QFiledialog::selectFiles()
QString filesPath = fd.directory().absolutePath();
for (int i=0; i < 5; ++i) {
- QFile file(filesPath + QString::fromLatin1("/qfiledialog_auto_test_not_pres_%1").arg(i));
+ QFile file(filesPath + QLatin1String("/qfiledialog_auto_test_not_pres_") + QString::number(i));
file.open(QIODevice::WriteOnly);
file.resize(1024);
file.flush();
@@ -957,7 +943,7 @@ void tst_QFiledialog::selectFiles()
QListView* listView = fd.findChild<QListView*>("listView");
QVERIFY(listView);
for (int i = 0; i < list.count(); ++i) {
- fd.selectFile(fd.directory().path() + "/" + list.at(i));
+ fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i));
QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty());
toSelect.append(listView->selectionModel()->selectedRows().last());
}
@@ -1409,15 +1395,18 @@ void tst_QFiledialog::tildeExpansion_data()
QTest::addColumn<QString>("tildePath");
QTest::addColumn<QString>("expandedPath");
+ const QString tilde = QStringLiteral("~");
+ const QString tildeUser = tilde + QString(qgetenv("USER"));
+ const QLatin1String someSubDir("/some/sub/dir");
+ const QString homePath = QDir::homePath();
+ const QString invalid = QStringLiteral("~thisIsNotAValidUserName");
+
QTest::newRow("empty path") << QString() << QString();
- QTest::newRow("~") << QString::fromLatin1("~") << QDir::homePath();
- QTest::newRow("~/some/sub/dir/") << QString::fromLatin1("~/some/sub/dir") << QDir::homePath()
- + QString::fromLatin1("/some/sub/dir");
- QString userHome = QString(qgetenv("USER"));
- userHome.prepend('~');
- QTest::newRow("current user (~<user> syntax)") << userHome << QDir::homePath();
- QString invalid = QString::fromLatin1("~thisIsNotAValidUserName");
- QTest::newRow("invalid user name") << invalid << invalid;
+ QTest::newRow("~") << tilde << homePath;
+ QTest::newRow("~/some/sub/dir/") << tilde + someSubDir << homePath + someSubDir;
+ QTest::newRow("~<user>") << tildeUser << homePath;
+ QTest::newRow("~<user>/some/sub/dir") << tildeUser + someSubDir << homePath + someSubDir;
+ QTest::newRow("invalid user name") << invalid << invalid;
}
#endif // QT_BUILD_INTERNAL