summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
commit198606f6dbca95ba3a170fff387327d8271018cd (patch)
tree79e8c632f5277fc7f0ae30ae7fb1e1c41745c815 /tests/auto/corelib/tools
parent77c0c1ca6505eb66bd75b3766f9a498574822bd1 (diff)
parent0d5ffd67a4748bcbf19dc3a4b9a36ae6314e58a6 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp30
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp4
-rw-r--r--tests/auto/corelib/tools/qpointf/tst_qpointf.cpp4
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp2
4 files changed, 20 insertions, 20 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 446e56e936..4ab79909e3 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -611,13 +611,11 @@ void tst_QDateTime::setMSecsSinceEpoch()
dt2.setTimeZone(europe);
dt2.setMSecsSinceEpoch(msecs);
QCOMPARE(dt2.date(), european.date());
-#ifdef Q_OS_MAC
- // NSTimeZone doesn't apply DST to high values
- if (msecs < (Q_INT64_C(123456) << 32))
-#else
- // Linux and Win are OK except when they overflow
- if (msecs != std::numeric_limits<qint64>::max())
-#endif
+
+ // don't compare the time if the date is too early or too late: prior
+ // to 1916, timezones in Europe were not standardised and some OS APIs
+ // have hard limits. Let's restrict it to the 32-bit Unix range
+ if (dt2.date().year() >= 1970 && dt2.date().year() <= 2037)
QCOMPARE(dt2.time(), european.time());
QCOMPARE(dt2.timeSpec(), Qt::TimeZone);
QCOMPARE(dt2.timeZone(), europe);
@@ -2634,10 +2632,10 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
-#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
- // Linux mktime bug uses last calculation
+#ifdef Q_OS_WIN
+ // Windows uses SecondOccurrence
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
+#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
// Add year to get to after tran FirstOccurrence
@@ -2676,10 +2674,10 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
-#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
- // Linux mktime bug uses last calculation
+#ifdef Q_OS_WIN
+ // Windows uses SecondOccurrence
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
+#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
// Add month to get to after tran FirstOccurrence
@@ -2718,10 +2716,10 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
-#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
- // Linux mktime bug uses last calculation
+#ifdef Q_OS_WIN
+ // Windows uses SecondOccurrence
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
+#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
// Add day to get to after tran FirstOccurrence
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index b33982695b..8726f77e58 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -753,7 +753,7 @@ void tst_QEasingCurve::testCbrtDouble()
if (f != 0.0)
t = t * (t_cubic + d + d) / f;
- double expected = pow(d, 1.0/3.0);
+ double expected = std::pow(d, 1.0/3.0);
const qreal error = qAbs(expected - t);
@@ -779,7 +779,7 @@ void tst_QEasingCurve::testCbrtFloat()
if (fac != 0.0f)
t = t * (t_cubic + f + f) / fac;
- float expected = pow(f, float(1.0/3.0));
+ float expected = std::pow(f, float(1.0/3.0));
const qreal error = qAbs(expected - t);
diff --git a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
index 436cedcca7..ff58c9b181 100644
--- a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
+++ b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
@@ -275,12 +275,12 @@ void tst_QPointF::division()
{
{
QPointF p(1e-14, 1e-14);
- p = p / sqrt(dot(p, p));
+ p = p / std::sqrt(dot(p, p));
QCOMPARE(dot(p, p), qreal(1.0));
}
{
QPointF p(1e-14, 1e-14);
- p /= sqrt(dot(p, p));
+ p /= std::sqrt(dot(p, p));
QCOMPARE(dot(p, p), qreal(1.0));
}
}
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 8cd9610542..d2f7a6ee50 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -2033,6 +2033,8 @@ void tst_QString::simplified_data()
QTest::newRow("chars apart posttab") << "a \tb" << "a b";
QTest::newRow("chars apart pretab") << "a\t b" << "a b";
QTest::newRow("many words") << " just some random\ttext here" << "just some random text here";
+ QTest::newRow("newlines") << "a\nb\nc" << "a b c";
+ QTest::newRow("newlines-trailing") << "a\nb\nc\n" << "a b c";
}
void tst_QString::simplified()