summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp6
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp39
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 109afbc..7b70a5e 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -3049,6 +3049,12 @@ void tst_QAccessibility::lineEditTest()
QTestAccessibility::clearEvents();
le2->setFocus(Qt::TabFocusReason);
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, 0, QAccessible::Focus)));
+
+ le->setText(QLatin1String("500"));
+ le->setValidator(new QIntValidator());
+ iface->setText(QAccessible::Value, 0, QLatin1String("This text is not a number"));
+ QCOMPARE(le->text(), QLatin1String("500"));
+
delete iface;
delete le;
delete le2;
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index bc076c5..08d2e88 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -78,6 +78,10 @@
# define STRINGIFY(x) #x
# define TOSTRING(x) STRINGIFY(x)
# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#elif defined(Q_OS_UNIX)
+#ifdef QT_BUILD_INTERNAL
+extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0);
+#endif
#endif
class QNonNativeFileDialog : public QFileDialog
@@ -144,6 +148,10 @@ private slots:
void clearLineEdit();
void enableChooseButton();
void hooks();
+#ifdef Q_OS_UNIX
+ void tildeExpansion_data();
+ void tildeExpansion();
+#endif
private:
QByteArray userSettings;
@@ -1323,5 +1331,36 @@ void tst_QFiledialog::hooks()
QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName"));
}
+#ifdef Q_OS_UNIX
+void tst_QFiledialog::tildeExpansion_data()
+{
+ QTest::addColumn<QString>("tildePath");
+ QTest::addColumn<QString>("expandedPath");
+
+ 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;
+}
+
+
+void tst_QFiledialog::tildeExpansion()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll);
+#else
+ QFETCH(QString, tildePath);
+ QFETCH(QString, expandedPath);
+
+ QCOMPARE(qt_tildeExpansion(tildePath), expandedPath);
+#endif
+}
+#endif
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"