diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-17 16:40:42 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-17 16:40:42 +0100 |
commit | 8cd7557cb45f8732f253a5242c3843c154219d5b (patch) | |
tree | 42c4b08aa2235ac7181395a5ab1f21006d0ee9fa | |
parent | e7af7ee0156aac6d142ad5daf1fec56d68b3e0e8 (diff) | |
parent | 12f3a1f3172f24bfbcfd8c8d47e7e0fc9b451f45 (diff) | |
download | qtscript-8cd7557cb45f8732f253a5242c3843c154219d5b.tar.gz |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: Icbbf8cc78ef730c6ea6fbc02136a2d0a8f9690c5
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h | 4 | ||||
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 35 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index cd60d43..00caa6d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -190,15 +190,19 @@ || defined(_M_PPC) \ || defined(__PPC) #define WTF_CPU_PPC 1 +#ifndef __LITTLE_ENDIAN__ #define WTF_CPU_BIG_ENDIAN 1 #endif +#endif /* CPU(PPC64) - PowerPC 64-bit */ #if defined(__ppc64__) \ || defined(__PPC64__) #define WTF_CPU_PPC64 1 +#ifndef __LITTLE_ENDIAN__ #define WTF_CPU_BIG_ENDIAN 1 #endif +#endif /* CPU(SH4) - SuperH SH-4 */ #if defined(__SH4__) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index aa4cb9f..dde048b 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -5795,6 +5795,20 @@ void tst_QScriptEngine::qRegExpInport() } } +static QByteArray msgDateRoundtripJSQtJS(int i, uint secs, + const QScriptValue &jsDate2, + const QScriptValue &jsDate) +{ + QString result; + const qsreal diff = jsDate.toNumber() - jsDate2.toNumber(); + QTextStream(&result) << "jsDate2=\"" << jsDate2.toString() + << "\" (" << jsDate2.toNumber() << "), jsDate=\"" + << jsDate.toString() << "\" (" << jsDate.toNumber() + << "), diff=" << diff << "\", i=" << i << ", secs=" << secs + << ", TZ=\"" << qgetenv("TZ") << '"'; + return result.toLocal8Bit(); +} + // QScriptValue::toDateTime() returns a local time, whereas JS dates // are always stored as UTC. Qt Script must respect the current time // zone, and correctly adjust for daylight saving time that may be in @@ -5807,8 +5821,8 @@ void tst_QScriptEngine::dateRoundtripJSQtJS() QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0 * 1000.0)").arg(secs)); QDateTime qtDate = jsDate.toDateTime(); QScriptValue jsDate2 = eng.newDate(qtDate); - if (jsDate2.toNumber() != jsDate.toNumber()) - QFAIL(qPrintable(jsDate.toString())); + QVERIFY2(jsDate2.toNumber() == jsDate.toNumber(), + msgDateRoundtripJSQtJS(i, secs, jsDate2, jsDate)); secs += 2*60*60; } } @@ -5826,6 +5840,19 @@ void tst_QScriptEngine::dateRoundtripQtJSQt() } } +static QByteArray msgDateConversionJSQt(int i, uint secs, + const QString &qtUTCDateStr, + const QString &jsUTCDateStr, + const QScriptValue &jsDate) +{ + QString result; + QTextStream(&result) << "qtUTCDateStr=\"" << qtUTCDateStr + << "\", jsUTCDateStr=\"" << jsUTCDateStr << "\", jsDate=\"" + << jsDate.toString() << "\", i=" << i << ", secs=" << secs + << ", TZ=\"" << qgetenv("TZ") << '"'; + return result.toLocal8Bit(); +} + void tst_QScriptEngine::dateConversionJSQt() { uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t(); @@ -5836,8 +5863,8 @@ void tst_QScriptEngine::dateConversionJSQt() QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000") - if (qtUTCDateStr != jsUTCDateStr) - QFAIL(qPrintable(jsDate.toString())); + QVERIFY2(qtUTCDateStr == jsUTCDateStr, + msgDateConversionJSQt(i, secs, qtUTCDateStr, jsUTCDateStr, jsDate)); secs += 2*60*60; } } |