summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-03 14:40:25 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-03 14:40:26 +0200
commit814f713f01a459b48b12a3695fb1242b7d687662 (patch)
tree571598012909d82d15aca670cd9be22823596ad6 /tests/auto/corelib
parent52ebf1f1914cea563b52baffc607407dbc6a7313 (diff)
parent448c3e85dddbfc5c101aceeeceb8584a3d41c913 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp8
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp47
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp2
3 files changed, 49 insertions, 8 deletions
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 7fbb5e9f5f..1ee628dde5 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -1221,9 +1221,9 @@ QT_END_NAMESPACE
class DummyEventDispatcher : public QAbstractEventDispatcher {
public:
- DummyEventDispatcher() : QAbstractEventDispatcher(), visited(false) {}
+ DummyEventDispatcher() : QAbstractEventDispatcher() {}
bool processEvents(QEventLoop::ProcessEventsFlags) {
- visited = true;
+ visited.store(true);
emit awake();
QCoreApplication::sendPostedEvents();
return false;
@@ -1247,7 +1247,7 @@ public:
void unregisterEventNotifier(QWinEventNotifier *) { }
#endif
- bool visited;
+ QBasicAtomicInt visited; // bool
};
class ThreadObj : public QObject
@@ -1285,7 +1285,7 @@ void tst_QThread::customEventDispatcher()
QMetaObject::invokeMethod(&obj, "visit", Qt::QueuedConnection);
loop.exec();
// test that the ED has really been used
- QVERIFY(ed->visited);
+ QVERIFY(ed->visited.load());
QPointer<DummyEventDispatcher> weak_ed(ed);
QVERIFY(!weak_ed.isNull());
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index ed74c939f7..f8775bc75f 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -48,6 +48,7 @@
#include <QScopedArrayPointer>
#include <qtextcodec.h>
#include <qdatetime.h>
+#include <qprocess.h>
#include <float.h>
#include <qlocale.h>
@@ -145,6 +146,9 @@ private slots:
void measurementSystems();
void QTBUG_26035_positivesign();
+ void textDirection_data();
+ void textDirection();
+
private:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
QString m_sysapp;
@@ -1633,10 +1637,10 @@ void tst_QLocale::defaultNumeringSystem()
QCOMPARE(pa.toString(123), QLatin1String("123"));
QLocale ne("ne_IN");
- QCOMPARE(ne.toString(123), QLatin1String("123"));
+ QCOMPARE(ne.toString(123), QString::fromUtf8("१२३"));
QLocale mr("mr_IN");
- QCOMPARE(mr.toString(123), QLatin1String("123"));
+ QCOMPARE(mr.toString(123), QString::fromUtf8("१२३"));
QLocale ml("ml_IN");
QCOMPARE(ml.toString(123), QLatin1String("123"));
@@ -1959,5 +1963,44 @@ void tst_QLocale::QTBUG_26035_positivesign()
QVERIFY(ok);
}
+void tst_QLocale::textDirection_data()
+{
+ QTest::addColumn<int>("language");
+ QTest::addColumn<int>("script");
+ QTest::addColumn<bool>("rightToLeft");
+
+ for (int language = QLocale::C; language <= QLocale::LastLanguage; ++language) {
+ bool rightToLeft = false;
+ switch (language) {
+ case QLocale::Arabic:
+ case QLocale::Hebrew:
+ case QLocale::Kashmiri:
+ case QLocale::Persian:
+ case QLocale::Pashto:
+ case QLocale::Urdu:
+ case QLocale::Syriac:
+ case QLocale::Divehi:
+ rightToLeft = QLocale(QLocale::Language(language)).language() == QLocale::Language(language); // false if there is no locale data for language
+ break;
+ default:
+ break;
+ }
+ QString testName = QLocalePrivate::languageToCode(QLocale::Language(language));
+ QTest::newRow(testName.toLatin1().constData()) << language << int(QLocale::AnyScript) << rightToLeft;
+ }
+ QTest::newRow("pa_Arab") << int(QLocale::Punjabi) << int(QLocale::ArabicScript) << true;
+ QTest::newRow("uz_Arab") << int(QLocale::Uzbek) << int(QLocale::ArabicScript) << true;
+}
+
+void tst_QLocale::textDirection()
+{
+ QFETCH(int, language);
+ QFETCH(int, script);
+ QFETCH(bool, rightToLeft);
+
+ QLocale locale(QLocale::Language(language), QLocale::Script(script), QLocale::AnyCountry);
+ QCOMPARE(locale.textDirection() == Qt::RightToLeft, rightToLeft);
+}
+
QTEST_MAIN(tst_QLocale)
#include "tst_qlocale.moc"
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 91293ffc21..0a1af0a058 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -1164,8 +1164,6 @@ void tst_QString::indexOf()
options |= QRegularExpression::CaseInsensitiveOption;
QRegularExpression re(QRegularExpression::escape(needle), options);
- QEXPECT_FAIL("data58", "QRegularExpression does not support case folding", Continue);
- QEXPECT_FAIL("data59", "QRegularExpression does not support case folding", Continue);
QCOMPARE( haystack.indexOf(re, startpos), resultpos );
}