summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:39 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:42 +0200
commit840f6a40e6218992b5b9d451ee3c0886a4846c89 (patch)
tree2b808decc7adf5218b810d2de6b45c5a8b4cfc42 /tests/auto/corelib
parent109bf980b37fed405c6c1eb14cb9c83ff897e389 (diff)
parent2e3870fe37d36ccf4bd84eb90e1d5e08ad00c1bc (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro2
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro2
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/test/test.pro2
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp57
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp20
-rw-r--r--tests/auto/corelib/codecs/utf8/utf8data.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/app/main.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp17
-rw-r--r--tests/auto/corelib/io/io.pro4
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp32
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp10
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp7
-rw-r--r--tests/auto/corelib/itemmodels/itemmodels.pro4
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro2
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp24
-rw-r--r--tests/auto/corelib/kernel/kernel.pro3
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro2
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp16
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro2
-rw-r--r--tests/auto/corelib/kernel/qpointer/qpointer.pro2
-rw-r--r--tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro2
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro1
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro1
-rw-r--r--tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro1
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro2
-rw-r--r--tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro2
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp25
-rw-r--r--tests/auto/corelib/tools/qmargins/tst_qmargins.cpp6
-rw-r--r--tests/auto/corelib/tools/qtimezone/qtimezone.pro2
29 files changed, 161 insertions, 97 deletions
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
index 4383c44259..23343f27f5 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qparallelanimationgroup
-QT = core gui testlib
+QT = core testlib
SOURCES = tst_qparallelanimationgroup.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
index 812c98f8f0..4c2dd02951 100644
--- a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
+++ b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qpauseanimation
-QT = core-private gui-private testlib
+QT = core-private testlib
SOURCES = tst_qpauseanimation.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/codecs/qtextcodec/test/test.pro b/tests/auto/corelib/codecs/qtextcodec/test/test.pro
index ba16a75604..35b2b34690 100644
--- a/tests/auto/corelib/codecs/qtextcodec/test/test.pro
+++ b/tests/auto/corelib/codecs/qtextcodec/test/test.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
-QT += testlib
+QT = core testlib
SOURCES = ../tst_qtextcodec.cpp
TARGET = ../tst_qtextcodec
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 6329160998..8e1b3cf3b2 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -44,7 +44,6 @@
#include <qtextcodec.h>
#include <qfile.h>
-#include <qtextdocument.h>
#include <time.h>
#include <qprocess.h>
#include <QThreadPool>
@@ -67,9 +66,9 @@ private slots:
void codecForLocale();
void asciiToIscii() const;
- void flagCodepointFFFF() const;
+ void nonFlaggedCodepointFFFF() const;
void flagF7808080() const;
- void flagEFBFBF() const;
+ void nonFlaggedEFBFBF() const;
void decode0D() const;
void aliasForUTF16() const;
void mibForTSCII() const;
@@ -288,7 +287,7 @@ void tst_QTextCodec::toUnicode_codecForHtml()
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
- QTextCodec *codec = Qt::codecForHtml(data);
+ QTextCodec *codec = QTextCodec::codecForHtml(data);
codec->toUnicode(data); // this line crashes
}
@@ -410,9 +409,9 @@ void tst_QTextCodec::asciiToIscii() const
}
}
-void tst_QTextCodec::flagCodepointFFFF() const
+void tst_QTextCodec::nonFlaggedCodepointFFFF() const
{
- // This is an invalid Unicode codepoint.
+ //Check that the code point 0xFFFF (=non-character code 0xEFBFBF) is not flagged
const QChar ch(0xFFFF);
QString input(ch);
@@ -420,12 +419,11 @@ void tst_QTextCodec::flagCodepointFFFF() const
QVERIFY(codec);
const QByteArray asDecoded(codec->fromUnicode(input));
- QCOMPARE(asDecoded, QByteArray("?"));
+ QCOMPARE(asDecoded, QByteArray("\357\277\277"));
QByteArray ffff("\357\277\277");
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(ffff.constData(), ffff.length(), &state) == QChar(0));
- QVERIFY(codec->toUnicode(ffff) == QChar(0xfffd));
+ QVERIFY(codec->toUnicode(ffff.constData(), ffff.length(), &state) == QByteArray::fromHex("EFBFBF"));
}
void tst_QTextCodec::flagF7808080() const
@@ -461,13 +459,16 @@ void tst_QTextCodec::flagF7808080() const
QVERIFY(codec->toUnicode(input.constData(), input.length(), &state) == QChar(0));
}
-void tst_QTextCodec::flagEFBFBF() const
+void tst_QTextCodec::nonFlaggedEFBFBF() const
{
- QByteArray invalidInput;
- invalidInput.resize(3);
- invalidInput[0] = char(0xEF);
- invalidInput[1] = char(0xBF);
- invalidInput[2] = char(0xBF);
+ /* Check that the codec does NOT flag EFBFBF.
+ * This is a regression test; see QTBUG-33229
+ */
+ QByteArray validInput;
+ validInput.resize(3);
+ validInput[0] = char(0xEF);
+ validInput[1] = char(0xBF);
+ validInput[2] = char(0xBF);
const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
QVERIFY(codec);
@@ -475,21 +476,20 @@ void tst_QTextCodec::flagEFBFBF() const
{
//QVERIFY(!codec->canEncode(QChar(0xFFFF)));
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(invalidInput.constData(), invalidInput.length(), &state) == QChar(0));
+ QVERIFY(codec->toUnicode(validInput.constData(), validInput.length(), &state) == QByteArray::fromHex("EFBFBF"));
QByteArray start("<?pi ");
- start.append(invalidInput);
+ start.append(validInput);
start.append("?>");
}
- /* When 0xEFBFBF is preceded by what seems to be an arbitrary character,
- * QTextCodec fails to flag it. */
+ // Check that 0xEFBFBF is correctly decoded when preceded by an arbitrary character
{
QByteArray start("B");
- start.append(invalidInput);
+ start.append(validInput);
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QString::fromLatin1("B\0", 2));
+ QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QByteArray("B").append(QByteArray::fromHex("EFBFBF")));
}
}
@@ -675,13 +675,12 @@ void tst_QTextCodec::utf8Codec_data()
str = QChar(0x7ff);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.2.2") << utf8 << str << -1;
- // 2.2.3 U+000FFFF
+ // 2.2.3 U+000FFFF - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbf);
- str.clear();
- str += QChar::ReplacementCharacter;
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.2.3") << utf8 << str << -1;
// 2.2.4 U+001FFFFF
@@ -1536,20 +1535,22 @@ void tst_QTextCodec::utf8Codec_data()
str += QChar(QChar::ReplacementCharacter);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.2.8") << utf8 << str << -1;
- // 5.3.1
+ // 5.3.1 - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbe);
- str = QChar(QChar::ReplacementCharacter);
+ //str = QChar(QChar::ReplacementCharacter);
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.3.1") << utf8 << str << -1;
- // 5.3.2
+ // 5.3.2 - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbf);
- str = QChar(QChar::ReplacementCharacter);
+ //str = QChar(QChar::ReplacementCharacter);
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.3.2") << utf8 << str << -1;
}
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index 99147f3aff..e18f6f73b9 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -233,8 +233,9 @@ void tst_Utf8::nonCharacters_data()
QTest::addColumn<QByteArray>("utf8");
QTest::addColumn<QString>("utf16");
- // Unicode has a couple of "non-characters" that one can use internally,
- // but are not allowed to be used for text interchange.
+ // Unicode has a couple of "non-characters" that one can use internally
+ // These characters may be used for interchange;
+ // see: http://www.unicode.org/versions/corrigendum9.html
//
// Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
// U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
@@ -279,20 +280,17 @@ void tst_Utf8::nonCharacters()
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
- // The system's UTF-8 codec is sometimes buggy
- // GNU libc's iconv is known to accept U+FFFF and U+FFFE encoded as UTF-8
- // OS X's iconv is known to accept those, plus surrogates and codepoints above U+10FFFF
if (!useLocale)
- QVERIFY(decoder->hasFailure());
- else if (!decoder->hasFailure())
- qWarning("System codec does not report failure when it should. Should report bug upstream.");
+ QVERIFY(!decoder->hasFailure());
+ else if (decoder->hasFailure())
+ qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
QSharedPointer<QTextEncoder> encoder(codec->makeEncoder());
encoder->fromUnicode(utf16);
if (!useLocale)
- QVERIFY(encoder->hasFailure());
- else if (!encoder->hasFailure())
- qWarning("System codec does not report failure when it should. Should report bug upstream.");
+ QVERIFY(!encoder->hasFailure());
+ else if (encoder->hasFailure())
+ qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
}
QTEST_MAIN(tst_Utf8)
diff --git a/tests/auto/corelib/codecs/utf8/utf8data.cpp b/tests/auto/corelib/codecs/utf8/utf8data.cpp
index 2516cc9734..a41b0772e6 100644
--- a/tests/auto/corelib/codecs/utf8/utf8data.cpp
+++ b/tests/auto/corelib/codecs/utf8/utf8data.cpp
@@ -129,8 +129,8 @@ void loadInvalidUtf8Rows()
void loadNonCharactersRows()
{
- // Unicode has a couple of "non-characters" that one can use internally,
- // but are not allowed to be used for text interchange.
+ // Unicode has a couple of "non-characters" that one can use internally
+ // These characters are allowed for text-interchange (see http://www.unicode.org/versions/corrigendum9.html)
//
// Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
// U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp
index 14416a914d..621059caad 100644
--- a/tests/auto/corelib/global/qlogging/app/main.cpp
+++ b/tests/auto/corelib/global/qlogging/app/main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <QCoreApplication>
+#include <QLoggingCategory>
struct T {
T() { qDebug("static constructor"); }
@@ -57,6 +58,9 @@ int main(int argc, char **argv)
qWarning("qWarning");
qCritical("qCritical");
+ QLoggingCategory cat("category");
+ qCWarning(cat) << "qDebug with category";
+
qSetMessagePattern(QString());
qDebug("qDebug2");
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 94387704f6..31a4254344 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -666,13 +666,14 @@ void tst_qmessagehandler::qMessagePattern()
// qDebug() << output;
QVERIFY(!output.isEmpty());
- QVERIFY(output.contains("debug 45 T::T static constructor"));
+ QVERIFY(output.contains("debug 46 T::T static constructor"));
// we can't be sure whether the QT_MESSAGE_PATTERN is already destructed
QVERIFY(output.contains("static destructor"));
- QVERIFY(output.contains("debug tst_qlogging 56 main qDebug"));
- QVERIFY(output.contains("warning tst_qlogging 57 main qWarning"));
- QVERIFY(output.contains("critical tst_qlogging 58 main qCritical"));
- QVERIFY(output.contains("debug tst_qlogging 62 main qDebug2"));
+ QVERIFY(output.contains("debug tst_qlogging 57 main qDebug"));
+ QVERIFY(output.contains("warning tst_qlogging 58 main qWarning"));
+ QVERIFY(output.contains("critical tst_qlogging 59 main qCritical"));
+ QVERIFY(output.contains("warning tst_qlogging 62 main qDebug with category "));
+ QVERIFY(output.contains("debug tst_qlogging 66 main qDebug2"));
environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{message}\"");
@@ -710,7 +711,8 @@ void tst_qmessagehandler::qMessagePattern()
QByteArray expected = "static constructor\n"
"[debug] qDebug\n"
"[warning] qWarning\n"
- "[critical] qCritical\n";
+ "[critical] qCritical\n"
+ "[warning] qDebug with category \n";
#ifdef Q_OS_WIN
output.replace("\r\n", "\n");
#endif
@@ -727,7 +729,7 @@ void tst_qmessagehandler::qMessagePatternIf()
const QString appExe = m_appDir + "/app";
QStringList environment = m_baseEnvironment;
- environment.prepend("QT_MESSAGE_PATTERN=\"[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}\"");
+ environment.prepend("QT_MESSAGE_PATTERN=\"[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{if-category}%{category}: %{endif}%{message}\"");
process.setEnvironment(environment);
process.start(appExe);
QVERIFY2(process.waitForStarted(), qPrintable(
@@ -745,6 +747,7 @@ void tst_qmessagehandler::qMessagePatternIf()
QVERIFY(output.contains("[D] qDebug"));
QVERIFY(output.contains("[W] qWarning"));
QVERIFY(output.contains("[C] qCritical"));
+ QVERIFY(output.contains("[W] category: qDebug with category"));
QVERIFY(output.contains("[D] qDebug2"));
//
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index d70737a53f..11815c6160 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -38,6 +38,10 @@ SUBDIRS=\
qwinoverlappedionotifier
}
+!qtHaveModule(gui): SUBDIRS -= \
+ qdatastream \
+ qsettings
+
!qtHaveModule(network): SUBDIRS -= \
qfile \
qiodevice \
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index df93262d93..a49793c3d4 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -226,7 +226,7 @@ private slots:
void QLoggingCategory_categoryName()
{
logMessage.clear();
- QCOMPARE(QString::fromLatin1(QLoggingCategory::defaultCategory().categoryName()),
+ QCOMPARE(QString::fromLatin1(QLoggingCategory::defaultCategory()->categoryName()),
QStringLiteral("default"));
QLoggingCategory defaultCategory("default");
@@ -237,7 +237,7 @@ private slots:
QCOMPARE(QByteArray(nullCategory.categoryName()), QByteArray("default"));
// we rely on the same pointer for any "default" category
- QCOMPARE(QLoggingCategory::defaultCategory().categoryName(),
+ QCOMPARE(QLoggingCategory::defaultCategory()->categoryName(),
defaultCategory.categoryName());
QCOMPARE(defaultCategory.categoryName(),
nullCategory.categoryName());
@@ -256,12 +256,12 @@ private slots:
{
logMessage.clear();
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtDebugMsg), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isWarningEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtWarningMsg), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isCriticalEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtCriticalMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtDebugMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isWarningEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtWarningMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isCriticalEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtCriticalMsg), true);
QLoggingCategory defaultCategory("default");
QCOMPARE(defaultCategory.isDebugEnabled(), true);
@@ -287,11 +287,11 @@ private slots:
{
logMessage.clear();
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), true);
- QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, false);
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), false);
- QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, true);
+ QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, false);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), false);
+ QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
// make sure nothing has printed warnings
QVERIFY(logMessage.isEmpty());
@@ -300,13 +300,13 @@ private slots:
void QLoggingCategory_installFilter()
{
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QLoggingCategory::CategoryFilter defaultFilter =
QLoggingCategory::installFilter(customCategoryFilter);
QVERIFY(defaultFilter);
customCategoryFilterArgs.clear();
- QVERIFY(!QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(!QLoggingCategory::defaultCategory()->isDebugEnabled());
QLoggingCategory cat("custom");
QCOMPARE(customCategoryFilterArgs, QStringList() << "custom");
@@ -319,7 +319,7 @@ private slots:
QCOMPARE((void*)currentFilter, (void*)customCategoryFilter);
QCOMPARE(customCategoryFilterArgs.size(), 0);
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QVERIFY(!cat.isDebugEnabled());
// install default filter
@@ -328,7 +328,7 @@ private slots:
QCOMPARE((void*)defaultFilter, (void*)currentFilter);
QCOMPARE(customCategoryFilterArgs.size(), 0);
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QVERIFY(!cat.isDebugEnabled());
}
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index d9a0f51f3e..b020a50346 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -514,20 +514,20 @@ void tst_QSettings::ctor()
QSettings settings5(format, QSettings::UserScope, "SoftWare.ORG", "killerApp");
if (format == QSettings::NativeFormat) {
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
-# ifdef Q_OS_MACX
+# ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("native", "See QTBUG-32655", Continue);
-# endif // Q_OS_MACX
+# endif // Q_OS_OSX
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
#endif
} else {
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
-# ifdef Q_OS_MACX
+# ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("", "See QTBUG-32655", Continue);
-# endif // Q_OS_MACX
+# endif // Q_OS_OSX
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
@@ -3183,7 +3183,7 @@ void tst_QSettings::rainersSyncBugOnMac()
{
QSettings s3(format, QSettings::UserScope, "software.org", "KillerAPP");
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("native", "See QTBUG-32655", Continue);
#endif
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 75b17df759..d3a8bcfd13 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -964,8 +964,10 @@ void tst_QUrlInternal::encodingRecode_data()
addUtf8Data("utf8-string-2", "\xDF\xBF\xE0\xA0\x80""A");
addUtf8Data("utf8-string-3", "\xE0\xA0\x80\xDF\xBF...");
+ QTest::newRow("encode-unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::FullyEncoded) << "%EF%BF%BF";
+ QTest::newRow("decode-unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::PrettyDecoded) << QString::fromUtf8("\xEF\xBF\xBF");
+
// special cases: stuff we can encode, but not decode
- QTest::newRow("unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::FullyEncoded) << "%EF%BF%BF";
QTest::newRow("unicode-lo-surrogate") << QString(QChar(0xD800)) << F(QUrl::FullyEncoded) << "%ED%A0%80";
QTest::newRow("unicode-hi-surrogate") << QString(QChar(0xDC00)) << F(QUrl::FullyEncoded) << "%ED%B0%80";
@@ -1011,9 +1013,6 @@ void tst_QUrlInternal::encodingRecodeInvalidUtf8_data()
extern void loadInvalidUtf8Rows();
loadInvalidUtf8Rows();
- extern void loadNonCharactersRows();
- loadNonCharactersRows();
-
QTest::newRow("utf8-mix-4") << QByteArray("\xE0.A2\x80");
QTest::newRow("utf8-mix-5") << QByteArray("\xE0\xA2.80");
QTest::newRow("utf8-mix-6") << QByteArray("\xE0\xA2\x33");
diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro
index 3f726692ff..7e0e3a0944 100644
--- a/tests/auto/corelib/itemmodels/itemmodels.pro
+++ b/tests/auto/corelib/itemmodels/itemmodels.pro
@@ -1,10 +1,12 @@
TEMPLATE=subdirs
SUBDIRS = qabstractitemmodel \
+ qstringlistmodel \
+
+qtHaveModule(gui): SUBDIRS += \
qabstractproxymodel \
qidentityproxymodel \
qitemselectionmodel \
- qstringlistmodel \
qtHaveModule(widgets): SUBDIRS += \
qitemmodel \
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
index ef36f8d7fc..ef571de192 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qabstractitemmodel
-QT += testlib
+QT = core testlib
mtdir = ../../../other/modeltest
INCLUDEPATH += $$PWD/$${mtdir}
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 9dbd6414ad..c79e7273c0 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -47,7 +47,8 @@
#include "qjsondocument.h"
#include <limits>
-#define INVALID_UNICODE "\357\277\277" // "\uffff"
+#define INVALID_UNICODE "\xCE\xBA\xE1"
+#define UNICODE_NON_CHARACTER "\xEF\xBF\xBF"
#define UNICODE_DJE "\320\202" // Character from the Serbian Cyrillic alphabet
class tst_QtJson: public QObject
@@ -1306,6 +1307,19 @@ void tst_QtJson::fromJson()
QCOMPARE(doc.toJson(), json);
}
{
+ //regression test: test if unicode_control_characters are correctly decoded
+ QByteArray json = "[\n \"" UNICODE_NON_CHARACTER "\"\n]\n";
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QVERIFY(!doc.isEmpty());
+ QCOMPARE(doc.isArray(), true);
+ QCOMPARE(doc.isObject(), false);
+ QJsonArray array = doc.array();
+ QCOMPARE(array.size(), 1);
+ QCOMPARE(array.at(0).type(), QJsonValue::String);
+ QCOMPARE(array.at(0).toString(), QString::fromUtf8(UNICODE_NON_CHARACTER));
+ QCOMPARE(doc.toJson(), json);
+ }
+ {
QByteArray json = "[]";
QJsonDocument doc = QJsonDocument::fromJson(json);
QVERIFY(!doc.isEmpty());
@@ -1532,7 +1546,7 @@ void tst_QtJson::fromJsonErrors()
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::IllegalUTF8String);
- QCOMPARE(error.offset, 13);
+ QCOMPARE(error.offset, 14);
}
{
QJsonParseError error;
@@ -1556,7 +1570,7 @@ void tst_QtJson::fromJsonErrors()
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::IllegalUTF8String);
- QCOMPARE(error.offset, 14);
+ QCOMPARE(error.offset, 15);
}
{
QJsonParseError error;
@@ -1702,6 +1716,7 @@ void tst_QtJson::parseStrings()
"abc\\tabc",
"abc\\u0019abc",
"abc" UNICODE_DJE "abc",
+ UNICODE_NON_CHARACTER
};
int size = sizeof(strings)/sizeof(const char *);
@@ -1728,7 +1743,8 @@ void tst_QtJson::parseStrings()
Pairs pairs [] = {
{ "abc\\/abc", "abc/abc" },
{ "abc\\u0402abc", "abc" UNICODE_DJE "abc" },
- { "abc\\u0065abc", "abceabc" }
+ { "abc\\u0065abc", "abceabc" },
+ { "abc\\uFFFFabc", "abc" UNICODE_NON_CHARACTER "abc" }
};
size = sizeof(pairs)/sizeof(Pairs);
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index 2f3c02332d..c1b867e6eb 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -21,6 +21,9 @@ SUBDIRS=\
qvariant \
qwineventnotifier
+!qtHaveModule(gui): SUBDIRS -= \
+ qmimedata
+
!qtHaveModule(network): SUBDIRS -= \
qeventloop \
qobject \
diff --git a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
index 0800b71c22..509ade6e2a 100644
--- a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
+++ b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qmetaobject
-QT = core-private gui testlib
+QT = core-private testlib
SOURCES = tst_qmetaobject.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 4f1320e375..870e65f0cc 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -43,7 +43,7 @@
#include <qobject.h>
#include <qmetaobject.h>
-#include <qwindow.h>
+#include <qabstractproxymodel.h>
#include <private/qmetaobject_p.h>
Q_DECLARE_METATYPE(const QMetaObject *)
@@ -746,13 +746,13 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember()
void tst_QMetaObject::qtMetaObjectInheritance()
{
QVERIFY(QObject::staticMetaObject.superClass() == 0);
- QCOMPARE(QWindow::staticMetaObject.indexOfEnumerator("Qt::ScreenOrientation"), -1);
- QCOMPARE(QWindow::staticMetaObject.indexOfEnumerator("ScreenOrientation"), -1);
- int indexOfContentOrientation = QWindow::staticMetaObject.indexOfProperty("contentOrientation");
- QVERIFY(indexOfContentOrientation != -1);
- QMetaProperty contentOrientation = QWindow::staticMetaObject.property(indexOfContentOrientation);
- QVERIFY(contentOrientation.isValid());
- QCOMPARE(contentOrientation.enumerator().name(), "ScreenOrientation");
+ QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("Qt::CaseSensitivity"), -1);
+ QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("CaseSensitivity"), -1);
+ int indexOfSortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.indexOfProperty("sortCaseSensitivity");
+ QVERIFY(indexOfSortCaseSensitivity != -1);
+ QMetaProperty sortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.property(indexOfSortCaseSensitivity);
+ QVERIFY(sortCaseSensitivity.isValid());
+ QCOMPARE(sortCaseSensitivity.enumerator().name(), "CaseSensitivity");
}
struct MyType
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
index 9e2d3519e6..68d3b48086 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
@@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qmetaobjectbuilder
-QT = core-private gui-private testlib
+QT = core-private testlib
SOURCES = tst_qmetaobjectbuilder.cpp
mac:CONFIG -= app_bundle
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro
index 8786d07292..4b573cb6a5 100644
--- a/tests/auto/corelib/kernel/qpointer/qpointer.pro
+++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qpointer
-QT += testlib
+QT = core testlib
qtHaveModule(widgets): QT += widgets
SOURCES = tst_qpointer.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
index 59660d4b07..526db5eef3 100644
--- a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
+++ b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qsignalmapper
-QT += testlib
+QT = core testlib
SOURCES = tst_qsignalmapper.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
index 66fe844b21..2496cd2f1e 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
@@ -1,4 +1,5 @@
TEMPLATE = lib
+QT = core
CONFIG += plugin
HEADERS = plugin1.h
SOURCES = plugin1.cpp
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
index aec057e80c..e70ed4fb25 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
@@ -1,4 +1,5 @@
TEMPLATE = lib
+QT = core
CONFIG += plugin
HEADERS = plugin2.h
SOURCES = plugin2.cpp
diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
index 9ce1ef3dcf..b2f7aaf2d3 100644
--- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
+++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
@@ -1,4 +1,5 @@
SOURCES = main.cpp
+QT = core
CONFIG += console
DESTDIR = ./
diff --git a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
index b830efe3a5..f6fbbc83c6 100644
--- a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
+++ b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qstatemachine
-QT = core-private testlib gui
+QT = core-private testlib
qtHaveModule(widgets): QT += widgets
SOURCES = tst_qstatemachine.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro b/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
index 135b1ff8c4..e23018f96a 100644
--- a/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
+++ b/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
@@ -1,4 +1,4 @@
TARGET = tst_qbytedatabuffer
CONFIG += testcase
-QT += core-private testlib
+QT = core-private testlib
SOURCES += tst_qbytedatabuffer.cpp
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index ffc4baa55d..8c0f32bb74 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -150,6 +150,8 @@ private slots:
void daylightTransitions() const;
void timeZones() const;
+ void invalid() const;
+
private:
bool europeanTimeZone;
QDate defDate() const { return QDate(1900, 1, 1); }
@@ -779,7 +781,11 @@ void tst_QDateTime::toString_rfcDate()
QFETCH(QDateTime, dt);
QFETCH(QString, formatted);
+ // Set to non-English locale to confirm still uses English
+ QLocale oldLocale;
+ QLocale::setDefault(QLocale("de_DE"));
QCOMPARE(dt.toString(Qt::RFC2822Date), formatted);
+ QLocale::setDefault(oldLocale);
}
void tst_QDateTime::toString_enumformat()
@@ -2902,5 +2908,24 @@ void tst_QDateTime::timeZones() const
QCOMPARE(hourAfterStd.toMSecsSinceEpoch(), dstToStdMSecs + 3600000);
}
+void tst_QDateTime::invalid() const
+{
+ QDateTime invalidDate = QDateTime(QDate(0, 0, 0), QTime(-1, -1, -1));
+ QCOMPARE(invalidDate.isValid(), false);
+ QCOMPARE(invalidDate.timeSpec(), Qt::LocalTime);
+
+ QDateTime utcDate = invalidDate.toUTC();
+ QCOMPARE(utcDate.isValid(), false);
+ QCOMPARE(utcDate.timeSpec(), Qt::UTC);
+
+ QDateTime offsetDate = invalidDate.toOffsetFromUtc(3600);
+ QCOMPARE(offsetDate.isValid(), false);
+ QCOMPARE(offsetDate.timeSpec(), Qt::OffsetFromUTC);
+
+ QDateTime tzDate = invalidDate.toTimeZone(QTimeZone("Europe/Oslo"));
+ QCOMPARE(tzDate.isValid(), false);
+ QCOMPARE(tzDate.timeSpec(), Qt::TimeZone);
+}
+
QTEST_APPLESS_MAIN(tst_QDateTime)
#include "tst_qdatetime.moc"
diff --git a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
index d22e771b79..ec83740196 100644
--- a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
+++ b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
@@ -93,6 +93,12 @@ void tst_QMargins::operators()
a -= m2;
QCOMPARE(a, subtracted);
+ QMargins h = m1;
+ h += 2;
+ QCOMPARE(h, QMargins(14, 16, 18, 20));
+ h -= 2;
+ QCOMPARE(h, m1);
+
const QMargins doubled = m1 * 2;
QCOMPARE(doubled, QMargins(24, 28, 32, 36));
QCOMPARE(2 * m1, doubled);
diff --git a/tests/auto/corelib/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
index 2c53100857..fa2397a6bb 100644
--- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro
+++ b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
@@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qtimezone
-QT += core-private testlib
+QT = core-private testlib
SOURCES = tst_qtimezone.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
contains(QT_CONFIG,icu) {