summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-02-05 21:25:31 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2012-02-05 21:26:33 +0100
commitd065dfd454890c332482a6109ed34a989e50809b (patch)
tree0d3e9c5367c1fad7d089d368182374e8d1d46ca1 /tests/auto/corelib/tools
parent632840cb0f5ad355d87fc040b015d04af86371ec (diff)
parent9f54846d951838361f4188b423e7aa7c7b9a9540 (diff)
Merge remote-tracking branch 'gerrit/master' into containers
Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp33
-rw-r--r--tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp4
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp86
-rw-r--r--tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp4
-rw-r--r--tests/auto/corelib/tools/qcache/tst_qcache.cpp4
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp4
-rw-r--r--tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp4
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp4
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp456
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp24
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp4
-rw-r--r--tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp4
-rw-r--r--tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp4
-rw-r--r--tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp4
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp4
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp4
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp4
-rw-r--r--tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp4
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp44
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp4
-rw-r--r--tests/auto/corelib/tools/qmargins/tst_qmargins.cpp4
-rw-r--r--tests/auto/corelib/tools/qpoint/tst_qpoint.cpp4
-rw-r--r--tests/auto/corelib/tools/qqueue/tst_qqueue.cpp4
-rw-r--r--tests/auto/corelib/tools/qrect/tst_qrect.cpp4
-rw-r--r--tests/auto/corelib/tools/qregexp/tst_qregexp.cpp10
-rw-r--r--tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp4
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp4
-rw-r--r--tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp4
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp23
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.h4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.h4
-rw-r--r--tests/auto/corelib/tools/qsize/tst_qsize.cpp4
-rw-r--r--tests/auto/corelib/tools/qsizef/tst_qsizef.cpp4
-rw-r--r--tests/auto/corelib/tools/qstl/tst_qstl.cpp4
-rw-r--r--tests/auto/corelib/tools/qstring/double_data.h4
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp383
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp4
-rw-r--r--tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp4
-rw-r--r--tests/auto/corelib/tools/qtime/tst_qtime.cpp12
-rw-r--r--tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp4
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp4
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp4
55 files changed, 844 insertions, 411 deletions
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 5735c4043b..1d7cb1e903 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -105,29 +105,24 @@ QVector<DataType> generateData(QString dataSetType, const int length)
{
QVector<DataType> container;
if (dataSetType == "Random") {
- for(int i=0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
container.append(rand());
- }
- else if (dataSetType == "Ascending") {
- for (int i=0; i < length; ++i)
+ } else if (dataSetType == "Ascending") {
+ for (int i = 0; i < length; ++i)
container.append(i);
- }
- else if (dataSetType == "Descending") {
- for (int i=0; i < length; ++i)
+ } else if (dataSetType == "Descending") {
+ for (int i = 0; i < length; ++i)
container.append(length - i);
- }
- else if (dataSetType == "Equal") {
- for (int i=0; i < length; ++i)
+ } else if (dataSetType == "Equal") {
+ for (int i = 0; i < length; ++i)
container.append(43);
- }
- else if (dataSetType == "Duplicates") {
- for (int i=0; i < length; ++i)
+ } else if (dataSetType == "Duplicates") {
+ for (int i = 0; i < length; ++i)
container.append(i % 10);
- }
- else if (dataSetType == "Almost Sorted") {
- for (int i=0; i < length; ++i)
+ } else if (dataSetType == "Almost Sorted") {
+ for (int i = 0; i < length; ++i)
container.append(i);
- for(int i = 0; i<= length / 10; ++i) {
+ for (int i = 0; i <= length / 10; ++i) {
const int iswap = i * 9;
DataType tmp = container.at(iswap);
container[iswap] = container.at(iswap + 1);
diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
index 9ee006827f..588506534a 100644
--- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
+++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 5b660ecd3f..585d6afa44 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -130,7 +130,8 @@ private slots:
void byteRefDetaching() const;
void reserve();
-
+ void movablity_data();
+ void movablity();
void literals();
};
@@ -1497,6 +1498,85 @@ void tst_QByteArray::reserve()
nil2.reserve(0);
}
+void tst_QByteArray::movablity_data()
+{
+ QTest::addColumn<QByteArray>("array");
+
+ QTest::newRow("0x00000000") << QByteArray("\x00\x00\x00\x00", 4);
+ QTest::newRow("0x000000ff") << QByteArray("\x00\x00\x00\xff", 4);
+ QTest::newRow("0xffffffff") << QByteArray("\xff\xff\xff\xff", 4);
+ QTest::newRow("empty") << QByteArray("");
+ QTest::newRow("null") << QByteArray();
+ QTest::newRow("sss") << QByteArray(3, 's');
+}
+
+void tst_QByteArray::movablity()
+{
+ QFETCH(QByteArray, array);
+
+ QVERIFY(!QTypeInfo<QByteArray>::isStatic);
+
+ const int size = array.size();
+ const bool isEmpty = array.isEmpty();
+ const bool isNull = array.isNull();
+ const int capacity = array.capacity();
+
+ QByteArray memSpace;
+
+ // we need only memory space not the instance
+ memSpace.~QByteArray();
+ // move array -> memSpace
+ memcpy(&memSpace, &array, sizeof(QByteArray));
+ // reconstruct empty QByteArray
+ new (&array) QByteArray;
+
+ QCOMPARE(memSpace.size(), size);
+ QCOMPARE(memSpace.isEmpty(), isEmpty);
+ QCOMPARE(memSpace.isNull(), isNull);
+ QCOMPARE(memSpace.capacity(), capacity);
+
+ // try to not crash
+ memSpace.toLower();
+ memSpace.toUpper();
+ memSpace.prepend('a');
+ memSpace.append("b", 1);
+ memSpace.squeeze();
+ memSpace.reserve(array.size() + 16);
+
+ QByteArray copy(memSpace);
+
+ // reinitialize base values
+ const int newSize = size + 2;
+ const bool newIsEmpty = false;
+ const bool newIsNull = false;
+ const int newCapacity = 16;
+
+ // move back memSpace -> array
+ array.~QByteArray();
+ memcpy(&array, &memSpace, sizeof(QByteArray));
+ // reconstruct empty QByteArray
+ new (&memSpace) QByteArray;
+
+ QCOMPARE(array.size(), newSize);
+ QCOMPARE(array.isEmpty(), newIsEmpty);
+ QCOMPARE(array.isNull(), newIsNull);
+ QCOMPARE(array.capacity(), newCapacity);
+ QVERIFY(array.startsWith("a"));
+ QVERIFY(array.endsWith("b"));
+
+ QCOMPARE(copy.size(), newSize);
+ QCOMPARE(copy.isEmpty(), newIsEmpty);
+ QCOMPARE(copy.isNull(), newIsNull);
+ QCOMPARE(copy.capacity(), newCapacity);
+ QVERIFY(copy.startsWith("a"));
+ QVERIFY(copy.endsWith("b"));
+
+ // try to not crash
+ array.squeeze();
+ array.reserve(array.size() + 3);
+ QVERIFY(true);
+}
+
void tst_QByteArray::literals()
{
#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
diff --git a/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp
index 8bc827ef7f..d0ba1fadc9 100644
--- a/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp
+++ b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qcache/tst_qcache.cpp b/tests/auto/corelib/tools/qcache/tst_qcache.cpp
index 88b56612af..8129f1510c 100644
--- a/tests/auto/corelib/tools/qcache/tst_qcache.cpp
+++ b/tests/auto/corelib/tools/qcache/tst_qcache.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index c5fdeeb54a..1732f628ea 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
index ad464dc40a..37fe346684 100644
--- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
+++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
index 14b41e178d..3a257c2f11 100644
--- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
+++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index 7bb6de8c9f..4921a7e734 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,20 +48,32 @@ class tst_QDate : public QObject
Q_OBJECT
private slots:
void toString();
+ void isNull_data();
+ void isNull();
void isValid_data();
void isValid();
void julianDay_data();
void julianDay();
+ void dayOfWeek_data();
+ void dayOfWeek();
+ void dayOfYear_data();
+ void dayOfYear();
+ void daysInMonth_data();
+ void daysInMonth();
+ void daysInYear();
+ void getDate();
void weekNumber_invalid_data();
void weekNumber_invalid();
void weekNumber_data();
void weekNumber();
+ void julianDaysLimits();
void addDays_data();
void addDays();
void addMonths_data();
void addMonths();
void addYears_data();
void addYears();
+ void daysTo();
void operator_eq_eq();
void operator_not_eq();
void operator_lt();
@@ -92,66 +104,92 @@ private slots:
Q_DECLARE_METATYPE(QDate)
+void tst_QDate::isNull_data()
+{
+ QTest::addColumn<qint64>("jd");
+ QTest::addColumn<bool>("null");
+
+ qint64 minJd = std::numeric_limits<qint64>::min() / 2;
+ qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+
+ QTest::newRow("qint64 min") << std::numeric_limits<qint64>::min() << true;
+ QTest::newRow("minJd - 1") << minJd - 1 << true;
+ QTest::newRow("minJd") << minJd << false;
+ QTest::newRow("minJd + 1") << minJd + 1 << false;
+ QTest::newRow("maxJd - 1") << maxJd - 1 << false;
+ QTest::newRow("maxJd") << maxJd << false;
+ QTest::newRow("maxJd + 1") << maxJd + 1 << true;
+ QTest::newRow("qint64 max") << std::numeric_limits<qint64>::max() << true;
+}
+
+void tst_QDate::isNull()
+{
+ QFETCH(qint64, jd);
+
+ QDate d = QDate::fromJulianDay(jd);
+ QTEST(d.isNull(), "null");
+}
+
void tst_QDate::isValid_data()
{
+ qint64 nullJd = std::numeric_limits<qint64>::min();
+
QTest::addColumn<int>("year");
QTest::addColumn<int>("month");
QTest::addColumn<int>("day");
- QTest::addColumn<uint>("jd");
+ QTest::addColumn<qint64>("jd");
QTest::addColumn<bool>("valid");
- QTest::newRow("0-0-0") << 0 << 0 << 0 << 0U << false;
- QTest::newRow("month 0") << 2000 << 0 << 1 << 0U << false;
- QTest::newRow("day 0") << 2000 << 1 << 0 << 0U << false;
+ QTest::newRow("0-0-0") << 0 << 0 << 0 << nullJd << false;
+ QTest::newRow("month 0") << 2000 << 0 << 1 << nullJd << false;
+ QTest::newRow("day 0") << 2000 << 1 << 0 << nullJd << false;
- QTest::newRow("month 13") << 2000 << 13 << 1 << 0U << false;
+ QTest::newRow("month 13") << 2000 << 13 << 1 << nullJd << false;
// test leap years
- QTest::newRow("non-leap") << 2006 << 2 << 29 << 0U << false;
- QTest::newRow("normal leap") << 2004 << 2 << 29 << 2453065U << true;
- QTest::newRow("century leap") << 1900 << 2 << 29 << 0U << false;
- QTest::newRow("century leap") << 2100 << 2 << 29 << 0U << false;
- QTest::newRow("400-years leap") << 2000 << 2 << 29 << 2451604U << true;
- QTest::newRow("400-years leap 2") << 2400 << 2 << 29 << 2597701U << true;
- QTest::newRow("400-years leap 3") << 1600 << 2 << 29 << 2305507U << true;
- QTest::newRow("year 0") << 0 << 2 << 27 << 0U << false;
+ QTest::newRow("non-leap") << 2006 << 2 << 29 << nullJd << false;
+ QTest::newRow("normal leap") << 2004 << 2 << 29 << qint64(2453065) << true;
+ QTest::newRow("century leap") << 1900 << 2 << 29 << nullJd << false;
+ QTest::newRow("century leap") << 2100 << 2 << 29 << nullJd << false;
+ QTest::newRow("400-years leap") << 2000 << 2 << 29 << qint64(2451604) << true;
+ QTest::newRow("400-years leap 2") << 2400 << 2 << 29 << qint64(2597701) << true;
+ QTest::newRow("400-years leap 3") << 1600 << 2 << 29 << qint64(2305507) << true;
+ QTest::newRow("year 0") << 0 << 2 << 27 << nullJd << false;
// test the number of days in months:
- QTest::newRow("jan") << 2000 << 1 << 31 << 2451575U << true;
- QTest::newRow("feb") << 2000 << 2 << 29 << 2451604U << true; // same data as 400-years leap
- QTest::newRow("mar") << 2000 << 3 << 31 << 2451635U << true;
- QTest::newRow("apr") << 2000 << 4 << 30 << 2451665U << true;
- QTest::newRow("may") << 2000 << 5 << 31 << 2451696U << true;
- QTest::newRow("jun") << 2000 << 6 << 30 << 2451726U << true;
- QTest::newRow("jul") << 2000 << 7 << 31 << 2451757U << true;
- QTest::newRow("aug") << 2000 << 8 << 31 << 2451788U << true;
- QTest::newRow("sep") << 2000 << 9 << 30 << 2451818U << true;
- QTest::newRow("oct") << 2000 << 10 << 31 << 2451849U << true;
- QTest::newRow("nov") << 2000 << 11 << 30 << 2451879U << true;
- QTest::newRow("dec") << 2000 << 12 << 31 << 2451910U << true;
+ QTest::newRow("jan") << 2000 << 1 << 31 << qint64(2451575) << true;
+ QTest::newRow("feb") << 2000 << 2 << 29 << qint64(2451604) << true; // same data as 400-years leap
+ QTest::newRow("mar") << 2000 << 3 << 31 << qint64(2451635) << true;
+ QTest::newRow("apr") << 2000 << 4 << 30 << qint64(2451665) << true;
+ QTest::newRow("may") << 2000 << 5 << 31 << qint64(2451696) << true;
+ QTest::newRow("jun") << 2000 << 6 << 30 << qint64(2451726) << true;
+ QTest::newRow("jul") << 2000 << 7 << 31 << qint64(2451757) << true;
+ QTest::newRow("aug") << 2000 << 8 << 31 << qint64(2451788) << true;
+ QTest::newRow("sep") << 2000 << 9 << 30 << qint64(2451818) << true;
+ QTest::newRow("oct") << 2000 << 10 << 31 << qint64(2451849) << true;
+ QTest::newRow("nov") << 2000 << 11 << 30 << qint64(2451879) << true;
+ QTest::newRow("dec") << 2000 << 12 << 31 << qint64(2451910) << true;
// and invalid dates:
- QTest::newRow("ijan") << 2000 << 1 << 32 << 0U << false;
- QTest::newRow("ifeb") << 2000 << 2 << 30 << 0U << false;
- QTest::newRow("imar") << 2000 << 3 << 32 << 0U << false;
- QTest::newRow("iapr") << 2000 << 4 << 31 << 0U << false;
- QTest::newRow("imay") << 2000 << 5 << 32 << 0U << false;
- QTest::newRow("ijun") << 2000 << 6 << 31 << 0U << false;
- QTest::newRow("ijul") << 2000 << 7 << 32 << 0U << false;
- QTest::newRow("iaug") << 2000 << 8 << 32 << 0U << false;
- QTest::newRow("isep") << 2000 << 9 << 31 << 0U << false;
- QTest::newRow("ioct") << 2000 << 10 << 32 << 0U << false;
- QTest::newRow("inov") << 2000 << 11 << 31 << 0U << false;
- QTest::newRow("idec") << 2000 << 12 << 32 << 0U << false;
+ QTest::newRow("ijan") << 2000 << 1 << 32 << nullJd << false;
+ QTest::newRow("ifeb") << 2000 << 2 << 30 << nullJd << false;
+ QTest::newRow("imar") << 2000 << 3 << 32 << nullJd << false;
+ QTest::newRow("iapr") << 2000 << 4 << 31 << nullJd << false;
+ QTest::newRow("imay") << 2000 << 5 << 32 << nullJd << false;
+ QTest::newRow("ijun") << 2000 << 6 << 31 << nullJd << false;
+ QTest::newRow("ijul") << 2000 << 7 << 32 << nullJd << false;
+ QTest::newRow("iaug") << 2000 << 8 << 32 << nullJd << false;
+ QTest::newRow("isep") << 2000 << 9 << 31 << nullJd << false;
+ QTest::newRow("ioct") << 2000 << 10 << 32 << nullJd << false;
+ QTest::newRow("inov") << 2000 << 11 << 31 << nullJd << false;
+ QTest::newRow("idec") << 2000 << 12 << 32 << nullJd << false;
// the beginning of the Julian Day calendar:
- QTest::newRow("jd negative1") << -4714 << 1 << 1 << 0U << false;
- QTest::newRow("jd negative2") << -4713 << 1 << 1 << 0U << false;
- QTest::newRow("jd negative3") << -4713 << 1 << 2 << 1U << true;
- QTest::newRow("jd negative4") << -4713 << 1 << 3 << 2U << true;
- QTest::newRow("jd 0") << -4713 << 1 << 1 << 0U << false;
- QTest::newRow("jd 1") << -4713 << 1 << 2 << 1U << true;
- QTest::newRow("imminent overflow") << 11754508 << 12 << 13 << 4294967295U << true;
+ QTest::newRow("jd earliest formula") << -4800 << 1 << 1 << qint64( -31738) << true;
+ QTest::newRow("jd -1") << -4714 << 11 << 23 << qint64( -1) << true;
+ QTest::newRow("jd 0") << -4714 << 11 << 24 << qint64( 0) << true;
+ QTest::newRow("jd 1") << -4714 << 11 << 25 << qint64( 1) << true;
+ QTest::newRow("jd latest formula") << 1400000 << 12 << 31 << qint64(513060925) << true;
}
void tst_QDate::isValid()
@@ -159,12 +197,25 @@ void tst_QDate::isValid()
QFETCH(int, year);
QFETCH(int, month);
QFETCH(int, day);
+ QFETCH(qint64, jd);
+ QFETCH(bool, valid);
- QTEST(QDate::isValid(year, month, day), "valid");
+ QCOMPARE(QDate::isValid(year, month, day), valid);
QDate d;
d.setDate(year, month, day);
- QTEST(d.isValid(), "valid");
+ QCOMPARE(d.isValid(), valid);
+ QCOMPARE(d.toJulianDay(), jd);
+
+ if (valid) {
+ QCOMPARE(d.year(), year);
+ QCOMPARE(d.month(), month);
+ QCOMPARE(d.day(), day);
+ } else {
+ QCOMPARE(d.year(), 0);
+ QCOMPARE(d.month(), 0);
+ QCOMPARE(d.day(), 0);
+ }
}
void tst_QDate::julianDay_data()
@@ -177,15 +228,15 @@ void tst_QDate::julianDay()
QFETCH(int, year);
QFETCH(int, month);
QFETCH(int, day);
- QFETCH(uint, jd);
+ QFETCH(qint64, jd);
{
QDate d;
d.setDate(year, month, day);
- QCOMPARE(uint(d.toJulianDay()), jd);
+ QCOMPARE(d.toJulianDay(), jd);
}
- if (jd) {
+ if (jd != std::numeric_limits<qint64>::min()) {
QDate d = QDate::fromJulianDay(jd);
QCOMPARE(d.year(), year);
QCOMPARE(d.month(), month);
@@ -193,6 +244,137 @@ void tst_QDate::julianDay()
}
}
+void tst_QDate::dayOfWeek_data()
+{
+ QTest::addColumn<int>("year");
+ QTest::addColumn<int>("month");
+ QTest::addColumn<int>("day");
+ QTest::addColumn<int>("dayOfWeek");
+
+ QTest::newRow("data0") << 0 << 0 << 0 << 0;
+ QTest::newRow("data1") << 2000 << 1 << 3 << 1;
+ QTest::newRow("data2") << 2000 << 1 << 4 << 2;
+ QTest::newRow("data3") << 2000 << 1 << 5 << 3;
+ QTest::newRow("data4") << 2000 << 1 << 6 << 4;
+ QTest::newRow("data5") << 2000 << 1 << 7 << 5;
+ QTest::newRow("data6") << 2000 << 1 << 8 << 6;
+ QTest::newRow("data7") << 2000 << 1 << 9 << 7;
+ QTest::newRow("data8") << -4800 << 1 << 1 << 1;
+ QTest::newRow("data9") << -4800 << 1 << 2 << 2;
+ QTest::newRow("data10") << -4800 << 1 << 3 << 3;
+ QTest::newRow("data12") << -4800 << 1 << 4 << 4;
+ QTest::newRow("data12") << -4800 << 1 << 5 << 5;
+ QTest::newRow("data13") << -4800 << 1 << 6 << 6;
+ QTest::newRow("data14") << -4800 << 1 << 7 << 7;
+ QTest::newRow("data15") << -4800 << 1 << 8 << 1;
+}
+
+void tst_QDate::dayOfWeek()
+{
+ QFETCH(int, year);
+ QFETCH(int, month);
+ QFETCH(int, day);
+ QFETCH(int, dayOfWeek);
+
+ QDate dt(year, month, day);
+ QCOMPARE(dt.dayOfWeek(), dayOfWeek);
+}
+
+void tst_QDate::dayOfYear_data()
+{
+ QTest::addColumn<int>("year");
+ QTest::addColumn<int>("month");
+ QTest::addColumn<int>("day");
+ QTest::addColumn<int>("dayOfYear");
+
+ QTest::newRow("data0") << 0 << 0 << 0 << 0;
+ QTest::newRow("data1") << 2000 << 1 << 1 << 1;
+ QTest::newRow("data2") << 2000 << 1 << 2 << 2;
+ QTest::newRow("data3") << 2000 << 1 << 3 << 3;
+ QTest::newRow("data4") << 2000 << 12 << 31 << 366;
+ QTest::newRow("data5") << 2001 << 12 << 31 << 365;
+ QTest::newRow("data6") << 1815 << 1 << 1 << 1;
+ QTest::newRow("data7") << 1815 << 12 << 31 << 365;
+ QTest::newRow("data8") << 1500 << 1 << 1 << 1;
+ QTest::newRow("data9") << 1500 << 12 << 31 << 365;
+ QTest::newRow("data10") << -1500 << 1 << 1 << 1;
+ QTest::newRow("data11") << -1500 << 12 << 31 << 365;
+ QTest::newRow("data12") << -4800 << 1 << 1 << 1;
+ QTest::newRow("data13") << -4800 << 12 << 31 << 365;
+}
+
+void tst_QDate::dayOfYear()
+{
+ QFETCH(int, year);
+ QFETCH(int, month);
+ QFETCH(int, day);
+ QFETCH(int, dayOfYear);
+
+ QDate dt(year, month, day);
+ QCOMPARE(dt.dayOfYear(), dayOfYear);
+}
+
+void tst_QDate::daysInMonth_data()
+{
+ QTest::addColumn<int>("year");
+ QTest::addColumn<int>("month");
+ QTest::addColumn<int>("day");
+ QTest::addColumn<int>("daysInMonth");
+
+ QTest::newRow("data0") << 0 << 0 << 0 << 0;
+ QTest::newRow("data1") << 2000 << 1 << 1 << 31;
+ QTest::newRow("data2") << 2000 << 2 << 1 << 29;
+ QTest::newRow("data3") << 2000 << 3 << 1 << 31;
+ QTest::newRow("data4") << 2000 << 4 << 1 << 30;
+ QTest::newRow("data5") << 2000 << 5 << 1 << 31;
+ QTest::newRow("data6") << 2000 << 6 << 1 << 30;
+ QTest::newRow("data7") << 2000 << 7 << 1 << 31;
+ QTest::newRow("data8") << 2000 << 8 << 1 << 31;
+ QTest::newRow("data9") << 2000 << 9 << 1 << 30;
+ QTest::newRow("data10") << 2000 << 10 << 1 << 31;
+ QTest::newRow("data11") << 2000 << 11 << 1 << 30;
+ QTest::newRow("data12") << 2000 << 12 << 1 << 31;
+ QTest::newRow("data13") << 2001 << 2 << 1 << 28;
+}
+
+void tst_QDate::daysInMonth()
+{
+ QFETCH(int, year);
+ QFETCH(int, month);
+ QFETCH(int, day);
+ QFETCH(int, daysInMonth);
+
+ QDate dt(year, month, day);
+ QCOMPARE(dt.daysInMonth(), daysInMonth);
+}
+
+void tst_QDate::daysInYear()
+{
+ QDate dt(2000, 1, 1);
+ QCOMPARE(dt.daysInYear(), 366);
+ dt.setDate(2001, 1, 1);
+ QCOMPARE(dt.daysInYear(), 365);
+ dt.setDate(4, 1, 1);
+ QCOMPARE(dt.daysInYear(), 366);
+ dt.setDate(5, 1, 1);
+ QCOMPARE(dt.daysInYear(), 365);
+}
+
+void tst_QDate::getDate()
+{
+ int y, m, d;
+ QDate dt(2000, 1, 1);
+ dt.getDate(&y, &m, &d);
+ QCOMPARE(y, 2000);
+ QCOMPARE(m, 1);
+ QCOMPARE(d, 1);
+ dt.setDate(0, 0, 0);
+ dt.getDate(&y, &m, &d);
+ QCOMPARE(y, 0);
+ QCOMPARE(m, 0);
+ QCOMPARE(d, 0);
+}
+
void tst_QDate::weekNumber_data()
{
QTest::addColumn<int>("expectedWeekNum");
@@ -244,6 +426,68 @@ void tst_QDate::weekNumber_invalid()
QCOMPARE( dt.weekNumber( &yearNumber ), 0 );
}
+void tst_QDate::julianDaysLimits()
+{
+ qint64 min = std::numeric_limits<qint64>::min();
+ qint64 max = std::numeric_limits<qint64>::max();
+ qint64 minJd = std::numeric_limits<qint64>::min() / 2;
+ qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+
+ QDate maxDate = QDate::fromJulianDay(maxJd);
+ QDate minDate = QDate::fromJulianDay(minJd);
+ QDate zeroDate = QDate::fromJulianDay(0);
+
+ QDate dt = QDate::fromJulianDay(min);
+ QCOMPARE(dt.isValid(), false);
+ dt = QDate::fromJulianDay(minJd - 1);
+ QCOMPARE(dt.isValid(), false);
+ dt = QDate::fromJulianDay(minJd);
+ QCOMPARE(dt.isValid(), true);
+ dt = QDate::fromJulianDay(minJd + 1);
+ QCOMPARE(dt.isValid(), true);
+ dt = QDate::fromJulianDay(maxJd - 1);
+ QCOMPARE(dt.isValid(), true);
+ dt = QDate::fromJulianDay(maxJd);
+ QCOMPARE(dt.isValid(), true);
+ dt = QDate::fromJulianDay(maxJd + 1);
+ QCOMPARE(dt.isValid(), false);
+ dt = QDate::fromJulianDay(max);
+ QCOMPARE(dt.isValid(), false);
+
+ dt = maxDate.addDays(1);
+ QCOMPARE(dt.isValid(), false);
+ dt = maxDate.addDays(0);
+ QCOMPARE(dt.isValid(), true);
+ dt = maxDate.addDays(-1);
+ QCOMPARE(dt.isValid(), true);
+ dt = maxDate.addDays(max);
+ QCOMPARE(dt.isValid(), false);
+ dt = maxDate.addDays(min);
+ QCOMPARE(dt.isValid(), false);
+
+ dt = minDate.addDays(-1);
+ QCOMPARE(dt.isValid(), false);
+ dt = minDate.addDays(0);
+ QCOMPARE(dt.isValid(), true);
+ dt = minDate.addDays(1);
+ QCOMPARE(dt.isValid(), true);
+ dt = minDate.addDays(min);
+ QCOMPARE(dt.isValid(), false);
+ dt = minDate.addDays(max);
+ QCOMPARE(dt.isValid(), true);
+
+ dt = zeroDate.addDays(-1);
+ QCOMPARE(dt.isValid(), true);
+ dt = zeroDate.addDays(0);
+ QCOMPARE(dt.isValid(), true);
+ dt = zeroDate.addDays(1);
+ QCOMPARE(dt.isValid(), true);
+ dt = zeroDate.addDays(min);
+ QCOMPARE(dt.isValid(), false);
+ dt = zeroDate.addDays(max);
+ QCOMPARE(dt.isValid(), false);
+}
+
void tst_QDate::addDays()
{
QFETCH( int, year );
@@ -286,9 +530,8 @@ void tst_QDate::addDays_data()
QTest::newRow( "data10" ) << 2000 << 2 << 28 << -1 << 2000 << 2 << 27;
QTest::newRow( "data11" ) << 2001 << 2 << 28 << -30 << 2001 << 1 << 29;
- QDate invalid;
- QTest::newRow( "data12" ) << -4713 << 1 << 2 << -2
- << invalid.year() << invalid.month() << invalid.day();
+ QTest::newRow( "data12" ) << -4713 << 1 << 2 << -2 << -4714 << 12 << 31;
+ QTest::newRow( "data13" ) << -4713 << 1 << 2 << 2 << -4713 << 1 << 4;
}
void tst_QDate::addMonths()
@@ -341,14 +584,6 @@ void tst_QDate::addMonths_data()
QTest::newRow( "data15" ) << 1 << 1 << 1 << -12 << -1 << 1 << 1;
QTest::newRow( "data16" ) << -1 << 12 << 1 << 1 << 1 << 1 << 1;
QTest::newRow( "data17" ) << -1 << 1 << 1 << 12 << 1 << 1 << 1;
-
- // Gregorian/Julian switchover
- QTest::newRow( "data18" ) << 1582 << 9 << 4 << 1 << 1582 << 10 << 4;
- QTest::newRow( "data19" ) << 1582 << 9 << 10 << 1 << 1582 << 10 << 15;
- QTest::newRow( "data20" ) << 1582 << 9 << 20 << 1 << 1582 << 10 << 20;
- QTest::newRow( "data21" ) << 1582 << 11 << 4 << -1 << 1582 << 10 << 4;
- QTest::newRow( "data22" ) << 1582 << 11 << 10 << -1 << 1582 << 10 << 4;
- QTest::newRow( "data23" ) << 1582 << 11 << 20 << -1 << 1582 << 10 << 20;
}
void tst_QDate::addYears()
@@ -402,6 +637,35 @@ void tst_QDate::addYears_data()
QTest::newRow( "data19" ) << -2000 << 1 << 1 << 2001 << 2 << 1 << 1;
}
+void tst_QDate::daysTo()
+{
+ qint64 minJd = std::numeric_limits<qint64>::min() / 2;
+ qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+
+ QDate dt1(2000, 1, 1);
+ QDate dt2(2000, 1, 5);
+ QCOMPARE(dt1.daysTo(dt2), (qint64) 4);
+ QCOMPARE(dt2.daysTo(dt1), (qint64) -4);
+
+ dt1.setDate(0, 0, 0);
+ QCOMPARE(dt1.daysTo(dt2), (qint64) 0);
+ dt1.setDate(2000, 1, 1);
+ dt2.setDate(0, 0, 0);
+ QCOMPARE(dt1.daysTo(dt2), (qint64) 0);
+
+
+ QDate maxDate = QDate::fromJulianDay(maxJd);
+ QDate minDate = QDate::fromJulianDay(minJd);
+ QDate zeroDate = QDate::fromJulianDay(0);
+
+ QCOMPARE(maxDate.daysTo(minDate), minJd - maxJd);
+ QCOMPARE(minDate.daysTo(maxDate), maxJd - minJd);
+ QCOMPARE(maxDate.daysTo(zeroDate), -maxJd);
+ QCOMPARE(zeroDate.daysTo(maxDate), maxJd);
+ QCOMPARE(minDate.daysTo(zeroDate), -minJd);
+ QCOMPARE(zeroDate.daysTo(minDate), minJd);
+}
+
void tst_QDate::operator_eq_eq()
{
QDate d1(2000,1,2);
@@ -636,6 +900,8 @@ void tst_QDate::toString_format()
void tst_QDate::isLeapYear()
{
+ QVERIFY(QDate::isLeapYear(-4801));
+ QVERIFY(!QDate::isLeapYear(-4800));
QVERIFY(QDate::isLeapYear(-4445));
QVERIFY(!QDate::isLeapYear(-4444));
QVERIFY(!QDate::isLeapYear(-6));
@@ -651,10 +917,10 @@ void tst_QDate::isLeapYear()
QVERIFY(QDate::isLeapYear(4));
QVERIFY(!QDate::isLeapYear(7));
QVERIFY(QDate::isLeapYear(8));
- QVERIFY(QDate::isLeapYear(100));
+ QVERIFY(!QDate::isLeapYear(100));
QVERIFY(QDate::isLeapYear(400));
- QVERIFY(QDate::isLeapYear(700));
- QVERIFY(QDate::isLeapYear(1500));
+ QVERIFY(!QDate::isLeapYear(700));
+ QVERIFY(!QDate::isLeapYear(1500));
QVERIFY(QDate::isLeapYear(1600));
QVERIFY(!QDate::isLeapYear(1700));
QVERIFY(!QDate::isLeapYear(1800));
@@ -703,6 +969,7 @@ void tst_QDate::yearsZeroToNinetyNine()
QVERIFY(QDate::isValid(1, 2, 3));
QVERIFY(QDate::isValid(-1, 2, 3));
+#if QT_DEPRECATED_SINCE(5,0)
{
QDate dt;
dt.setYMD(1, 2, 3);
@@ -710,6 +977,7 @@ void tst_QDate::yearsZeroToNinetyNine()
QCOMPARE(dt.month(), 2);
QCOMPARE(dt.day(), 3);
}
+#endif
{
QDate dt;
@@ -777,6 +1045,8 @@ void tst_QDate::roundtripGermanLocale() const
void tst_QDate::shortDayName() const
{
+ QCOMPARE(QDate::shortDayName(0), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::shortDayName(1), QLatin1String("Mon"));
QCOMPARE(QDate::shortDayName(7), QLatin1String("Sun"));
@@ -790,6 +1060,8 @@ void tst_QDate::shortDayName() const
void tst_QDate::standaloneShortDayName() const
{
+ QCOMPARE(QDate::shortDayName(0, QDate::StandaloneFormat), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::shortDayName(1, QDate::StandaloneFormat), QLatin1String("Mon"));
QCOMPARE(QDate::shortDayName(7, QDate::StandaloneFormat), QLatin1String("Sun"));
@@ -803,6 +1075,8 @@ void tst_QDate::standaloneShortDayName() const
void tst_QDate::longDayName() const
{
+ QCOMPARE(QDate::longDayName(0), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::longDayName(1), QLatin1String("Monday"));
QCOMPARE(QDate::longDayName(7), QLatin1String("Sunday"));
@@ -816,6 +1090,8 @@ void tst_QDate::longDayName() const
void tst_QDate::standaloneLongDayName() const
{
+ QCOMPARE(QDate::longDayName(0, QDate::StandaloneFormat), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::longDayName(1, QDate::StandaloneFormat), QLatin1String("Monday"));
QCOMPARE(QDate::longDayName(7, QDate::StandaloneFormat), QLatin1String("Sunday"));
@@ -829,6 +1105,8 @@ void tst_QDate::standaloneLongDayName() const
void tst_QDate::shortMonthName() const
{
+ QCOMPARE(QDate::shortMonthName(0), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::shortMonthName(1), QLatin1String("Jan"));
QCOMPARE(QDate::shortMonthName(8), QLatin1String("Aug"));
@@ -842,6 +1120,8 @@ void tst_QDate::shortMonthName() const
void tst_QDate::standaloneShortMonthName() const
{
+ QCOMPARE(QDate::shortMonthName(0, QDate::StandaloneFormat), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::shortMonthName(1, QDate::StandaloneFormat), QLatin1String("Jan"));
QCOMPARE(QDate::shortMonthName(8, QDate::StandaloneFormat), QLatin1String("Aug"));
@@ -855,6 +1135,8 @@ void tst_QDate::standaloneShortMonthName() const
void tst_QDate::longMonthName() const
{
+ QCOMPARE(QDate::longMonthName(0), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::longMonthName(1), QLatin1String("January"));
QCOMPARE(QDate::longMonthName(8), QLatin1String("August"));
@@ -868,6 +1150,8 @@ void tst_QDate::longMonthName() const
void tst_QDate::standaloneLongMonthName() const
{
+ QCOMPARE(QDate::longMonthName(0, QDate::StandaloneFormat), QString());
+
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::longMonthName(1, QDate::StandaloneFormat), QLatin1String("January"));
QCOMPARE(QDate::longMonthName(8, QDate::StandaloneFormat), QLatin1String("August"));
@@ -885,28 +1169,44 @@ void tst_QDate::roundtrip() const
// year(), month(), day(), julianDayFromDate(), and getDateFromJulianDay()
// to ensure they are internally consistent (but doesn't guarantee correct)
- // Test Julian round trip in both BC and AD
+ // Test Julian round trip around JD 0 and current low end of valid range
QDate testDate;
- QDate loopDate = QDate::fromJulianDay(1684899); // 1 Jan 100 BC
- while ( loopDate.toJulianDay() <= 1757948 ) { // 31 Dec 100 AD
- testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
- QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ QDate loopDate = QDate::fromJulianDay(-31738); // 1 Jan 4800 BC
+ while (loopDate.toJulianDay() <= 5150) { // 31 Dec 4700 BC
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
loopDate = loopDate.addDays(1);
}
- // Test Julian and Gregorian round trip during changeover period
- loopDate = QDate::fromJulianDay(2298153); // 1 Jan 1580 AD
- while ( loopDate.toJulianDay() <= 2300334 ) { // 31 Dec 1585 AD
- testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
- QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ // Test Julian round trip in both BC and AD
+ loopDate = QDate::fromJulianDay(1684901); // 1 Jan 100 BC
+ while (loopDate.toJulianDay() <= 1757949) { // 31 Dec 100 AD
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
loopDate = loopDate.addDays(1);
}
// Test Gregorian round trip during current useful period
loopDate = QDate::fromJulianDay(2378497); // 1 Jan 1900 AD
- while ( loopDate.toJulianDay() <= 2488433 ) { // 31 Dec 2100 AD
- testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
- QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ while (loopDate.toJulianDay() <= 2488433) { // 31 Dec 2100 AD
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
+ loopDate = loopDate.addDays(1);
+ }
+
+ // Test Gregorian round trip at top end of widget/format range
+ loopDate = QDate::fromJulianDay(5336961); // 1 Jan 9900 AD
+ while (loopDate.toJulianDay() <= 5373484) { // 31 Dec 9999 AD
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
+ loopDate = loopDate.addDays(1);
+ }
+
+ // Test Gregorian round trip at top end of conversion range
+ loopDate = QDate::fromJulianDay(513024036); // 1 Jan 1399900 AD
+ while (loopDate.toJulianDay() <= 513060925) { // 31 Dec 1400000 AD
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
loopDate = loopDate.addDays(1);
}
}
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 4ef508e92b..af8deefa4c 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -726,14 +726,6 @@ void tst_QDateTime::addSecs_data()
QTest::newRow("toPositive") << QDateTime(QDate(-1, 12, 31), QTime(23, 59, 59), Qt::UTC)
<< 1
<< QDateTime(QDate(1, 1, 1), QTime(0, 0, 0), Qt::UTC);
-
- // Gregorian/Julian switchover
- QTest::newRow("toGregorian") << QDateTime(QDate(1582, 10, 4), QTime(23, 59, 59))
- << 1
- << QDateTime(QDate(1582, 10, 15), QTime(0, 0, 0));
- QTest::newRow("toJulian") << QDateTime(QDate(1582, 10, 15), QTime(0, 0, 0))
- << -1
- << QDateTime(QDate(1582, 10, 4), QTime(23, 59, 59));
}
void tst_QDateTime::addSecs()
@@ -883,22 +875,22 @@ void tst_QDateTime::daysTo()
QDateTime dt2(QDate(1760, 2, 2), QTime());
QDateTime dt3(QDate(1760, 3, 2), QTime());
- QCOMPARE(dt1.daysTo(dt2), 31);
+ QCOMPARE(dt1.daysTo(dt2), (qint64) 31);
QCOMPARE(dt1.addDays(31), dt2);
- QCOMPARE(dt2.daysTo(dt3), 29);
+ QCOMPARE(dt2.daysTo(dt3), (qint64) 29);
QCOMPARE(dt2.addDays(29), dt3);
- QCOMPARE(dt1.daysTo(dt3), 60);
+ QCOMPARE(dt1.daysTo(dt3), (qint64) 60);
QCOMPARE(dt1.addDays(60), dt3);
- QCOMPARE(dt2.daysTo(dt1), -31);
+ QCOMPARE(dt2.daysTo(dt1), (qint64) -31);
QCOMPARE(dt2.addDays(-31), dt1);
- QCOMPARE(dt3.daysTo(dt2), -29);
+ QCOMPARE(dt3.daysTo(dt2), (qint64) -29);
QCOMPARE(dt3.addDays(-29), dt2);
- QCOMPARE(dt3.daysTo(dt1), -60);
+ QCOMPARE(dt3.daysTo(dt1), (qint64) -60);
QCOMPARE(dt3.addDays(-60), dt1);
}
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index a4a96c6df7..0a006ab5b4 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp
index 0e2f61ab98..7f28e8dc0c 100644
--- a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
index a031bf811d..e0e74efdd0 100644
--- a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
+++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp
index a713fd4ca7..86696ab0c9 100644
--- a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp
+++ b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 6c941179d6..3b5d15dbfc 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp
index 0c4df63884..28ed8d3e22 100644
--- a/tests/auto/corelib/tools/qline/tst_qline.cpp
+++ b/tests/auto/corelib/tools/qline/tst_qline.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
index c1b71de2b7..fbb821c730 100644
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp
index 2b6280fd2b..508833b5d0 100644
--- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp
+++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index a670cac03c..5544c0fd71 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -123,9 +123,6 @@ private slots:
void monthName();
void standaloneMonthName();
- // QSystemLocale tests
- void queryDateTime();
-
void ampm();
void currency();
void quoteString();
@@ -1778,43 +1775,6 @@ a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000
QVERIFY(!ok);
}
-class SystemLocale : public QSystemLocale
-{
-public:
- virtual QVariant query(QueryType type, QVariant in) const
- {
- switch (type) {
- case DateTimeFormatLong: return QLatin1String("dddd ddd dd d MMMM MMM MM M yyyy hh:mm:ss.zzz");
- case DateTimeFormatShort: return QLatin1String("d M yy h:m");
- case DateTimeToStringLong:
- case DateTimeToStringShort:
- return in.toDateTime().toString(type == DateTimeToStringShort
- ? QLatin1String("dMyyhm")
- : QLatin1String("ddMMyyyyhhmmsszzz"));
- default:
- break;
- }
- return QSystemLocale::query(type, in);
- }
-};
-
-
-
-void tst_QLocale::queryDateTime()
-{
- SystemLocale loc;
- QCOMPARE(QLocale::system().dateTimeFormat(QLocale::LongFormat),
- loc.query(QSystemLocale::DateTimeFormatLong, QVariant()).toString());
- QCOMPARE(QLocale::system().dateTimeFormat(QLocale::ShortFormat),
- loc.query(QSystemLocale::DateTimeFormatShort, QVariant()).toString());
- QCOMPARE(QLocale::system().toString(QDateTime(QDate(1974, 12, 1), QTime(1, 2, 3, 4)), QLocale::ShortFormat),
- QString("1127412"));
- QCOMPARE(QLocale::system().toString(QDateTime(QDate(1974, 12, 1), QTime(1, 2, 3, 4)), QLocale::NarrowFormat),
- QLocale::system().toString(QDateTime(QDate(1974, 12, 1), QTime(1, 2, 3, 4)), QLocale::ShortFormat));
- QCOMPARE(QLocale::system().toString(QDateTime(QDate(1974, 12, 1), QTime(1, 2, 3, 4)), QLocale::LongFormat),
- QString("01121974010203004"));
-}
-
void tst_QLocale::ampm()
{
QLocale c(QLocale::C);
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index c48bcfb4b3..79b0a931cb 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
index bdaf98cbf2..de3c0269e1 100644
--- a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
+++ b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp
index acdfd20488..aaeb6bd9f5 100644
--- a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp
+++ b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp b/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp
index 5282d2964b..eb800e57bc 100644
--- a/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp
+++ b/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
index c2a9d05af6..f9d0f0f291 100644
--- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp
+++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
index 836c02dfca..0148e933e4 100644
--- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
+++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -829,6 +829,8 @@ void tst_QRegExp::testEscapingWildcard_data(){
QTest::newRow("? Escaped") << "\\?O;" << "?O;" << true;
QTest::newRow("[] not escaped") << "[lL]" << "l" << true;
+ QTest::newRow("[] escaped") << "\\[\\]" << "[]" << true;
+
QTest::newRow("case [[]") << "[[abc]" << "[" << true;
QTest::newRow("case []abc] match ]") << "[]abc]" << "]" << true;
QTest::newRow("case []abc] match a") << "[]abc]" << "a" << true;
@@ -844,7 +846,7 @@ void tst_QRegExp::testEscapingWildcard_data(){
QTest::newRow("a true '\\' in input") << "\\Qt;" << "\\Qt;" << true;
QTest::newRow("two true '\\' in input") << "\\\\Qt;" << "\\\\Qt;" << true;
- QTest::newRow("a '\\' at the end") << "\\\\Qt;" << "\\\\Qt;" << true;
+ QTest::newRow("a '\\' at the end") << "\\\\Qt;\\" << "\\\\Qt;\\" << true;
}
void tst_QRegExp::testEscapingWildcard(){
@@ -1309,7 +1311,7 @@ void tst_QRegExp::posAndCapConsistency()
QFETCH( QString, cap2 );
QRegExp re(reStr);
- QCOMPARE(re.numCaptures(), 2);
+ QCOMPARE(re.captureCount(), 2);
QCOMPARE(re.capturedTexts().size(), 3);
QCOMPARE(re.indexIn(text), matchIndex);
diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
index 67de98b867..d94d35afaf 100644
--- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
+++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
index 22f6cb7d32..45ccaa671d 100644
--- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
index c0e036e232..b070b105da 100644
--- a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
+++ b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index 4c0ecce5ec..d7d8c99071 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index c7ffe8cb7b..fb946d9ca1 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,6 +52,7 @@
#include <QtCore/QDirIterator>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
+#include <QtCore/QLibraryInfo>
#ifndef DEFAULT_MAKESPEC
# error DEFAULT_MAKESPEC not defined
@@ -464,7 +465,11 @@ namespace QTest {
"SOURCES += project.cpp\n"
"QT -= core gui\n"
"INCLUDEPATH += . ");
- projectFile.write(QFile::encodeName(QDir::currentPath()));
+
+ QString workingDir = QDir::currentPath();
+ if (extraProgramSources.count() > 0)
+ workingDir = QFileInfo(extraProgramSources.first()).absolutePath();
+ projectFile.write(QFile::encodeName(workingDir));
#ifndef QT_NO_DEBUG
projectFile.write("\nCONFIG += debug\n");
@@ -565,7 +570,17 @@ namespace QTest {
<< makespec()
<< QLatin1String("project.pro");
qmake.setWorkingDirectory(temporaryDirPath);
- qmake.start(QLatin1String("qmake"), args);
+
+ QString cmd = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake";
+#ifdef Q_OS_WIN
+ cmd.append(".exe");
+#endif
+ if (!QFile::exists(cmd)) {
+ cmd = "qmake";
+ qWarning("qmake from build not found, fallback to PATH's qmake");
+ }
+
+ qmake.start(cmd, args);
std_out += "### --- stdout from qmake --- ###\n";
std_err += "### --- stderr from qmake --- ###\n";
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.h b/tests/auto/corelib/tools/qsharedpointer/externaltests.h
index 6903433b70..96edbd8a2b 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.h
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp
index b5d59de037..6fb01c6aa2 100644
--- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
index 17812216c0..b10b7e53ba 100644
--- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
index cebbe94ef1..23f6dbf24c 100644
--- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
+++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 35b63deb4c..2bae52a622 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
index 889493ddb4..9123853696 100644
--- a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsharedpointer/wrapper.h b/tests/auto/corelib/tools/qsharedpointer/wrapper.h
index 66202a5a31..98b9a804c4 100644
--- a/tests/auto/corelib/tools/qsharedpointer/wrapper.h
+++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsize/tst_qsize.cpp b/tests/auto/corelib/tools/qsize/tst_qsize.cpp
index bc40e2aa64..be8a374a49 100644
--- a/tests/auto/corelib/tools/qsize/tst_qsize.cpp
+++ b/tests/auto/corelib/tools/qsize/tst_qsize.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
index c74f4c3754..a098abe5b0 100644
--- a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
+++ b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstl/tst_qstl.cpp b/tests/auto/corelib/tools/qstl/tst_qstl.cpp
index f9e3549a4d..6fff2b7d6b 100644
--- a/tests/auto/corelib/tools/qstl/tst_qstl.cpp
+++ b/tests/auto/corelib/tools/qstl/tst_qstl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstring/double_data.h b/tests/auto/corelib/tools/qstring/double_data.h
index 8ffb981675..dc392723d3 100644
--- a/tests/auto/corelib/tools/qstring/double_data.h
+++ b/tests/auto/corelib/tools/qstring/double_data.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 622d494a06..37d80afd34 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -220,6 +220,11 @@ private slots:
void reserve();
void toHtmlEscaped_data();
void toHtmlEscaped();
+
+ void operatorGreaterWithQLatin1String();
+ void compareQLatin1Strings();
+ void fromQLatin1StringWithLength();
+ void assignQLatin1String();
};
typedef QList<int> IntList;
@@ -1417,6 +1422,10 @@ void tst_QString::mid()
QCOMPARE(a.mid(3,3),(QString)"DEF");
QCOMPARE(a.mid(0,0),(QString)"");
+ QVERIFY(!a.mid(15,0).isNull());
+ QVERIFY(a.mid(15,0).isEmpty());
+ QVERIFY(!a.mid(15,1).isNull());
+ QVERIFY(a.mid(15,1).isEmpty());
QVERIFY(a.mid(9999).isNull());
QVERIFY(a.mid(9999,1).isNull());
@@ -1439,6 +1448,10 @@ void tst_QString::midRef()
QCOMPARE(a.midRef(3,3).toString(),(QString)"DEF");
QCOMPARE(a.midRef(0,0).toString(),(QString)"");
+ QVERIFY(!a.midRef(15,0).toString().isNull());
+ QVERIFY(a.midRef(15,0).toString().isEmpty());
+ QVERIFY(!a.midRef(15,1).toString().isNull());
+ QVERIFY(a.midRef(15,1).toString().isEmpty());
QVERIFY(a.midRef(9999).toString().isEmpty());
QVERIFY(a.midRef(9999,1).toString().isEmpty());
@@ -3976,107 +3989,83 @@ void tst_QString::operator_smaller()
void tst_QString::integer_conversion_data()
{
- QTest::addColumn<QString>("locale_name");
QTest::addColumn<QString>("num_str");
QTest::addColumn<int>("base");
QTest::addColumn<bool>("good");
QTest::addColumn<qlonglong>("num");
- QTest::newRow("C empty 0") << QString("C") << QString("") << 0 << false << (qlonglong)0;
- QTest::newRow("C empty 8") << QString("C") << QString("") << 8 << false << (qlonglong)0;
- QTest::newRow("C empty 10") << QString("C") << QString("") << 10 << false << (qlonglong)0;
- QTest::newRow("C empty 16") << QString("C") << QString("") << 16 << false << (qlonglong)0;
-
- QTest::newRow("C null 0") << QString("C") << QString() << 0 << false << (qlonglong)0;
- QTest::newRow("C null 8") << QString("C") << QString() << 8 << false << (qlonglong)0;
- QTest::newRow("C null 10") << QString("C") << QString() << 10 << false << (qlonglong)0;
- QTest::newRow("C null 16") << QString("C") << QString() << 16 << false << (qlonglong)0;
-
- QTest::newRow("C -0xf 0") << QString("C") << QString(" -0xf") << 0 << true << (qlonglong)-15;
- QTest::newRow("C -0xf 0") << QString("C") << QString("-0xf ") << 0 << true << (qlonglong)-15;
- QTest::newRow("C \t0xf\t 0") << QString("C") << QString("\t0xf\t") << 0 << true << (qlonglong)15;
- QTest::newRow("C -010 0") << QString("C") << QString(" -010") << 0 << true << (qlonglong)-8;
- QTest::newRow("C 010 0") << QString("C") << QString("010 ") << 0 << true << (qlonglong)8;
- QTest::newRow("C \t-010\t 0") << QString("C") << QString("\t-010\t") << 0 << true << (qlonglong)-8;
- QTest::newRow("C 123 10") << QString("C") << QString(" 123") << 10 << true << (qlonglong)123;
- QTest::newRow("C 123 10") << QString("C") << QString("123 ") << 10 << true << (qlonglong)123;
- QTest::newRow("C \t123\t 10") << QString("C") << QString("\t123\t") << 10 << true << (qlonglong)123;
- QTest::newRow("C -0xf 16") << QString("C") << QString(" -0xf") << 16 << true << (qlonglong)-15;
- QTest::newRow("C -0xf 16") << QString("C") << QString("-0xf ") << 16 << true << (qlonglong)-15;
- QTest::newRow("C \t0xf\t 16") << QString("C") << QString("\t0xf\t") << 16 << true << (qlonglong)15;
-
- QTest::newRow("C -0 0") << QString("C") << QString("-0") << 0 << true << (qlonglong)0;
- QTest::newRow("C -0 8") << QString("C") << QString("-0") << 8 << true << (qlonglong)0;
- QTest::newRow("C -0 10") << QString("C") << QString("-0") << 10 << true << (qlonglong)0;
- QTest::newRow("C -0 16") << QString("C") << QString("-0") << 16 << true << (qlonglong)0;
-
- QTest::newRow("C 1.234 10") << QString("C") << QString("1.234") << 10 << false << (qlonglong)0;
- QTest::newRow("C 1,234 10") << QString("C") << QString("1,234") << 10 << false << (qlonglong)0;
- QTest::newRow("de_DE 1.234 10") << QString("de_DE") << QString("1.234") << 10 << false << (qlonglong)0;
- QTest::newRow("de_DE 1,234 10") << QString("de_DE") << QString("1,234") << 10 << false << (qlonglong)0;
-
- QTest::newRow("C 0x 0") << QString("C") << QString("0x") << 0 << false << (qlonglong)0;
- QTest::newRow("C 0x 16") << QString("C") << QString("0x") << 16 << false << (qlonglong)0;
-
- QTest::newRow("C 10 0") << QString("C") << QString("10") << 0 << true << (qlonglong)10;
- QTest::newRow("C 010 0") << QString("C") << QString("010") << 0 << true << (qlonglong)8;
- QTest::newRow("C 0x10 0") << QString("C") << QString("0x10") << 0 << true << (qlonglong)16;
- QTest::newRow("C 10 8") << QString("C") << QString("10") << 8 << true << (qlonglong)8;
- QTest::newRow("C 010 8") << QString("C") << QString("010") << 8 << true << (qlonglong)8;
- QTest::newRow("C 0x10 8") << QString("C") << QString("0x10") << 8 << false << (qlonglong)0;
- QTest::newRow("C 10 10") << QString("C") << QString("10") << 10 << true << (qlonglong)10;
- QTest::newRow("C 010 10") << QString("C") << QString("010") << 10 << true << (qlonglong)10;
- QTest::newRow("C 0x10 10") << QString("C") << QString("0x10") << 10 << false << (qlonglong)0;
- QTest::newRow("C 10 16") << QString("C") << QString("10") << 16 << true << (qlonglong)16;
- QTest::newRow("C 010 16") << QString("C") << QString("010") << 16 << true << (qlonglong)16;
- QTest::newRow("C 0x10 16") << QString("C") << QString("0x10") << 16 << true << (qlonglong)16;
-
- QTest::newRow("de_DE 10 0") << QString("de_DE") << QString("10") << 0 << true << (qlonglong)10;
- QTest::newRow("de_DE 010 0") << QString("de_DE") << QString("010") << 0 << true << (qlonglong)8;
- QTest::newRow("de_DE 0x10 0") << QString("de_DE") << QString("0x10") << 0 << true << (qlonglong)16;
- QTest::newRow("de_DE 10 8") << QString("de_DE") << QString("10") << 8 << true << (qlonglong)8;
- QTest::newRow("de_DE 010 8") << QString("de_DE") << QString("010") << 8 << true << (qlonglong)8;
- QTest::newRow("de_DE 0x10 8") << QString("de_DE") << QString("0x10") << 8 << false << (qlonglong)0;
- QTest::newRow("de_DE 10 10") << QString("de_DE") << QString("10") << 10 << true << (qlonglong)10;
- QTest::newRow("de_DE 010 10") << QString("de_DE") << QString("010") << 10 << true << (qlonglong)10;
- QTest::newRow("de_DE 0x10 10") << QString("de_DE") << QString("0x10") << 10 << false << (qlonglong)0;
- QTest::newRow("de_DE 10 16") << QString("de_DE") << QString("10") << 16 << true << (qlonglong)16;
- QTest::newRow("de_DE 010 16") << QString("de_DE") << QString("010") << 16 << true << (qlonglong)16;
- QTest::newRow("de_DE 0x10 16") << QString("de_DE") << QString("0x10") << 16 << true << (qlonglong)16;
-
- QTest::newRow("C -10 0") << QString("C") << QString("-10") << 0 << true << (qlonglong)-10;
- QTest::newRow("C -010 0") << QString("C") << QString("-010") << 0 << true << (qlonglong)-8;
- QTest::newRow("C -0x10 0") << QString("C") << QString("-0x10") << 0 << true << (qlonglong)-16;
- QTest::newRow("C -10 8") << QString("C") << QString("-10") << 8 << true << (qlonglong)-8;
- QTest::newRow("C -010 8") << QString("C") << QString("-010") << 8 << true << (qlonglong)-8;
- QTest::newRow("C -0x10 8") << QString("C") << QString("-0x10") << 8 << false << (qlonglong)0;
- QTest::newRow("C -10 10") << QString("C") << QString("-10") << 10 << true << (qlonglong)-10;
- QTest::newRow("C -010 10") << QString("C") << QString("-010") << 10 << true << (qlonglong)-10;
- QTest::newRow("C -0x10 10") << QString("C") << QString("-0x10") << 10 << false << (qlonglong)0;
- QTest::newRow("C -10 16") << QString("C") << QString("-10") << 16 << true << (qlonglong)-16;
- QTest::newRow("C -010 16") << QString("C") << QString("-010") << 16 << true << (qlonglong)-16;
- QTest::newRow("C -0x10 16") << QString("C") << QString("-0x10") << 16 << true << (qlonglong)-16;
+ QTest::newRow("C empty 0") << QString("") << 0 << false << (qlonglong)0;
+ QTest::newRow("C empty 8") << QString("") << 8 << false << (qlonglong)0;
+ QTest::newRow("C empty 10") << QString("") << 10 << false << (qlonglong)0;
+ QTest::newRow("C empty 16") << QString("") << 16 << false << (qlonglong)0;
+
+ QTest::newRow("C null 0") << QString() << 0 << false << (qlonglong)0;
+ QTest::newRow("C null 8") << QString() << 8 << false << (qlonglong)0;
+ QTest::newRow("C null 10") << QString() << 10 << false << (qlonglong)0;
+ QTest::newRow("C null 16") << QString() << 16 << false << (qlonglong)0;
+
+ QTest::newRow("C -0xf 0") << QString(" -0xf") << 0 << true << (qlonglong)-15;
+ QTest::newRow("C -0xf 0") << QString("-0xf ") << 0 << true << (qlonglong)-15;
+ QTest::newRow("C \t0xf\t 0") << QString("\t0xf\t") << 0 << true << (qlonglong)15;
+ QTest::newRow("C -010 0") << QString(" -010") << 0 << true << (qlonglong)-8;
+ QTest::newRow("C 010 0") << QString("010 ") << 0 << true << (qlonglong)8;
+ QTest::newRow("C \t-010\t 0") << QString("\t-010\t") << 0 << true << (qlonglong)-8;
+ QTest::newRow("C 123 10") << QString(" 123") << 10 << true << (qlonglong)123;
+ QTest::newRow("C 123 10") << QString("123 ") << 10 << true << (qlonglong)123;
+ QTest::newRow("C \t123\t 10") << QString("\t123\t") << 10 << true << (qlonglong)123;
+ QTest::newRow("C -0xf 16") << QString(" -0xf") << 16 << true << (qlonglong)-15;
+ QTest::newRow("C -0xf 16") << QString("-0xf ") << 16 << true << (qlonglong)-15;
+ QTest::newRow("C \t0xf\t 16") << QString("\t0xf\t") << 16 << true << (qlonglong)15;
+
+ QTest::newRow("C -0 0") << QString("-0") << 0 << true << (qlonglong)0;
+ QTest::newRow("C -0 8") << QString("-0") << 8 << true << (qlonglong)0;
+ QTest::newRow("C -0 10") << QString("-0") << 10 << true << (qlonglong)0;
+ QTest::newRow("C -0 16") << QString("-0") << 16 << true << (qlonglong)0;
+
+ QTest::newRow("C 1.234 10") << QString("1.234") << 10 << false << (qlonglong)0;
+ QTest::newRow("C 1,234 10") << QString("1,234") << 10 << false << (qlonglong)0;
+
+ QTest::newRow("C 0x 0") << QString("0x") << 0 << false << (qlonglong)0;
+ QTest::newRow("C 0x 16") << QString("0x") << 16 << false << (qlonglong)0;
+
+ QTest::newRow("C 10 0") << QString("10") << 0 << true << (qlonglong)10;
+ QTest::newRow("C 010 0") << QString("010") << 0 << true << (qlonglong)8;
+ QTest::newRow("C 0x10 0") << QString("0x10") << 0 << true << (qlonglong)16;
+ QTest::newRow("C 10 8") << QString("10") << 8 << true << (qlonglong)8;
+ QTest::newRow("C 010 8") << QString("010") << 8 << true << (qlonglong)8;
+ QTest::newRow("C 0x10 8") << QString("0x10") << 8 << false << (qlonglong)0;
+ QTest::newRow("C 10 10") << QString("10") << 10 << true << (qlonglong)10;
+ QTest::newRow("C 010 10") << QString("010") << 10 << true << (qlonglong)10;
+ QTest::newRow("C 0x10 10") << QString("0x10") << 10 << false << (qlonglong)0;
+ QTest::newRow("C 10 16") << QString("10") << 16 << true << (qlonglong)16;
+ QTest::newRow("C 010 16") << QString("010") << 16 << true << (qlonglong)16;
+ QTest::newRow("C 0x10 16") << QString("0x10") << 16 << true << (qlonglong)16;
+
+ QTest::newRow("C -10 0") << QString("-10") << 0 << true << (qlonglong)-10;
+ QTest::newRow("C -010 0") << QString("-010") << 0 << true << (qlonglong)-8;
+ QTest::newRow("C -0x10 0") << QString("-0x10") << 0 << true << (qlonglong)-16;
+ QTest::newRow("C -10 8") << QString("-10") << 8 << true << (qlonglong)-8;
+ QTest::newRow("C -010 8") << QString("-010") << 8 << true << (qlonglong)-8;
+ QTest::newRow("C -0x10 8") << QString("-0x10") << 8 << false << (qlonglong)0;
+ QTest::newRow("C -10 10") << QString("-10") << 10 << true << (qlonglong)-10;
+ QTest::newRow("C -010 10") << QString("-010") << 10 << true << (qlonglong)-10;
+ QTest::newRow("C -0x10 10") << QString("-0x10") << 10 << false << (qlonglong)0;
+ QTest::newRow("C -10 16") << QString("-10") << 16 << true << (qlonglong)-16;
+ QTest::newRow("C -010 16") << QString("-010") << 16 << true << (qlonglong)-16;
+ QTest::newRow("C -0x10 16") << QString("-0x10") << 16 << true << (qlonglong)-16;
// Let's try some Arabic
const quint16 arabic_str[] = { 0x0661, 0x0662, 0x0663, 0x0664, 0x0000 }; // "1234"
- QTest::newRow("ar_SA 1234 0") << QString("ar_SA") << QString::fromUtf16(arabic_str) << 0 << true << (qlonglong)1234;
- QTest::newRow("ar_SA 1234 8") << QString("ar_SA") << QString::fromUtf16(arabic_str) << 8 << true << (qlonglong)668;
- QTest::newRow("ar_SA 1234 10") << QString("ar_SA") << QString::fromUtf16(arabic_str) << 10 << true << (qlonglong)1234;
- QTest::newRow("ar_SA 1234 16") << QString("ar_SA") << QString::fromUtf16(arabic_str) << 16 << true << (qlonglong)4660;
+ QTest::newRow("ar_SA 1234 0") << QString::fromUtf16(arabic_str) << 0 << false << (qlonglong)0;
}
void tst_QString::integer_conversion()
{
- QFETCH(QString, locale_name);
QFETCH(QString, num_str);
QFETCH(int, base);
QFETCH(bool, good);
QFETCH(qlonglong, num);
-
- QLocale::setDefault(locale_name);
- QCOMPARE(QLocale().name(), locale_name);
-
bool ok;
qlonglong d = num_str.toLongLong(&ok, base);
QCOMPARE(ok, good);
@@ -4084,100 +4073,65 @@ void tst_QString::integer_conversion()
if (ok) {
QCOMPARE(d, num);
}
-
- QLocale::setDefault(QLocale::C);
}
void tst_QString::double_conversion_data()
{
- QTest::addColumn<QString>("locale_name");
QTest::addColumn<QString>("num_str");
QTest::addColumn<bool>("good");
QTest::addColumn<double>("num");
// The good...
- QTest::newRow("C 1") << QString("C") << QString("1") << true << 1.0;
- QTest::newRow("C 1.0") << QString("C") << QString("1.0") << true << 1.0;
- QTest::newRow("C 1.234") << QString("C") << QString("1.234") << true << 1.234;
- QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10;
- QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10;
- QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10;
+ QTest::newRow("C 1") << QString("1") << true << 1.0;
+ QTest::newRow("C 1.0") << QString("1.0") << true << 1.0;
+ QTest::newRow("C 1.234") << QString("1.234") << true << 1.234;
+ QTest::newRow("C 1.234e-10") << QString("1.234e-10") << true << 1.234e-10;
+ QTest::newRow("C 1.234E10") << QString("1.234E10") << true << 1.234e10;
+ QTest::newRow("C 1e10") << QString("1e10") << true << 1.0e10;
// The bad...
- QTest::newRow("C empty") << QString("C") << QString("") << false << 0.0;
- QTest::newRow("C null") << QString("C") << QString() << false << 0.0;
- QTest::newRow("C .") << QString("C") << QString(".") << false << 0.0;
- QTest::newRow("C 1e") << QString("C") << QString("1e") << false << 0.0;
- QTest::newRow("C 1,") << QString("C") << QString("1,") << false << 0.0;
- QTest::newRow("C 1,0") << QString("C") << QString("1,0") << false << 0.0;
- QTest::newRow("C 1,000") << QString("C") << QString("1,000") << false << 0.0;
- QTest::newRow("C 1e1.0") << QString("C") << QString("1e1.0") << false << 0.0;
- QTest::newRow("C 1e+") << QString("C") << QString("1e+") << false << 0.0;
- QTest::newRow("C 1e-") << QString("C") << QString("1e-") << false << 0.0;
+ QTest::newRow("C empty") << QString("") << false << 0.0;
+ QTest::newRow("C null") << QString() << false << 0.0;
+ QTest::newRow("C .") << QString(".") << false << 0.0;
+ QTest::newRow("C 1e") << QString("1e") << false << 0.0;
+ QTest::newRow("C 1,") << QString("1,") << false << 0.0;
+ QTest::newRow("C 1,0") << QString("1,0") << false << 0.0;
+ QTest::newRow("C 1,000") << QString("1,000") << false << 0.0;
+ QTest::newRow("C 1e1.0") << QString("1e1.0") << false << 0.0;
+ QTest::newRow("C 1e+") << QString("1e+") << false << 0.0;
+ QTest::newRow("C 1e-") << QString("1e-") << false << 0.0;
+ QTest::newRow("de_DE 1,0") << QString("1,0") << false << 0.0;
+ QTest::newRow("de_DE 1,234") << QString("1,234") << false << 0.0;
+ QTest::newRow("de_DE 1,234e-10") << QString("1,234e-10") << false << 0.0;
+ QTest::newRow("de_DE 1,234E10") << QString("1,234E10") << false << 0.0;
// And the ugly...
- QTest::newRow("C .1") << QString("C") << QString(".1") << true << 0.1;
- QTest::newRow("C -.1") << QString("C") << QString("-.1") << true << -0.1;
- QTest::newRow("C 1.") << QString("C") << QString("1.") << true << 1.0;
- QTest::newRow("C 1.E10") << QString("C") << QString("1.E10") << true << 1.0e10;
- QTest::newRow("C 1e+10") << QString("C") << QString("1e+10") << true << 1.0e+10;
-
- QTest::newRow("de_DE 1") << QString("de_DE") << QString("1") << true << 1.0;
- QTest::newRow("de_DE 1.0") << QString("de_DE") << QString("1.0") << true << 1.0;
- QTest::newRow("de_DE 1.234") << QString("de_DE") << QString("1.234") << true << 1.234;
- QTest::newRow("de_DE 1.234e-10") << QString("de_DE") << QString("1.234e-10") << true << 1.234e-10;
- QTest::newRow("de_DE 1.234E10") << QString("de_DE") << QString("1.234E10") << true << 1.234e10;
- QTest::newRow("de_DE 1e10") << QString("de_DE") << QString("1e10") << true << 1.0e10;
- QTest::newRow("de_DE .1") << QString("de_DE") << QString(".1") << true << 0.1;
- QTest::newRow("de_DE -.1") << QString("de_DE") << QString("-.1") << true << -0.1;
- QTest::newRow("de_DE 1.") << QString("de_DE") << QString("1.") << true << 1.0;
- QTest::newRow("de_DE 1.E10") << QString("de_DE") << QString("1.E10") << true << 1.0e10;
- QTest::newRow("de_DE 1e+10") << QString("de_DE") << QString("1e+10") << true << 1.0e+10;
-
- QTest::newRow("de_DE 1,0") << QString("de_DE") << QString("1,0") << true << 1.0;
- QTest::newRow("de_DE 1,234") << QString("de_DE") << QString("1,234") << true << 1.234;
- QTest::newRow("de_DE 1,234e-10") << QString("de_DE") << QString("1,234e-10") << true << 1.234e-10;
- QTest::newRow("de_DE 1,234E10") << QString("de_DE") << QString("1,234E10") << true << 1.234e10;
- QTest::newRow("de_DE ,1") << QString("de_DE") << QString(",1") << true << 0.1;
- QTest::newRow("de_DE -,1") << QString("de_DE") << QString("-,1") << true << -0.1;
- QTest::newRow("de_DE 1,") << QString("de_DE") << QString("1,") << true << 1.0;
- QTest::newRow("de_DE 1,E10") << QString("de_DE") << QString("1,E10") << true << 1.0e10;
-
- QTest::newRow("de_DE empty") << QString("de_DE") << QString("") << false << 0.0;
- QTest::newRow("de_DE null") << QString("de_DE") << QString() << false << 0.0;
- QTest::newRow("de_DE .") << QString("de_DE") << QString(".") << false << 0.0;
- QTest::newRow("de_DE 1e") << QString("de_DE") << QString("1e") << false << 0.0;
- QTest::newRow("de_DE 1e1.0") << QString("de_DE") << QString("1e1.0") << false << 0.0;
- QTest::newRow("de_DE 1e+") << QString("de_DE") << QString("1e+") << false << 0.0;
- QTest::newRow("de_DE 1e-") << QString("de_DE") << QString("1e-") << false << 0.0;
-
- QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
- QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0;
- QTest::newRow("de_DE 1") << QString("de_DE") << QString(" 1") << true << 1.0;
- QTest::newRow("de_DE 1 ") << QString("de_DE") << QString("1 ") << true << 1.0;
+ QTest::newRow("C .1") << QString(".1") << true << 0.1;
+ QTest::newRow("C -.1") << QString("-.1") << true << -0.1;
+ QTest::newRow("C 1.") << QString("1.") << true << 1.0;
+ QTest::newRow("C 1.E10") << QString("1.E10") << true << 1.0e10;
+ QTest::newRow("C 1e+10") << QString("1e+10") << true << 1.0e+10;
+ QTest::newRow("C 1") << QString(" 1") << true << 1.0;
+ QTest::newRow("C 1 ") << QString("1 ") << true << 1.0;
// Let's try some Arabic
const quint16 arabic_str[] = { 0x0660, 0x066B, 0x0661, 0x0662,
0x0663, 0x0664, 0x0065, 0x0662,
0x0000 }; // "0.1234e2"
- QTest::newRow("ar_SA") << QString("ar_SA") << QString::fromUtf16(arabic_str) << true << 0.1234e2;
+ QTest::newRow("ar_SA") << QString::fromUtf16(arabic_str) << false << 0.0;
}
void tst_QString::double_conversion()
{
#define MY_DOUBLE_EPSILON (2.22045e-16)
- QFETCH(QString, locale_name);
QFETCH(QString, num_str);
QFETCH(bool, good);
QFETCH(double, num);
- QLocale::setDefault(locale_name);
- QCOMPARE(QLocale().name(), locale_name);
-
bool ok;
double d = num_str.toDouble(&ok);
QCOMPARE(ok, good);
@@ -4188,8 +4142,6 @@ void tst_QString::double_conversion()
diff = -diff;
QVERIFY(diff <= MY_DOUBLE_EPSILON);
}
-
- QLocale::setDefault(QLocale::C);
}
#ifndef Q_MOC_RUN
@@ -4788,6 +4740,13 @@ void tst_QString::compare()
QCOMPARE(sign(QString::compare(s1, QLatin1String(s2.toLatin1()), Qt::CaseInsensitive)), cir);
QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(s2.toLatin1()))), csr);
QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(s2.toLatin1()), Qt::CaseInsensitive)), cir);
+ QByteArray l1 = s2.toLatin1();
+ l1 += "x";
+ QLatin1String l1str(l1.constData(), l1.size() - 1);
+ QCOMPARE(sign(QString::compare(s1, l1str)), csr);
+ QCOMPARE(sign(QString::compare(s1, l1str, Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(QStringRef::compare(r1, l1str)), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, l1str, Qt::CaseInsensitive)), cir);
}
if (isLatin(s1)) {
@@ -5167,6 +5126,128 @@ void tst_QString::toHtmlEscaped()
QCOMPARE(original.toHtmlEscaped(), expected);
}
+void tst_QString::operatorGreaterWithQLatin1String()
+{
+ QLatin1String latin1foo("fooZZ", 3);
+ QString stringfoo = QString::fromLatin1("foo");
+ QVERIFY(stringfoo >= latin1foo);
+ QVERIFY(!(stringfoo > latin1foo));
+ QVERIFY(stringfoo <= latin1foo);
+ QVERIFY(!(stringfoo < latin1foo));
+}
+
+void tst_QString::compareQLatin1Strings()
+{
+ QLatin1String abc("abc");
+ QLatin1String abcd("abcd");
+ QLatin1String cba("cba");
+ QLatin1String de("de");
+
+ QVERIFY(abc == abc);
+ QVERIFY(!(abc == cba));
+ QVERIFY(!(cba == abc));
+ QVERIFY(!(abc == abcd));
+ QVERIFY(!(abcd == abc));
+
+ QVERIFY(abc != cba);
+ QVERIFY(!(abc != abc));
+ QVERIFY(cba != abc);
+ QVERIFY(abc != abcd);
+ QVERIFY(abcd != abc);
+
+ QVERIFY(abc < abcd);
+ QVERIFY(abc < cba);
+ QVERIFY(abc < de);
+ QVERIFY(abcd < cba);
+ QVERIFY(!(abc < abc));
+ QVERIFY(!(abcd < abc));
+ QVERIFY(!(de < cba));
+
+ QVERIFY(abcd > abc);
+ QVERIFY(cba > abc);
+ QVERIFY(de > abc);
+ QVERIFY(!(abc > abc));
+ QVERIFY(!(abc > abcd));
+ QVERIFY(!(abcd > cba));
+
+ QVERIFY(abc <= abc);
+ QVERIFY(abc <= abcd);
+ QVERIFY(abc <= cba);
+ QVERIFY(abc <= de);
+ QVERIFY(!(abcd <= abc));
+ QVERIFY(!(cba <= abc));
+ QVERIFY(!(cba <= abcd));
+ QVERIFY(!(de <= abc));
+
+ QVERIFY(abc >= abc);
+ QVERIFY(abcd >= abc);
+ QVERIFY(!(abc >= abcd));
+ QVERIFY(cba >= abc);
+ QVERIFY(!(abc >= cba));
+ QVERIFY(de >= abc);
+ QVERIFY(!(abc >= de));
+
+ QLatin1String subfoo("fooZZ", 3);
+ QLatin1String foo("foo");
+ QVERIFY(subfoo == foo);
+ QVERIFY(foo == subfoo);
+ QVERIFY(!(subfoo != foo));
+ QVERIFY(!(foo != subfoo));
+ QVERIFY(!(foo < subfoo));
+ QVERIFY(!(subfoo < foo));
+ QVERIFY(foo >= subfoo);
+ QVERIFY(subfoo >= foo);
+ QVERIFY(!(foo > subfoo));
+ QVERIFY(!(subfoo > foo));
+ QVERIFY(foo <= subfoo);
+ QVERIFY(subfoo <= foo);
+
+ QLatin1String subabc("abcZZ", 3);
+ QLatin1String subab("abcZZ", 2);
+ QVERIFY(subabc != subab);
+ QVERIFY(subab != subabc);
+ QVERIFY(!(subabc == subab));
+ QVERIFY(!(subab == subabc));
+ QVERIFY(subab < subabc);
+ QVERIFY(!(subabc < subab));
+ QVERIFY(subabc > subab);
+ QVERIFY(!(subab > subabc));
+ QVERIFY(subab <= subabc);
+ QVERIFY(!(subabc <= subab));
+ QVERIFY(subabc >= subab);
+ QVERIFY(!(subab >= subabc));
+}
+
+void tst_QString::fromQLatin1StringWithLength()
+{
+ QLatin1String latin1foo("foobar", 3);
+ QString foo(latin1foo);
+ QCOMPARE(foo.size(), latin1foo.size());
+ QCOMPARE(foo, QString::fromLatin1("foo"));
+}
+
+void tst_QString::assignQLatin1String()
+{
+ QString empty = QLatin1String("");
+ QVERIFY(empty.isEmpty());
+ QVERIFY(!empty.isNull());
+
+ QString null = QLatin1String(0);
+ QVERIFY(null.isEmpty());
+ QVERIFY(null.isNull());
+
+ QLatin1String latin1foo("foo");
+ QString foo = latin1foo;
+ QCOMPARE(foo.size(), latin1foo.size());
+ QCOMPARE(foo, QString::fromLatin1("foo"));
+
+ QLatin1String latin1subfoo("foobar", 3);
+ foo = latin1subfoo;
+ QCOMPARE(foo.size(), latin1subfoo.size());
+ QCOMPARE(foo, QString::fromLatin1("foo"));
+
+}
+
QTEST_APPLESS_MAIN(tst_QString)
#include "tst_qstring.moc"
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 283e707c1b..95e24b22fb 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp
index fd92aafadd..4201fc3f5c 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp
index 6bdb607431..0e8e081c46 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp
index 915c0d23ad..09d7f38125 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp
index c9837a0489..91bb07039a 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 54ca9dd3a7..e3eb1a21ac 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
index 10906902ff..ebbad86c81 100644
--- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
+++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
index c0dc253167..77d2101320 100644
--- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
index 100ddfcb12..89dd01ac3a 100644
--- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
+++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
index bc03e74b41..d8f72dffdb 100644
--- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp
+++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -242,6 +242,7 @@ void tst_QTime::hour_data()
QTest::newRow( "data2" ) << 1 << 2 << 3 << 4;
QTest::newRow( "data3" ) << 2 << 12 << 13 << 65;
QTest::newRow( "data4" ) << 23 << 59 << 59 << 999;
+ QTest::newRow( "data5" ) << -1 << -1 << -1 << -1;
}
void tst_QTime::hour()
@@ -271,6 +272,7 @@ void tst_QTime::setHMS_data()
QTest::newRow( "data4" ) << 23 << 0 << 0;
QTest::newRow( "data5" ) << 23 << 59 << 0;
QTest::newRow( "data6" ) << 23 << 59 << 59;
+ QTest::newRow( "data7" ) << -1 << -1 << -1;
}
void tst_QTime::setHMS()
@@ -296,6 +298,9 @@ void tst_QTime::secsTo_data()
QTest::newRow( "data1" ) << QTime(0,0,0) << QTime(0,1,0) << 60;
QTest::newRow( "data2" ) << QTime(0,0,0) << QTime(0,10,0) << 600;
QTest::newRow( "data3" ) << QTime(0,0,0) << QTime(23,59,59) << 86399;
+ QTest::newRow( "data4" ) << QTime(-1, -1, -1) << QTime(0, 0, 0) << 0;
+ QTest::newRow( "data5" ) << QTime(0, 0, 0) << QTime(-1, -1, -1) << 0;
+ QTest::newRow( "data6" ) << QTime(-1, -1, -1) << QTime(-1, -1, -1) << 0;
}
void tst_QTime::secsTo()
@@ -317,6 +322,9 @@ void tst_QTime::msecsTo_data()
QTest::newRow( "data1" ) << QTime(0,0,0,0) << QTime(0,0,1,0) << 1000;
QTest::newRow( "data2" ) << QTime(0,0,0,0) << QTime(0,0,10,0) << 10000;
QTest::newRow( "data3" ) << QTime(0,0,0,0) << QTime(23,59,59,0) << 86399000;
+ QTest::newRow( "data4" ) << QTime(-1, -1, -1, -1) << QTime(0, 0, 0, 0) << 0;
+ QTest::newRow( "data5" ) << QTime(0, 0, 0, 0) << QTime(-1, -1, -1, -1) << 0;
+ QTest::newRow( "data6" ) << QTime(-1, -1, -1, -1) << QTime(-1, -1, -1, -1) << 0;
}
void tst_QTime::msecsTo()
diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
index db08bc5724..f05497d7a2 100644
--- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index cc2bbe2f1f..8361150d1c 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index bed2e25d31..67ca547736 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/