From 2714d94ff4652e863f2e6005a138a2563d836f07 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Jun 2016 16:19:04 +0200 Subject: Fix tst_QNetworkReply::qtbug45581WrongReplyStatusCode() on Windows The file is read using CRLF line convention on Windows. Task-number: QTBUG-24226 Change-Id: Ie08fa603e29c80a42de4bfbfd1f4237f53c22b98 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 02aca3d6c1..0f2d0873a7 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -7295,7 +7295,11 @@ void tst_QNetworkReply::qtbug45581WrongReplyStatusCode() const QByteArray expectedContent = "" - "\n"; + "" +#ifdef Q_OS_WIN + "\r" +#endif + "\n"; QCOMPARE(reply->readAll(), expectedContent); -- cgit v1.2.3 From 3c93286f08a80b6e1821d7d63d361742b25c6578 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Mon, 13 Jun 2016 17:25:34 +0300 Subject: QDataStream: unify deserialization of containers Serialization of the Qt container classes is accomplished by breaking up the data into primitive units. On the receiver side, these units should be read atomically to guarantee integrity of the container. Deserialization procedures for QHash and QMap were already implemented in accordance with this strategy and have the following behavior: - a previously latched error status is saved for the caller. This overrides possible different errors in the current read. This is consistent with the treatment of primitive types. - if an error occurs during the deserialization, the container is cleared. To make the API consistent, this patch adjusts the behavior of QList, QLinkedList, QVector, and QSet deserialization. On the implementation side we accomplish this with a private StreamStateSaver RAII class that consolidates the handling of the stream status for all containers. [ChangeLog][Important Behavior Changes][QtCore][QDataStream] Incomplete reads of Qt containers are now handled same way as for primitive types, meaning that previous errors are latched. Task-number: QTBUG-54022 Change-Id: I5c77257fe2a4637e8a7e6cf3cd43091c8469340e Reviewed-by: Oswald Buddenhagen Reviewed-by: Edward Welbourne --- .../corelib/io/qdatastream/tst_qdatastream.cpp | 50 ++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index ea4c557574..fefe08db30 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -2813,10 +2813,11 @@ void tst_QDataStream::status_QHash_QMap() MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, StringHash()); } -#define LIST_TEST(byteArray, expectedStatus, expectedList) \ +#define LIST_TEST(byteArray, initialStatus, expectedStatus, expectedList) \ { \ QByteArray ba = byteArray; \ QDataStream stream(&ba, QIODevice::ReadOnly); \ + stream.setStatus(initialStatus); \ stream >> list; \ QCOMPARE((int)stream.status(), (int)expectedStatus); \ QCOMPARE(list.size(), expectedList.size()); \ @@ -2828,6 +2829,7 @@ void tst_QDataStream::status_QHash_QMap() expectedLinkedList << expectedList.at(i); \ QByteArray ba = byteArray; \ QDataStream stream(&ba, QIODevice::ReadOnly); \ + stream.setStatus(initialStatus); \ stream >> linkedList; \ QCOMPARE((int)stream.status(), (int)expectedStatus); \ QCOMPARE(linkedList.size(), expectedLinkedList.size()); \ @@ -2839,6 +2841,7 @@ void tst_QDataStream::status_QHash_QMap() expectedVector << expectedList.at(i); \ QByteArray ba = byteArray; \ QDataStream stream(&ba, QIODevice::ReadOnly); \ + stream.setStatus(initialStatus); \ stream >> vector; \ QCOMPARE((int)stream.status(), (int)expectedStatus); \ QCOMPARE(vector.size(), expectedVector.size()); \ @@ -2854,8 +2857,49 @@ void tst_QDataStream::status_QLinkedList_QList_QVector() List list; Vector vector; - LIST_TEST(QByteArray(), QDataStream::ReadPastEnd, List()); - LIST_TEST(QByteArray("\x00\x00\x00\x00", 4), QDataStream::Ok, List()); + // ok + { + List listWithEmptyString; + listWithEmptyString.append(""); + + List someList; + someList.append("J"); + someList.append("MN"); + + LIST_TEST(QByteArray("\x00\x00\x00\x00", 4), QDataStream::Ok, QDataStream::Ok, List()); + LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00", 8), QDataStream::Ok, QDataStream::Ok, listWithEmptyString); + LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x02\x00J" + "\x00\x00\x00\x04\x00M\x00N", 18), QDataStream::Ok, QDataStream::Ok, someList); + } + + // past end + { + LIST_TEST(QByteArray(), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + LIST_TEST(QByteArray("\x00", 1), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + LIST_TEST(QByteArray("\x00\x00", 2), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + LIST_TEST(QByteArray("\x00\x00\x00", 3), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + LIST_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + for (int i = 4; i < 12; ++i) { + LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", i), QDataStream::Ok, QDataStream::ReadPastEnd, List()); + } + } + + // corrupt data + { + LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::Ok, QDataStream::ReadCorruptData, List()); + LIST_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x01\x00J" + "\x00\x00\x00\x02\x00M\x00N", 18), QDataStream::Ok, QDataStream::ReadCorruptData, List()); + } + + // test the previously latched error status is not affected by reading + { + List listWithEmptyString; + listWithEmptyString.append(""); + + LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, listWithEmptyString); + LIST_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::ReadCorruptData, QDataStream::ReadCorruptData, List()); + LIST_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, List()); + } } void tst_QDataStream::streamToAndFromQByteArray() -- cgit v1.2.3 From 1af4916e11c1251b2957a909f819678e9fd32feb Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 1 Jul 2016 13:49:46 +0200 Subject: QTime: restore Qt3 compatibility in the QDataStream operators A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3), and then a Qt3 program reading that, would lead to a weird QTime, with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295. This commit restores interoperability, by writing out the expected value (0) for a null QTime rather than the -1 value used by Qt4 and Qt5. Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af Reviewed-by: Thiago Macieira --- .../corelib/io/qdatastream/tst_qdatastream.cpp | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 86fd142036..76650ea9a4 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -1203,10 +1203,11 @@ static QTime qTimeData(int index) case 57: return QTime(23, 59, 59, 99); case 58: return QTime(23, 59, 59, 100); case 59: return QTime(23, 59, 59, 999); + case 60: return QTime(); } return QTime(0, 0, 0); } -#define MAX_QTIME_DATA 60 +#define MAX_QTIME_DATA 61 void tst_QDataStream::stream_QTime_data() { @@ -3081,6 +3082,30 @@ void tst_QDataStream::compatibility_Qt3() QVERIFY(in_palette.brush(QPalette::Button).style() == Qt::NoBrush); QVERIFY(in_palette.color(QPalette::Light) == Qt::green); } + // QTime() was serialized to (0, 0, 0, 0) in Qt3, not (0xFF, 0xFF, 0xFF, 0xFF) + // This is because in Qt3 a null time was valid, and there was no support for deserializing a value of -1. + { + QByteArray stream; + { + QDataStream out(&stream, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_3_3); + out << QTime(); + } + QTime in_time; + { + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> in_time; + } + QVERIFY(in_time.isNull()); + + quint32 rawValue; + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> rawValue; + QCOMPARE(rawValue, quint32(0)); + } + } void tst_QDataStream::compatibility_Qt2() -- cgit v1.2.3 From 4f3eb6617331ba2634206064512ae68a4fbd793e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jun 2016 15:48:52 -0700 Subject: QUrl: Test that we do correctly accept valid schemes ... and reject invalid ones. There was one error: we accepted schemes starting with pluses, dashes and dots. Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad Reviewed-by: David Faure --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 162 +++++++++++++++++++------------- 1 file changed, 95 insertions(+), 67 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index ef210d4a64..eb29646053 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -125,7 +125,8 @@ private slots: void isValid(); void schemeValidator_data(); void schemeValidator(); - void invalidSchemeValidator(); + void setScheme_data(); + void setScheme(); void strictParser_data(); void strictParser(); void tolerantParser(); @@ -2082,87 +2083,114 @@ void tst_QUrl::isValid() void tst_QUrl::schemeValidator_data() { - QTest::addColumn("encodedUrl"); + QTest::addColumn("input"); QTest::addColumn("result"); - QTest::addColumn("toString"); - - QTest::newRow("empty") << QByteArray() << false << QString(); - - // ftp - QTest::newRow("ftp:") << QByteArray("ftp:") << true << QString("ftp:"); - QTest::newRow("ftp://ftp.qt-project.org") - << QByteArray("ftp://ftp.qt-project.org") - << true << QString("ftp://ftp.qt-project.org"); - QTest::newRow("ftp://ftp.qt-project.org/") - << QByteArray("ftp://ftp.qt-project.org/") - << true << QString("ftp://ftp.qt-project.org/"); - QTest::newRow("ftp:/index.html") - << QByteArray("ftp:/index.html") - << false << QString(); - - // mailto - QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:"); - QTest::newRow("mailto://smtp.trolltech.com/ole@bull.name") - << QByteArray("mailto://smtp.trolltech.com/ole@bull.name") << false << QString(); - QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:"); - QTest::newRow("mailto:ole@bull.name") - << QByteArray("mailto:ole@bull.name") << true << QString("mailto:ole@bull.name"); + QTest::addColumn("scheme"); - // file - QTest::newRow("file:") << QByteArray("file:/etc/passwd") << true << QString("file:///etc/passwd"); + // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + + QTest::newRow("empty") << QString() << false << QString(); + + // uncontroversial ones + QTest::newRow("ftp") << "ftp://ftp.example.com/" << true << "ftp"; + QTest::newRow("http") << "http://www.example.com/" << true << "http"; + QTest::newRow("mailto") << "mailto:smith@example.com" << true << "mailto"; + QTest::newRow("file-1slash") << "file:/etc/passwd" << true << "file"; + QTest::newRow("file-2slashes") << "file://server/etc/passwd" << true << "file"; + QTest::newRow("file-3slashes") << "file:///etc/passwd" << true << "file"; + + QTest::newRow("mailto+subject") << "mailto:smith@example.com?subject=Hello%20World" << true << "mailto"; + QTest::newRow("mailto+host") << "mailto://smtp.example.com/smith@example.com" << true << "mailto"; + + // valid, but unexpected + QTest::newRow("ftp-nohost") << "ftp:/etc/passwd" << true << "ftp"; + QTest::newRow("http-nohost") << "http:/etc/passwd" << true << "http"; + QTest::newRow("mailto-nomail") << "mailto://smtp.example.com" << true << "mailto"; + + // schemes with numbers + QTest::newRow("digits") << "proto2://" << true << "proto2"; + + // schemes with dots, dashes, and pluses + QTest::newRow("svn+ssh") << "svn+ssh://svn.example.com" << true << "svn+ssh"; + QTest::newRow("withdash") << "svn-ssh://svn.example.com" << true << "svn-ssh"; + QTest::newRow("withdots") << "org.qt-project://qt-project.org" << true << "org.qt-project"; + + // lowercasing + QTest::newRow("FTP") << "FTP://ftp.example.com/" << true << "ftp"; + QTest::newRow("HTTP") << "HTTP://www.example.com/" << true << "http"; + QTest::newRow("MAILTO") << "MAILTO:smith@example.com" << true << "mailto"; + QTest::newRow("FILE") << "FILE:/etc/passwd" << true << "file"; + QTest::newRow("SVN+SSH") << "SVN+SSH://svn.example.com" << true << "svn+ssh"; + QTest::newRow("WITHDASH") << "SVN-SSH://svn.example.com" << true << "svn-ssh"; + QTest::newRow("WITHDOTS") << "ORG.QT-PROJECT://qt-project.org" << true << "org.qt-project"; + + // invalid entries + QTest::newRow("start-digit") << "1http://example.com" << false << "1http"; + QTest::newRow("start-plus") << "+ssh://user@example.com" << false << "+ssh"; + QTest::newRow("start-dot") << ".org.example:///" << false << ".org.example"; + QTest::newRow("with-space") << "a b://" << false << "a b"; + QTest::newRow("with-non-ascii") << "\304\245\305\243\305\245\321\200://example.com" << false << "\304\245\305\243\305\245\321\200"; + QTest::newRow("with-control1") << "http\1://example.com" << false << "http\1"; + QTest::newRow("with-control127") << "http\177://example.com" << false << "http\177"; + QTest::newRow("with-null") << QString::fromLatin1("http\0://example.com", 19) << false << QString::fromLatin1("http\0", 5); + + QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70"; + + static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~"; + for (size_t i = 0; i < sizeof(controls) - 1; ++i) + QTest::newRow(("with-" + QByteArray(1, controls[i])).constData()) + << QString("pre%1post://example.com/").arg(QLatin1Char(controls[i])) + << false << QString("pre%1post").arg(QLatin1Char(controls[i])); } void tst_QUrl::schemeValidator() { - QFETCH(QByteArray, encodedUrl); + QFETCH(QString, input); QFETCH(bool, result); - QFETCH(QString, toString); - QUrl url = QUrl::fromEncoded(encodedUrl); - QEXPECT_FAIL("ftp:/index.html", "high-level URL validation not reimplemented yet", Abort); - QEXPECT_FAIL("mailto://smtp.trolltech.com/ole@bull.name", "high-level URL validation not reimplemented yet", Abort); + QUrl url(input); QCOMPARE(url.isValid(), result); - if (!result) - QVERIFY(url.toString().isEmpty()); -} + if (result) { + QFETCH(QString, scheme); + QCOMPARE(url.scheme(), scheme); -void tst_QUrl::invalidSchemeValidator() -{ - // test that if scheme does not start with an ALPHA, QUrl::isValid() returns false - { - QUrl url("1http://qt-project.org"); - QVERIFY(url.scheme().isEmpty()); - QVERIFY(url.path().startsWith("1http")); - } - { - QUrl url("http://qt-project.org"); - url.setScheme("111http://qt-project.org"); - QCOMPARE(url.isValid(), false); - QVERIFY(url.toString().isEmpty()); - } - // non-ALPHA character at other positions in the scheme are ok - { - QUrl url("ht111tp://qt-project.org", QUrl::StrictMode); + // reconstruct with just the scheme: + url.setUrl(scheme + ':'); QVERIFY(url.isValid()); - QCOMPARE(url.scheme(), QString("ht111tp")); - QVERIFY(!url.toString().isEmpty()); - } - { - QUrl url("http://qt-project.org"); - url.setScheme("ht123tp://qt-project.org"); - QVERIFY(!url.isValid()); + QCOMPARE(url.scheme(), scheme); + } else { QVERIFY(url.toString().isEmpty()); - url.setScheme("http"); - QVERIFY(url.isValid()); - QVERIFY(!url.toString().isEmpty()); - } - { - QUrl url = QUrl::fromEncoded("ht321tp://qt-project.org", QUrl::StrictMode); - QVERIFY(url.isValid()); - QVERIFY(!url.toString().isEmpty()); } } +void tst_QUrl::setScheme_data() +{ + schemeValidator_data(); + + // a couple more which wouldn't work in parsing a full URL + QTest::newRow("with-slash") << QString() << false << "http/"; + QTest::newRow("with-question") << QString() << false << "http?"; + QTest::newRow("with-hash") << QString() << false << "http#"; +} + +void tst_QUrl::setScheme() +{ + QFETCH(QString, scheme); + QFETCH(bool, result); + QString expectedScheme; + if (result) + expectedScheme = scheme; + + QUrl url; + url.setScheme(scheme); + QCOMPARE(url.isValid(), result); + QCOMPARE(url.scheme(), expectedScheme); + + url.setScheme(scheme.toUpper()); + QCOMPARE(url.isValid(), result); + QCOMPARE(url.scheme(), expectedScheme); +} + void tst_QUrl::strictParser_data() { QTest::addColumn("input"); -- cgit v1.2.3 From a9613ba3f16cd960e222a37d83ba4cbb6810a6d8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Jul 2016 09:31:44 +0200 Subject: Testlib: generate_expected_output.py: Run in C locale Otherwise, float numbers are formatted using a decimal comma in German, causing huge diffs and failures. Change-Id: Icd85a293d0564cac6be244eb0793611920d0c89c Reviewed-by: Edward Welbourne --- tests/auto/testlib/selftests/generate_expected_output.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 83c617fee5..b917dacc78 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -109,6 +109,7 @@ if isWindows: exit() tests = sys.argv[1:] +os.environ['LC_ALL'] = 'C' if len(tests) == 0: tests = subdirs() print("Generating " + str(len(tests)) + " test results for: " + qtver + " in: " + rootPath) -- cgit v1.2.3 From e7d476031474786a2e11ff6d3f9af0d5244f19d8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Jul 2016 09:41:15 +0200 Subject: Testlib: Format QRegion in QCOMPARE Output regions as a compact list of rectangles: QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) Change-Id: I62e42bd30897a1d31b28e0cbd6afe7fa8ecf2664 Reviewed-by: Edward Welbourne --- .../auto/testlib/selftests/cmptest/tst_cmptest.cpp | 25 +++++++ .../testlib/selftests/expected_cmptest.lightxml | 77 ++++++++++++++-------- .../testlib/selftests/expected_cmptest.teamcity | 66 +++++++++++-------- tests/auto/testlib/selftests/expected_cmptest.txt | 68 +++++++++++-------- tests/auto/testlib/selftests/expected_cmptest.xml | 77 ++++++++++++++-------- .../testlib/selftests/expected_cmptest.xunitxml | 10 ++- 6 files changed, 209 insertions(+), 114 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index c3229b495e..3586b7f420 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -141,6 +141,8 @@ private slots: void compareQPixmaps_data(); void compareQImages(); void compareQImages_data(); + void compareQRegion_data(); + void compareQRegion(); #endif void verify(); void verify2(); @@ -409,6 +411,29 @@ void tst_Cmptest::compareQImages() QCOMPARE(opA, opB); } + +void tst_Cmptest::compareQRegion_data() +{ + QTest::addColumn("rA"); + QTest::addColumn("rB"); + const QRect rect1(QPoint(10, 10), QSize(200, 50)); + const QRegion region1(rect1); + QRegion listRegion2; + const QVector list2 = QVector() << QRect(QPoint(100, 200), QSize(50, 200)) << rect1; + listRegion2.setRects(list2.constData(), list2.size()); + QTest::newRow("equal-empty") << QRegion() << QRegion(); + QTest::newRow("1-empty") << region1 << QRegion(); + QTest::newRow("equal") << region1 << region1; + QTest::newRow("different lists") << region1 << listRegion2; +} + +void tst_Cmptest::compareQRegion() +{ + QFETCH(QRegion, rA); + QFETCH(QRegion, rB); + + QCOMPARE(rA, rB); +} #endif // QT_GUI_LIB static int opaqueFunc() diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index dc4a8a290e..a66413dfa0 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -8,13 +8,13 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -38,7 +38,7 @@ - + - + - + - + ) @@ -74,31 +74,31 @@ - + - + - + - + - + - + @@ -115,7 +115,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -134,13 +134,13 @@ - + - + - + - + @@ -165,13 +165,13 @@ - + - + - + - + - + + + + + + + + + + + + + + + + + + - + - + - + - + diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity index 8bcbfc50a9..925acb37fe 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.teamcity +++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity @@ -2,106 +2,116 @@ ##teamcity[testStarted name='initTestCase()'] ##teamcity[testFinished name='initTestCase()'] ##teamcity[testStarted name='compare_unregistered_enums()'] -##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(156)|]' details='Compared values are not the same'] +##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(158)|]' details='Compared values are not the same'] ##teamcity[testFinished name='compare_unregistered_enums()'] ##teamcity[testStarted name='compare_registered_enums()'] -##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(162)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday'] +##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(165)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday'] ##teamcity[testFinished name='compare_registered_enums()'] ##teamcity[testStarted name='compare_class_enums()'] -##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(168)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2'] +##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(171)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2'] ##teamcity[testFinished name='compare_class_enums()'] ##teamcity[testStarted name='compare_boolfuncs()'] ##teamcity[testFinished name='compare_boolfuncs()'] ##teamcity[testStarted name='compare_pointerfuncs()'] ##teamcity[testFinished name='compare_pointerfuncs()'] ##teamcity[testStarted name='compare_tostring(int, string)'] -##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)'] +##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)'] ##teamcity[testFinished name='compare_tostring(int, string)'] ##teamcity[testStarted name='compare_tostring(both invalid)'] ##teamcity[testFinished name='compare_tostring(both invalid)'] ##teamcity[testStarted name='compare_tostring(null hash, invalid)'] -##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()'] +##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()'] ##teamcity[testFinished name='compare_tostring(null hash, invalid)'] ##teamcity[testStarted name='compare_tostring(string, null user type)'] -##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)'] +##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)'] ##teamcity[testFinished name='compare_tostring(string, null user type)'] ##teamcity[testStarted name='compare_tostring(both non-null user type)'] -##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,)|n Expected (expected): QVariant(PhonyClass,)'] +##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,)|n Expected (expected): QVariant(PhonyClass,)'] ##teamcity[testFinished name='compare_tostring(both non-null user type)'] ##teamcity[testStarted name='compareQStringLists(empty lists)'] ##teamcity[testFinished name='compareQStringLists(empty lists)'] ##teamcity[testStarted name='compareQStringLists(equal lists)'] ##teamcity[testFinished name='compareQStringLists(equal lists)'] ##teamcity[testStarted name='compareQStringLists(last item different)'] -##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"'] +##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"'] ##teamcity[testFinished name='compareQStringLists(last item different)'] ##teamcity[testStarted name='compareQStringLists(second-last item different)'] -##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"'] +##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"'] ##teamcity[testFinished name='compareQStringLists(second-last item different)'] ##teamcity[testStarted name='compareQStringLists(prefix)'] -##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1'] +##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1'] ##teamcity[testFinished name='compareQStringLists(prefix)'] ##teamcity[testStarted name='compareQStringLists(short list second)'] -##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1'] +##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1'] ##teamcity[testFinished name='compareQStringLists(short list second)'] ##teamcity[testStarted name='compareQStringLists(short list first)'] -##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12'] +##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12'] ##teamcity[testFinished name='compareQStringLists(short list first)'] ##teamcity[testStarted name='compareQListInt()'] -##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(340)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4'] +##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(343)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4'] ##teamcity[testFinished name='compareQListInt()'] ##teamcity[testStarted name='compareQListDouble()'] -##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(347)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1'] +##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(350)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1'] ##teamcity[testFinished name='compareQListDouble()'] ##teamcity[testStarted name='compareQColor()'] -##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(357)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00'] +##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(360)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00'] ##teamcity[testFinished name='compareQColor()'] ##teamcity[testStarted name='compareQPixmaps(both null)'] ##teamcity[testFinished name='compareQPixmaps(both null)'] ##teamcity[testStarted name='compareQPixmaps(one null)'] -##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0'] +##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0'] ##teamcity[testFinished name='compareQPixmaps(one null)'] ##teamcity[testStarted name='compareQPixmaps(other null)'] -##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1'] +##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1'] ##teamcity[testFinished name='compareQPixmaps(other null)'] ##teamcity[testStarted name='compareQPixmaps(equal)'] ##teamcity[testFinished name='compareQPixmaps(equal)'] ##teamcity[testStarted name='compareQPixmaps(different size)'] -##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20'] +##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20'] ##teamcity[testFinished name='compareQPixmaps(different size)'] ##teamcity[testStarted name='compareQPixmaps(different pixels)'] -##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared values are not the same'] +##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared values are not the same'] ##teamcity[testFinished name='compareQPixmaps(different pixels)'] ##teamcity[testStarted name='compareQImages(both null)'] ##teamcity[testFinished name='compareQImages(both null)'] ##teamcity[testStarted name='compareQImages(one null)'] -##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0'] +##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0'] ##teamcity[testFinished name='compareQImages(one null)'] ##teamcity[testStarted name='compareQImages(other null)'] -##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1'] +##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1'] ##teamcity[testFinished name='compareQImages(other null)'] ##teamcity[testStarted name='compareQImages(equal)'] ##teamcity[testFinished name='compareQImages(equal)'] ##teamcity[testStarted name='compareQImages(different size)'] -##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20'] +##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20'] ##teamcity[testFinished name='compareQImages(different size)'] ##teamcity[testStarted name='compareQImages(different format)'] -##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3'] +##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3'] ##teamcity[testFinished name='compareQImages(different format)'] ##teamcity[testStarted name='compareQImages(different pixels)'] -##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared values are not the same'] +##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared values are not the same'] ##teamcity[testFinished name='compareQImages(different pixels)'] +##teamcity[testStarted name='compareQRegion(equal-empty)'] +##teamcity[testFinished name='compareQRegion(equal-empty)'] +##teamcity[testStarted name='compareQRegion(1-empty)'] +##teamcity[testFailed name='compareQRegion(1-empty)' message='Failure! |[Loc: tst_cmptest.cpp(435)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(null)'] +##teamcity[testFinished name='compareQRegion(1-empty)'] +##teamcity[testStarted name='compareQRegion(equal)'] +##teamcity[testFinished name='compareQRegion(equal)'] +##teamcity[testStarted name='compareQRegion(different lists)'] +##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: tst_cmptest.cpp(435)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)'] +##teamcity[testFinished name='compareQRegion(different lists)'] ##teamcity[testStarted name='verify()'] -##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(421)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()'] +##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(447)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()'] ##teamcity[testFinished name='verify()'] ##teamcity[testStarted name='verify2()'] -##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(427)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)'] +##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(453)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)'] ##teamcity[testFinished name='verify2()'] ##teamcity[testStarted name='tryVerify()'] -##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(433)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()'] +##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(459)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()'] ##teamcity[testFinished name='tryVerify()'] ##teamcity[testStarted name='tryVerify2()'] -##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(439)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)'] +##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(465)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)'] ##teamcity[testFinished name='tryVerify2()'] ##teamcity[testStarted name='cleanupTestCase()'] ##teamcity[testFinished name='cleanupTestCase()'] diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 276383ce9d..c7094a4113 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -2,112 +2,122 @@ Config: Using QtTest library PASS : tst_Cmptest::initTestCase() FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same - Loc: [tst_cmptest.cpp(156)] + Loc: [tst_cmptest.cpp(158)] FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same Actual (Qt::Monday): Monday Expected (Qt::Sunday): Sunday - Loc: [tst_cmptest.cpp(162)] + Loc: [tst_cmptest.cpp(165)] FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2 - Loc: [tst_cmptest.cpp(168)] + Loc: [tst_cmptest.cpp(171)] PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same Actual (actual) : QVariant(int,123) Expected (expected): QVariant(QString,hi) - Loc: [tst_cmptest.cpp(239)] + Loc: [tst_cmptest.cpp(242)] PASS : tst_Cmptest::compare_tostring(both invalid) FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same Actual (actual) : QVariant(QVariantHash) Expected (expected): QVariant() - Loc: [tst_cmptest.cpp(239)] + Loc: [tst_cmptest.cpp(242)] FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same Actual (actual) : QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass) - Loc: [tst_cmptest.cpp(239)] + Loc: [tst_cmptest.cpp(242)] FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same Actual (actual) : QVariant(PhonyClass,) Expected (expected): QVariant(PhonyClass,) - Loc: [tst_cmptest.cpp(239)] + Loc: [tst_cmptest.cpp(242)] PASS : tst_Cmptest::compareQStringLists(empty lists) PASS : tst_Cmptest::compareQStringLists(equal lists) FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(333)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(333)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(333)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(333)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes. Actual (opA) size: 1 Expected (opB) size: 12 - Loc: [tst_cmptest.cpp(333)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2. Actual (int1): 3 Expected (int2): 4 - Loc: [tst_cmptest.cpp(340)] + Loc: [tst_cmptest.cpp(343)] FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1 - Loc: [tst_cmptest.cpp(347)] + Loc: [tst_cmptest.cpp(350)] FAIL! : tst_Cmptest::compareQColor() Compared values are not the same Actual (yellow): #ffff00 Expected (green) : #00ff00 - Loc: [tst_cmptest.cpp(357)] + Loc: [tst_cmptest.cpp(360)] PASS : tst_Cmptest::compareQPixmaps(both null) FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(382)] + Loc: [tst_cmptest.cpp(385)] FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(382)] + Loc: [tst_cmptest.cpp(385)] PASS : tst_Cmptest::compareQPixmaps(equal) FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(382)] + Loc: [tst_cmptest.cpp(385)] FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(382)] + Loc: [tst_cmptest.cpp(385)] PASS : tst_Cmptest::compareQImages(both null) FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(409)] + Loc: [tst_cmptest.cpp(412)] FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(409)] + Loc: [tst_cmptest.cpp(412)] PASS : tst_Cmptest::compareQImages(equal) FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(409)] + Loc: [tst_cmptest.cpp(412)] FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format. Actual (opA): 6 Expected (opB): 3 - Loc: [tst_cmptest.cpp(409)] + Loc: [tst_cmptest.cpp(412)] FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(409)] + Loc: [tst_cmptest.cpp(412)] +PASS : tst_Cmptest::compareQRegion(equal-empty) +FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same + Actual (rA): QRegion(200x50+10+10) + Expected (rB): QRegion(null) + Loc: [tst_cmptest.cpp(435)] +PASS : tst_Cmptest::compareQRegion(equal) +FAIL! : tst_Cmptest::compareQRegion(different lists) Compared values are not the same + Actual (rA): QRegion(200x50+10+10) + Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) + Loc: [tst_cmptest.cpp(435)] FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(421)] + Loc: [tst_cmptest.cpp(447)] FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(427)] + Loc: [tst_cmptest.cpp(453)] FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(433)] + Loc: [tst_cmptest.cpp(459)] FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(439)] + Loc: [tst_cmptest.cpp(465)] PASS : tst_Cmptest::cleanupTestCase() -Totals: 11 passed, 28 failed, 0 skipped, 0 blacklisted, 247ms +Totals: 13 passed, 30 failed, 0 skipped, 0 blacklisted, 246ms ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index ba5bd3dba6..d472840e98 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -10,13 +10,13 @@ - + - + @@ -24,7 +24,7 @@ - + @@ -40,7 +40,7 @@ - + - + - + - + ) @@ -76,31 +76,31 @@ - + - + - + - + - + - + @@ -117,7 +117,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -136,13 +136,13 @@ - + - + - + - + @@ -167,13 +167,13 @@ - + - + - + - + - + + + + + + + + + + + + + + + + + + - + - + - + - + diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index 0b43fba654..9f1726b0d6 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -1,5 +1,5 @@ - + @@ -94,6 +94,14 @@ Expected (opB): 3" result="fail"/> + + + + -- cgit v1.2.3 From cddb344f3e24e3a61baf896161618c36a3f0c737 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 30 Jun 2016 18:45:41 +0300 Subject: QSslSocket: reset connection parameters on disconnect Otherwise socketDescriptor(), localPort(), localAddress(), peerPort(), peerAddress(), and peerName() remain uncleared until close() is called. This could take place when the connection is closed by the remote endpoint or the user calls disconnectFromHost(). After disconnecting, connection parameters are no longer valid, while I/O device is still opened and may have pending data for reading. Usually, the user reads all incoming data and closes the device independently. Change-Id: Ic898851c39137faf64019949910f0d94ebb79df7 Reviewed-by: Edward Welbourne --- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 382fbf08a8..6bb502edcb 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -1213,6 +1213,12 @@ void tst_QTcpSocket::connectDisconnectConnectDisconnect() QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); QCOMPARE(socket->socketType(), QTcpSocket::TcpSocket); + QCOMPARE(socket->socketDescriptor(), qintptr(-1)); + QCOMPARE(int(socket->localPort()), 0); + QCOMPARE(socket->localAddress(), QHostAddress()); + QCOMPARE(int(socket->peerPort()), 0); + QCOMPARE(socket->peerAddress(), QHostAddress()); + socket->connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket->waitForReadyRead(10000)); QCOMPARE(QString::fromLatin1(socket->read(4)), QString("* OK")); -- cgit v1.2.3 From a91d0dd369313dfa8865f99e590b868146cb4388 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 5 Jul 2016 15:11:43 +0200 Subject: Q_(U)INT64_C is not a type, so don't use it as if it was These expressions only work because they contain no non-parenthesized commas and an int literal is last. Fix by wrapping only the integer literal in Q_(U)INT64_C. Change-Id: I6b8e508b6c7c022f4b3342f65c26aab89ce17702 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index 77fc6ad6ae..c978761266 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -189,9 +189,9 @@ void tst_QRingBuffer::free() ringBuffer.append(QByteArray("01234", 5)); ringBuffer.free(1); - QCOMPARE(ringBuffer.size(), Q_INT64_C(4095 + 2048 + 5)); + QCOMPARE(ringBuffer.size(), Q_INT64_C(4095) + 2048 + 5); ringBuffer.free(4096); - QCOMPARE(ringBuffer.size(), Q_INT64_C(2047 + 5)); + QCOMPARE(ringBuffer.size(), Q_INT64_C(2047) + 5); ringBuffer.free(48); ringBuffer.free(2000); QCOMPARE(ringBuffer.size(), Q_INT64_C(4)); @@ -251,9 +251,9 @@ void tst_QRingBuffer::chop() ringBuffer.reserve(4096); ringBuffer.chop(1); - QCOMPARE(ringBuffer.size(), Q_INT64_C(5 + 2048 + 4095)); + QCOMPARE(ringBuffer.size(), Q_INT64_C(5) + 2048 + 4095); ringBuffer.chop(4096); - QCOMPARE(ringBuffer.size(), Q_INT64_C(5 + 2047)); + QCOMPARE(ringBuffer.size(), Q_INT64_C(5) + 2047); ringBuffer.chop(48); ringBuffer.chop(2000); QCOMPARE(ringBuffer.size(), Q_INT64_C(4)); -- cgit v1.2.3 From 631b143b3f6650b5761ac2c78e7936e1594b6e4f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 1 Jul 2016 17:28:37 +0200 Subject: QComboBox: fix crash on setEditable(false) called from editTextChanged() QLineEdit::setText() emits QLineEdit::textChanged(), which is connected to QComboBox::editTextChanged(). When a user slot connected to editTextChanged() sets QComboBox::editable to false, the line edit will be deleted in setEditable() and when control returns to QComboBoxPrivate::setCurrentIndex(), the formerly non-null 'lineEdit' has changed to nullptr, leading to a nullptr dereference when attempting to set the completionPrefix on lineEdit->completer(). Fix by re-checking 'lineEdit' after returning from the QLineEdit::setText() call. Add a test. Task-number: QTBUG-54191 Change-Id: I94154796cfde73fb490f8471c48b9d6f62825a92 Reviewed-by: Friedemann Kleint --- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index ae516639a6..15bf686699 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -161,6 +161,7 @@ private slots: void itemData(); void task_QTBUG_31146_popupCompletion(); void task_QTBUG_41288_completerChangesCurrentIndex(); + void task_QTBUG_54191_slotOnEditTextChangedSetsComboBoxToReadOnly(); void keyboardSelection(); void setCustomModelAndView(); void updateDelegateOnEditableChange(); @@ -3124,6 +3125,30 @@ void tst_QComboBox::task_QTBUG_41288_completerChangesCurrentIndex() } } +namespace { + struct SetReadOnly { + QComboBox *cb; + explicit SetReadOnly(QComboBox *cb) : cb(cb) {} + void operator()() const + { cb->setEditable(false); } + }; +} + +void tst_QComboBox::task_QTBUG_54191_slotOnEditTextChangedSetsComboBoxToReadOnly() +{ + QComboBox cb; + cb.addItems(QStringList() << "one" << "two"); + cb.setEditable(true); + cb.setCurrentIndex(0); + + connect(&cb, &QComboBox::editTextChanged, + SetReadOnly(&cb)); + + cb.setCurrentIndex(1); + // the real test is that it didn't crash... + QCOMPARE(cb.currentIndex(), 1); +} + void tst_QComboBox::keyboardSelection() { QComboBox comboBox; -- cgit v1.2.3 From b36c6bab8db724a59f69e5205e031cccf4520ab7 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 7 Jul 2016 14:36:38 +0300 Subject: QString: add auto test for chop() Change-Id: I8fc65c65776a64cc92e8cba3993d17746be81ba1 Reviewed-by: Edward Welbourne --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index a922e3ad27..601987086d 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -482,6 +482,7 @@ private slots: void sprintf(); void fill(); void truncate(); + void chop(); void constructor(); void constructorQByteArray_data(); void constructorQByteArray(); @@ -1221,6 +1222,31 @@ void tst_QString::truncate() } +void tst_QString::chop() +{ + const QString original("abcd"); + + QString str = original; + str.chop(1); + QCOMPARE(str, QLatin1String("abc")); + + str = original; + str.chop(0); + QCOMPARE(str, original); + + str = original; + str.chop(-1); + QCOMPARE(str, original); + + str = original; + str.chop(original.size()); + QVERIFY(str.isEmpty()); + + str = original; + str.chop(1000); + QVERIFY(str.isEmpty()); +} + void tst_QString::fill() { QString e; -- cgit v1.2.3 From e27c07389bcf8b6c5cc1c356a3ee1759045270a8 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 8 Jul 2016 11:27:50 +0300 Subject: QString: adapt chop() auto test as data-driven test Thiago Macieira asked to do that. Change-Id: I9a07dad7ff2bfebc2f863e0e9f151aab66450bcf Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 37 ++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 601987086d..3bacf5d942 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -482,6 +482,7 @@ private slots: void sprintf(); void fill(); void truncate(); + void chop_data(); void chop(); void constructor(); void constructorQByteArray_data(); @@ -1222,29 +1223,29 @@ void tst_QString::truncate() } -void tst_QString::chop() +void tst_QString::chop_data() { - const QString original("abcd"); - - QString str = original; - str.chop(1); - QCOMPARE(str, QLatin1String("abc")); + QTest::addColumn("input"); + QTest::addColumn("count" ); + QTest::addColumn("result"); - str = original; - str.chop(0); - QCOMPARE(str, original); + const QString original("abcd"); - str = original; - str.chop(-1); - QCOMPARE(str, original); + QTest::newRow("data0") << original << 1 << QString("abc"); + QTest::newRow("data1") << original << 0 << original; + QTest::newRow("data2") << original << -1 << original; + QTest::newRow("data3") << original << original.size() << QString(); + QTest::newRow("data4") << original << 1000 << QString(); +} - str = original; - str.chop(original.size()); - QVERIFY(str.isEmpty()); +void tst_QString::chop() +{ + QFETCH(QString, input); + QFETCH(int, count); + QFETCH(QString, result); - str = original; - str.chop(1000); - QVERIFY(str.isEmpty()); + input.chop(count); + QCOMPARE(input, result); } void tst_QString::fill() -- cgit v1.2.3 From 6a7bae9a26aac877bceaf2810328064abc71c768 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 11 Jul 2016 12:11:14 +0200 Subject: QHashFunctions: test for hash equality of null and empty string types In Qt, null QStrings compare equal to empty ones, so add an explicit check that the corresponding hash values are identical, too. Ditto for QByteArray. Change-Id: I190fc95a765305928d9b6b0e4955433865b6b247 Reviewed-by: Thiago Macieira --- .../corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index bde9433a24..4d61bc393d 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -45,6 +45,8 @@ class tst_QHashFunctions : public QObject Q_OBJECT private Q_SLOTS: void qhash(); + void qhash_of_empty_and_null_qstring(); + void qhash_of_empty_and_null_qbytearray(); void fp_qhash_of_zero_is_zero(); void qthash_data(); void qthash(); @@ -117,6 +119,20 @@ void tst_QHashFunctions::qhash() } } +void tst_QHashFunctions::qhash_of_empty_and_null_qstring() +{ + QString null, empty(""); + QCOMPARE(null, empty); + QCOMPARE(qHash(null), qHash(empty)); +} + +void tst_QHashFunctions::qhash_of_empty_and_null_qbytearray() +{ + QByteArray null, empty(""); + QCOMPARE(null, empty); + QCOMPARE(qHash(null), qHash(empty)); +} + void tst_QHashFunctions::fp_qhash_of_zero_is_zero() { QCOMPARE(qHash(-0.0f), 0U); -- cgit v1.2.3 From e6a5be1d81a3f8fce7e55906b4bc84d723e11ac5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 11 Jul 2016 11:04:52 +0200 Subject: QPair: add test for pair of references std::pair explicitly supports this (cf. std::tie), so check we do, too. Change-Id: Idc3c1739a4bc64a0da120dcf953def7e432f6f71 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qpair/tst_qpair.cpp | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 076efc5428..94740d74bc 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -40,6 +40,7 @@ class tst_QPair : public QObject { Q_OBJECT private Q_SLOTS: + void pairOfReferences(); void testConstexpr(); }; @@ -94,6 +95,35 @@ Q_STATIC_ASSERT(!QTypeInfo::isDummy ); Q_STATIC_ASSERT(!QTypeInfo::isPointer); +void tst_QPair::pairOfReferences() +{ + int i = 0; + QString s; + + QPair p(i, s); + + p.first = 1; + QCOMPARE(i, 1); + + i = 2; + QCOMPARE(p.first, 2); + + p.second = QLatin1String("Hello"); + QCOMPARE(s, QLatin1String("Hello")); + + s = QLatin1String("olleH"); + QCOMPARE(p.second, QLatin1String("olleH")); + + QPair q = p; + q.first = 3; + QCOMPARE(i, 3); + QCOMPARE(p.first, 3); + + q.second = QLatin1String("World"); + QCOMPARE(s, QLatin1String("World")); + QCOMPARE(p.second, QLatin1String("World")); +} + void tst_QPair::testConstexpr() { Q_CONSTEXPR QPair pID = qMakePair(0, 0.0); -- cgit v1.2.3 From e21bf5e6b390001ac83c403005957ddc8bfc36ae Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 30 Mar 2016 16:01:27 +0200 Subject: QString::replace(): protect sought text and replacement When replacing each copy of one text with a copy of another, we do so in batches of 1024; if we get more than one batch, we need to keep a copy of the sought text and replacement if they're part of the string we're modifying, for use in later batches. Also do the replacements in full batches of 1024, not 1023 (which left the last entry in an array unused); marked some related tests as (un)likely; and move some repeated code out into a pair of little local functions to save duplcation. Those new functions can also serve replace_helper(); and it can shed a const_cast and some conditioning of free() by using them the same way replace() now does. (There was also one place it still used the raw after, rather than the replacement copy; which could have produced errors if memcpy were to exercise its right to assume no overlap in arrays. This error is what prompted me to notice all of the above.) Added tests. The last error proved untestable as my memcpy is in fact as fussy as memmove. The first two tests added were attempts to get a failure out of it. The third did get a failure, but also tripped over the problem in replace() itself. Added to an existing test function and renamed it to generally cover extra tests for replace. Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e Reviewed-by: Robin Burchell Reviewed-by: Lars Knoll --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 42 ++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 3bacf5d942..da6cdddd4f 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -360,7 +360,7 @@ private slots: void replace_qchar_qstring(); void replace_uint_uint_data(); void replace_uint_uint(); - void replace_uint_uint_extra(); + void replace_extra(); void replace_string_data(); void replace_string(); void replace_regexp_data(); @@ -2790,7 +2790,7 @@ void tst_QString::replace_uint_uint() } } -void tst_QString::replace_uint_uint_extra() +void tst_QString::replace_extra() { /* This test is designed to be extremely slow if QString::replace() doesn't optimize the case @@ -2827,6 +2827,44 @@ void tst_QString::replace_uint_uint_extra() QString str5("abcdefghij"); str5.replace(8, 10, str5); QCOMPARE(str5, QString("abcdefghabcdefghij")); + + // Replacements using only part of the string modified: + QString str6("abcdefghij"); + str6.replace(1, 8, str6.constData() + 3, 3); + QCOMPARE(str6, QString("adefj")); + + QString str7("abcdefghibcdefghij"); + str7.replace(str7.constData() + 1, 6, str7.constData() + 2, 3); + QCOMPARE(str7, QString("acdehicdehij")); + + const int many = 1024; + /* + QS::replace(const QChar *, int, const QChar *, int, Qt::CaseSensitivity) + does its replacements in batches of many (please keep in sync with any + changes to batch size), which lead to misbehaviour if ether QChar * array + was part of the data being modified. + */ + QString str8("abcdefg"), ans8("acdeg"); + { + // Make str8 and ans8 repeat themselves many + 1 times: + int i = many; + QString big(str8), small(ans8); + while (i && !(i & 1)) { // Exploit many being a power of 2: + big += big; + small += small; + i >>= 1; + } + while (i-- > 0) { + str8 += big; + ans8 += small; + } + } + str8.replace(str8.constData() + 1, 5, str8.constData() + 2, 3); + // Pre-test the bit where the diff happens, so it gets displayed: + QCOMPARE(str8.mid((many - 3) * 5), ans8.mid((many - 3) * 5)); + // Also check the full values match, of course: + QCOMPARE(str8.size(), ans8.size()); + QCOMPARE(str8, ans8); } void tst_QString::replace_string() -- cgit v1.2.3 From 9131f6e56139924162778c6c0538dda58d839bbb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 12 Jul 2016 16:02:53 +0200 Subject: QCompleter::setModel(): Restore completion role When setting a QFileSystemModel as model, the completion role is set to QFileSystemModel::FileNameRole. This needs to be reset to the default Qt::EditRole when setting another model. Task-number: QTBUG-54642 Change-Id: Ie78d5d417e008ad05a2f995bdbc218b3ad1bc49c Reviewed-by: Andy Shaw --- tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index e8ac9aa5d2..86a0bdf901 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -291,8 +291,8 @@ retry: // Testing get/set functions void tst_QCompleter::getSetCheck() { - QStandardItemModel model(3,3); - QCompleter completer(&model); + QStandardItemModel standardItemModel(3,3); + QCompleter completer(&standardItemModel); // QString QCompleter::completionPrefix() // void QCompleter::setCompletionPrefix(QString) @@ -352,6 +352,21 @@ void tst_QCompleter::getSetCheck() QCOMPARE(completer.wrapAround(), true); // default value completer.setWrapAround(false); QCOMPARE(completer.wrapAround(), false); + +#ifndef QT_NO_FILESYSTEMMODEL + // QTBUG-54642, changing from QFileSystemModel to another model should restore role. + completer.setCompletionRole(Qt::EditRole); + QCOMPARE(completer.completionRole(), static_cast(Qt::EditRole)); // default value + QFileSystemModel fileSystemModel; + completer.setModel(&fileSystemModel); + QCOMPARE(completer.completionRole(), static_cast(QFileSystemModel::FileNameRole)); + completer.setModel(&standardItemModel); + QCOMPARE(completer.completionRole(), static_cast(Qt::EditRole)); + completer.setCompletionRole(Qt::ToolTipRole); + QStandardItemModel standardItemModel2(2, 2); // Do not clobber a custom role when changing models + completer.setModel(&standardItemModel2); + QCOMPARE(completer.completionRole(), static_cast(Qt::ToolTipRole)); +#endif // QT_NO_FILESYSTEMMODEL } void tst_QCompleter::csMatchingOnCsSortedModel_data() -- cgit v1.2.3 From b27d4835c2ae0d8767ca914acb72a4bdcea6fc85 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Jun 2016 15:40:17 +0200 Subject: fix error() not propagating through if() if() would simply "downgrade" a fatal error to a false condition, which is certainly not expected. Change-Id: Ie9c54f2bddf588856498bf795007b341b7c9363a Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index beafef5ad2..f172cda865 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2103,6 +2103,12 @@ void tst_qmakelib::addTestFunctions(const QString &qindir) << "Project ERROR: World, you FAIL!" << false; + QTest::newRow("if(error())") + << "if(error(\\'World, you FAIL!\\')): OK = 1\nOKE = 1" + << "OK = UNDEF\nOKE = UNDEF" + << "Project ERROR: World, you FAIL!" + << false; + QTest::newRow("system()") << "system('" #ifdef Q_OS_WIN -- cgit v1.2.3 From 339b9706ccbed4063a92337c9994731793558b0a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Jun 2016 16:56:57 +0200 Subject: make error() propagate from custom replace functions it didn't, which is rather unexpected. Change-Id: I8cdb7b1490a8c2207809812b93cc65fbe23a1b98 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index f172cda865..b7acf70e88 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -641,6 +641,72 @@ void tst_qmakelib::addControlStructs() << "VAR = final" << "" << true; + + QTest::newRow("error() from replace function (assignment)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$func()\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (replacement)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$func()\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (LHS)") + << "defineReplace(func) {\nerror(error)\nreturn(VAR)\n}\n" + "$$func() = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (loop variable)") + << "defineReplace(func) {\nerror(error)\nreturn(BLAH)\n}\n" + "for($$func()) {\nVAR = $$BLAH\nbreak()\n}\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (built-in test arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "message($$func()): VAR = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (built-in replace arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$upper($$func())\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (custom test arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "defineTest(custom) {\n}\n" + "custom($$func()): VAR = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (custom replace arguments)") + << "defineReplace(func) {\nerror(error)\nreturn(1)\n}\n" + "defineReplace(custom) {\nreturn($$1)\n}\n" + "VAR = $$custom($$func(1))\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; } void tst_qmakelib::addReplaceFunctions(const QString &qindir) -- cgit v1.2.3 From 1b4ea11332f74984a62a4cc4597ad49f5b5269dc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2016 16:02:29 +0200 Subject: make error() propagate from requires() and REQUIRES= that can make sense if a function which determines the availability of a dependency fails to do so for unexpected reasons. Change-Id: If6cd113df25aee66830c120a2fab067c822a4543 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index b7acf70e88..934ee580ed 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -707,6 +707,20 @@ void tst_qmakelib::addControlStructs() << "VAR = UNDEF\nOKE = UNDEF" << "Project ERROR: error" << false; + + QTest::newRow("REQUIRES = error()") + << "REQUIRES = error(error)\n" + "OKE = 1" + << "OKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("requires(error())") + << "requires(error(error))\n" + "OKE = 1" + << "OKE = UNDEF" + << "Project ERROR: error" + << false; } void tst_qmakelib::addReplaceFunctions(const QString &qindir) -- cgit v1.2.3 From dacf3994ba29106132c3a377dba303acdb74daca Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2016 17:26:01 +0200 Subject: fix custom functions inheriting other functions' arguments Task-number: QTBUG-41830 Change-Id: Iba3eee4975a1ee671b7190e52c0efc9a18147c62 Reviewed-by: Joerg Bornemann Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- tests/auto/tools/qmakelib/evaltest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 934ee580ed..f70ee683e2 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -599,6 +599,23 @@ void tst_qmakelib::addControlStructs() << "" << true; + QTest::newRow("function arguments") + << "defineTest(func) {\n" + "defined(1, var) {\nd1 = 1\nexport(d1)\n}\n" + "defined(3, var) {\nd3 = 1\nexport(d3)\n}\n" + "x1 = $$1\nexport(x1)\n" + "2 += foo\nx2 = $$2\nexport(x2)\n" + "x3 = $$3\nexport(x3)\n" + "4 += foo\nx4 = $$4\nexport(x4)\n" + "x5 = $$5\nexport(x5)\n" + "6 += foo\nx6 = $$6\nexport(x6)\n" + "}\n" + "1 = first\n2 = second\n3 = third\n4 = fourth\nfunc(one, two)" + << "1 = first\n2 = second\n3 = third\n4 = fourth\n5 = UNDEF\n6 = UNDEF\n" + "d1 = 1\nd3 = UNDEF\nx1 = one\nx2 = two foo\nx3 =\nx4 = foo\nx5 =\nx6 = foo" + << "" + << true; + QTest::newRow("ARGC and ARGS") << "defineTest(func) {\n" "export(ARGC)\n" -- cgit v1.2.3 From d459a6b0e0d4f128caceaafe981ecf374bb3e420 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 5 Jul 2016 20:00:17 +0200 Subject: fix calculations of worst-case size requirements for token buffer Change-Id: I3aa4c736acec44f95a0a33c7baae9276568f684f Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- tests/auto/tools/qmakelib/parsertest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp index a7b7431a98..7e6757a2ff 100644 --- a/tests/auto/tools/qmakelib/parsertest.cpp +++ b/tests/auto/tools/qmakelib/parsertest.cpp @@ -1872,6 +1872,13 @@ void tst_qmakelib::addParseAbuse() /* 24 */ /* else branch */ << I(0)) << "in:1: OR operator without prior condition." << false; + + // Token buffer overflow. Verify with Valgrind or asan. + QTest::newRow("QTCREATORBUG-16508") + << "a{b{c{d{" + << TS() + << "in:2: Missing closing brace(s)." + << false; } void tst_qmakelib::proParser_data() -- cgit v1.2.3 From 3c8134958c66f40bb86588aa91b83bf58b5de0c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 5 Jul 2016 18:07:14 +0200 Subject: fix raw data leak in $$absolute_path() when the file name is empty, the path will be returned verbatim. this must be considered when constructing the return value. Task-number: QTBUG-54550 Change-Id: Ie108ed52275e66a154ef63bd6f7193f55b3e0454 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index f70ee683e2..09482d86d9 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2482,6 +2482,14 @@ void tst_qmakelib::proEval_data() "Project MESSAGE: assign split joined: word: this is a test:done\n" "Project MESSAGE: assign split quoted: word this is a test done" << true; + + // Raw data leak with empty file name. Verify with Valgrind or asan. + QTest::newRow("QTBUG-54550") + << "FULL = /there/is\n" + "VAR = $$absolute_path(, $$FULL/nothing/here/really)" + << "VAR = /there/is/nothing/here/really" + << "" + << true; } static QString formatValue(const ProStringList &vals) -- cgit v1.2.3 From 34de4f6a157ac10a434b719f41a06b4293023b29 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 7 Jul 2016 12:08:31 +0200 Subject: moc: Fix a crash with malformed input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not increment 'data' past the buffer in case of invalid token. Remove the left over qDebug so we can make a test. Task-number: QTBUG-54609 Change-Id: I8f0dd3381fbdea3f07d3c05c9a44a16d92538117 Reviewed-by: Jędrzej Nowacki --- tests/auto/tools/moc/tst_moc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index b3f9a9f85f..9d2b883112 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1935,6 +1935,13 @@ void tst_Moc::warnings_data() << 1 << QString("IGNORE_ALL_STDOUT") << QString(":2: Error: Macro invoked with too few parameters for a use of '#'"); + + QTest::newRow("QTBUG-54609: crash on invalid input") + << QByteArray::fromBase64("EAkJCQkJbGFzcyBjbGFzcyBiYWkcV2kgTUEKcGYjZGVmaW5lIE1BKFEs/4D/FoQ=") + << QStringList() + << 1 + << QString("IGNORE_ALL_STDOUT") + << QString(":-1: Error: Unexpected character in macro argument list."); } void tst_Moc::warnings() @@ -1950,7 +1957,7 @@ void tst_Moc::warnings() #ifdef Q_CC_MSVC // for some reasons, moc compiled with MSVC uses a different output format - QRegExp lineNumberRe(":(\\d+):"); + QRegExp lineNumberRe(":(-?\\d+):"); lineNumberRe.setMinimal(true); expectedStdErr.replace(lineNumberRe, "(\\1):"); #endif -- cgit v1.2.3