From bc69fd1dfe30876909091d93a07640a498a24c0c Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Fri, 13 Feb 2015 13:01:57 +0200 Subject: Skip instead of entirely excluding tests with disabled features Properly QSKIP tests that use disabled QProcess and symlink features instead of excluding them silently by #ifdef. Other reason is that moc doesn't respect QT_NO_* defines in class definition which causes build issues on some platforms. Change-Id: I041020f7452f7d36c7ec8a5866a4ba5eb23d1f94 Reviewed-by: Oswald Buddenhagen Reviewed-by: Jason McDonald --- .../corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 8 ++++++-- tests/auto/corelib/io/qfile/tst_qfile.cpp | 17 ++++++++++++++--- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 10 ++++++---- .../auto/corelib/io/qtextstream/tst_qtextstream.cpp | 16 ++++++++++++++-- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 8 ++++---- .../kernel/qsharedmemory/test/tst_qsharedmemory.cpp | 18 ++++++++++++------ .../qsystemsemaphore/test/tst_qsystemsemaphore.cpp | 20 ++++++++++++++++---- .../qmimedatabase-cache/tst_qmimedatabase-cache.cpp | 4 ++++ tests/auto/corelib/plugin/quuid/tst_quuid.cpp | 8 ++++---- .../thread/qthreadstorage/tst_qthreadstorage.cpp | 8 +++++--- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 8 +++++++- 11 files changed, 92 insertions(+), 33 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index 01d23e8aa2..c96e933f0e 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -84,7 +84,7 @@ private slots: void codecForUtfText_data(); void codecForUtfText(); -#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) +#if defined(Q_OS_UNIX) void toLocal8Bit(); #endif @@ -2070,9 +2070,12 @@ void tst_QTextCodec::codecForUtfText() QVERIFY(codec == 0); } -#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) +#if defined(Q_OS_UNIX) void tst_QTextCodec::toLocal8Bit() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess process; process.start("echo/echo"); QString string(QChar(0x410)); @@ -2082,6 +2085,7 @@ void tst_QTextCodec::toLocal8Bit() process.waitForFinished(); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); +#endif } #endif diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index a0609d67ac..98963108be 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -139,7 +139,7 @@ private slots: void readAll_data(); void readAll(); void readAllBuffer(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void readAllStdin(); void readLineStdin(); void readLineStdin_lineByLine(); @@ -868,9 +868,12 @@ void tst_QFile::readAllBuffer() QFile::remove(fileName); } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void tst_QFile::readAllStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QByteArray lotsOfData(1024, '@'); // 10 megs QProcess process; @@ -887,11 +890,14 @@ void tst_QFile::readAllStdin() process.closeWriteChannel(); process.waitForFinished(); QCOMPARE(process.readAll().size(), lotsOfData.size() * 5); +#endif } void tst_QFile::readLineStdin() { - +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QByteArray lotsOfData(1024, '@'); // 10 megs for (int i = 0; i < lotsOfData.size(); ++i) { if ((i % 32) == 31) @@ -926,10 +932,14 @@ void tst_QFile::readLineStdin() QCOMPARE(char(array[i]), char('0' + i % 32)); } } +#endif } void tst_QFile::readLineStdin_lineByLine() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else for (int i = 0; i < 2; ++i) { QProcess process; process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), @@ -949,6 +959,7 @@ void tst_QFile::readLineStdin_lineByLine() process.closeWriteChannel(); QVERIFY(process.waitForFinished(5000)); } +#endif } #endif diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 05546eb2b7..62e183f619 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -219,10 +219,8 @@ private slots: void fileTimes(); void fileTimes_oldFile(); -#ifndef Q_NO_SYMLINKS void isSymLink_data(); void isSymLink(); -#endif void isHidden_data(); void isHidden(); @@ -1206,9 +1204,9 @@ void tst_QFileInfo::fileTimes_oldFile() #endif } -#ifndef Q_NO_SYMLINKS void tst_QFileInfo::isSymLink_data() { +#ifndef Q_NO_SYMLINKS QFile::remove("link.lnk"); QFile::remove("brokenlink.lnk"); QFile::remove("dummyfile"); @@ -1228,10 +1226,14 @@ void tst_QFileInfo::isSymLink_data() QTest::newRow("existent file") << m_sourceFile << false << ""; QTest::newRow("link") << "link.lnk" << true << QFileInfo(m_sourceFile).absoluteFilePath(); QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); +#endif } void tst_QFileInfo::isSymLink() { +#ifdef Q_NO_SYMLINKS + QSKIP("No symlink support", SkipAll); +#else QFETCH(QString, path); QFETCH(bool, isSymLink); QFETCH(QString, linkTarget); @@ -1239,8 +1241,8 @@ void tst_QFileInfo::isSymLink() QFileInfo fi(path); QCOMPARE(fi.isSymLink(), isSymLink); QCOMPARE(fi.symLinkTarget(), linkTarget); -} #endif +} void tst_QFileInfo::isHidden_data() { diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 63d07a7ce3..aa7a3762ce 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -187,7 +187,7 @@ private slots: void pos(); void pos2(); void pos3LargeFile(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void readStdin(); void readAllFromStdin(); void readLineFromStdin(); @@ -1484,9 +1484,12 @@ void tst_QTextStream::pos3LargeFile() // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void tst_QTextStream::readStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("stdinProcess/stdinProcess"); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1505,12 +1508,16 @@ void tst_QTextStream::readStdin() QCOMPARE(a, 1); QCOMPARE(b, 2); QCOMPARE(c, 3); +#endif } // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes void tst_QTextStream::readAllFromStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1523,12 +1530,16 @@ void tst_QTextStream::readAllFromStdin() QVERIFY(stdinProcess.waitForFinished(5000)); QCOMPARE(stream.readAll(), QString::fromLatin1("hello world\n")); +#endif } // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes void tst_QTextStream::readLineFromStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1544,6 +1555,7 @@ void tst_QTextStream::readLineFromStdin() stdinProcess.closeWriteChannel(); QVERIFY(stdinProcess.waitForFinished(5000)); +#endif } #endif diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 24cfe8f3bc..94242607f0 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -91,9 +91,7 @@ private slots: void floatProperty(); void qrealProperty(); void property(); -#ifndef QT_NO_PROCESS void recursiveSignalEmission(); -#endif void signalBlocking(); void blockingQueuedConnection(); void childEvents(); @@ -2981,9 +2979,11 @@ void tst_QObject::dynamicProperties() QVERIFY(obj.dynamicPropertyNames().isEmpty()); } -#ifndef QT_NO_PROCESS void tst_QObject::recursiveSignalEmission() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess proc; // signalbug helper app should always be next to this test binary const QString path = QStringLiteral("signalbug/signalbug"); @@ -2992,8 +2992,8 @@ void tst_QObject::recursiveSignalEmission() QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); -} #endif +} void tst_QObject::signalBlocking() { diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 5a92c2f0cb..26bb70fc66 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -74,7 +74,7 @@ private slots: void removeWhileAttached(); #endif void emptyMemory(); -#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WIN) void readOnly(); #endif @@ -90,10 +90,8 @@ private slots: void simpleThreadedProducerConsumer(); // with processes -#ifndef QT_NO_PROCESS void simpleProcessProducerConsumer_data(); void simpleProcessProducerConsumer(); -#endif // extreme cases void useTooMuchMemory(); @@ -457,9 +455,12 @@ void tst_QSharedMemory::emptyMemory() by writing to data and causing a segfault. */ // This test opens a crash dialog on Windows. -#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WIN) void tst_QSharedMemory::readOnly() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else rememberKey("readonly_segfault"); // ### on windows disable the popup somehow QProcess p; @@ -467,6 +468,7 @@ void tst_QSharedMemory::readOnly() p.setProcessChannelMode(QProcess::ForwardedChannels); p.waitForFinished(); QCOMPARE(p.error(), QProcess::Crashed); +#endif } #endif @@ -738,15 +740,16 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer() } } -#ifndef QT_NO_PROCESS void tst_QSharedMemory::simpleProcessProducerConsumer_data() { +#ifndef QT_NO_PROCESS QTest::addColumn("processes"); int tries = 5; for (int i = 0; i < tries; ++i) { QTest::newRow("1 process") << 1; QTest::newRow("5 processes") << 5; } +#endif } /*! @@ -754,6 +757,9 @@ void tst_QSharedMemory::simpleProcessProducerConsumer_data() */ void tst_QSharedMemory::simpleProcessProducerConsumer() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QFETCH(int, processes); QSKIP("This test is unstable: QTBUG-25655"); @@ -797,8 +803,8 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() producer.write("", 1); producer.waitForBytesWritten(); QVERIFY(producer.waitForFinished(5000)); -} #endif +} void tst_QSharedMemory::uniqueKey_data() { diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index b2198e9267..169a13aff2 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -59,7 +59,6 @@ private slots: void complexacquire(); void release(); -#ifndef QT_NO_PROCESS void basicProcesses(); void processes_data(); @@ -69,7 +68,6 @@ private slots: void undo(); #endif void initialValue(); -#endif // QT_NO_PROCESS private: static QString helperBinary(); @@ -177,9 +175,11 @@ void tst_QSystemSemaphore::release() QCOMPARE(sem.errorString(), QString()); } -#ifndef QT_NO_PROCESS void tst_QSystemSemaphore::basicProcesses() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 0, QSystemSemaphore::Create); QProcess acquire; @@ -198,6 +198,7 @@ void tst_QSystemSemaphore::basicProcesses() acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state() == QProcess::NotRunning); +#endif } void tst_QSystemSemaphore::processes_data() @@ -212,6 +213,9 @@ void tst_QSystemSemaphore::processes_data() void tst_QSystemSemaphore::processes() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QFETCH(int, processes); @@ -231,12 +235,16 @@ void tst_QSystemSemaphore::processes() QCOMPARE(consumers.first()->exitCode(), 0); delete consumers.takeFirst(); } +#endif } // This test only checks a system v unix behavior. #if !defined(Q_OS_WIN) && !defined(QT_POSIX_IPC) void tst_QSystemSemaphore::undo() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QStringList acquireArguments = QStringList("acquire"); @@ -253,11 +261,15 @@ void tst_QSystemSemaphore::undo() QVERIFY2(acquire.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); +#endif } #endif void tst_QSystemSemaphore::initialValue() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QStringList acquireArguments = QStringList("acquire"); @@ -284,8 +296,8 @@ void tst_QSystemSemaphore::initialValue() acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); -} #endif +} QString tst_QSystemSemaphore::helperBinary() { diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp index 0fb1f91e3b..7f78312582 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp @@ -41,7 +41,11 @@ void tst_QMimeDatabase::init() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else const QString mimeDirName = m_globalXdgDir + QStringLiteral("/mime"); runUpdateMimeDatabase(mimeDirName); QVERIFY(QFile::exists(mimeDirName + QStringLiteral("/mime.cache"))); +#endif } diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index 2c70911274..8f37b265f6 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -66,9 +66,7 @@ private slots: void versions(); void threadUniqueness(); -#ifndef QT_NO_PROCESS void processUniqueness(); -#endif void hash(); @@ -325,9 +323,11 @@ void tst_QUuid::threadUniqueness() qDeleteAll(threads); } -#ifndef QT_NO_PROCESS void tst_QUuid::processUniqueness() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess process; QString processOneOutput; QString processTwoOutput; @@ -352,8 +352,8 @@ void tst_QUuid::processUniqueness() // They should be *different*! QVERIFY(processOneOutput != processTwoOutput); -} #endif +} void tst_QUuid::hash() { diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 8a315af850..ac606acfc9 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -63,9 +63,7 @@ private slots: void autoDelete(); void adoptedThreads(); void ensureCleanupOrder(); -#ifndef QT_NO_PROCESS void crashOnExit(); -#endif void leakInDestructor(); void resetInDestructor(); void valueBased(); @@ -320,14 +318,18 @@ static inline bool runCrashOnExit(const QString &binary, QString *errorMessage) } return true; } +#endif void tst_QThreadStorage::crashOnExit() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QString errorMessage; QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage), qPrintable(errorMessage)); -} #endif +} // S stands for thread Safe. class SPointer diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 1c96aaba98..5b9c9e0b36 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -134,7 +134,7 @@ private slots: #endif void ctor(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void emptyCtor(); #endif void legacyNames(); @@ -499,9 +499,14 @@ static inline bool runSysAppTest(const QString &binary, } return true; } +#endif +#if !defined(Q_OS_WINCE) void tst_QLocale::emptyCtor() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #define TEST_CTOR(req_lc, exp_str) \ { \ /* Test constructor without arguments. Needs separate process */ \ @@ -570,6 +575,7 @@ void tst_QLocale::emptyCtor() #endif // Q_OS_BLACKBERRY #undef TEST_CTOR +#endif } #endif -- cgit v1.2.3 From cd4fbead3b7f166b1c14d282584b4213e214c35b Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 13 Mar 2015 14:56:56 +0100 Subject: QStateMachine: fix warnings in test. - removed an unused field - initialized variable that might be used uninitialized. Change-Id: I7a7a063f025ecc32fa462dd8d5e2485c2ba52eb8 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 1e195b364a..911668e534 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -1898,7 +1898,7 @@ class DelayedEventPosterThread : public QThread public: DelayedEventPosterThread(QStateMachine *machine, QObject *parent = 0) : QThread(parent), firstEventWasCancelled(false), - m_machine(machine), m_count(0) + m_machine(machine) { moveToThread(this); QObject::connect(m_machine, SIGNAL(started()), @@ -1919,7 +1919,6 @@ private Q_SLOTS: } private: QStateMachine *m_machine; - int m_count; }; void tst_QStateMachine::postDelayedEventFromThread() @@ -2744,7 +2743,7 @@ void tst_QStateMachine::eventTransitions() QState *s0 = new QState(&machine); QFinalState *s1 = new QFinalState(&machine); - QEventTransition *trans; + QEventTransition *trans = 0; if (x == 0) { trans = new QEventTransition(); QCOMPARE(trans->eventSource(), (QObject*)0); -- cgit v1.2.3 From 8e12367a94ce1245da87b0440dc43e31e6a9b76f Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 13 Mar 2015 14:57:31 +0100 Subject: QStateMachine: add objectName to objects to ease debugging. Change-Id: I3c495cc5bd04c0cac24d4abf827d6acfb35b8433 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../corelib/statemachine/qstatemachine/tst_qstatemachine.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 911668e534..6e51f8f0ed 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -4275,26 +4275,34 @@ void tst_QStateMachine::parallelStateTransition() QStateMachine machine; QState *parallelState = new QState(QState::ParallelStates, &machine); + parallelState->setObjectName("parallelState"); DEFINE_ACTIVE_SPY(parallelState); machine.setInitialState(parallelState); QState *s1 = new QState(parallelState); + s1->setObjectName("s1"); DEFINE_ACTIVE_SPY(s1); QState *s2 = new QState(parallelState); + s2->setObjectName("s2"); DEFINE_ACTIVE_SPY(s2); QState *s1InitialChild = new QState(s1); + s1InitialChild->setObjectName("s1InitialChild"); DEFINE_ACTIVE_SPY(s1InitialChild); s1->setInitialState(s1InitialChild); QState *s2InitialChild = new QState(s2); + s2InitialChild->setObjectName("s2InitialChild"); DEFINE_ACTIVE_SPY(s2InitialChild); s2->setInitialState(s2InitialChild); QState *s1OtherChild = new QState(s1); + s1OtherChild->setObjectName("s1OtherChild"); DEFINE_ACTIVE_SPY(s1OtherChild); - s1->addTransition(new EventTransition(QEvent::User, s1OtherChild)); + EventTransition *et = new EventTransition(QEvent::User, s1OtherChild); + et->setObjectName("s1->s1OtherChild"); + s1->addTransition(et); machine.start(); QCoreApplication::processEvents(); -- cgit v1.2.3 From 8fe016158fb4a9f96d97ec2f2617e76d753c6a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Mar 2015 14:37:11 +0100 Subject: iOS: Skip tests that don't make sense or don't work on the platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id6777bdf430ad8a8e3b432caf5000bea8f7860b6 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø --- tests/auto/corelib/kernel/kernel.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 6b93439a56..f85c39e9e6 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -38,4 +38,4 @@ SUBDIRS=\ # This test is only applicable on Windows !win32*|winrt: SUBDIRS -= qwineventnotifier -android: SUBDIRS -= qsharedmemory qsystemsemaphore +android|ios: SUBDIRS -= qsharedmemory qsystemsemaphore -- cgit v1.2.3 From 699e7a0869607d1d6a1bc0d0d922c648516f60d1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 3 Mar 2015 18:16:03 -0800 Subject: Remove the tests for Ubuntu Oneiric (11.10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This system is no longer in the CI rotation and we haven't had reports of the same issues happening on later versions. Either the issues have since been fixed or they were never an issue in Qt in the first place. This commit has the additional benefit of getting rid of the following shell error when qmake was run: sh: line 0: [: =: unary operator expected as /etc/lsb-release hasn't contained DISTRIB_CODENAME for some time and proper quoting was never implemented (not even qtcpsocket.pro). Change-Id: Ia0aac2f09e9245339951ffff13c829e910ee64e9 Reviewed-by: Albert Astals Cid Reviewed-by: Tony Sarajärvi Reviewed-by: Richard J. Moore Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro | 1 - tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp | 3 --- 2 files changed, 4 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro index bec6c1e17e..679f9bbda4 100644 --- a/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro +++ b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro @@ -3,4 +3,3 @@ TARGET = tst_qeasingcurve QT = core testlib SOURCES = tst_qeasingcurve.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-32432 diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index 8726f77e58..dd88edae7b 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -427,9 +427,6 @@ void tst_QEasingCurve::setCustomType() QCOMPARE(curve.valueForProgress(0.15), 0.1); QCOMPARE(curve.valueForProgress(0.20), 0.2); QCOMPARE(curve.valueForProgress(0.25), 0.2); -#if defined(UBUNTU_ONEIRIC) && defined(__i386__) - QEXPECT_FAIL("", "QTBUG-32432: Fails on Ubuntu 11.10 32 bit configurations", Abort); -#endif QCOMPARE(curve.valueForProgress(0.30), 0.3); QCOMPARE(curve.valueForProgress(0.35), 0.3); QCOMPARE(curve.valueForProgress(0.999999), 0.9); -- cgit v1.2.3 From 7c77013c7f6ec57cd1b1faf3b480c40a619067c8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 22 Feb 2015 10:02:08 +0100 Subject: Fix source incompatibility while connecting signals with forward declared arguments QObject::connect tries to determine if the arguments are registered metatypes. This used to work even for arguments that were forward declared. But now, the metatype system tries to call QtPrivate::IsQEnumHelper::Value to know if it is registered. That fails on gcc if T is forward declared. Apparently gcc needs to know the full type of T to pass it in the ellipsis function, even within a sizeof expression. So change the ellipsis expression to a template one. Task-number: QTBUG-44496 Change-Id: I7fa07bd3cde470b134c2ec53b0d581333d16a6f1 Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 94242607f0..263cc5a07a 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Olivier Goffart +** Copyright (C) 2015 Olivier Goffart ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -127,6 +127,7 @@ private slots: void connectConvert(); void connectWithReference(); void connectManyArguments(); + void connectForwardDeclare(); void returnValue_data(); void returnValue(); void returnValue2_data(); @@ -5208,6 +5209,24 @@ void tst_QObject::connectManyArguments() QCOMPARE(ManyArgumentNamespace::count, 12); } +class ForwardDeclared; + +class ForwardDeclareArguments : public QObject +{ + Q_OBJECT +signals: + void mySignal(const ForwardDeclared&); +public slots: + void mySlot(const ForwardDeclared&) {} +}; + +void tst_QObject::connectForwardDeclare() +{ + ForwardDeclareArguments ob; + // it should compile + QVERIFY(connect(&ob, &ForwardDeclareArguments::mySignal, &ob, &ForwardDeclareArguments::mySlot, Qt::QueuedConnection)); +} + class ReturnValue : public QObject { friend class tst_QObject; Q_OBJECT -- cgit v1.2.3 From 124da60c1de2cc63ad8692bd3a72e8769c6c1e5a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 17 Mar 2015 15:16:44 +0100 Subject: Fix support for iso8859-16 when compiling with ICU ICU doesn't support iso8859-16, so we need to fall back to the Qt codec for this encoding. Task-number: QTBUG-45053 Change-Id: I9754cf098c906fe8a75363a3d090029543cd0e35 Reviewed-by: Thiago Macieira --- tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index c96e933f0e..3aa06d237d 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -65,6 +65,7 @@ private slots: void aliasForUTF16() const; void mibForTSCII() const; void codecForTSCII() const; + void iso8859_16() const; void utf8Codec_data(); void utf8Codec(); @@ -514,6 +515,13 @@ void tst_QTextCodec::codecForTSCII() const QCOMPARE(codec->mibEnum(), 2107); } +void tst_QTextCodec::iso8859_16() const +{ + QTextCodec *codec = QTextCodec::codecForName("ISO8859-16"); + QVERIFY(codec); + QCOMPARE(codec->name(), QByteArray("ISO-8859-16")); +} + static QString fromInvalidUtf8Sequence(const QByteArray &ba) { return QString().fill(QChar::ReplacementCharacter, ba.size()); -- cgit v1.2.3 From 0411240fdaada112d150f28f82973beb15478b1d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 17 Mar 2015 16:01:05 +0100 Subject: Make sure remove() doesn't corrupt the json object When using non latin keys, remove() could cause corruption of the json object. Task-number: QTBUG-42270 Change-Id: I7305e57ebb78630a9bf68bc4f831a6d1646abb79 Reviewed-by: Thiago Macieira --- tests/auto/corelib/json/tst_qtjson.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 18d1ecd33c..884c4b3850 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -145,6 +145,8 @@ private Q_SLOTS: void unicodeKeys(); void garbageAtEnd(); + + void removeNonLatinKey(); private: QString testDataDir; }; @@ -2776,5 +2778,24 @@ void tst_QtJson::garbageAtEnd() QVERIFY(!doc.isEmpty()); } +void tst_QtJson::removeNonLatinKey() +{ + const QString nonLatinKeyName = QString::fromUtf8("Атрибут100500"); + + QJsonObject sourceObject; + + sourceObject.insert("code", 1); + sourceObject.remove("code"); + + sourceObject.insert(nonLatinKeyName, 1); + + const QByteArray json = QJsonDocument(sourceObject).toJson(); + const QJsonObject restoredObject = QJsonDocument::fromJson(json).object(); + + QCOMPARE(sourceObject.keys(), restoredObject.keys()); + QVERIFY(sourceObject.contains(nonLatinKeyName)); + QVERIFY(restoredObject.contains(nonLatinKeyName)); +} + QTEST_MAIN(tst_QtJson) #include "tst_qtjson.moc" -- cgit v1.2.3 From ce97f37bffca141597ad326d5964dd49abb43a0b Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Fri, 13 Feb 2015 12:48:32 +0200 Subject: Fix tst_largefile QCOMPARE value types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added casting to QT_OFF_T type. Otherwise fails on some compilers. Change-Id: I4f1f0c558af7d182a4babf38a7f048b27b3db611 Reviewed-by: Pasi Petäjäjärvi Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/largefile/tst_largefile.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index c1c4b5ea46..0a28ee7b9c 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -407,11 +407,11 @@ void tst_LargeFile::fdPositioning() file.close(); - QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(0), SEEK_SET), QT_OFF_T(0) ); - QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(position), SEEK_SET), QT_OFF_T(position) ); + QCOMPARE( QT_OFF_T(QT_LSEEK(fd_, QT_OFF_T(0), SEEK_SET)), QT_OFF_T(0) ); + QCOMPARE( QT_OFF_T(QT_LSEEK(fd_, QT_OFF_T(position), SEEK_SET)), QT_OFF_T(position) ); QVERIFY( file.open(fd_, QIODevice::ReadOnly) ); - QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(0), SEEK_CUR), QT_OFF_T(position) ); + QCOMPARE( QT_OFF_T(QT_LSEEK(fd_, QT_OFF_T(0), SEEK_CUR)), QT_OFF_T(position) ); QCOMPARE( file.pos(), position ); QVERIFY( file.seek(0) ); QCOMPARE( file.pos(), (qint64)0 ); @@ -438,12 +438,12 @@ void tst_LargeFile::streamPositioning() file.close(); QVERIFY( !QT_FSEEK(stream_, QT_OFF_T(0), SEEK_SET) ); - QCOMPARE( QT_FTELL(stream_), QT_OFF_T(0) ); + QCOMPARE( QT_OFF_T(QT_FTELL(stream_)), QT_OFF_T(0) ); QVERIFY( !QT_FSEEK(stream_, QT_OFF_T(position), SEEK_SET) ); - QCOMPARE( QT_FTELL(stream_), QT_OFF_T(position) ); + QCOMPARE( QT_OFF_T(QT_FTELL(stream_)), QT_OFF_T(position) ); QVERIFY( file.open(stream_, QIODevice::ReadOnly) ); - QCOMPARE( QT_FTELL(stream_), QT_OFF_T(position) ); + QCOMPARE( QT_OFF_T(QT_FTELL(stream_)), QT_OFF_T(position) ); QCOMPARE( file.pos(), position ); QVERIFY( file.seek(0) ); QCOMPARE( file.pos(), (qint64)0 ); -- cgit v1.2.3 From 3cb2e0dd09e07b6580de8021e04d8b882e08f85f Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sat, 21 Mar 2015 06:06:52 +0400 Subject: Clean-up tst_QChar Since Qt 5.0, static overloads of QChar has a uint parameter only, so there is no more ambiguity between uint<->ushort and thus some tests does not make sense anymore; avoid explicit cast to uint for the others. Change-Id: Ibc7a2ac4de63d3f023a8dbb5e53211ef8521579d Reviewed-by: Lars Knoll --- tests/auto/corelib/tools/qchar/tst_qchar.cpp | 515 ++++++++++++--------------- 1 file changed, 218 insertions(+), 297 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 1ca7a213ad..4e882263bf 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -132,124 +132,92 @@ void tst_QChar::toUpper() { QVERIFY(QChar('a').toUpper() == 'A'); QVERIFY(QChar('A').toUpper() == 'A'); - QVERIFY(QChar((ushort)0x1c7).toUpper().unicode() == 0x1c7); - QVERIFY(QChar((ushort)0x1c8).toUpper().unicode() == 0x1c7); - QVERIFY(QChar((ushort)0x1c9).toUpper().unicode() == 0x1c7); - QVERIFY(QChar((ushort)0x1d79).toUpper().unicode() == 0xa77d); - QVERIFY(QChar((ushort)0x0265).toUpper().unicode() == 0xa78d); - - QVERIFY(QChar::toUpper((ushort)'a') == 'A'); - QVERIFY(QChar::toUpper((ushort)'A') == 'A'); - QVERIFY(QChar::toUpper((ushort)0x1c7) == 0x1c7); - QVERIFY(QChar::toUpper((ushort)0x1c8) == 0x1c7); - QVERIFY(QChar::toUpper((ushort)0x1c9) == 0x1c7); - QVERIFY(QChar::toUpper((ushort)0x1d79) == 0xa77d); - QVERIFY(QChar::toUpper((ushort)0x0265) == 0xa78d); - - QVERIFY(QChar::toUpper((uint)'a') == 'A'); - QVERIFY(QChar::toUpper((uint)'A') == 'A'); - QVERIFY(QChar::toUpper((uint)0xdf) == 0xdf); // german sharp s - QVERIFY(QChar::toUpper((uint)0x1c7) == 0x1c7); - QVERIFY(QChar::toUpper((uint)0x1c8) == 0x1c7); - QVERIFY(QChar::toUpper((uint)0x1c9) == 0x1c7); - QVERIFY(QChar::toUpper((uint)0x1d79) == 0xa77d); - QVERIFY(QChar::toUpper((uint)0x0265) == 0xa78d); - - QVERIFY(QChar::toUpper((uint)0x10400) == 0x10400); - QVERIFY(QChar::toUpper((uint)0x10428) == 0x10400); + QVERIFY(QChar(0x1c7).toUpper().unicode() == 0x1c7); + QVERIFY(QChar(0x1c8).toUpper().unicode() == 0x1c7); + QVERIFY(QChar(0x1c9).toUpper().unicode() == 0x1c7); + QVERIFY(QChar(0x1d79).toUpper().unicode() == 0xa77d); + QVERIFY(QChar(0x0265).toUpper().unicode() == 0xa78d); + + QVERIFY(QChar::toUpper('a') == 'A'); + QVERIFY(QChar::toUpper('A') == 'A'); + QVERIFY(QChar::toUpper(0xdf) == 0xdf); // german sharp s + QVERIFY(QChar::toUpper(0x1c7) == 0x1c7); + QVERIFY(QChar::toUpper(0x1c8) == 0x1c7); + QVERIFY(QChar::toUpper(0x1c9) == 0x1c7); + QVERIFY(QChar::toUpper(0x1d79) == 0xa77d); + QVERIFY(QChar::toUpper(0x0265) == 0xa78d); + + QVERIFY(QChar::toUpper(0x10400) == 0x10400); + QVERIFY(QChar::toUpper(0x10428) == 0x10400); } void tst_QChar::toLower() { QVERIFY(QChar('A').toLower() == 'a'); QVERIFY(QChar('a').toLower() == 'a'); - QVERIFY(QChar((ushort)0x1c7).toLower().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0x1c8).toLower().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0x1c9).toLower().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0xa77d).toLower().unicode() == 0x1d79); - QVERIFY(QChar((ushort)0xa78d).toLower().unicode() == 0x0265); - - QVERIFY(QChar::toLower((ushort)'a') == 'a'); - QVERIFY(QChar::toLower((ushort)'A') == 'a'); - QVERIFY(QChar::toLower((ushort)0x1c7) == 0x1c9); - QVERIFY(QChar::toLower((ushort)0x1c8) == 0x1c9); - QVERIFY(QChar::toLower((ushort)0x1c9) == 0x1c9); - QVERIFY(QChar::toLower((ushort)0xa77d) == 0x1d79); - QVERIFY(QChar::toLower((ushort)0xa78d) == 0x0265); - - QVERIFY(QChar::toLower((uint)'a') == 'a'); - QVERIFY(QChar::toLower((uint)'A') == 'a'); - QVERIFY(QChar::toLower((uint)0x1c7) == 0x1c9); - QVERIFY(QChar::toLower((uint)0x1c8) == 0x1c9); - QVERIFY(QChar::toLower((uint)0x1c9) == 0x1c9); - QVERIFY(QChar::toLower((uint)0xa77d) == 0x1d79); - QVERIFY(QChar::toLower((uint)0xa78d) == 0x0265); - - QVERIFY(QChar::toLower((uint)0x10400) == 0x10428); - QVERIFY(QChar::toLower((uint)0x10428) == 0x10428); + QVERIFY(QChar(0x1c7).toLower().unicode() == 0x1c9); + QVERIFY(QChar(0x1c8).toLower().unicode() == 0x1c9); + QVERIFY(QChar(0x1c9).toLower().unicode() == 0x1c9); + QVERIFY(QChar(0xa77d).toLower().unicode() == 0x1d79); + QVERIFY(QChar(0xa78d).toLower().unicode() == 0x0265); + + QVERIFY(QChar::toLower('a') == 'a'); + QVERIFY(QChar::toLower('A') == 'a'); + QVERIFY(QChar::toLower(0x1c7) == 0x1c9); + QVERIFY(QChar::toLower(0x1c8) == 0x1c9); + QVERIFY(QChar::toLower(0x1c9) == 0x1c9); + QVERIFY(QChar::toLower(0xa77d) == 0x1d79); + QVERIFY(QChar::toLower(0xa78d) == 0x0265); + + QVERIFY(QChar::toLower(0x10400) == 0x10428); + QVERIFY(QChar::toLower(0x10428) == 0x10428); } void tst_QChar::toTitle() { QVERIFY(QChar('a').toTitleCase() == 'A'); QVERIFY(QChar('A').toTitleCase() == 'A'); - QVERIFY(QChar((ushort)0x1c7).toTitleCase().unicode() == 0x1c8); - QVERIFY(QChar((ushort)0x1c8).toTitleCase().unicode() == 0x1c8); - QVERIFY(QChar((ushort)0x1c9).toTitleCase().unicode() == 0x1c8); - QVERIFY(QChar((ushort)0x1d79).toTitleCase().unicode() == 0xa77d); - QVERIFY(QChar((ushort)0x0265).toTitleCase().unicode() == 0xa78d); - - QVERIFY(QChar::toTitleCase((ushort)'a') == 'A'); - QVERIFY(QChar::toTitleCase((ushort)'A') == 'A'); - QVERIFY(QChar::toTitleCase((ushort)0x1c7) == 0x1c8); - QVERIFY(QChar::toTitleCase((ushort)0x1c8) == 0x1c8); - QVERIFY(QChar::toTitleCase((ushort)0x1c9) == 0x1c8); - QVERIFY(QChar::toTitleCase((ushort)0x1d79) == 0xa77d); - QVERIFY(QChar::toTitleCase((ushort)0x0265) == 0xa78d); - - QVERIFY(QChar::toTitleCase((uint)'a') == 'A'); - QVERIFY(QChar::toTitleCase((uint)'A') == 'A'); - QVERIFY(QChar::toTitleCase((uint)0xdf) == 0xdf); // german sharp s - QVERIFY(QChar::toTitleCase((uint)0x1c7) == 0x1c8); - QVERIFY(QChar::toTitleCase((uint)0x1c8) == 0x1c8); - QVERIFY(QChar::toTitleCase((uint)0x1c9) == 0x1c8); - QVERIFY(QChar::toTitleCase((uint)0x1d79) == 0xa77d); - QVERIFY(QChar::toTitleCase((uint)0x0265) == 0xa78d); - - QVERIFY(QChar::toTitleCase((uint)0x10400) == 0x10400); - QVERIFY(QChar::toTitleCase((uint)0x10428) == 0x10400); + QVERIFY(QChar(0x1c7).toTitleCase().unicode() == 0x1c8); + QVERIFY(QChar(0x1c8).toTitleCase().unicode() == 0x1c8); + QVERIFY(QChar(0x1c9).toTitleCase().unicode() == 0x1c8); + QVERIFY(QChar(0x1d79).toTitleCase().unicode() == 0xa77d); + QVERIFY(QChar(0x0265).toTitleCase().unicode() == 0xa78d); + + QVERIFY(QChar::toTitleCase('a') == 'A'); + QVERIFY(QChar::toTitleCase('A') == 'A'); + QVERIFY(QChar::toTitleCase(0xdf) == 0xdf); // german sharp s + QVERIFY(QChar::toTitleCase(0x1c7) == 0x1c8); + QVERIFY(QChar::toTitleCase(0x1c8) == 0x1c8); + QVERIFY(QChar::toTitleCase(0x1c9) == 0x1c8); + QVERIFY(QChar::toTitleCase(0x1d79) == 0xa77d); + QVERIFY(QChar::toTitleCase(0x0265) == 0xa78d); + + QVERIFY(QChar::toTitleCase(0x10400) == 0x10400); + QVERIFY(QChar::toTitleCase(0x10428) == 0x10400); } void tst_QChar::toCaseFolded() { QVERIFY(QChar('a').toCaseFolded() == 'a'); QVERIFY(QChar('A').toCaseFolded() == 'a'); - QVERIFY(QChar((ushort)0x1c7).toCaseFolded().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0x1c8).toCaseFolded().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0x1c9).toCaseFolded().unicode() == 0x1c9); - QVERIFY(QChar((ushort)0xa77d).toCaseFolded().unicode() == 0x1d79); - QVERIFY(QChar((ushort)0xa78d).toCaseFolded().unicode() == 0x0265); - - QVERIFY(QChar::toCaseFolded((ushort)'a') == 'a'); - QVERIFY(QChar::toCaseFolded((ushort)'A') == 'a'); - QVERIFY(QChar::toCaseFolded((ushort)0x1c7) == 0x1c9); - QVERIFY(QChar::toCaseFolded((ushort)0x1c8) == 0x1c9); - QVERIFY(QChar::toCaseFolded((ushort)0x1c9) == 0x1c9); - QVERIFY(QChar::toCaseFolded((ushort)0xa77d) == 0x1d79); - QVERIFY(QChar::toCaseFolded((ushort)0xa78d) == 0x0265); - - QVERIFY(QChar::toCaseFolded((uint)'a') == 'a'); - QVERIFY(QChar::toCaseFolded((uint)'A') == 'a'); - QVERIFY(QChar::toCaseFolded((uint)0x1c7) == 0x1c9); - QVERIFY(QChar::toCaseFolded((uint)0x1c8) == 0x1c9); - QVERIFY(QChar::toCaseFolded((uint)0x1c9) == 0x1c9); - QVERIFY(QChar::toCaseFolded((uint)0xa77d) == 0x1d79); - QVERIFY(QChar::toCaseFolded((uint)0xa78d) == 0x0265); - - QVERIFY(QChar::toCaseFolded((uint)0x10400) == 0x10428); - QVERIFY(QChar::toCaseFolded((uint)0x10428) == 0x10428); - - QVERIFY(QChar::toCaseFolded((ushort)0xb5) == 0x3bc); + QVERIFY(QChar(0x1c7).toCaseFolded().unicode() == 0x1c9); + QVERIFY(QChar(0x1c8).toCaseFolded().unicode() == 0x1c9); + QVERIFY(QChar(0x1c9).toCaseFolded().unicode() == 0x1c9); + QVERIFY(QChar(0xa77d).toCaseFolded().unicode() == 0x1d79); + QVERIFY(QChar(0xa78d).toCaseFolded().unicode() == 0x0265); + + QVERIFY(QChar::toCaseFolded('a') == 'a'); + QVERIFY(QChar::toCaseFolded('A') == 'a'); + QVERIFY(QChar::toCaseFolded(0x1c7) == 0x1c9); + QVERIFY(QChar::toCaseFolded(0x1c8) == 0x1c9); + QVERIFY(QChar::toCaseFolded(0x1c9) == 0x1c9); + QVERIFY(QChar::toCaseFolded(0xa77d) == 0x1d79); + QVERIFY(QChar::toCaseFolded(0xa78d) == 0x0265); + + QVERIFY(QChar::toCaseFolded(0x10400) == 0x10428); + QVERIFY(QChar::toCaseFolded(0x10428) == 0x10428); + + QVERIFY(QChar::toCaseFolded(0xb5) == 0x3bc); } void tst_QChar::isDigit_data() @@ -331,11 +299,11 @@ void tst_QChar::isPrint() QVERIFY(!QChar(0xfff8).isPrint()); QVERIFY(!QChar(0xfffe).isPrint()); QVERIFY(!QChar(0xffff).isPrint()); - QVERIFY(!QChar::isPrint(0xe0000u)); - QVERIFY(!QChar::isPrint(0xe0002u)); - QVERIFY(!QChar::isPrint(0xe001fu)); - QVERIFY(!QChar::isPrint(0xe0080u)); - QVERIFY(!QChar::isPrint(0xe00ffu)); + QVERIFY(!QChar::isPrint(0xe0000)); + QVERIFY(!QChar::isPrint(0xe0002)); + QVERIFY(!QChar::isPrint(0xe001f)); + QVERIFY(!QChar::isPrint(0xe0080)); + QVERIFY(!QChar::isPrint(0xe00ff)); // Other_Default_Ignorable_Code_Point, Variation_Selector QVERIFY(QChar(0x034f).isPrint()); @@ -346,8 +314,8 @@ void tst_QChar::isPrint() QVERIFY(QChar(0xfe00).isPrint()); QVERIFY(QChar(0xfe0f).isPrint()); QVERIFY(QChar(0xffa0).isPrint()); - QVERIFY(QChar::isPrint(0xe0100u)); - QVERIFY(QChar::isPrint(0xe01efu)); + QVERIFY(QChar::isPrint(0xe0100)); + QVERIFY(QChar::isPrint(0xe01ef)); // Cf, Cs, Cc, White_Space, Annotation Characters QVERIFY(!QChar(0x0008).isPrint()); @@ -359,7 +327,7 @@ void tst_QChar::isPrint() QVERIFY(!QChar(0xd800).isPrint()); QVERIFY(!QChar(0xdc00).isPrint()); QVERIFY(!QChar(0xfeff).isPrint()); - QVERIFY(!QChar::isPrint(0x1d173u)); + QVERIFY(!QChar::isPrint(0x1d173)); QVERIFY(QChar('0').isPrint()); QVERIFY(QChar('A').isPrint()); @@ -371,8 +339,8 @@ void tst_QChar::isPrint() QVERIFY(QChar(0x08a0).isPrint()); // assigned in 6.1 QVERIFY(!QChar(0x1aff).isPrint()); // not assigned QVERIFY(QChar(0x1e9e).isPrint()); // assigned in 5.1 - QVERIFY(QChar::isPrint(0x1b000u)); // assigned in 6.0 - QVERIFY(QChar::isPrint(0x110d0u)); // assigned in 5.1 + QVERIFY(QChar::isPrint(0x1b000)); // assigned in 6.0 + QVERIFY(QChar::isPrint(0x110d0)); // assigned in 5.1 } void tst_QChar::isUpper() @@ -448,25 +416,22 @@ void tst_QChar::category() QVERIFY(QChar('a').category() == QChar::Letter_Lowercase); QVERIFY(QChar('A').category() == QChar::Letter_Uppercase); - QVERIFY(QChar::category((ushort)'a') == QChar::Letter_Lowercase); - QVERIFY(QChar::category((ushort)'A') == QChar::Letter_Uppercase); + QVERIFY(QChar::category('a') == QChar::Letter_Lowercase); + QVERIFY(QChar::category('A') == QChar::Letter_Uppercase); - QVERIFY(QChar::category((uint)'a') == QChar::Letter_Lowercase); - QVERIFY(QChar::category((uint)'A') == QChar::Letter_Uppercase); + QVERIFY(QChar::category(0xe0100) == QChar::Mark_NonSpacing); + QVERIFY(QChar::category(0xeffff) != QChar::Other_PrivateUse); + QVERIFY(QChar::category(0xf0000) == QChar::Other_PrivateUse); + QVERIFY(QChar::category(0xf0001) == QChar::Other_PrivateUse); - QVERIFY(QChar::category(0xe0100u) == QChar::Mark_NonSpacing); - QVERIFY(QChar::category(0xeffffu) != QChar::Other_PrivateUse); - QVERIFY(QChar::category(0xf0000u) == QChar::Other_PrivateUse); - QVERIFY(QChar::category(0xf0001u) == QChar::Other_PrivateUse); + QVERIFY(QChar::category(0xd900) == QChar::Other_Surrogate); + QVERIFY(QChar::category(0xdc00) == QChar::Other_Surrogate); + QVERIFY(QChar::category(0xdc01) == QChar::Other_Surrogate); - QVERIFY(QChar::category(0xd900u) == QChar::Other_Surrogate); - QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate); - QVERIFY(QChar::category(0xdc01u) == QChar::Other_Surrogate); - - QVERIFY(QChar::category((uint)0x1aff) == QChar::Other_NotAssigned); - QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse); - QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned); - QVERIFY(QChar::category((uint)0x110000u) == QChar::Other_NotAssigned); + QVERIFY(QChar::category(0x1aff) == QChar::Other_NotAssigned); + QVERIFY(QChar::category(0x10fffd) == QChar::Other_PrivateUse); + QVERIFY(QChar::category(0x10ffff) == QChar::Other_NotAssigned); + QVERIFY(QChar::category(0x110000) == QChar::Other_NotAssigned); } void tst_QChar::direction() @@ -485,79 +450,62 @@ void tst_QChar::direction() QVERIFY(QChar('a').direction() == QChar::DirL); QVERIFY(QChar('0').direction() == QChar::DirEN); - QVERIFY(QChar((ushort)0x627).direction() == QChar::DirAL); - QVERIFY(QChar((ushort)0x5d0).direction() == QChar::DirR); - - QVERIFY(QChar::direction((ushort)'a') == QChar::DirL); - QVERIFY(QChar::direction((ushort)'0') == QChar::DirEN); - QVERIFY(QChar::direction((ushort)0x627) == QChar::DirAL); - QVERIFY(QChar::direction((ushort)0x5d0) == QChar::DirR); - - QVERIFY(QChar::direction((uint)'a') == QChar::DirL); - QVERIFY(QChar::direction((uint)'0') == QChar::DirEN); - QVERIFY(QChar::direction((uint)0x627) == QChar::DirAL); - QVERIFY(QChar::direction((uint)0x5d0) == QChar::DirR); - - QVERIFY(QChar::direction(0xE01DAu) == QChar::DirNSM); - QVERIFY(QChar::direction(0xf0000u) == QChar::DirL); - QVERIFY(QChar::direction(0xE0030u) == QChar::DirBN); - QVERIFY(QChar::direction(0x2FA17u) == QChar::DirL); + QVERIFY(QChar(0x627).direction() == QChar::DirAL); + QVERIFY(QChar(0x5d0).direction() == QChar::DirR); + + QVERIFY(QChar::direction('a') == QChar::DirL); + QVERIFY(QChar::direction('0') == QChar::DirEN); + QVERIFY(QChar::direction(0x627) == QChar::DirAL); + QVERIFY(QChar::direction(0x5d0) == QChar::DirR); + + QVERIFY(QChar::direction(0xE01DA) == QChar::DirNSM); + QVERIFY(QChar::direction(0xf0000) == QChar::DirL); + QVERIFY(QChar::direction(0xE0030) == QChar::DirBN); + QVERIFY(QChar::direction(0x2FA17) == QChar::DirL); } void tst_QChar::joiningType() { QVERIFY(QChar('a').joiningType() == QChar::Joining_None); QVERIFY(QChar('0').joiningType() == QChar::Joining_None); - QVERIFY(QChar((ushort)0x0627).joiningType() == QChar::Joining_Right); - QVERIFY(QChar((ushort)0x05d0).joiningType() == QChar::Joining_None); - QVERIFY(QChar((ushort)0x00ad).joiningType() == QChar::Joining_Transparent); - - QVERIFY(QChar::joiningType((ushort)'a') == QChar::Joining_None); - QVERIFY(QChar::joiningType((ushort)'0') == QChar::Joining_None); - QVERIFY(QChar::joiningType((ushort)0x0627) == QChar::Joining_Right); - QVERIFY(QChar::joiningType((ushort)0x05d0) == QChar::Joining_None); - QVERIFY(QChar::joiningType((ushort)0x00ad) == QChar::Joining_Transparent); - - QVERIFY(QChar::joiningType((uint)'a') == QChar::Joining_None); - QVERIFY(QChar::joiningType((uint)'0') == QChar::Joining_None); - QVERIFY(QChar::joiningType((uint)0x0627) == QChar::Joining_Right); - QVERIFY(QChar::joiningType((uint)0x05d0) == QChar::Joining_None); - QVERIFY(QChar::joiningType((uint)0x00ad) == QChar::Joining_Transparent); - - QVERIFY(QChar::joiningType(0xE01DAu) == QChar::Joining_Transparent); - QVERIFY(QChar::joiningType(0xf0000u) == QChar::Joining_None); - QVERIFY(QChar::joiningType(0xE0030u) == QChar::Joining_Transparent); - QVERIFY(QChar::joiningType(0x2FA17u) == QChar::Joining_None); - - QVERIFY(QChar::joiningType((uint)0xA872) == QChar::Joining_Left); + QVERIFY(QChar(0x0627).joiningType() == QChar::Joining_Right); + QVERIFY(QChar(0x05d0).joiningType() == QChar::Joining_None); + QVERIFY(QChar(0x00ad).joiningType() == QChar::Joining_Transparent); + + QVERIFY(QChar::joiningType('a') == QChar::Joining_None); + QVERIFY(QChar::joiningType('0') == QChar::Joining_None); + QVERIFY(QChar::joiningType(0x0627) == QChar::Joining_Right); + QVERIFY(QChar::joiningType(0x05d0) == QChar::Joining_None); + QVERIFY(QChar::joiningType(0x00ad) == QChar::Joining_Transparent); + + QVERIFY(QChar::joiningType(0xE01DA) == QChar::Joining_Transparent); + QVERIFY(QChar::joiningType(0xf0000) == QChar::Joining_None); + QVERIFY(QChar::joiningType(0xE0030) == QChar::Joining_Transparent); + QVERIFY(QChar::joiningType(0x2FA17) == QChar::Joining_None); + + QVERIFY(QChar::joiningType(0xA872) == QChar::Joining_Left); } void tst_QChar::combiningClass() { QVERIFY(QChar('a').combiningClass() == 0); QVERIFY(QChar('0').combiningClass() == 0); - QVERIFY(QChar((ushort)0x627).combiningClass() == 0); - QVERIFY(QChar((ushort)0x5d0).combiningClass() == 0); + QVERIFY(QChar(0x627).combiningClass() == 0); + QVERIFY(QChar(0x5d0).combiningClass() == 0); - QVERIFY(QChar::combiningClass((ushort)'a') == 0); - QVERIFY(QChar::combiningClass((ushort)'0') == 0); - QVERIFY(QChar::combiningClass((ushort)0x627) == 0); - QVERIFY(QChar::combiningClass((ushort)0x5d0) == 0); + QVERIFY(QChar::combiningClass('a') == 0); + QVERIFY(QChar::combiningClass('0') == 0); + QVERIFY(QChar::combiningClass(0x627) == 0); + QVERIFY(QChar::combiningClass(0x5d0) == 0); - QVERIFY(QChar::combiningClass((uint)'a') == 0); - QVERIFY(QChar::combiningClass((uint)'0') == 0); - QVERIFY(QChar::combiningClass((uint)0x627) == 0); - QVERIFY(QChar::combiningClass((uint)0x5d0) == 0); + QVERIFY(QChar::combiningClass(0xE01DA) == 0); + QVERIFY(QChar::combiningClass(0xf0000) == 0); + QVERIFY(QChar::combiningClass(0xE0030) == 0); + QVERIFY(QChar::combiningClass(0x2FA17) == 0); - QVERIFY(QChar::combiningClass(0xE01DAu) == 0); - QVERIFY(QChar::combiningClass(0xf0000u) == 0); - QVERIFY(QChar::combiningClass(0xE0030u) == 0); - QVERIFY(QChar::combiningClass(0x2FA17u) == 0); + QVERIFY(QChar::combiningClass(0x300) == 230); - QVERIFY(QChar::combiningClass((ushort)0x300) == 230); - QVERIFY(QChar::combiningClass((uint)0x300) == 230); - - QVERIFY(QChar::combiningClass((uint)0x1d244) == 230); + QVERIFY(QChar::combiningClass(0x1d244) == 230); } @@ -565,93 +513,70 @@ void tst_QChar::unicodeVersion() { QVERIFY(QChar('a').unicodeVersion() == QChar::Unicode_1_1); QVERIFY(QChar('0').unicodeVersion() == QChar::Unicode_1_1); - QVERIFY(QChar((ushort)0x627).unicodeVersion() == QChar::Unicode_1_1); - QVERIFY(QChar((ushort)0x5d0).unicodeVersion() == QChar::Unicode_1_1); - - QVERIFY(QChar::unicodeVersion((ushort)'a') == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((ushort)'0') == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((ushort)0x627) == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((ushort)0x5d0) == QChar::Unicode_1_1); + QVERIFY(QChar(0x627).unicodeVersion() == QChar::Unicode_1_1); + QVERIFY(QChar(0x5d0).unicodeVersion() == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((uint)'a') == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((uint)'0') == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((uint)0x627) == QChar::Unicode_1_1); - QVERIFY(QChar::unicodeVersion((uint)0x5d0) == QChar::Unicode_1_1); + QVERIFY(QChar::unicodeVersion('a') == QChar::Unicode_1_1); + QVERIFY(QChar::unicodeVersion('0') == QChar::Unicode_1_1); + QVERIFY(QChar::unicodeVersion(0x627) == QChar::Unicode_1_1); + QVERIFY(QChar::unicodeVersion(0x5d0) == QChar::Unicode_1_1); QVERIFY(QChar(0x0591).unicodeVersion() == QChar::Unicode_2_0); - QVERIFY(QChar::unicodeVersion((ushort)0x0591) == QChar::Unicode_2_0); - QVERIFY(QChar::unicodeVersion((uint)0x0591) == QChar::Unicode_2_0); + QVERIFY(QChar::unicodeVersion(0x0591) == QChar::Unicode_2_0); QVERIFY(QChar(0x20AC).unicodeVersion() == QChar::Unicode_2_1_2); - QVERIFY(QChar::unicodeVersion((ushort)0x020AC) == QChar::Unicode_2_1_2); - QVERIFY(QChar::unicodeVersion((uint)0x20AC) == QChar::Unicode_2_1_2); + QVERIFY(QChar::unicodeVersion(0x20AC) == QChar::Unicode_2_1_2); QVERIFY(QChar(0xfffc).unicodeVersion() == QChar::Unicode_2_1_2); - QVERIFY(QChar::unicodeVersion((ushort)0x0fffc) == QChar::Unicode_2_1_2); - QVERIFY(QChar::unicodeVersion((uint)0xfffc) == QChar::Unicode_2_1_2); + QVERIFY(QChar::unicodeVersion(0xfffc) == QChar::Unicode_2_1_2); QVERIFY(QChar(0x01f6).unicodeVersion() == QChar::Unicode_3_0); - QVERIFY(QChar::unicodeVersion((ushort)0x01f6) == QChar::Unicode_3_0); - QVERIFY(QChar::unicodeVersion((uint)0x01f6) == QChar::Unicode_3_0); + QVERIFY(QChar::unicodeVersion(0x01f6) == QChar::Unicode_3_0); QVERIFY(QChar(0x03F4).unicodeVersion() == QChar::Unicode_3_1); - QVERIFY(QChar::unicodeVersion((ushort)0x03F4) == QChar::Unicode_3_1); - QVERIFY(QChar::unicodeVersion((uint)0x03F4) == QChar::Unicode_3_1); - QVERIFY(QChar::unicodeVersion((uint)0x10300) == QChar::Unicode_3_1); + QVERIFY(QChar::unicodeVersion(0x03F4) == QChar::Unicode_3_1); + QVERIFY(QChar::unicodeVersion(0x10300) == QChar::Unicode_3_1); QVERIFY(QChar(0x0220).unicodeVersion() == QChar::Unicode_3_2); - QVERIFY(QChar::unicodeVersion((ushort)0x0220) == QChar::Unicode_3_2); - QVERIFY(QChar::unicodeVersion((uint)0x0220) == QChar::Unicode_3_2); - QVERIFY(QChar::unicodeVersion((uint)0xFF5F) == QChar::Unicode_3_2); + QVERIFY(QChar::unicodeVersion(0x0220) == QChar::Unicode_3_2); + QVERIFY(QChar::unicodeVersion(0xFF5F) == QChar::Unicode_3_2); QVERIFY(QChar(0x0221).unicodeVersion() == QChar::Unicode_4_0); - QVERIFY(QChar::unicodeVersion((ushort)0x0221) == QChar::Unicode_4_0); - QVERIFY(QChar::unicodeVersion((uint)0x0221) == QChar::Unicode_4_0); - QVERIFY(QChar::unicodeVersion((uint)0x10000) == QChar::Unicode_4_0); + QVERIFY(QChar::unicodeVersion(0x0221) == QChar::Unicode_4_0); + QVERIFY(QChar::unicodeVersion(0x10000) == QChar::Unicode_4_0); QVERIFY(QChar(0x0237).unicodeVersion() == QChar::Unicode_4_1); - QVERIFY(QChar::unicodeVersion((ushort)0x0237) == QChar::Unicode_4_1); - QVERIFY(QChar::unicodeVersion((uint)0x0237) == QChar::Unicode_4_1); - QVERIFY(QChar::unicodeVersion((uint)0x10140) == QChar::Unicode_4_1); + QVERIFY(QChar::unicodeVersion(0x0237) == QChar::Unicode_4_1); + QVERIFY(QChar::unicodeVersion(0x10140) == QChar::Unicode_4_1); QVERIFY(QChar(0x0242).unicodeVersion() == QChar::Unicode_5_0); - QVERIFY(QChar::unicodeVersion((ushort)0x0242) == QChar::Unicode_5_0); - QVERIFY(QChar::unicodeVersion((uint)0x0242) == QChar::Unicode_5_0); - QVERIFY(QChar::unicodeVersion((uint)0x12000) == QChar::Unicode_5_0); + QVERIFY(QChar::unicodeVersion(0x0242) == QChar::Unicode_5_0); + QVERIFY(QChar::unicodeVersion(0x12000) == QChar::Unicode_5_0); QVERIFY(QChar(0x0370).unicodeVersion() == QChar::Unicode_5_1); - QVERIFY(QChar::unicodeVersion((ushort)0x0370) == QChar::Unicode_5_1); - QVERIFY(QChar::unicodeVersion((uint)0x0370) == QChar::Unicode_5_1); - QVERIFY(QChar::unicodeVersion((uint)0x1f093) == QChar::Unicode_5_1); + QVERIFY(QChar::unicodeVersion(0x0370) == QChar::Unicode_5_1); + QVERIFY(QChar::unicodeVersion(0x1f093) == QChar::Unicode_5_1); QVERIFY(QChar(0x0524).unicodeVersion() == QChar::Unicode_5_2); - QVERIFY(QChar::unicodeVersion((ushort)0x0524) == QChar::Unicode_5_2); - QVERIFY(QChar::unicodeVersion((uint)0x0524) == QChar::Unicode_5_2); - QVERIFY(QChar::unicodeVersion((uint)0x2b734) == QChar::Unicode_5_2); + QVERIFY(QChar::unicodeVersion(0x0524) == QChar::Unicode_5_2); + QVERIFY(QChar::unicodeVersion(0x2b734) == QChar::Unicode_5_2); QVERIFY(QChar(0x26ce).unicodeVersion() == QChar::Unicode_6_0); - QVERIFY(QChar::unicodeVersion((ushort)0x26ce) == QChar::Unicode_6_0); - QVERIFY(QChar::unicodeVersion((uint)0x26ce) == QChar::Unicode_6_0); - QVERIFY(QChar::unicodeVersion((uint)0x1f618) == QChar::Unicode_6_0); + QVERIFY(QChar::unicodeVersion(0x26ce) == QChar::Unicode_6_0); + QVERIFY(QChar::unicodeVersion(0x1f618) == QChar::Unicode_6_0); QVERIFY(QChar(0xa69f).unicodeVersion() == QChar::Unicode_6_1); - QVERIFY(QChar::unicodeVersion((ushort)0xa69f) == QChar::Unicode_6_1); - QVERIFY(QChar::unicodeVersion((uint)0xa69f) == QChar::Unicode_6_1); - QVERIFY(QChar::unicodeVersion((uint)0x1f600) == QChar::Unicode_6_1); + QVERIFY(QChar::unicodeVersion(0xa69f) == QChar::Unicode_6_1); + QVERIFY(QChar::unicodeVersion(0x1f600) == QChar::Unicode_6_1); QVERIFY(QChar(0x20ba).unicodeVersion() == QChar::Unicode_6_2); - QVERIFY(QChar::unicodeVersion((ushort)0x20ba) == QChar::Unicode_6_2); - QVERIFY(QChar::unicodeVersion((uint)0x20ba) == QChar::Unicode_6_2); - QVERIFY(QChar::unicodeVersion((uint)0x20ba) == QChar::Unicode_6_2); + QVERIFY(QChar::unicodeVersion(0x20ba) == QChar::Unicode_6_2); QVERIFY(QChar(0x061c).unicodeVersion() == QChar::Unicode_6_3); - QVERIFY(QChar::unicodeVersion((ushort)0x061c) == QChar::Unicode_6_3); - QVERIFY(QChar::unicodeVersion((uint)0x061c) == QChar::Unicode_6_3); - QVERIFY(QChar::unicodeVersion((uint)0x061c) == QChar::Unicode_6_3); + QVERIFY(QChar::unicodeVersion(0x061c) == QChar::Unicode_6_3); QVERIFY(QChar(0x09ff).unicodeVersion() == QChar::Unicode_Unassigned); - QVERIFY(QChar::unicodeVersion((ushort)0x09ff) == QChar::Unicode_Unassigned); - QVERIFY(QChar::unicodeVersion((uint)0x09ff) == QChar::Unicode_Unassigned); - QVERIFY(QChar::unicodeVersion((uint)0x110000) == QChar::Unicode_Unassigned); + QVERIFY(QChar::unicodeVersion(0x09ff) == QChar::Unicode_Unassigned); + QVERIFY(QChar::unicodeVersion(0x110000) == QChar::Unicode_Unassigned); } void tst_QChar::digitValue() @@ -660,18 +585,14 @@ void tst_QChar::digitValue() QVERIFY(QChar('0').digitValue() == 0); QVERIFY(QChar('a').digitValue() == -1); - QVERIFY(QChar::digitValue((ushort)'9') == 9); - QVERIFY(QChar::digitValue((ushort)'0') == 0); - QVERIFY(QChar::digitValue((uint)'9') == 9); - QVERIFY(QChar::digitValue((uint)'0') == 0); + QVERIFY(QChar::digitValue('9') == 9); + QVERIFY(QChar::digitValue('0') == 0); - QVERIFY(QChar::digitValue((ushort)0x1049) == 9); - QVERIFY(QChar::digitValue((ushort)0x1040) == 0); - QVERIFY(QChar::digitValue((uint)0x1049) == 9); - QVERIFY(QChar::digitValue((uint)0x1040) == 0); + QVERIFY(QChar::digitValue(0x1049) == 9); + QVERIFY(QChar::digitValue(0x1040) == 0); - QVERIFY(QChar::digitValue((ushort)0xd800) == -1); - QVERIFY(QChar::digitValue((uint)0x110000u) == -1); + QVERIFY(QChar::digitValue(0xd800) == -1); + QVERIFY(QChar::digitValue(0x110000) == -1); } void tst_QChar::mirroredChar() @@ -697,9 +618,9 @@ void tst_QChar::decomposition() QVERIFY2(QChar::decompositionTag(ucs) == expected, desc.toLatin1()); } - QVERIFY(QChar((ushort)0xa0).decompositionTag() == QChar::NoBreak); - QVERIFY(QChar((ushort)0xa8).decompositionTag() == QChar::Compat); - QVERIFY(QChar((ushort)0x41).decompositionTag() == QChar::NoDecomposition); + QVERIFY(QChar(0xa0).decompositionTag() == QChar::NoBreak); + QVERIFY(QChar(0xa8).decompositionTag() == QChar::Compat); + QVERIFY(QChar(0x41).decompositionTag() == QChar::NoDecomposition); QVERIFY(QChar::decompositionTag(0xa0) == QChar::NoBreak); QVERIFY(QChar::decompositionTag(0xa8) == QChar::Compat); @@ -734,58 +655,58 @@ void tst_QChar::decomposition() void tst_QChar::lineBreakClass() { - QVERIFY(QUnicodeTables::lineBreakClass(0x0029u) == QUnicodeTables::LineBreak_CP); - QVERIFY(QUnicodeTables::lineBreakClass(0x0041u) == QUnicodeTables::LineBreak_AL); - QVERIFY(QUnicodeTables::lineBreakClass(0x0033u) == QUnicodeTables::LineBreak_NU); - QVERIFY(QUnicodeTables::lineBreakClass(0x00adu) == QUnicodeTables::LineBreak_BA); - QVERIFY(QUnicodeTables::lineBreakClass(0x05d0u) == QUnicodeTables::LineBreak_HL); - QVERIFY(QUnicodeTables::lineBreakClass(0xfffcu) == QUnicodeTables::LineBreak_CB); - QVERIFY(QUnicodeTables::lineBreakClass(0xe0164u) == QUnicodeTables::LineBreak_CM); - QVERIFY(QUnicodeTables::lineBreakClass(0x2f9a4u) == QUnicodeTables::LineBreak_ID); - QVERIFY(QUnicodeTables::lineBreakClass(0x10000u) == QUnicodeTables::LineBreak_AL); - QVERIFY(QUnicodeTables::lineBreakClass(0x1f1e6u) == QUnicodeTables::LineBreak_RI); + QVERIFY(QUnicodeTables::lineBreakClass(0x0029) == QUnicodeTables::LineBreak_CP); + QVERIFY(QUnicodeTables::lineBreakClass(0x0041) == QUnicodeTables::LineBreak_AL); + QVERIFY(QUnicodeTables::lineBreakClass(0x0033) == QUnicodeTables::LineBreak_NU); + QVERIFY(QUnicodeTables::lineBreakClass(0x00ad) == QUnicodeTables::LineBreak_BA); + QVERIFY(QUnicodeTables::lineBreakClass(0x05d0) == QUnicodeTables::LineBreak_HL); + QVERIFY(QUnicodeTables::lineBreakClass(0xfffc) == QUnicodeTables::LineBreak_CB); + QVERIFY(QUnicodeTables::lineBreakClass(0xe0164) == QUnicodeTables::LineBreak_CM); + QVERIFY(QUnicodeTables::lineBreakClass(0x2f9a4) == QUnicodeTables::LineBreak_ID); + QVERIFY(QUnicodeTables::lineBreakClass(0x10000) == QUnicodeTables::LineBreak_AL); + QVERIFY(QUnicodeTables::lineBreakClass(0x1f1e6) == QUnicodeTables::LineBreak_RI); // mapped to AL: - QVERIFY(QUnicodeTables::lineBreakClass(0xfffdu) == QUnicodeTables::LineBreak_AL); // AI -> AL - QVERIFY(QUnicodeTables::lineBreakClass(0x100000u) == QUnicodeTables::LineBreak_AL); // XX -> AL + QVERIFY(QUnicodeTables::lineBreakClass(0xfffd) == QUnicodeTables::LineBreak_AL); // AI -> AL + QVERIFY(QUnicodeTables::lineBreakClass(0x100000) == QUnicodeTables::LineBreak_AL); // XX -> AL } void tst_QChar::script() { - QVERIFY(QChar::script(0x0020u) == QChar::Script_Common); - QVERIFY(QChar::script(0x0041u) == QChar::Script_Latin); - QVERIFY(QChar::script(0x0375u) == QChar::Script_Greek); - QVERIFY(QChar::script(0x0400u) == QChar::Script_Cyrillic); - QVERIFY(QChar::script(0x0531u) == QChar::Script_Armenian); - QVERIFY(QChar::script(0x0591u) == QChar::Script_Hebrew); - QVERIFY(QChar::script(0x0600u) == QChar::Script_Arabic); - QVERIFY(QChar::script(0x0700u) == QChar::Script_Syriac); - QVERIFY(QChar::script(0x0780u) == QChar::Script_Thaana); - QVERIFY(QChar::script(0x07c0u) == QChar::Script_Nko); - QVERIFY(QChar::script(0x0900u) == QChar::Script_Devanagari); - QVERIFY(QChar::script(0x0981u) == QChar::Script_Bengali); - QVERIFY(QChar::script(0x0a01u) == QChar::Script_Gurmukhi); - QVERIFY(QChar::script(0x0a81u) == QChar::Script_Gujarati); - QVERIFY(QChar::script(0x0b01u) == QChar::Script_Oriya); - QVERIFY(QChar::script(0x0b82u) == QChar::Script_Tamil); - QVERIFY(QChar::script(0x0c01u) == QChar::Script_Telugu); - QVERIFY(QChar::script(0x0c82u) == QChar::Script_Kannada); - QVERIFY(QChar::script(0x0d02u) == QChar::Script_Malayalam); - QVERIFY(QChar::script(0x0d82u) == QChar::Script_Sinhala); - QVERIFY(QChar::script(0x0e01u) == QChar::Script_Thai); - QVERIFY(QChar::script(0x0e81u) == QChar::Script_Lao); - QVERIFY(QChar::script(0x0f00u) == QChar::Script_Tibetan); - QVERIFY(QChar::script(0x1000u) == QChar::Script_Myanmar); - QVERIFY(QChar::script(0x10a0u) == QChar::Script_Georgian); - QVERIFY(QChar::script(0x1100u) == QChar::Script_Hangul); - QVERIFY(QChar::script(0x1680u) == QChar::Script_Ogham); - QVERIFY(QChar::script(0x16a0u) == QChar::Script_Runic); - QVERIFY(QChar::script(0x1780u) == QChar::Script_Khmer); - QVERIFY(QChar::script(0x200cu) == QChar::Script_Inherited); - QVERIFY(QChar::script(0x200du) == QChar::Script_Inherited); - QVERIFY(QChar::script(0x1018au) == QChar::Script_Greek); - QVERIFY(QChar::script(0x1f130u) == QChar::Script_Common); - QVERIFY(QChar::script(0xe0100u) == QChar::Script_Inherited); + QVERIFY(QChar::script(0x0020) == QChar::Script_Common); + QVERIFY(QChar::script(0x0041) == QChar::Script_Latin); + QVERIFY(QChar::script(0x0375) == QChar::Script_Greek); + QVERIFY(QChar::script(0x0400) == QChar::Script_Cyrillic); + QVERIFY(QChar::script(0x0531) == QChar::Script_Armenian); + QVERIFY(QChar::script(0x0591) == QChar::Script_Hebrew); + QVERIFY(QChar::script(0x0600) == QChar::Script_Arabic); + QVERIFY(QChar::script(0x0700) == QChar::Script_Syriac); + QVERIFY(QChar::script(0x0780) == QChar::Script_Thaana); + QVERIFY(QChar::script(0x07c0) == QChar::Script_Nko); + QVERIFY(QChar::script(0x0900) == QChar::Script_Devanagari); + QVERIFY(QChar::script(0x0981) == QChar::Script_Bengali); + QVERIFY(QChar::script(0x0a01) == QChar::Script_Gurmukhi); + QVERIFY(QChar::script(0x0a81) == QChar::Script_Gujarati); + QVERIFY(QChar::script(0x0b01) == QChar::Script_Oriya); + QVERIFY(QChar::script(0x0b82) == QChar::Script_Tamil); + QVERIFY(QChar::script(0x0c01) == QChar::Script_Telugu); + QVERIFY(QChar::script(0x0c82) == QChar::Script_Kannada); + QVERIFY(QChar::script(0x0d02) == QChar::Script_Malayalam); + QVERIFY(QChar::script(0x0d82) == QChar::Script_Sinhala); + QVERIFY(QChar::script(0x0e01) == QChar::Script_Thai); + QVERIFY(QChar::script(0x0e81) == QChar::Script_Lao); + QVERIFY(QChar::script(0x0f00) == QChar::Script_Tibetan); + QVERIFY(QChar::script(0x1000) == QChar::Script_Myanmar); + QVERIFY(QChar::script(0x10a0) == QChar::Script_Georgian); + QVERIFY(QChar::script(0x1100) == QChar::Script_Hangul); + QVERIFY(QChar::script(0x1680) == QChar::Script_Ogham); + QVERIFY(QChar::script(0x16a0) == QChar::Script_Runic); + QVERIFY(QChar::script(0x1780) == QChar::Script_Khmer); + QVERIFY(QChar::script(0x200c) == QChar::Script_Inherited); + QVERIFY(QChar::script(0x200d) == QChar::Script_Inherited); + QVERIFY(QChar::script(0x1018a) == QChar::Script_Greek); + QVERIFY(QChar::script(0x1f130) == QChar::Script_Common); + QVERIFY(QChar::script(0xe0100) == QChar::Script_Inherited); } void tst_QChar::normalization_data() -- cgit v1.2.3 From d3659bf88bac8dbfcdc6c957bdcc25e29bef0f04 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Mar 2015 09:28:59 +0100 Subject: QVarLengthArray: Add initializer_list constructor Implement an initializer_list constructor, which was probably just forgotten so far. Technically this is a SC incompatible change, since QVarLengthArray array = {10}; will now create an array with one element 10, instead of an empty array with a reserved size of 10. Anyhow, keeping the inconsistency with the STL / other Qt containers here would certainly do more harm than good in the long run. Task-number: QTBUG-45047 Change-Id: I4675880f93e141181250939942fa32300916b0e3 Reviewed-by: Marc Mutz --- .../tools/qvarlengtharray/tst_qvarlengtharray.cpp | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 0b507ca277..40917eebea 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -54,6 +54,12 @@ private slots: void indexOf(); void lastIndexOf(); void contains(); + void initializeListInt(); + void initializeListMovable(); + void initializeListComplex(); +private: + template + void initializeList(); }; int fooCtor = 0; @@ -333,11 +339,23 @@ struct MyPrimitive struct MyMovable : MyBase { + MyMovable(char input = 'j') : i(input) {} + bool operator==(const MyMovable &other) const + { + return i == other.i; + } + char i; }; struct MyComplex : MyBase { + MyComplex(char input = 'j') : i(input) {} + bool operator==(const MyComplex &other) const + { + return i == other.i; + } + char i; }; QT_BEGIN_NAMESPACE @@ -734,5 +752,49 @@ void tst_QVarLengthArray::contains() QVERIFY(myvec.contains(QLatin1String("I don't exist"))); } +void tst_QVarLengthArray::initializeListInt() +{ + initializeList(); +} + +void tst_QVarLengthArray::initializeListMovable() +{ + const int instancesCount = MyMovable::liveCount; + initializeList(); + QCOMPARE(MyMovable::liveCount, instancesCount); +} + +void tst_QVarLengthArray::initializeListComplex() +{ + const int instancesCount = MyComplex::liveCount; + initializeList(); + QCOMPARE(MyComplex::liveCount, instancesCount); +} + +template +void tst_QVarLengthArray::initializeList() +{ +#ifdef Q_COMPILER_INITIALIZER_LISTS + T val1(110); + T val2(105); + T val3(101); + T val4(114); + + QVarLengthArray v1 {val1, val2, val3}; + QCOMPARE(v1, QVarLengthArray() << val1 << val2 << val3); + QCOMPARE(v1, (QVarLengthArray {val1, val2, val3})); + + QVarLengthArray, 4> v2{ v1, {val4}, QVarLengthArray(), {val1, val2, val3} }; + QVarLengthArray, 4> v3; + v3 << v1 << (QVarLengthArray() << val4) << QVarLengthArray() << v1; + QCOMPARE(v3, v2); + + QVarLengthArray v4({}); + QCOMPARE(v4.size(), 0); +#else + QSKIP("This tests requires a compiler that supports initializer lists."); +#endif +} + QTEST_APPLESS_MAIN(tst_QVarLengthArray) #include "tst_qvarlengtharray.moc" -- cgit v1.2.3 From ddf6ac03cb40c4a299f14b7f0b0c9257587ee828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Fri, 20 Mar 2015 17:09:53 +0200 Subject: Do not search test binary if QProcess is not supported. Without QProcess support we do not run test which initTestCase is trying to find. Change-Id: Icecaad90f61a019489e372517a6d62372155bd46 Reviewed-by: Thiago Macieira --- tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index ac606acfc9..5e9b7370b9 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -83,6 +83,7 @@ int Pointer::count = 0; void tst_QThreadStorage::initTestCase() { +#ifndef QT_NO_PROCESS const QString crashOnExitDir = QFINDTESTDATA("crashonexit"); QVERIFY2(!crashOnExitDir.isEmpty(), qPrintable(QString::fromLatin1("Could not find 'crashonexit' starting from '%1'") @@ -93,6 +94,7 @@ void tst_QThreadStorage::initTestCase() #endif QVERIFY2(QFileInfo(m_crashOnExit).isExecutable(), qPrintable(QDir::toNativeSeparators(m_crashOnExit) + QStringLiteral(" does not exist or is not executable."))); +#endif } void tst_QThreadStorage::hasLocalData() -- cgit v1.2.3