diff options
Diffstat (limited to 'tests')
141 files changed, 2824 insertions, 642 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/echo/main.cpp b/tests/auto/corelib/codecs/qtextcodec/echo/main.cpp index 55c831bd35..09c3ac3c09 100644 --- a/tests/auto/corelib/codecs/qtextcodec/echo/main.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/echo/main.cpp @@ -47,8 +47,7 @@ int main(int argc, char **argv) { - static char lc_all[] = "LC_ALL=C"; - putenv(lc_all); + qputenv("LC_ALL", "C"); QCoreApplication app(argc, argv); QString string(QChar(0x410)); diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 31a4254344..21e07630e2 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -672,7 +672,7 @@ void tst_qmessagehandler::qMessagePattern() 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("warning tst_qlogging 62 main qDebug with category")); QVERIFY(output.contains("debug tst_qlogging 66 main qDebug2")); environment = m_baseEnvironment; @@ -712,7 +712,7 @@ void tst_qmessagehandler::qMessagePattern() "[debug] qDebug\n" "[warning] qWarning\n" "[critical] qCritical\n" - "[warning] qDebug with category \n"; + "[warning] qDebug with category\n"; #ifdef Q_OS_WIN output.replace("\r\n", "\n"); #endif diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 20f99e9191..36e01a0ccd 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp @@ -44,6 +44,7 @@ #include <QtGlobal> #include <math.h> +#include <float.h> class tst_QNumeric: public QObject { @@ -53,6 +54,10 @@ private slots: void fuzzyCompare_data(); void fuzzyCompare(); void qNan(); + void floatDistance_data(); + void floatDistance(); + void floatDistance_double_data(); + void floatDistance_double(); }; void tst_QNumeric::fuzzyCompare_data() @@ -121,5 +126,93 @@ void tst_QNumeric::qNan() QVERIFY(qFuzzyCompare(1/inf, 0.0)); } +void tst_QNumeric::floatDistance_data() +{ + QTest::addColumn<float>("val1"); + QTest::addColumn<float>("val2"); + QTest::addColumn<quint32>("expectedDistance"); + + // exponent: 8 bits + // mantissa: 23 bits + const quint32 number_of_denormals = (1 << 23) - 1; // Set to 0 if denormals are not included + + quint32 _0_to_1 = quint32((1 << 23) * 126 + 1 + number_of_denormals); // We need +1 to include the 0 + quint32 _1_to_2 = quint32(1 << 23); + + // We don't need +1 because FLT_MAX has all bits set in the mantissa. (Thus mantissa + // have not wrapped back to 0, which would be the case for 1 in _0_to_1 + quint32 _0_to_FLT_MAX = quint32((1 << 23) * 254) + number_of_denormals; + + quint32 _0_to_FLT_MIN = 1 + number_of_denormals; + QTest::newRow("[0,FLT_MIN]") << 0.F << FLT_MIN << _0_to_FLT_MIN; + QTest::newRow("[0,FLT_MAX]") << 0.F << FLT_MAX << _0_to_FLT_MAX; + QTest::newRow("[1,1.5]") << 1.0F << 1.5F << quint32(1 << 22); + QTest::newRow("[0,1]") << 0.F << 1.0F << _0_to_1; + QTest::newRow("[0.5,1]") << 0.5F << 1.0F << quint32(1 << 23); + QTest::newRow("[1,2]") << 1.F << 2.0F << _1_to_2; + QTest::newRow("[-1,+1]") << -1.F << +1.0F << 2 * _0_to_1; + QTest::newRow("[-1,0]") << -1.F << 0.0F << _0_to_1; + QTest::newRow("[-1,FLT_MAX]") << -1.F << FLT_MAX << _0_to_1 + _0_to_FLT_MAX; + QTest::newRow("[-2,-1") << -2.F << -1.F << _1_to_2; + QTest::newRow("[-1,-2") << -1.F << -2.F << _1_to_2; + QTest::newRow("[FLT_MIN,FLT_MAX]") << FLT_MIN << FLT_MAX << _0_to_FLT_MAX - _0_to_FLT_MIN; + QTest::newRow("[-FLT_MAX,FLT_MAX]") << -FLT_MAX << FLT_MAX << (2*_0_to_FLT_MAX); + float denormal = FLT_MIN; + denormal/=2.0F; + QTest::newRow("denormal") << 0.F << denormal << _0_to_FLT_MIN/2; +} + +void tst_QNumeric::floatDistance() +{ + QFETCH(float, val1); + QFETCH(float, val2); + QFETCH(quint32, expectedDistance); + QCOMPARE(qFloatDistance(val1, val2), expectedDistance); +} + +void tst_QNumeric::floatDistance_double_data() +{ + QTest::addColumn<double>("val1"); + QTest::addColumn<double>("val2"); + QTest::addColumn<quint64>("expectedDistance"); + + // exponent: 11 bits + // mantissa: 52 bits + const quint64 number_of_denormals = (Q_UINT64_C(1) << 52) - 1; // Set to 0 if denormals are not included + + quint64 _0_to_1 = (Q_UINT64_C(1) << 52) * ((1 << (11-1)) - 2) + 1 + number_of_denormals; // We need +1 to include the 0 + quint64 _1_to_2 = Q_UINT64_C(1) << 52; + + // We don't need +1 because DBL_MAX has all bits set in the mantissa. (Thus mantissa + // have not wrapped back to 0, which would be the case for 1 in _0_to_1 + quint64 _0_to_DBL_MAX = quint64((Q_UINT64_C(1) << 52) * ((1 << 11) - 2)) + number_of_denormals; + + quint64 _0_to_DBL_MIN = 1 + number_of_denormals; + QTest::newRow("[0,DBL_MIN]") << 0.0 << DBL_MIN << _0_to_DBL_MIN; + QTest::newRow("[0,DBL_MAX]") << 0.0 << DBL_MAX << _0_to_DBL_MAX; + QTest::newRow("[1,1.5]") << 1.0 << 1.5 << (Q_UINT64_C(1) << 51); + QTest::newRow("[0,1]") << 0.0 << 1.0 << _0_to_1; + QTest::newRow("[0.5,1]") << 0.5 << 1.0 << (Q_UINT64_C(1) << 52); + QTest::newRow("[1,2]") << 1.0 << 2.0 << _1_to_2; + QTest::newRow("[-1,+1]") << -1.0 << +1.0 << 2 * _0_to_1; + QTest::newRow("[-1,0]") << -1.0 << 0.0 << _0_to_1; + QTest::newRow("[-1,DBL_MAX]") << -1.0 << DBL_MAX << _0_to_1 + _0_to_DBL_MAX; + QTest::newRow("[-2,-1") << -2.0 << -1.0 << _1_to_2; + QTest::newRow("[-1,-2") << -1.0 << -2.0 << _1_to_2; + QTest::newRow("[DBL_MIN,DBL_MAX]") << DBL_MIN << DBL_MAX << _0_to_DBL_MAX - _0_to_DBL_MIN; + QTest::newRow("[-DBL_MAX,DBL_MAX]") << -DBL_MAX << DBL_MAX << (2*_0_to_DBL_MAX); + double denormal = DBL_MIN; + denormal/=2.0; + QTest::newRow("denormal") << 0.0 << denormal << _0_to_DBL_MIN/2; +} + +void tst_QNumeric::floatDistance_double() +{ + QFETCH(double, val1); + QFETCH(double, val2); + QFETCH(quint64, expectedDistance); + QCOMPARE(qFloatDistance(val1, val2), expectedDistance); +} + QTEST_APPLESS_MAIN(tst_QNumeric) #include "tst_qnumeric.moc" diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index ab66323d3b..259463f976 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -43,7 +43,6 @@ SUBDIRS=\ qsettings !qtHaveModule(network): SUBDIRS -= \ - qfile \ qiodevice \ qprocess \ qtextstream @@ -56,3 +55,9 @@ SUBDIRS=\ win32:!contains(QT_CONFIG, private_tests): SUBDIRS -= \ qfilesystementry + +winrt: SUBDIRS -= \ + qprocess \ + qprocess-noapplication \ + qprocessenvironment \ + qwinoverlappedionotifier diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index f452efc1b3..29c7e6a81e 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -65,8 +65,8 @@ void tst_QDebug::assignment() const QDebug debug1(QtDebugMsg); QDebug debug2(QtWarningMsg); - QTest::ignoreMessage(QtDebugMsg, "foo "); - QTest::ignoreMessage(QtWarningMsg, "bar 1 2 "); + QTest::ignoreMessage(QtDebugMsg, "foo"); + QTest::ignoreMessage(QtWarningMsg, "bar 1 2"); debug1 << "foo"; debug2 << "bar"; @@ -118,7 +118,7 @@ void tst_QDebug::warningWithoutDebug() const { qWarning() << "A qWarning() message"; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtWarningMsg); - QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message ")); + QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -133,7 +133,7 @@ void tst_QDebug::criticalWithoutDebug() const { qCritical() << "A qCritical() message"; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtCriticalMsg); - QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message ")); + QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -145,7 +145,7 @@ void tst_QDebug::debugWithBool() const { qDebug() << false << true; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("false true ")); + QCOMPARE(s_msg, QString::fromLatin1("false true")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -215,7 +215,7 @@ void tst_QDebug::stateSaver() const } d.space() << 42; } - QCOMPARE(s_msg, QString::fromLatin1("02a 42 ")); + QCOMPARE(s_msg, QString::fromLatin1("02a 42")); } void tst_QDebug::veryLongWarningMessage() const @@ -247,7 +247,7 @@ void tst_QDebug::qDebugQStringRef() const { qDebug() << inRef; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"input\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"input\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -261,7 +261,7 @@ void tst_QDebug::qDebugQStringRef() const { qDebug() << inRef; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -274,7 +274,7 @@ void tst_QDebug::qDebugQLatin1String() const { qDebug() << QLatin1String("foo") << QLatin1String("") << QLatin1String("barbaz", 3); } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index bc6922b4e9..03863e9943 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -1,7 +1,10 @@ CONFIG += testcase CONFIG += parallel_test CONFIG -= app_bundle debug_and_release_target -QT = core-private core network testlib +QT = core-private core testlib +qtHaveModule(network): QT += network +else: DEFINES += QT_NO_NETWORK + TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp @@ -13,5 +16,5 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \ ../Makefile ../forCopying.txt ../forRenaming.txt \ ../resources/file1.ext1 -win32: LIBS+=-lole32 -luuid +win32:!winrt: LIBS+=-lole32 -luuid DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 2b029203e9..77ac4bcd86 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -59,7 +59,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE #endif -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK) #include <QHostInfo> #endif #include <QProcess> @@ -527,7 +527,7 @@ void tst_QFile::open_data() << false << QFile::OpenError; QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) << false << QFile::OpenError; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hTest != INVALID_HANDLE_VALUE) { @@ -1057,7 +1057,7 @@ void tst_QFile::ungetChar() QCOMPARE(buf[2], '4'); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QString driveLetters() { wchar_t volumeName[MAX_PATH]; @@ -1094,7 +1094,7 @@ void tst_QFile::invalidFile_data() #if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); #endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); @@ -1338,10 +1338,12 @@ void tst_QFile::copyFallback() #ifdef Q_OS_WIN #include <objbase.h> +#ifndef Q_OS_WINPHONE #include <shlobj.h> #endif +#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) static QString getWorkingDirectoryForLink(const QString &linkFileName) { bool neededCoInit = false; @@ -1400,7 +1402,7 @@ void tst_QFile::link() QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath())); #endif @@ -2243,7 +2245,7 @@ void tst_QFile::writeLargeDataBlock_data() QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd; QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK) // Some semi-randomness to avoid collisions. QTest::newRow("unc file") << QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt") @@ -2690,8 +2692,12 @@ void tst_QFile::nativeHandleLeaks() } #ifdef Q_OS_WIN +# ifndef Q_OS_WINRT handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +# else + handle1 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL); +# endif QVERIFY( INVALID_HANDLE_VALUE != handle1 ); QVERIFY( ::CloseHandle(handle1) ); #endif @@ -2705,8 +2711,12 @@ void tst_QFile::nativeHandleLeaks() } #ifdef Q_OS_WIN +# ifndef Q_OS_WINRT handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +# else + handle2 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL); +# endif QVERIFY( INVALID_HANDLE_VALUE != handle2 ); QVERIFY( ::CloseHandle(handle2) ); #endif diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index c4b37a8847..64d289bc3c 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -6,5 +6,5 @@ RESOURCES += qfileinfo.qrc TESTDATA += qfileinfo.qrc qfileinfo.pro tst_qfileinfo.cpp resources/file1 resources/file1.ext1 resources/file1.ext1.ext2 -win32*:!wince*:LIBS += -ladvapi32 -lnetapi32 +win32*:!wince*:!winrt:LIBS += -ladvapi32 -lnetapi32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index d2171cc64a..74667a951f 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -62,7 +62,7 @@ #ifdef Q_OS_WIN #include <qt_windows.h> #include <qlibrary.h> -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #include <lm.h> #endif #endif @@ -176,7 +176,7 @@ private slots: void refresh(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void ntfsJunctionPointsAndSymlinks_data(); void ntfsJunctionPointsAndSymlinks(); void brokenShortcut(); @@ -193,7 +193,7 @@ private slots: void detachingOperations(); -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void owner(); #endif void group(); @@ -1058,7 +1058,7 @@ void tst_QFileInfo::fileTimes() //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). //To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate //is set to 0, in the test machine. -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) HKEY key; if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem", 0, KEY_READ, &key)) { @@ -1085,8 +1085,8 @@ void tst_QFileInfo::fileTimes() void tst_QFileInfo::fileTimes_oldFile() { - // This is not supported on WinCE -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + // This is not supported on WinCE or WinRT +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) // All files are opened in share mode (both read and write). DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; @@ -1329,7 +1329,7 @@ void tst_QFileInfo::refresh() QCOMPARE(info2.size(), info.size()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() { QTest::addColumn<QString>("path"); @@ -1680,7 +1680,7 @@ void tst_QFileInfo::detachingOperations() QVERIFY(!info1.caching()); } -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #if defined (Q_OS_WIN) BOOL IsUserAdmin() { diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index fda6519d82..b681cec802 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -55,6 +55,7 @@ class tst_QFileSystemWatcher : public QObject public: tst_QFileSystemWatcher(); +#ifndef QT_NO_FILESYSTEMWATCHER private slots: void basicTest_data(); void basicTest(); @@ -83,16 +84,20 @@ private slots: private: QString m_tempDirPattern; +#endif // QT_NO_FILESYSTEMWATCHER }; tst_QFileSystemWatcher::tst_QFileSystemWatcher() { +#ifndef QT_NO_FILESYSTEMWATCHER m_tempDirPattern = QDir::tempPath(); if (!m_tempDirPattern.endsWith(QLatin1Char('/'))) m_tempDirPattern += QLatin1Char('/'); m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); +#endif // QT_NO_FILESYSTEMWATCHER } +#ifndef QT_NO_FILESYSTEMWATCHER void tst_QFileSystemWatcher::basicTest_data() { QTest::addColumn<QString>("backend"); @@ -676,6 +681,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved() QTRY_COMPARE(changedSpy.count(), 10); } +#endif // QT_NO_FILESYSTEMWATCHER QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index 157e42b447..a516b762f7 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -68,8 +68,8 @@ void tst_QNoDebug::noDebugOutput() const qCDebug(cat) << "foo"; // qWarning still works, though - QTest::ignoreMessage(QtWarningMsg, "bar "); - QTest::ignoreMessage(QtWarningMsg, "custom-bar "); + QTest::ignoreMessage(QtWarningMsg, "bar"); + QTest::ignoreMessage(QtWarningMsg, "custom-bar"); qWarning() << "bar"; qCWarning(cat) << "custom-bar"; } @@ -79,7 +79,7 @@ void tst_QNoDebug::streaming() const QDateTime dt(QDate(1,2,3),QTime(4,5,6)); QString debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")) + QStringLiteral(" Qt::LocalTime"); - QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\") ").arg(debugString))); + QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\")").arg(debugString))); qWarning() << dt; } diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index c5a9b421ee..42c360f2d8 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -119,7 +119,7 @@ private slots: #if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER) void dontReorderIniKeysNeedlessly(); #endif -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void consistentRegistryStorage(); #endif @@ -274,7 +274,7 @@ void tst_QSettings::init() QSettings::setSystemIniPath(settingsPath("__system__")); QSettings::setUserIniPath(settingsPath("__user__")); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear(); @@ -1496,7 +1496,7 @@ void tst_QSettings::sync() // Now "some other app" will change other.software.org.ini QString userConfDir = settingsPath("__user__") + QDir::separator(); -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) unlink((userConfDir + "other.software.org.ini").toLatin1()); rename((userConfDir + "software.org.ini").toLatin1(), (userConfDir + "other.software.org.ini").toLatin1()); @@ -3197,7 +3197,7 @@ void tst_QSettings::recursionBug() } } -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static DWORD readKeyType(HKEY handle, const QString &rSubKey) { diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 35a59401b7..d19f4379c7 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -289,9 +289,9 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. - // Blackberry OS is an exception to this case, owing to the fact that + // Blackberry OS and WinRT are an exception to this case, owing to the fact that // applications are sandboxed. -#ifndef Q_OS_BLACKBERRY +#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); @@ -335,6 +335,7 @@ void tst_qstandardpaths::testFindExecutable_data() QTest::addColumn<QString>("needle"); QTest::addColumn<QString>("expected"); #ifdef Q_OS_WIN +# ifndef Q_OS_WINRT const QFileInfo cmdFi = QFileInfo(QDir::cleanPath(QString::fromLocal8Bit(qgetenv("COMSPEC")))); const QString cmdPath = cmdFi.absoluteFilePath(); @@ -358,6 +359,7 @@ void tst_qstandardpaths::testFindExecutable_data() QTest::newRow("win8-logo-nosuffix") << QString() << logo << logoPath; } +# endif // Q_OS_WINRT #else const QFileInfo shFi = findSh(); Q_ASSERT(shFi.exists()); diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 713d0c5c17..a6cc083d9c 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -257,7 +257,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() void tst_QTemporaryDir::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -271,7 +271,7 @@ void tst_QTemporaryDir::openOnRootDrives() QVERIFY(dir.isValid()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 6eb6f83d2a..5ad798ae1f 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -371,7 +371,7 @@ void tst_QTemporaryFile::resize() void tst_QTemporaryFile::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -385,7 +385,7 @@ void tst_QTemporaryFile::openOnRootDrives() QVERIFY(file.open()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 923b9a3a07..bb77ec54c5 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -2740,9 +2740,9 @@ void tst_QSortFilterProxyModel::mapFromToSource() QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex()); #ifdef QT_NO_DEBUG //if Qt is compiled in debug mode, this will assert - QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource "); + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource"); QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex()); - QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource "); + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource"); QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex()); #endif } diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index c79e7273c0..a8534bf6f0 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1985,11 +1985,11 @@ void tst_QtJson::testDebugStream() // QJsonObject QJsonObject object; - QTest::ignoreMessage(QtDebugMsg, "QJsonObject() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonObject()"); qDebug() << object; object.insert(QLatin1String("foo"), QLatin1String("bar")); - QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\": \"bar\"}) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\": \"bar\"})"); qDebug() << object; } @@ -1997,12 +1997,12 @@ void tst_QtJson::testDebugStream() // QJsonArray QJsonArray array; - QTest::ignoreMessage(QtDebugMsg, "QJsonArray() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonArray()"); qDebug() << array; array.append(1); array.append(QLatin1String("foo")); - QTest::ignoreMessage(QtDebugMsg, "QJsonArray([1,\"foo\"]) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonArray([1,\"foo\"])"); qDebug() << array; } @@ -2010,19 +2010,19 @@ void tst_QtJson::testDebugStream() // QJsonDocument QJsonDocument doc; - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument()"); qDebug() << doc; QJsonObject object; object.insert(QLatin1String("foo"), QLatin1String("bar")); doc.setObject(object); - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\": \"bar\"}) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\": \"bar\"})"); qDebug() << doc; QJsonArray array; array.append(1); array.append(QLatin1String("foo")); - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument([1,\"foo\"]) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument([1,\"foo\"])"); doc.setArray(array); qDebug() << doc; } @@ -2032,36 +2032,36 @@ void tst_QtJson::testDebugStream() QJsonValue value; - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(null) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(null)"); qDebug() << value; value = QJsonValue(true); // bool - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(bool, true) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(bool, true)"); qDebug() << value; value = QJsonValue((double)4.2); // double - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 4.2) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 4.2)"); qDebug() << value; value = QJsonValue((int)42); // int - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 42) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 42)"); qDebug() << value; value = QJsonValue(QLatin1String("foo")); // string - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(string, \"foo\") "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(string, \"foo\")"); qDebug() << value; QJsonArray array; array.append(1); array.append(QLatin1String("foo")); value = QJsonValue(array); // array - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(array, QJsonArray([1,\"foo\"]) ) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(array, QJsonArray([1,\"foo\"]) )"); qDebug() << value; QJsonObject object; object.insert(QLatin1String("foo"), QLatin1String("bar")); value = QJsonValue(object); // object - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\": \"bar\"}) ) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\": \"bar\"}) )"); qDebug() << value; } } diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index fe3e4b7e0a..4b3b2e824e 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -13,6 +13,7 @@ SUBDIRS=\ qobject \ qpointer \ qsharedmemory \ + qsignalblocker \ qsignalmapper \ qsocketnotifier \ qsystemsemaphore \ @@ -34,6 +35,6 @@ SUBDIRS=\ qsharedmemory # This test is only applicable on Windows -!win32*:SUBDIRS -= qwineventnotifier +!win32*|winrt: SUBDIRS -= qwineventnotifier android|qnx: SUBDIRS -= qsharedmemory qsystemsemaphore diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index e5bcc31e6a..5593aa2430 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -4,7 +4,7 @@ TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp -win32:!wince*:LIBS += -luser32 +win32:!wince*:!winrt:LIBS += -luser32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 5cf3e6d97c..0e7005799e 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1323,8 +1323,8 @@ bool tst_QMetaObjectBuilder::sameMetaObject return false; } - const QMetaObject **objects1 = meta1->d.relatedMetaObjects; - const QMetaObject **objects2 = meta2->d.relatedMetaObjects; + const QMetaObject * const *objects1 = meta1->d.relatedMetaObjects; + const QMetaObject * const *objects2 = meta2->d.relatedMetaObjects; if (objects1 && !objects2) return false; if (objects2 && !objects1) diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index 23a8e6d23a..d19ec23760 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp TESTDATA=./typeFlags.bin DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32-msvc*|wince { +win32-msvc*|wince|winrt { # Prevents "fatal error C1128: number of sections exceeded object file format limit". QMAKE_CXXFLAGS += /bigobj # Reduce compile time - win32-msvc2012|wince { + win32-msvc2012|wince|winrt { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE -= -O2 } diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index f1e04511cd..a5b5b659ea 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -102,6 +102,7 @@ private slots: #ifndef QT_NO_PROCESS void recursiveSignalEmission(); #endif + void signalBlocking(); void blockingQueuedConnection(); void childEvents(); void installEventFilter(); @@ -454,7 +455,7 @@ void tst_QObject::connectSlotsByName() sender.setObjectName("Sender"); QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()"); - QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\") "); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")"); QMetaObject::connectSlotsByName(&receiver); receiver.called_slots.clear(); @@ -2981,6 +2982,30 @@ void tst_QObject::recursiveSignalEmission() } #endif +void tst_QObject::signalBlocking() +{ + SenderObject sender; + ReceiverObject receiver; + + receiver.connect(&sender, SIGNAL(signal1()), SLOT(slot1())); + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); + + sender.blockSignals(true); + + sender.emitSignal1(); + QVERIFY(!receiver.called(1)); + receiver.reset(); + + sender.blockSignals(false); + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); +} + void tst_QObject::blockingQueuedConnection() { { diff --git a/tests/auto/corelib/kernel/qsignalblocker/.gitignore b/tests/auto/corelib/kernel/qsignalblocker/.gitignore new file mode 100644 index 0000000000..a841a2a0a8 --- /dev/null +++ b/tests/auto/corelib/kernel/qsignalblocker/.gitignore @@ -0,0 +1 @@ +tst_qsignalblocker diff --git a/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro new file mode 100644 index 0000000000..c6c6f379eb --- /dev/null +++ b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro @@ -0,0 +1,7 @@ +CONFIG += testcase console +CONFIG += parallel_test +TARGET = tst_qsignalblocker +QT = core testlib +SOURCES = tst_qsignalblocker.cpp + +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp new file mode 100644 index 0000000000..1f71692ffe --- /dev/null +++ b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp @@ -0,0 +1,305 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@woboq.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +#include "qobject.h" + +class tst_QSignalBlocker : public QObject +{ + Q_OBJECT +private slots: + void signalBlocking(); + void signalBlockingMoveAssignment(); +}; + +class SenderObject : public QObject +{ + Q_OBJECT + +public: + SenderObject() : aPublicSlotCalled(0), recursionCount(0) {} + + void emitSignal1AfterRecursion() + { + if (recursionCount++ < 100) + emitSignal1AfterRecursion(); + else + emitSignal1(); + } + + void emitSignal1() { emit signal1(); } + void emitSignal2() { emit signal2(); } + void emitSignal3() { emit signal3(); } + void emitSignal4() { emit signal4(); } + +signals: + void signal1(); + void signal2(); + void signal3(); + void signal4(); + QT_MOC_COMPAT void signal5(); + void signal6(void); + void signal7(int, const QString &); + +public slots: + void aPublicSlot() { aPublicSlotCalled++; } + +public: + Q_INVOKABLE void invoke1(){} + Q_SCRIPTABLE void sinvoke1(){} + int aPublicSlotCalled; +protected: + Q_INVOKABLE QT_MOC_COMPAT void invoke2(){} + Q_INVOKABLE QT_MOC_COMPAT void invoke2(int){} + Q_SCRIPTABLE QT_MOC_COMPAT void sinvoke2(){} +private: + Q_INVOKABLE void invoke3(int hinz = 0, int kunz = 0){Q_UNUSED(hinz) Q_UNUSED(kunz)} + Q_SCRIPTABLE void sinvoke3(){} + + int recursionCount; +}; + +class ReceiverObject : public QObject +{ + Q_OBJECT + +public: + ReceiverObject() + : sequence_slot1( 0 ) + , sequence_slot2( 0 ) + , sequence_slot3( 0 ) + , sequence_slot4( 0 ) + {} + + void reset() + { + sequence_slot4 = 0; + sequence_slot3 = 0; + sequence_slot2 = 0; + sequence_slot1 = 0; + count_slot1 = 0; + count_slot2 = 0; + count_slot3 = 0; + count_slot4 = 0; + } + + int sequence_slot1; + int sequence_slot2; + int sequence_slot3; + int sequence_slot4; + int count_slot1; + int count_slot2; + int count_slot3; + int count_slot4; + + bool called(int slot) + { + switch (slot) { + case 1: return sequence_slot1; + case 2: return sequence_slot2; + case 3: return sequence_slot3; + case 4: return sequence_slot4; + default: return false; + } + } + + static int sequence; + +public slots: + void slot1() { sequence_slot1 = ++sequence; count_slot1++; } + void slot2() { sequence_slot2 = ++sequence; count_slot2++; } + void slot3() { sequence_slot3 = ++sequence; count_slot3++; } + void slot4() { sequence_slot4 = ++sequence; count_slot4++; } + +}; + +int ReceiverObject::sequence = 0; + +void tst_QSignalBlocker::signalBlocking() +{ + SenderObject sender; + ReceiverObject receiver; + + receiver.connect(&sender, SIGNAL(signal1()), SLOT(slot1())); + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); + + { + QSignalBlocker blocker(&sender); + + sender.emitSignal1(); + QVERIFY(!receiver.called(1)); + receiver.reset(); + + sender.blockSignals(false); + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); + + sender.blockSignals(true); + + sender.emitSignal1(); + QVERIFY(!receiver.called(1)); + receiver.reset(); + + blocker.unblock(); + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); + + blocker.reblock(); + + sender.emitSignal1(); + QVERIFY(!receiver.called(1)); + receiver.reset(); + } + + sender.emitSignal1(); + QVERIFY(receiver.called(1)); + receiver.reset(); +} + +void tst_QSignalBlocker::signalBlockingMoveAssignment() +{ +#ifdef Q_COMPILER_RVALUE_REFS + QObject o1, o2; + + // move-assignment: both block other objects + { + QSignalBlocker b(&o1); + QVERIFY(o1.signalsBlocked()); + + QVERIFY(!o2.signalsBlocked()); + b = QSignalBlocker(&o2); + QVERIFY(!o1.signalsBlocked()); + QVERIFY(o2.signalsBlocked()); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + + // move-assignment: from inert other + { + QSignalBlocker b(&o1); + QVERIFY(o1.signalsBlocked()); + b = QSignalBlocker(0); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + + // move-assignment: to inert *this + { + QSignalBlocker b(0); + QVERIFY(!o1.signalsBlocked()); + { + QSignalBlocker inner(&o1); + QVERIFY(o1.signalsBlocked()); + b = std::move(inner); + } + QVERIFY(o1.signalsBlocked()); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + + // move-assignment: both block the same object, neither is unblocked + { + QSignalBlocker b(&o1); + QVERIFY(o1.signalsBlocked()); + { + b.unblock(); // make sure inner.m_blocked = false + QVERIFY(!o1.signalsBlocked()); + QSignalBlocker inner(&o1); + QVERIFY(o1.signalsBlocked()); + b.reblock(); + QVERIFY(o1.signalsBlocked()); + b = std::move(inner); + } + QVERIFY(o1.signalsBlocked()); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + + // move-assignment: both block the same object, but *this is unblocked + { + QSignalBlocker b(&o1); + QVERIFY(o1.signalsBlocked()); + b.unblock(); + QVERIFY(!o1.signalsBlocked()); + b = QSignalBlocker(&o1); + QVERIFY(o1.signalsBlocked()); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + + // move-assignment: both block the same object, but other is unblocked + { + QSignalBlocker b(&o1); + { + QVERIFY(o1.signalsBlocked()); + QSignalBlocker inner(&o1); + QVERIFY(o1.signalsBlocked()); + inner.unblock(); + QVERIFY(o1.signalsBlocked()); + b = std::move(inner); + QVERIFY(!o1.signalsBlocked()); + } + QVERIFY(!o1.signalsBlocked()); + } + + QVERIFY(!o1.signalsBlocked()); + QVERIFY(!o2.signalsBlocked()); + +#else + QSKIP("This compiler is not in C++11 mode or doesn't support move semantics"); +#endif // Q_COMPILER_RVALUE_REFS +} + +QTEST_MAIN(tst_QSignalBlocker) +#include "tst_qsignalblocker.moc" diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 5cc0e5bdb4..0e53139414 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -55,6 +55,8 @@ #endif #if defined(Q_OS_WINCE) #include <windows.h> +#elif defined(Q_OS_WINRT) +#include <thread> #elif defined(Q_OS_WIN) #include <process.h> #include <windows.h> @@ -326,6 +328,9 @@ void tst_QThread::isRunning() void tst_QThread::setPriority() { +#if defined(Q_OS_WINRT) + QSKIP("Thread priority is not supported on WinRT"); +#endif Simple_Thread thread; // cannot change the priority, since the thread is not running @@ -460,6 +465,10 @@ void tst_QThread::start() QVERIFY(!thread.isFinished()); QVERIFY(!thread.isRunning()); QMutexLocker locker(&thread.mutex); +#ifdef Q_OS_WINRT + if (priorities[i] != QThread::NormalPriority && priorities[i] != QThread::InheritPriority) + QTest::ignoreMessage(QtWarningMsg, "QThread::start: Failed to set thread priority (not implemented)"); +#endif thread.start(priorities[i]); QVERIFY(thread.isRunning()); QVERIFY(!thread.isFinished()); @@ -472,6 +481,9 @@ void tst_QThread::start() void tst_QThread::terminate() { +#if defined(Q_OS_WINRT) + QSKIP("Terminate is not supported on WinRT"); +#endif Terminate_Thread thread; { QMutexLocker locker(&thread.mutex); @@ -535,6 +547,9 @@ void tst_QThread::finished() void tst_QThread::terminated() { +#if defined(Q_OS_WINRT) + QSKIP("Terminate is not supported on WinRT"); +#endif SignalRecorder recorder; Terminate_Thread thread; connect(&thread, SIGNAL(finished()), &recorder, SLOT(slot()), Qt::DirectConnection); @@ -630,6 +645,8 @@ void noop(void*) { } #if defined Q_OS_UNIX typedef pthread_t ThreadHandle; +#elif defined Q_OS_WINRT + typedef std::thread ThreadHandle; #elif defined Q_OS_WIN typedef HANDLE ThreadHandle; #endif @@ -671,6 +688,8 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data) #if defined Q_OS_UNIX const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this); Q_UNUSED(state); +#elif defined(Q_OS_WINRT) + nativeThreadHandle = std::thread(NativeThreadWrapper::runWin, this); #elif defined(Q_OS_WINCE) nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); #elif defined Q_OS_WIN @@ -690,6 +709,8 @@ void NativeThreadWrapper::join() { #if defined Q_OS_UNIX pthread_join(nativeThreadHandle, 0); +#elif defined Q_OS_WINRT + nativeThreadHandle.join(); #elif defined Q_OS_WIN WaitForSingleObject(nativeThreadHandle, INFINITE); CloseHandle(nativeThreadHandle); @@ -780,6 +801,9 @@ void tst_QThread::adoptedThreadAffinity() void tst_QThread::adoptedThreadSetPriority() { +#if defined(Q_OS_WINRT) + QSKIP("Thread priority is not supported on WinRT"); +#endif NativeThreadWrapper nativeThread; nativeThread.setWaitForStop(); @@ -857,6 +881,9 @@ void tst_QThread::adoptedThreadFinished() nativeThread.join(); QTestEventLoop::instance().enterLoop(5); +#if defined(Q_OS_WINRT) + QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); } @@ -872,6 +899,9 @@ void tst_QThread::adoptedThreadExecFinished() nativeThread.join(); QTestEventLoop::instance().enterLoop(5); +#if defined(Q_OS_WINRT) + QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); } @@ -908,6 +938,9 @@ void tst_QThread::adoptMultipleThreads() } QTestEventLoop::instance().enterLoop(5); +#if defined(Q_OS_WINRT) + QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(recorder.activationCount.load(), numThreads); } @@ -950,6 +983,9 @@ void tst_QThread::adoptMultipleThreadsOverlap() } QTestEventLoop::instance().enterLoop(5); +#if defined(Q_OS_WINRT) + QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(recorder.activationCount.load(), numThreads); } diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 4a9932798c..859cd1b36a 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -80,6 +80,7 @@ private slots: void destruction(); void threadRecycling(); void expiryTimeout(); + void expiryTimeoutRace(); #ifndef QT_NO_EXCEPTIONS void exceptions(); #endif @@ -315,7 +316,7 @@ class ExpiryTimeoutTask : public QRunnable { public: QThread *thread; - int runCount; + QAtomicInt runCount; QSemaphore semaphore; ExpiryTimeoutTask() @@ -327,7 +328,7 @@ public: void run() { thread = QThread::currentThread(); - ++runCount; + runCount.ref(); semaphore.release(); } }; @@ -346,7 +347,7 @@ void tst_QThreadPool::expiryTimeout() // run the task threadPool.start(&task); QVERIFY(task.semaphore.tryAcquire(1, 10000)); - QCOMPARE(task.runCount, 1); + QCOMPARE(task.runCount.load(), 1); QVERIFY(!task.thread->wait(100)); // thread should expire QThread *firstThread = task.thread; @@ -355,7 +356,7 @@ void tst_QThreadPool::expiryTimeout() // run task again, thread should be restarted threadPool.start(&task); QVERIFY(task.semaphore.tryAcquire(1, 10000)); - QCOMPARE(task.runCount, 2); + QCOMPARE(task.runCount.load(), 2); QVERIFY(!task.thread->wait(100)); // thread should expire again QVERIFY(task.thread->wait(10000)); @@ -368,6 +369,22 @@ void tst_QThreadPool::expiryTimeout() QCOMPARE(threadPool.expiryTimeout(), expiryTimeout); } +void tst_QThreadPool::expiryTimeoutRace() // QTBUG-3786 +{ + ExpiryTimeoutTask task; + + QThreadPool threadPool; + threadPool.setMaxThreadCount(1); + threadPool.setExpiryTimeout(50); + const int numTasks = 20; + for (int i = 0; i < numTasks; ++i) { + threadPool.start(&task); + QThread::msleep(50); // exactly the same as the expiry timeout + } + QCOMPARE(task.runCount.load(), numTasks); + QVERIFY(threadPool.waitForDone(2000)); +} + #ifndef QT_NO_EXCEPTIONS class ExceptionTask : public QRunnable { @@ -503,7 +520,8 @@ void tst_QThreadPool::setMaxThreadCountStartsAndStopsThreads() QVERIFY(task->waitForStarted.tryAcquire(6, 1000)); task->waitToFinish.release(10); -// delete task; + threadPool.waitForDone(); + delete task; } void tst_QThreadPool::reserveThread_data() diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 2072034f5f..c96de29b98 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -232,7 +232,7 @@ void tst_QThreadStorage::adoptedThreads() const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers); QCOMPARE(state, 0); pthread_join(thread, 0); -#elif defined Q_OS_WIN +#elif defined Q_OS_WIN && !defined(Q_OS_WINRT) HANDLE thread; #if defined(Q_OS_WINCE) thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL); diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index d111c53551..cbbb30a598 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -565,6 +565,9 @@ void tst_QCommandLineParser::testHelpOption() void tst_QCommandLineParser::testQuoteEscaping() { +#ifdef QT_NO_PROCESS + QSKIP("This test requires QProcess support"); +#else QCoreApplication app(empty_argc, empty_argv); QProcess process; process.start("testhelper/qcommandlineparser_test_helper", QStringList() << @@ -580,6 +583,7 @@ void tst_QCommandLineParser::testQuoteEscaping() QVERIFY2(output.contains("KEY2=\\\"VALUE2\\\""), qPrintable(output)); QVERIFY2(output.contains("QTBUG-15379=C:\\path\\'file.ext"), qPrintable(output)); QVERIFY2(output.contains("QTBUG-30628=C:\\temp\\'file'.ext"), qPrintable(output)); +#endif // !QT_NO_PROCESS } QTEST_APPLESS_MAIN(tst_QCommandLineParser) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 6c80c5ff47..7d51696fe3 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -49,6 +49,9 @@ #ifdef Q_OS_WIN # include <qt_windows.h> +# if defined(Q_OS_WINRT) +# define tzset() +# endif #endif class tst_QDateTime : public QObject @@ -175,7 +178,7 @@ void tst_QDateTime::init() { #if defined(Q_OS_WINCE) SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN32) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif } diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 028cea3d62..1bac5f39e7 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -133,7 +133,7 @@ public: private slots: void initTestCase(); void cleanupTestCase(); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void windowsDefaultLocale(); #endif #ifdef Q_OS_MAC @@ -1472,7 +1472,7 @@ void tst_QLocale::macDefaultLocale() } #endif // Q_OS_MAC -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #include <qt_windows.h> static QString getWinLocaleInfo(LCTYPE type) @@ -1526,7 +1526,7 @@ public: #endif // Q_OS_WIN -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QLocale::windowsDefaultLocale() { RestoreLocaleHelper systemLocale; diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 48874781c0..a0edc16718 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -1440,6 +1440,8 @@ void tst_QString::contains() QVERIFY(a.contains('F',Qt::CaseInsensitive)); QVERIFY(a.contains("FG")); QVERIFY(a.contains("FG",Qt::CaseInsensitive)); + QVERIFY(a.contains(QLatin1String("FG"))); + QVERIFY(a.contains(QLatin1String("fg"),Qt::CaseInsensitive)); QVERIFY(a.contains( QString(), Qt::CaseInsensitive)); QVERIFY(a.contains( "", Qt::CaseInsensitive)); QVERIFY(a.contains(QRegExp("[FG][HI]"))); @@ -3880,6 +3882,14 @@ void tst_QString::toLatin1Roundtrip() // and back: QCOMPARE(QString::fromLatin1(latin1, latin1.length()).length(), unicodedst.length()); QCOMPARE(QString::fromLatin1(latin1, latin1.length()), unicodedst); + + // try the rvalue version of toLatin1() + QString s = unicodesrc; + QCOMPARE(qMove(s).toLatin1(), latin1); + + // and verify that the moved-from object can still be used + s = "foo"; + s.clear(); } void tst_QString::stringRef_toLatin1Roundtrip_data() diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index b4f13af0a1..d81bfc33fb 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -827,7 +827,7 @@ void tst_QTimeZone::macTest() void tst_QTimeZone::winTest() { -#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) +#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Known datetimes qint64 std = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch(); qint64 dst = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch(); diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index bdd0c15788..33c301a500 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -5,7 +5,7 @@ QT += core-private gui-private testlib qtHaveModule(widgets): QT += widgets widgets-private SOURCES += tst_qpixmap.cpp -!wince* { +!wince*:!winrt { win32:LIBS += -lgdi32 -luser32 } diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index cb5d836291..79dc3f311a 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -116,7 +116,7 @@ private slots: void convertFromImageDetach(); void convertFromImageCacheKey(); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void toWinHBITMAP_data(); void toWinHBITMAP(); void fromWinHBITMAP_data(); @@ -805,7 +805,7 @@ void tst_QPixmap::convertFromImageCacheKey() QCOMPARE(copy.cacheKey(), pix.cacheKey()); } -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); @@ -1024,7 +1024,7 @@ void tst_QPixmap::fromWinHICON() #endif // Q_OS_WINCE } -#endif // Q_OS_WIN +#endif // Q_OS_WIN && !Q_OS_WINRT void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() { diff --git a/tests/auto/gui/kernel/qguivariant/test/black.png b/tests/auto/gui/kernel/qguivariant/test/black.png Binary files differnew file mode 100644 index 0000000000..6c94085ed5 --- /dev/null +++ b/tests/auto/gui/kernel/qguivariant/test/black.png diff --git a/tests/auto/gui/kernel/qguivariant/test/black2.png b/tests/auto/gui/kernel/qguivariant/test/black2.png Binary files differnew file mode 100644 index 0000000000..6c94085ed5 --- /dev/null +++ b/tests/auto/gui/kernel/qguivariant/test/black2.png diff --git a/tests/auto/gui/kernel/qguivariant/test/test.pro b/tests/auto/gui/kernel/qguivariant/test/test.pro index e3b4a350ca..c4123797d2 100644 --- a/tests/auto/gui/kernel/qguivariant/test/test.pro +++ b/tests/auto/gui/kernel/qguivariant/test/test.pro @@ -2,6 +2,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qguivariant SOURCES += tst_qguivariant.cpp +RESOURCES = tst_qguivariant.qrc INCLUDEPATH += $$PWD/../../../../other/qvariant_common QT += testlib RESOURCES += qguivariant.qrc diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 42570751fc..efc688f0b1 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -126,6 +126,8 @@ private slots: void implicitConstruction(); void guiVariantAtExit(); + + void iconEquality(); }; void tst_QGuiVariant::constructor_invalid_data() @@ -761,5 +763,32 @@ void tst_QGuiVariant::guiVariantAtExit() QVERIFY(true); } +void tst_QGuiVariant::iconEquality() +{ + QIcon i; + QVariant a = i; + QVariant b = i; + QCOMPARE(a, b); + + i = QIcon(":/black.png"); + a = i; + QVERIFY(a != b); + + b = a; + QCOMPARE(a, b); + + i = QIcon(":/black2.png"); + a = i; + QVERIFY(a != b); + + b = i; + QCOMPARE(a, b); + + // This is a "different" QIcon + // even if the contents are the same + b = QIcon(":/black2.png"); + QVERIFY(a != b); +} + QTEST_MAIN(tst_QGuiVariant) #include "tst_qguivariant.moc" diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.qrc b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.qrc new file mode 100644 index 0000000000..15cfde5788 --- /dev/null +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/"> +<file>black.png</file> +<file>black2.png</file> +</qresource> +</RCC> diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index d5ddf8fbec..53aef40df0 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -187,6 +187,9 @@ private slots: void htmlExportImportBlockCount(); void QTBUG27354_spaceAndSoftSpace(); + void baseUrl_data(); + void baseUrl(); + void QTBUG28998_linkColor(); private: @@ -2947,6 +2950,53 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace() } } +class BaseDocument : public QTextDocument +{ +public: + QUrl loadedResource() const { return resourceUrl; } + + QVariant loadResource(int type, const QUrl &name) + { + resourceUrl = name; + return QTextDocument::loadResource(type, name); + } + +private: + QUrl resourceUrl; +}; + +void tst_QTextDocument::baseUrl_data() +{ + QTest::addColumn<QUrl>("base"); + QTest::addColumn<QUrl>("resource"); + QTest::addColumn<QUrl>("loaded"); + + QTest::newRow("1") << QUrl() << QUrl("images/logo.png") << QUrl("images/logo.png"); + QTest::newRow("2") << QUrl("file:///path/to/content") << QUrl("images/logo.png") << QUrl("file:///path/to/images/logo.png"); + QTest::newRow("3") << QUrl("file:///path/to/content/") << QUrl("images/logo.png") << QUrl("file:///path/to/content/images/logo.png"); + QTest::newRow("4") << QUrl("file:///path/to/content/images") << QUrl("images/logo.png") << QUrl("file:///path/to/content/images/logo.png"); + QTest::newRow("5") << QUrl("file:///path/to/content/images/") << QUrl("images/logo.png") << QUrl("file:///path/to/content/images/images/logo.png"); + QTest::newRow("6") << QUrl("file:///path/to/content/images") << QUrl("../images/logo.png") << QUrl("file:///path/to/images/logo.png"); + QTest::newRow("7") << QUrl("file:///path/to/content/images/") << QUrl("../images/logo.png") << QUrl("file:///path/to/content/images/logo.png"); + QTest::newRow("8") << QUrl("file:///path/to/content/index.html") << QUrl("images/logo.png") << QUrl("file:///path/to/content/images/logo.png"); +} + +void tst_QTextDocument::baseUrl() +{ + QFETCH(QUrl, base); + QFETCH(QUrl, resource); + QFETCH(QUrl, loaded); + + BaseDocument document; + QVERIFY(!document.baseUrl().isValid()); + document.setBaseUrl(base); + QCOMPARE(document.baseUrl(), base); + + document.setHtml(QString("<img src='%1'/>").arg(resource.toString())); + document.resource(QTextDocument::ImageResource, resource); + QCOMPARE(document.loadedResource(), loaded); +} + void tst_QTextDocument::QTBUG28998_linkColor() { QPalette pal; diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 71af9690be..fffe663f0a 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -197,14 +197,18 @@ void tst_QFtp::initTestCase_data() QTest::addColumn<bool>("setSession"); QTest::newRow("WithoutProxy") << false << 0 << false; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy) << false; +#endif //### doesn't work well yet. //QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy); #ifndef QT_NO_BEARERMANAGEMENT QTest::newRow("WithoutProxyWithSession") << false << 0 << true; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5ProxyAndSession") << true << int(QNetworkProxy::Socks5Proxy) << true; #endif +#endif } void tst_QFtp::initTestCase() @@ -232,11 +236,16 @@ void tst_QFtp::init() QFETCH_GLOBAL(int, proxyType); QFETCH_GLOBAL(bool, setSession); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } else if (proxyType == QNetworkProxy::HttpProxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); } +#else // !QT_NO_NETWORKPROXY + Q_UNUSED(proxyType); + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #ifndef QT_NO_BEARERMANAGEMENT if (setSession) { @@ -293,7 +302,11 @@ void tst_QFtp::cleanup() } QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#else + QSKIP("No proxy support"); +#endif } delete ftp; @@ -749,14 +762,14 @@ void tst_QFtp::put() QFETCH( QByteArray, fileData ); QFETCH( bool, useIODevice ); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(QT_NO_NETWORKPROXY) QFETCH_GLOBAL(bool, setProxy); if (setProxy) { QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 the put() test takes too long time on Windows."); } -#endif +#endif // OS_WIN && !QT_NO_NETWORKPROXY const int timestep = 50; diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 4ee4b67ec0..bcfe9f090f 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -211,6 +211,17 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data() result += cookie; QTest::newRow("effective-tld2-accepted") << preset << cookie << "http://www.gobiernoelectronico.ar" << result << true; + result.clear(); + preset.clear(); + cookie.setDomain("127.0.0.1"); + result += cookie; + QTest::newRow("IPv4-address-as-domain") << preset << cookie << "http://127.0.0.1/" << result << true; + + result.clear(); + preset.clear(); + cookie.setDomain("fe80::250:56ff:fec0:1"); + result += cookie; + QTest::newRow("IPv6-address-as-domain") << preset << cookie << "http://[fe80::250:56ff:fec0:1]/" << result << true; // setting the defaults: finalCookie = cookie; diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 1837e8d665..b35c934680 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -97,7 +97,9 @@ Q_DECLARE_METATYPE(QSharedPointer<char>) #include "../../../network-settings.h" Q_DECLARE_METATYPE(QAuthenticator*) +#ifndef QT_NO_NETWORKPROXY Q_DECLARE_METATYPE(QNetworkProxyQuery) +#endif typedef QSharedPointer<QNetworkReply> QNetworkReplyPtr; @@ -106,6 +108,7 @@ class tst_QNetworkReply: public QObject { Q_OBJECT +#ifndef QT_NO_NETWORKPROXY struct ProxyData { ProxyData(const QNetworkProxy &p, const QByteArray &t, bool auth) : tag(t), proxy(p), requiresAuthentication(auth) @@ -114,6 +117,7 @@ class tst_QNetworkReply: public QObject QNetworkProxy proxy; bool requiresAuthentication; }; +#endif // !QT_NO_NETWORKPROXY static bool seedCreated; static QString createUniqueExtension() { @@ -134,7 +138,9 @@ class tst_QNetworkReply: public QObject QString wronlyFileName; #endif QString uniqueExtension; +#ifndef QT_NO_NETWORKPROXY QList<ProxyData> proxies; +#endif QNetworkAccessManager manager; MyCookieJar *cookieJar; #ifndef QT_NO_SSL @@ -203,8 +209,10 @@ private Q_SLOTS: void getFromHttp(); void getErrors_data(); void getErrors(); +#ifndef QT_NO_NETWORKPROXY void headFromHttp_data(); void headFromHttp(); +#endif // !QT_NO_NETWORKPROXY void putToFile_data(); void putToFile(); void putToFtp_data(); @@ -261,9 +269,11 @@ private Q_SLOTS: void ioGetFromHttpWithAuth_data(); void ioGetFromHttpWithAuth(); void ioGetFromHttpWithAuthSynchronous(); +#ifndef QT_NO_NETWORKPROXY void ioGetFromHttpWithProxyAuth(); void ioGetFromHttpWithProxyAuthSynchronous(); void ioGetFromHttpWithSocksProxy(); +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL void ioGetFromHttpsWithSslErrors(); void ioGetFromHttpsWithIgnoreSslErrors(); @@ -278,8 +288,10 @@ private Q_SLOTS: void ioGetFromHttpWithCache_data(); void ioGetFromHttpWithCache(); +#ifndef QT_NO_NETWORKPROXY void ioGetWithManyProxies_data(); void ioGetWithManyProxies(); +#endif // !QT_NO_NETWORKPROXY void ioPutToFileFromFile_data(); void ioPutToFileFromFile(); @@ -297,10 +309,12 @@ private Q_SLOTS: void ioPutToHttpFromFile(); void ioPostToHttpFromFile_data(); void ioPostToHttpFromFile(); +#ifndef QT_NO_NETWORKPROXY void ioPostToHttpFromSocket_data(); void ioPostToHttpFromSocket(); void ioPostToHttpFromSocketSynchronous(); void ioPostToHttpFromSocketSynchronous_data(); +#endif // !QT_NO_NETWORKPROXY void ioPostToHttpFromMiddleOfFileToEnd(); void ioPostToHttpFromMiddleOfFileFiveBytes(); void ioPostToHttpFromMiddleOfQBufferFiveBytes(); @@ -339,11 +353,13 @@ private Q_SLOTS: void nestedEventLoops(); +#ifndef QT_NO_NETWORKPROXY void httpProxyCommands_data(); void httpProxyCommands(); void httpProxyCommandsSynchronous_data(); void httpProxyCommandsSynchronous(); void proxyChange(); +#endif // !QT_NO_NETWORKPROXY void authorizationError_data(); void authorizationError(); @@ -419,9 +435,11 @@ private Q_SLOTS: void dontInsertPartialContentIntoTheCache(); void httpUserAgent(); +#ifndef QT_NO_NETWORKPROXY void authenticationCacheAfterCancel_data(); void authenticationCacheAfterCancel(); void authenticationWithDifferentRealm(); +#endif // !QT_NO_NETWORKPROXY void synchronousAuthenticationCache(); void pipelining(); @@ -638,6 +656,7 @@ public: { QNetworkCookieJar::setAllCookies(cookieList); } }; +#ifndef QT_NO_NETWORKPROXY class MyProxyFactory: public QNetworkProxyFactory { public: @@ -660,6 +679,7 @@ public: return toReturn; } }; +#endif // !QT_NO_NETWORKPROXY class MyMemoryCache: public QAbstractNetworkCache { @@ -1154,7 +1174,9 @@ tst_QNetworkReply::tst_QNetworkReply() { qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy qRegisterMetaType<QAuthenticator *>(); +#ifndef QT_NO_NETWORKPROXY qRegisterMetaType<QNetworkProxy>(); +#endif #ifndef QT_NO_SSL qRegisterMetaType<QList<QSslError> >(); #endif @@ -1165,6 +1187,7 @@ tst_QNetworkReply::tst_QNetworkReply() cookieJar = new MyCookieJar; manager.setCookieJar(cookieJar); +#ifndef QT_NO_NETWORKPROXY QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName()); proxies << ProxyData(QNetworkProxy::NoProxy, "", false); @@ -1178,10 +1201,13 @@ tst_QNetworkReply::tst_QNetworkReply() << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080), "+socks", false) << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1081), "+socksauth", true); } else { +#endif // !QT_NO_NETWORKPROXY printf("==================================================================\n"); printf("Proxy could not be looked up. No proxy will be used while testing!\n"); printf("==================================================================\n"); +#ifndef QT_NO_NETWORKPROXY } +#endif // !QT_NO_NETWORKPROXY } tst_QNetworkReply::~tst_QNetworkReply() @@ -1438,7 +1464,9 @@ void tst_QNetworkReply::cleanup() // clear the internal cache manager.clearAccessCache(); +#ifndef QT_NO_NETWORKPROXY manager.setProxy(QNetworkProxy()); +#endif manager.setCache(0); // clear cookies @@ -1732,6 +1760,7 @@ void tst_QNetworkReply::getFromHttp() QCOMPARE(reply->readAll(), reference.readAll()); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::headFromHttp_data() { QTest::addColumn<qint64>("referenceSize"); @@ -1790,6 +1819,7 @@ void tst_QNetworkReply::headFromHttp() if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toString(), contentType); } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::getErrors_data() { @@ -3270,6 +3300,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous() QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 401); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() { // This test sends three requests @@ -3432,6 +3463,7 @@ void tst_QNetworkReply::ioGetFromHttpWithSocksProxy() QCOMPARE(authspy.count(), 0); } } +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL void tst_QNetworkReply::ioGetFromHttpsWithSslErrors() @@ -3793,6 +3825,7 @@ void tst_QNetworkReply::ioGetFromHttpWithCache() QCOMPARE(reply->readAll().constData(), qPrintable(body)); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioGetWithManyProxies_data() { QTest::addColumn<QList<QNetworkProxy> >("proxyList"); @@ -4054,6 +4087,7 @@ void tst_QNetworkReply::ioGetWithManyProxies() QCOMPARE(authspy.count(), 0); } } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::ioPutToFileFromFile_data() { @@ -4346,6 +4380,7 @@ void tst_QNetworkReply::ioPostToHttpFromFile() QCOMPARE(reply->readAll().trimmed(), md5sum(sourceFile.readAll()).toHex()); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioPostToHttpFromSocket_data() { QTest::addColumn<QByteArray>("data"); @@ -4496,6 +4531,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous() QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); } +#endif // !QT_NO_NETWORKPROXY // this tests checks if rewinding the POST-data to some place in the middle // worked. @@ -5410,6 +5446,7 @@ void tst_QNetworkReply::nestedEventLoops() QCOMPARE(errorspy.count(), 0); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::httpProxyCommands_data() { QTest::addColumn<QUrl>("url"); @@ -5485,6 +5522,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous_data() { httpProxyCommands_data(); } +#endif // !QT_NO_NETWORKPROXY struct QThreadCleanup { @@ -5506,6 +5544,7 @@ struct QDeleteLaterCleanup } }; +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::httpProxyCommandsSynchronous() { QFETCH(QUrl, url); @@ -5586,6 +5625,7 @@ void tst_QNetworkReply::proxyChange() QVERIFY(int(reply3->error()) > 0); } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::authorizationError_data() { @@ -6502,6 +6542,7 @@ void tst_QNetworkReply::qtbug4121unknownAuthentication() QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::authenticationCacheAfterCancel_data() { QTest::addColumn<QNetworkProxy>("proxy"); @@ -6716,6 +6757,7 @@ void tst_QNetworkReply::authenticationWithDifferentRealm() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::NoError); } +#endif // !QT_NO_NETWORKPROXY class QtBug13431Helper : public QObject { Q_OBJECT diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro index 14080a0548..8594ad5932 100644 --- a/tests/auto/network/kernel/kernel.pro +++ b/tests/auto/network/kernel/kernel.pro @@ -10,6 +10,10 @@ SUBDIRS=\ qnetworkaddressentry \ qhostaddress \ +winrt: SUBDIRS -= \ + qnetworkproxy \ + qnetworkproxyfactory \ + !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qauthenticator \ qhostinfo \ diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index dd9202c748..c4d42206fe 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -50,6 +50,9 @@ #include <qdatastream.h> #ifdef Q_OS_WIN # include <qt_windows.h> +# if defined(Q_OS_WINRT) +# include <winsock2.h> +# endif #endif class tst_QHostAddress : public QObject @@ -336,12 +339,15 @@ void tst_QHostAddress::assignment() address = "::1"; QCOMPARE(address, QHostAddress("::1")); + // WinRT does not support sockaddr_in +#ifndef Q_OS_WINRT QHostAddress addr("4.2.2.1"); sockaddr_in sockAddr; sockAddr.sin_family = AF_INET; sockAddr.sin_addr.s_addr = htonl(addr.toIPv4Address()); address.setAddress((sockaddr *)&sockAddr); QCOMPARE(address, addr); +#endif // !Q_OS_WINRT } void tst_QHostAddress::scopeId() diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index e81c7f71db..e3156ceb3f 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -67,7 +67,7 @@ #include <time.h> #include <qlibrary.h> -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include <windows.h> #else #include <unistd.h> diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index f474f97f5d..35028735e2 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -64,7 +64,11 @@ #define PLATFORMSOCKETENGINE QNativeSocketEngine #define PLATFORMSOCKETENGINESTRING "QNativeSocketEngine" -#include <private/qnativesocketengine_p.h> +#ifndef Q_OS_WINRT +# include <private/qnativesocketengine_p.h> +#else +# include <private/qnativesocketengine_winrt_p.h> +#endif #include <qstringlist.h> @@ -97,7 +101,9 @@ private slots: void networkError(); void setSocketDescriptor(); void invalidSend(); +#ifndef Q_OS_WINRT void receiveUrgentData(); +#endif void tooManySockets(); }; @@ -608,7 +614,9 @@ void tst_PlatformSocketEngine::networkError() QVERIFY(client.state() == QAbstractSocket::ConnectedState); // An unexpected network error! -#ifdef Q_OS_WIN +#ifdef Q_OS_WINRT + client.close(); +#elif defined(Q_OS_WIN) // could use shutdown to produce different errors ::closesocket(client.socketDescriptor()); #else @@ -641,6 +649,7 @@ void tst_PlatformSocketEngine::invalidSend() } //--------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_PlatformSocketEngine::receiveUrgentData() { PLATFORMSOCKETENGINE server; @@ -703,6 +712,7 @@ void tst_PlatformSocketEngine::receiveUrgentData() QCOMPARE(response.at(0), msg); #endif } +#endif // !Q_OS_WINRT QTEST_MAIN(tst_PlatformSocketEngine) #include "tst_platformsocketengine.moc" diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 9887acf7dd..6053021cf4 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -1026,7 +1026,7 @@ void tst_QLocalSocket::writeToClientAndDisconnect() void tst_QLocalSocket::debug() { // Make sure this compiles - QTest::ignoreMessage(QtDebugMsg, "QLocalSocket::ConnectionRefusedError QLocalSocket::UnconnectedState "); + QTest::ignoreMessage(QtDebugMsg, "QLocalSocket::ConnectionRefusedError QLocalSocket::UnconnectedState"); qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState; } diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index d838b463f7..10b41ced9e 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -100,16 +100,20 @@ private slots: void maxPendingConnections(); void listenError(); void waitForConnectionTest(); +#ifndef Q_OS_WINRT void setSocketDescriptor(); +#endif void listenWhileListening(); #ifndef QT_NO_PROCESS void addressReusable(); #endif void setNewSocketDescriptorBlocking(); +#ifndef QT_NO_NETWORKPROXY void invalidProxy_data(); void invalidProxy(); void proxyFactory_data(); void proxyFactory(); +#endif // !QT_NO_NETWORKPROXY void qtbug14268_peek(); @@ -158,7 +162,9 @@ void tst_QTcpServer::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif crashingServerDir = QFINDTESTDATA("crashingServer"); QVERIFY2(!crashingServerDir.isEmpty(), qPrintable( @@ -181,16 +187,22 @@ void tst_QTcpServer::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } } void tst_QTcpServer::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } //---------------------------------------------------------------------------------- @@ -369,9 +381,13 @@ void tst_QTcpServer::maxPendingConnections() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 only 1 connection is allowed ever"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } //### sees to fail sometimes ... a timing issue with the test on windows QTcpServer server; @@ -407,9 +423,13 @@ void tst_QTcpServer::listenError() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 we can not make hard requirements on the address or port"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif //QT_NO_NETWORKPROXY } QTcpServer server; QVERIFY(!server.listen(QHostAddress("1.2.3.4"), 0)); @@ -453,9 +473,13 @@ void tst_QTcpServer::waitForConnectionTest() QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("Localhost servers don't work well with SOCKS5"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } QTcpSocket findLocalIpSocket; @@ -481,6 +505,7 @@ void tst_QTcpServer::waitForConnectionTest() } //---------------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_QTcpServer::setSocketDescriptor() { QTcpServer server; @@ -510,6 +535,7 @@ void tst_QTcpServer::setSocketDescriptor() WSACleanup(); #endif } +#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- void tst_QTcpServer::listenWhileListening() @@ -531,6 +557,7 @@ public: bool ok; protected: +#ifndef Q_OS_WINRT void incomingConnection(qintptr socketDescriptor) { // how a user woulddo it (qabstractsocketengine is not public) @@ -543,6 +570,7 @@ protected: ::close(socketDescriptor); #endif } +#endif // !Q_OS_WINRT }; #ifndef QT_NO_PROCESS @@ -550,9 +578,13 @@ void tst_QTcpServer::addressReusable() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 this test does not make senans at the momment"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #if defined(Q_OS_WINCE) QString signalName = QString::fromLatin1("/test_signal.txt"); @@ -596,9 +628,13 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 we can not make the socket descripter blocking"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } SeverWithBlockingSockets server; QVERIFY(server.listen()); @@ -609,6 +645,7 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking() QVERIFY(server.ok); } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpServer::invalidProxy_data() { QTest::addColumn<int>("type"); @@ -763,6 +800,7 @@ void tst_QTcpServer::proxyFactory() // Sometimes, error codes change for the better QTEST(int(server.serverError()), "expectedError"); } +#endif // !QT_NO_NETWORKPROXY class Qtbug14268Helper : public QObject { diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index b6df536b98..f4eac0d6b8 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -132,7 +132,9 @@ private slots: void bind_data(); void bind(); void setInvalidSocketDescriptor(); +#ifndef Q_OS_WINRT void setSocketDescriptor(); +#endif void socketDescriptor(); void blockingIMAP(); void nonBlockingIMAP(); @@ -191,10 +193,12 @@ private slots: void taskQtBug5799ConnectionErrorEventLoop(); void taskQtBug7054TimeoutErrorResetting(); +#ifndef QT_NO_NETWORKPROXY void invalidProxy_data(); void invalidProxy(); void proxyFactory_data(); void proxyFactory(); +#endif // !QT_NO_NETWORKPROXY void qtbug14268_peek(); @@ -216,7 +220,9 @@ protected slots: void hostLookupSlot(); void abortiveClose_abortSlot(); void remoteCloseErrorSlot(); +#ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); +#endif void earlySocketBytesSent(qint64 bytes); void earlySocketReadyRead(); @@ -354,6 +360,7 @@ void tst_QTcpSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); QList<QHostAddress> addresses = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses(); QVERIFY2(addresses.count() > 0, "failed to get ip address for test server"); @@ -382,6 +389,9 @@ void tst_QTcpSocket::init() break; } QNetworkProxy::setApplicationProxy(proxy); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } qt_qhostinfo_clear_cache(); @@ -406,15 +416,19 @@ QTcpSocket *tst_QTcpSocket::newSocket() const void tst_QTcpSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { ++proxyAuthCalled; auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY //---------------------------------------------------------------------------------- @@ -552,6 +566,7 @@ void tst_QTcpSocket::setInvalidSocketDescriptor() //---------------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_QTcpSocket::setSocketDescriptor() { QFETCH_GLOBAL(bool, setProxy); @@ -596,6 +611,7 @@ void tst_QTcpSocket::setSocketDescriptor() delete dummy; #endif } +#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- @@ -1546,7 +1562,9 @@ void tst_QTcpSocket::synchronousApi() void tst_QTcpSocket::dontCloseOnTimeout() { QTcpServer server; +#ifndef QT_NO_NETWORKPROXY server.setProxy(QNetworkProxy(QNetworkProxy::NoProxy)); +#endif QVERIFY(server.listen()); QHostAddress serverAddress = QHostAddress::LocalHost; @@ -1673,11 +1691,13 @@ private slots: { quit(); } +#ifndef QT_NO_NETWORKPROXY inline void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY private: int exitCode; QTcpSocket *socket; @@ -1970,11 +1990,13 @@ public slots: tst_QTcpSocket::exitLoop(); } +#ifndef QT_NO_NETWORKPROXY inline void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY }; //---------------------------------------------------------------------------------- @@ -2500,6 +2522,7 @@ void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting() QVERIFY(socket->error() == QAbstractSocket::RemoteHostClosedError); } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpSocket::invalidProxy_data() { QTest::addColumn<int>("type"); @@ -2676,6 +2699,7 @@ void tst_QTcpSocket::proxyFactory() delete socket; } +#endif // !QT_NO_NETWORKPROXY // there is a similar test inside tst_qtcpserver that uses the event loop instead void tst_QTcpSocket::qtbug14268_peek() diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index f08afaa9a5..f3cae6f4eb 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -162,8 +162,10 @@ void tst_QUdpSocket::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_SOCKS5 if (!newTestServer) QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); @@ -186,16 +188,22 @@ void tst_QUdpSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_SOCKS5 QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else + QSKIP("No proxy support"); +#endif // !QT_NO_SOCKS5 } } void tst_QUdpSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif // !QT_NO_NETWORKPROXY } @@ -265,9 +273,13 @@ void tst_QUdpSocket::broadcasting() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 Broadcast is not supported."); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #ifdef Q_OS_AIX QSKIP("Broadcast does not work on darko"); @@ -761,9 +773,13 @@ void tst_QUdpSocket::bindMode() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 explicit port binding is not supported."); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } QUdpSocket socket; diff --git a/tests/auto/network/socket/socket.pro b/tests/auto/network/socket/socket.pro index 6d86eab209..436ebe5c7f 100644 --- a/tests/auto/network/socket/socket.pro +++ b/tests/auto/network/socket/socket.pro @@ -14,3 +14,7 @@ SUBDIRS=\ qtcpsocket \ qhttpsocketengine \ qsocks5socketengine \ + +winrt: SUBDIRS -= \ + qhttpsocketengine \ + qsocks5socketengine \ diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index a15daf660a..82543fbc91 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -111,7 +111,9 @@ public slots: void initTestCase(); void init(); void cleanup(); +#ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); +#endif #ifndef QT_NO_SSL private slots: @@ -276,6 +278,7 @@ void tst_QSslSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); QNetworkProxy proxy; @@ -302,6 +305,9 @@ void tst_QSslSocket::init() break; } QNetworkProxy::setApplicationProxy(proxy); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } qt_qhostinfo_clear_cache(); @@ -309,7 +315,9 @@ void tst_QSslSocket::init() void tst_QSslSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } #ifndef QT_NO_SSL @@ -326,12 +334,14 @@ QSslSocketPtr tst_QSslSocket::newSocket() } #endif +#ifndef QT_NO_NETWORKPROXY void tst_QSslSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { ++proxyAuthCalled; auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro index 06f4a05241..0b8f269fac 100644 --- a/tests/auto/network/ssl/ssl.pro +++ b/tests/auto/network/ssl/ssl.pro @@ -12,3 +12,7 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked): qsslsocket_onDemandCertificates_member \ qsslsocket_onDemandCertificates_static \ } + +winrt: SUBDIRS -= \ + qsslsocket_onDemandCertificates_member \ + qsslsocket_onDemandCertificates_static \ diff --git a/tests/auto/other/d3dcompiler/d3dcompiler.pro b/tests/auto/other/d3dcompiler/d3dcompiler.pro new file mode 100644 index 0000000000..6242d0a554 --- /dev/null +++ b/tests/auto/other/d3dcompiler/d3dcompiler.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_d3dcompiler +QT = core testlib + +SOURCES = tst_d3dcompiler.cpp diff --git a/tests/auto/other/d3dcompiler/tst_d3dcompiler.cpp b/tests/auto/other/d3dcompiler/tst_d3dcompiler.cpp new file mode 100644 index 0000000000..1a3f4f4592 --- /dev/null +++ b/tests/auto/other/d3dcompiler/tst_d3dcompiler.cpp @@ -0,0 +1,358 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This test verifies the behavior of d3dcompiler_qt, which is only built when ANGLE is enabled + +#include <QCryptographicHash> +#include <QDir> +#include <QFuture> +#include <QObject> +#include <QStandardPaths> +#include <QTemporaryDir> +#include <QTest> +#include <QThread> + +#if defined(Q_OS_WIN) + +#include <d3dcommon.h> + +#ifndef Q_OS_WINRT +#define loadLibrary(library) LoadLibrary(library) +#else +#define loadLibrary(library) LoadPackagedLibrary(library, NULL) +#endif + +#ifdef D3DCOMPILER_DLL +#undef D3DCOMPILER_DLL +#endif + +#ifdef QT_NO_DEBUG +#define D3DCOMPILER_DLL L"d3dcompiler_qt" +#else +#define D3DCOMPILER_DLL L"d3dcompiler_qtd" +#endif + +#define getCompilerFunc(dll) reinterpret_cast<D3DCompileFunc>(GetProcAddress(dll, "D3DCompile")) + +typedef HRESULT (WINAPI *D3DCompileFunc)(const void *data, SIZE_T data_size, const char *filename, + const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, + const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages); + +static const wchar_t *compilerDlls[] = { + L"d3dcompiler_47.dll", + L"d3dcompiler_46.dll", + L"d3dcompiler_45.dll", + L"d3dcompiler_44.dll", + L"d3dcompiler_43.dll", + 0 +}; + +static const char hlsl[] = + "uniform SamplerState Sampler : register(s0);\n" + "uniform Texture2D Texture : register(t0);\n" + "float4 main(in float4 gl_Position : SV_POSITION, in float2 coord : TEXCOORD0) : SV_TARGET0\n" + "{\n" + "return Texture.Sample(Sampler, coord);\n" + "}\n"; + +static inline QByteArray blobToByteArray(ID3DBlob *blob) +{ + return blob ? QByteArray::fromRawData(reinterpret_cast<const char *>(blob->GetBufferPointer()), blob->GetBufferSize()) : QByteArray(); +} + +class CompileRunner : public QThread +{ +public: + CompileRunner(D3DCompileFunc d3dCompile, const QByteArray &data, ID3DBlob **shader, ID3DBlob **error) + : m_d3dCompile(d3dCompile), m_data(data), m_shader(shader), m_error(error) + { + } + + HRESULT result() const + { + return m_result; + } + +private: + void run() + { + m_result = m_d3dCompile(m_data.constData(), m_data.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, m_shader, m_error); + } + + HRESULT m_result; + D3DCompileFunc m_d3dCompile; + QByteArray m_data; + ID3DBlob **m_shader; + ID3DBlob **m_error; +}; + +class tst_d3dcompiler : public QObject +{ + Q_OBJECT +private slots: + void initTestCase(); + void init(); + void cleanup(); + void service_data(); + void service(); + void offlineCompile(); + void onlineCompile(); + +private: + QString blobPath(); + + HMODULE d3dcompiler_qt; + HMODULE d3dcompiler_win; + + D3DCompileFunc d3dCompile; + + QTemporaryDir tempDir; +}; + +QString tst_d3dcompiler::blobPath() +{ + QDir path; + if (qEnvironmentVariableIsSet("QT_D3DCOMPILER_DIR")) + path.setPath(qgetenv("QT_D3DCOMPILER_DIR")); + else + path.setPath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + + path.mkdir(QStringLiteral("d3dcompiler")); + + return path.absoluteFilePath(QStringLiteral("d3dcompiler/")); +} + +void tst_d3dcompiler::initTestCase() +{ + QVERIFY(tempDir.isValid()); +} + +void tst_d3dcompiler::init() +{ + qunsetenv("QT_D3DCOMPILER_DIR"); + qunsetenv("QT_D3DCOMPILER_TIMEOUT"); +} + +void tst_d3dcompiler::cleanup() +{ + FreeLibrary(d3dcompiler_qt); + FreeLibrary(d3dcompiler_win); + + QDir path(blobPath()); + path.removeRecursively(); +} + +void tst_d3dcompiler::service_data() +{ + QTest::addColumn<QByteArray>("compilerDir"); + QTest::addColumn<bool>("exists"); + QTest::addColumn<HRESULT>("result"); + + // Don't test the default case, as it would clutter the AppData directory + //QTest::newRow("default") << QByteArrayLiteral("") << true << E_ABORT; + QTest::newRow("temporary") << tempDir.path().toUtf8() << true << E_ABORT; + QTest::newRow("invalid") << QByteArrayLiteral("ZZ:\\") << false << S_OK; +} + +void tst_d3dcompiler::service() +{ + QFETCH(QByteArray, compilerDir); + QFETCH(bool, exists); + QFETCH(HRESULT, result); + qputenv("QT_D3DCOMPILER_DIR", compilerDir); + const QDir path = blobPath(); + + if (exists) { + // Activate service + QVERIFY(path.exists()); + + QFile control(path.absoluteFilePath(QStringLiteral("control"))); + QVERIFY(control.open(QFile::WriteOnly)); + control.close(); + QVERIFY(control.exists()); + } else { + QVERIFY(!path.exists()); + } + + // Run compiler (fast fail) + d3dcompiler_qt = loadLibrary(D3DCOMPILER_DLL); + QVERIFY(d3dcompiler_qt); + d3dCompile = getCompilerFunc(d3dcompiler_qt); + QVERIFY(d3dCompile); + + qputenv("QT_D3DCOMPILER_TIMEOUT", "1"); + const QByteArray data(hlsl); + ID3DBlob *shader = 0, *errorMessage = 0; + HRESULT hr = d3dCompile(data.constData(), data.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, &shader, &errorMessage); + QVERIFY2(hr == result, blobToByteArray(errorMessage)); + + // Check that passthrough works + if (hr == S_OK) { + for (int i = 0; compilerDlls[i]; ++i) { + d3dcompiler_win = loadLibrary(compilerDlls[i]); + if (d3dcompiler_win) + break; + } + QVERIFY(d3dcompiler_win); + d3dCompile = getCompilerFunc(d3dcompiler_win); + QVERIFY(d3dCompile); + + // Compile a shader to compare with + ID3DBlob *reference = 0; + HRESULT hr = d3dCompile(data.constData(), data.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, &reference, &errorMessage); + QVERIFY2(SUCCEEDED(hr), blobToByteArray(errorMessage)); + + QByteArray shaderData(reinterpret_cast<const char *>(shader->GetBufferPointer()), shader->GetBufferSize()); + QByteArray referenceData(reinterpret_cast<const char *>(reference->GetBufferPointer()), reference->GetBufferSize()); + reference->Release(); + QCOMPARE(shaderData, referenceData); + } else { + QVERIFY(FAILED(hr)); + } + + if (shader) + shader->Release(); +} + +void tst_d3dcompiler::offlineCompile() +{ + for (int i = 0; compilerDlls[i]; ++i) { + d3dcompiler_win = loadLibrary(compilerDlls[i]); + if (d3dcompiler_win) + break; + } + QVERIFY(d3dcompiler_win); + d3dCompile = getCompilerFunc(d3dcompiler_win); + QVERIFY(d3dCompile); + + // Compile a shader to place in binary directory + const QByteArray data(hlsl); + ID3DBlob *shader = 0, *errorMessage = 0; + HRESULT hr = d3dCompile(data.constData(), data.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, &shader, &errorMessage); + QVERIFY2(SUCCEEDED(hr), blobToByteArray(errorMessage)); + QVERIFY(shader); + + QDir outputPath(blobPath()); + QVERIFY(outputPath.mkpath(QStringLiteral("binary"))); + outputPath.cd(QStringLiteral("binary")); + QFile output(outputPath.absoluteFilePath(QCryptographicHash::hash(data, QCryptographicHash::Sha1).toHex())); + QVERIFY(output.open(QFile::WriteOnly)); + output.write(reinterpret_cast<const char *>(shader->GetBufferPointer()), shader->GetBufferSize()); + shader->Release(); + + // Run compiler + d3dcompiler_qt = loadLibrary(D3DCOMPILER_DLL); + QVERIFY(d3dcompiler_qt); + d3dCompile = getCompilerFunc(d3dcompiler_qt); + QVERIFY(d3dCompile); + + hr = d3dCompile(data.constData(), data.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, &shader, &errorMessage); + // Returns S_FALSE if a cached shader was found + QVERIFY2(hr == S_FALSE, blobToByteArray(errorMessage)); +} + +void tst_d3dcompiler::onlineCompile() +{ + QByteArray data(hlsl); + + const QDir path = blobPath(); + + // Activate service + QVERIFY(path.exists()); + QFile control(path.absoluteFilePath(QStringLiteral("control"))); + QVERIFY(control.open(QFile::WriteOnly)); + control.close(); + QVERIFY(control.exists()); + + d3dcompiler_qt = loadLibrary(D3DCOMPILER_DLL); + QVERIFY(d3dcompiler_qt); + D3DCompileFunc concurrentCompile = getCompilerFunc(d3dcompiler_qt); + QVERIFY(d3dCompile); + + // Run async + ID3DBlob *shader = 0, *errorMessage = 0; + CompileRunner runner(concurrentCompile, data, &shader, &errorMessage); + runner.start(); + + // Wait for source to appear + QVERIFY(path.mkpath(QStringLiteral("source"))); + QVERIFY(path.mkpath(QStringLiteral("binary"))); + + const QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Sha1).toHex(); + QFile input(path.absoluteFilePath(QStringLiteral("source/") + hash)); + QTRY_VERIFY_WITH_TIMEOUT(input.exists(), 3000); + QTRY_VERIFY_WITH_TIMEOUT(input.isOpen() || input.open(QFile::ReadOnly), 1000); + + // Compile passed source + const QByteArray inputData = input.readAll(); + for (int i = 0; compilerDlls[i]; ++i) { + d3dcompiler_win = loadLibrary(compilerDlls[i]); + if (d3dcompiler_win) + break; + } + QVERIFY(d3dcompiler_win); + d3dCompile = getCompilerFunc(d3dcompiler_win); + QVERIFY(d3dCompile); + ID3DBlob *reference = 0, *errorMessage2 = 0; + HRESULT hr = d3dCompile(inputData.constData(), inputData.size(), 0, 0, 0, "main", "ps_4_0", 0, 0, &reference, &errorMessage2); + QVERIFY2(SUCCEEDED(hr), blobToByteArray(errorMessage2)); + const QByteArray referenceData(reinterpret_cast<const char *>(reference->GetBufferPointer()), reference->GetBufferSize()); + reference->Release(); + + // Write to output directory + QFile output(path.absoluteFilePath(QStringLiteral("binary/") + hash)); + QVERIFY(output.open(QFile::WriteOnly)); + output.write(referenceData); + output.close(); + + // All done + QVERIFY(runner.wait(3000)); + hr = runner.result(); + QVERIFY2(hr == S_FALSE, blobToByteArray(errorMessage2)); + const QByteArray resultData(reinterpret_cast<const char *>(shader->GetBufferPointer()), shader->GetBufferSize()); + shader->Release(); + QVERIFY(referenceData == resultData); +} + +QTEST_MAIN(tst_d3dcompiler) +#include "tst_d3dcompiler.moc" + +#endif // Q_OS_WIN diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 63cbca539d..2bddc8d127 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -4,6 +4,7 @@ SUBDIRS=\ baselineexample \ collections \ compiler \ + d3dcompiler \ gestures \ headersclean \ lancelot \ @@ -57,6 +58,8 @@ cross_compile: SUBDIRS -= \ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility +!angle_d3d11: SUBDIRS -= d3dcompiler + !contains(QT_CONFIG, accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux !mac: SUBDIRS -= \ diff --git a/tests/auto/other/qvariant_common/tst_qvariant_common.h b/tests/auto/other/qvariant_common/tst_qvariant_common.h index fc3eff4b91..7a34d7b0c2 100644 --- a/tests/auto/other/qvariant_common/tst_qvariant_common.h +++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h @@ -107,7 +107,7 @@ protected: currentName.chop(1); ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0")); } - ok &= msg.endsWith(") "); + ok &= msg.endsWith(")"); QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData()); } diff --git a/tests/auto/printsupport/dialogs/dialogs.pro b/tests/auto/printsupport/dialogs/dialogs.pro new file mode 100644 index 0000000000..419bd13ccf --- /dev/null +++ b/tests/auto/printsupport/dialogs/dialogs.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qabstractprintdialog \ diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore b/tests/auto/printsupport/dialogs/qabstractprintdialog/.gitignore index a768494da5..a768494da5 100644 --- a/tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore +++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/.gitignore diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro b/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro index 2e9ae33592..2e9ae33592 100644 --- a/tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro +++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp index c79a4a97ef..c79a4a97ef 100644 --- a/tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp +++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp diff --git a/tests/auto/printsupport/printsupport.pro b/tests/auto/printsupport/printsupport.pro index 69ba296738..062f46980a 100644 --- a/tests/auto/printsupport/printsupport.pro +++ b/tests/auto/printsupport/printsupport.pro @@ -1,3 +1,4 @@ TEMPLATE=subdirs SUBDIRS=\ + dialogs \ kernel \ diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index f87493205f..69ecbcb019 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -55,11 +55,14 @@ #include <QtSql/private/qsqldriver_p.h> #include <QtTest/QtTest> -#if defined (Q_OS_WIN) || defined (Q_OS_WIN32) +#if defined(Q_OS_WIN) # include <qt_windows.h> -# if defined (Q_OS_WINCE) +# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) # include <winsock2.h> # endif +# if defined(Q_OS_WINRT) && !defined(Q_OS_WINPHONE) +static inline int gethostname(char *name, int len) { qstrcpy(name, "localhost"); return 9; } +# endif #else #include <unistd.h> #endif diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 1a100ce706..b74e02bcc4 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -1384,7 +1384,9 @@ void tst_QSqlQuery::isNull() QVERIFY_SQL(q, exec("select id, t_varchar from " + qTableName("qtest_null", __FILE__, db) + " order by id")); QVERIFY( q.next() ); QVERIFY( !q.isNull( 0 ) ); + QVERIFY(!q.isNull("id")); QVERIFY( q.isNull( 1 ) ); + QVERIFY(q.isNull("t_varchar")); QCOMPARE( q.value( 0 ).toInt(), 0 ); QCOMPARE( q.value( 1 ).toString(), QString() ); QVERIFY( !q.value( 0 ).isNull() ); @@ -1392,7 +1394,13 @@ void tst_QSqlQuery::isNull() QVERIFY( q.next() ); QVERIFY( !q.isNull( 0 ) ); + QVERIFY(!q.isNull("id")); QVERIFY( !q.isNull( 1 ) ); + QVERIFY(!q.isNull("t_varchar")); + + // For a non existent field, it should be returning true. + QVERIFY(q.isNull(2)); + QVERIFY(q.isNull("unknown")); } /*! TDS specific BIT field test */ diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index 067c2a9f4f..3b73d87876 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -57,7 +57,7 @@ private slots: void tst_Crashes::crash() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //we avoid the error dialogbox to appear on windows SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif diff --git a/tests/auto/testlib/selftests/expected_counting.lightxml b/tests/auto/testlib/selftests/expected_counting.lightxml index c49792fec4..799a7d7b17 100644 --- a/tests/auto/testlib/selftests/expected_counting.lightxml +++ b/tests/auto/testlib/selftests/expected_counting.lightxml @@ -107,7 +107,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -135,7 +135,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_counting.txt b/tests/auto/testlib/selftests/expected_counting.txt index f413882c2a..51b9402d3a 100644 --- a/tests/auto/testlib/selftests/expected_counting.txt +++ b/tests/auto/testlib/selftests/expected_counting.txt @@ -36,7 +36,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(234)] PASS : tst_Counting::testFailInInit(after) PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -45,7 +45,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(236)] PASS : tst_Counting::testSkipInInit(after) PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_counting.xml b/tests/auto/testlib/selftests/expected_counting.xml index 7caa915f65..8177a2dc7f 100644 --- a/tests/auto/testlib/selftests/expected_counting.xml +++ b/tests/auto/testlib/selftests/expected_counting.xml @@ -109,7 +109,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -137,7 +137,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_counting.xunitxml b/tests/auto/testlib/selftests/expected_counting.xunitxml index f317ed5923..72bf047ba8 100644 --- a/tests/auto/testlib/selftests/expected_counting.xunitxml +++ b/tests/auto/testlib/selftests/expected_counting.xunitxml @@ -38,14 +38,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -56,9 +56,9 @@ <![CDATA[Skipping]]> <![CDATA[Skipping]]> <![CDATA[Skipping]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml index 6d68bfbdb5..0fc9d527fb 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.lightxml +++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml @@ -4,83 +4,83 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -95,7 +95,7 @@ <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1 ]]></Description> + <Description><![CDATA[init skipLocal local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 1]]></DataTag> @@ -103,11 +103,11 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2 ]]></Description> + <Description><![CDATA[init skipLocal local 2]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 2]]></DataTag> @@ -115,43 +115,43 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 2]]></Description> </Message> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false local: false ]]></Description> + <Description><![CDATA[global: false local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true ]]></Description> + <Description><![CDATA[global: false local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143"> <DataTag><![CDATA[2:local 1]]></DataTag> @@ -159,19 +159,19 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true local: true ]]></Description> + <Description><![CDATA[global: true local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -179,7 +179,7 @@ </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.txt b/tests/auto/testlib/selftests/expected_globaldata.txt index e5d9cacc9c..4e3544dbe0 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.txt +++ b/tests/auto/testlib/selftests/expected_globaldata.txt @@ -1,54 +1,54 @@ ********* Start testing of tst_globaldata ********* Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ -QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null) +QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null) PASS : tst_globaldata::initTestCase() -QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1 -QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false -QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false -QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1 PASS : tst_globaldata::testGlobal(1:local 1) -QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2 -QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false -QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true -QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2 PASS : tst_globaldata::testGlobal(1:local 2) -QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1 -QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true -QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false -QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1 PASS : tst_globaldata::testGlobal(2:local 1) -QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2 -QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true -QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true -QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2 PASS : tst_globaldata::testGlobal(2:local 2) SKIP : tst_globaldata::skip(1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(129)] -QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 SKIP : tst_globaldata::skipLocal(1:local 1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)] -QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1 -QDEBUG : tst_globaldata::skipLocal(1:local 2) init skipLocal local 2 +QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 2) init skipLocal local 2 SKIP : tst_globaldata::skipLocal(1:local 2) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)] -QDEBUG : tst_globaldata::skipLocal(1:local 2) cleanup skipLocal local 2 -QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1 -QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false -QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 2) cleanup skipLocal local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false +QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1 PASS : tst_globaldata::skipSingle(1:local 1) -QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2 -QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true -QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true +QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2 PASS : tst_globaldata::skipSingle(1:local 2) -QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 SKIP : tst_globaldata::skipSingle(2:local 1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(143)] -QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1 -QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2 -QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true -QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true +QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2 PASS : tst_globaldata::skipSingle(2:local 2) -QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) +QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) PASS : tst_globaldata::cleanupTestCase() Totals: 9 passed, 0 failed, 4 skipped ********* Finished testing of tst_globaldata ********* diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml index 906e66ca68..cf2534e34a 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xml +++ b/tests/auto/testlib/selftests/expected_globaldata.xml @@ -6,83 +6,83 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -97,7 +97,7 @@ <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1 ]]></Description> + <Description><![CDATA[init skipLocal local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 1]]></DataTag> @@ -105,11 +105,11 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2 ]]></Description> + <Description><![CDATA[init skipLocal local 2]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 2]]></DataTag> @@ -117,43 +117,43 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 2]]></Description> </Message> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false local: false ]]></Description> + <Description><![CDATA[global: false local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true ]]></Description> + <Description><![CDATA[global: false local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143"> <DataTag><![CDATA[2:local 1]]></DataTag> @@ -161,19 +161,19 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true local: true ]]></Description> + <Description><![CDATA[global: true local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -181,7 +181,7 @@ </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml index 9e0cd149dc..e8cd03a59c 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml +++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml @@ -5,91 +5,91 @@ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> </properties> <testcase result="pass" name="initTestCase"> - <!-- message="initTestCase initTestCase (null) " type="qdebug" --> + <!-- message="initTestCase initTestCase (null)" type="qdebug" --> </testcase> <testcase result="pass" name="testGlobal"> - <!-- tag="1:local 1" message="init testGlobal local 1 " type="qdebug" --> - <!-- tag="1:local 1" message="global: false " type="qdebug" --> - <!-- tag="1:local 1" message="local: false " type="qdebug" --> - <!-- tag="1:local 1" message="cleanup testGlobal local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init testGlobal local 2 " type="qdebug" --> - <!-- tag="1:local 2" message="global: false " type="qdebug" --> - <!-- tag="1:local 2" message="local: true " type="qdebug" --> - <!-- tag="1:local 2" message="cleanup testGlobal local 2 " type="qdebug" --> - <!-- tag="2:local 1" message="init testGlobal local 1 " type="qdebug" --> - <!-- tag="2:local 1" message="global: true " type="qdebug" --> - <!-- tag="2:local 1" message="local: false " type="qdebug" --> - <!-- tag="2:local 1" message="cleanup testGlobal local 1 " type="qdebug" --> - <!-- tag="2:local 2" message="init testGlobal local 2 " type="qdebug" --> - <!-- tag="2:local 2" message="global: true " type="qdebug" --> - <!-- tag="2:local 2" message="local: true " type="qdebug" --> - <!-- tag="2:local 2" message="cleanup testGlobal local 2 " type="qdebug" --> + <!-- tag="1:local 1" message="init testGlobal local 1" type="qdebug" --> + <!-- tag="1:local 1" message="global: false" type="qdebug" --> + <!-- tag="1:local 1" message="local: false" type="qdebug" --> + <!-- tag="1:local 1" message="cleanup testGlobal local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init testGlobal local 2" type="qdebug" --> + <!-- tag="1:local 2" message="global: false" type="qdebug" --> + <!-- tag="1:local 2" message="local: true" type="qdebug" --> + <!-- tag="1:local 2" message="cleanup testGlobal local 2" type="qdebug" --> + <!-- tag="2:local 1" message="init testGlobal local 1" type="qdebug" --> + <!-- tag="2:local 1" message="global: true" type="qdebug" --> + <!-- tag="2:local 1" message="local: false" type="qdebug" --> + <!-- tag="2:local 1" message="cleanup testGlobal local 1" type="qdebug" --> + <!-- tag="2:local 2" message="init testGlobal local 2" type="qdebug" --> + <!-- tag="2:local 2" message="global: true" type="qdebug" --> + <!-- tag="2:local 2" message="local: true" type="qdebug" --> + <!-- tag="2:local 2" message="cleanup testGlobal local 2" type="qdebug" --> </testcase> <testcase name="skip"> <!-- tag="1" message="skipping" type="skip" --> </testcase> <testcase name="skipLocal"> - <!-- tag="1:local 1" message="init skipLocal local 1 " type="qdebug" --> + <!-- tag="1:local 1" message="init skipLocal local 1" type="qdebug" --> <!-- tag="1:local 1" message="skipping" type="skip" --> - <!-- tag="1:local 1" message="cleanup skipLocal local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init skipLocal local 2 " type="qdebug" --> + <!-- tag="1:local 1" message="cleanup skipLocal local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init skipLocal local 2" type="qdebug" --> <!-- tag="1:local 2" message="skipping" type="skip" --> - <!-- tag="1:local 2" message="cleanup skipLocal local 2 " type="qdebug" --> + <!-- tag="1:local 2" message="cleanup skipLocal local 2" type="qdebug" --> </testcase> <testcase result="pass" name="skipSingle"> - <!-- tag="1:local 1" message="init skipSingle local 1 " type="qdebug" --> - <!-- tag="1:local 1" message="global: false local: false " type="qdebug" --> - <!-- tag="1:local 1" message="cleanup skipSingle local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init skipSingle local 2 " type="qdebug" --> - <!-- tag="1:local 2" message="global: false local: true " type="qdebug" --> - <!-- tag="1:local 2" message="cleanup skipSingle local 2 " type="qdebug" --> - <!-- tag="2:local 1" message="init skipSingle local 1 " type="qdebug" --> + <!-- tag="1:local 1" message="init skipSingle local 1" type="qdebug" --> + <!-- tag="1:local 1" message="global: false local: false" type="qdebug" --> + <!-- tag="1:local 1" message="cleanup skipSingle local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init skipSingle local 2" type="qdebug" --> + <!-- tag="1:local 2" message="global: false local: true" type="qdebug" --> + <!-- tag="1:local 2" message="cleanup skipSingle local 2" type="qdebug" --> + <!-- tag="2:local 1" message="init skipSingle local 1" type="qdebug" --> <!-- tag="2:local 1" message="skipping" type="skip" --> - <!-- tag="2:local 1" message="cleanup skipSingle local 1 " type="qdebug" --> - <!-- tag="2:local 2" message="init skipSingle local 2 " type="qdebug" --> - <!-- tag="2:local 2" message="global: true local: true " type="qdebug" --> - <!-- tag="2:local 2" message="cleanup skipSingle local 2 " type="qdebug" --> + <!-- tag="2:local 1" message="cleanup skipSingle local 1" type="qdebug" --> + <!-- tag="2:local 2" message="init skipSingle local 2" type="qdebug" --> + <!-- tag="2:local 2" message="global: true local: true" type="qdebug" --> + <!-- tag="2:local 2" message="cleanup skipSingle local 2" type="qdebug" --> </testcase> <testcase result="pass" name="cleanupTestCase"> - <!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" --> + <!-- message="cleanupTestCase cleanupTestCase (null)" type="qdebug" --> </testcase> <system-err> -<![CDATA[initTestCase initTestCase (null) ]]> -<![CDATA[init testGlobal local 1 ]]> -<![CDATA[global: false ]]> -<![CDATA[local: false ]]> -<![CDATA[cleanup testGlobal local 1 ]]> -<![CDATA[init testGlobal local 2 ]]> -<![CDATA[global: false ]]> -<![CDATA[local: true ]]> -<![CDATA[cleanup testGlobal local 2 ]]> -<![CDATA[init testGlobal local 1 ]]> -<![CDATA[global: true ]]> -<![CDATA[local: false ]]> -<![CDATA[cleanup testGlobal local 1 ]]> -<![CDATA[init testGlobal local 2 ]]> -<![CDATA[global: true ]]> -<![CDATA[local: true ]]> -<![CDATA[cleanup testGlobal local 2 ]]> +<![CDATA[initTestCase initTestCase (null)]]> +<![CDATA[init testGlobal local 1]]> +<![CDATA[global: false]]> +<![CDATA[local: false]]> +<![CDATA[cleanup testGlobal local 1]]> +<![CDATA[init testGlobal local 2]]> +<![CDATA[global: false]]> +<![CDATA[local: true]]> +<![CDATA[cleanup testGlobal local 2]]> +<![CDATA[init testGlobal local 1]]> +<![CDATA[global: true]]> +<![CDATA[local: false]]> +<![CDATA[cleanup testGlobal local 1]]> +<![CDATA[init testGlobal local 2]]> +<![CDATA[global: true]]> +<![CDATA[local: true]]> +<![CDATA[cleanup testGlobal local 2]]> <![CDATA[skipping]]> -<![CDATA[init skipLocal local 1 ]]> +<![CDATA[init skipLocal local 1]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipLocal local 1 ]]> -<![CDATA[init skipLocal local 2 ]]> +<![CDATA[cleanup skipLocal local 1]]> +<![CDATA[init skipLocal local 2]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipLocal local 2 ]]> -<![CDATA[init skipSingle local 1 ]]> -<![CDATA[global: false local: false ]]> -<![CDATA[cleanup skipSingle local 1 ]]> -<![CDATA[init skipSingle local 2 ]]> -<![CDATA[global: false local: true ]]> -<![CDATA[cleanup skipSingle local 2 ]]> -<![CDATA[init skipSingle local 1 ]]> +<![CDATA[cleanup skipLocal local 2]]> +<![CDATA[init skipSingle local 1]]> +<![CDATA[global: false local: false]]> +<![CDATA[cleanup skipSingle local 1]]> +<![CDATA[init skipSingle local 2]]> +<![CDATA[global: false local: true]]> +<![CDATA[cleanup skipSingle local 2]]> +<![CDATA[init skipSingle local 1]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipSingle local 1 ]]> -<![CDATA[init skipSingle local 2 ]]> -<![CDATA[global: true local: true ]]> -<![CDATA[cleanup skipSingle local 2 ]]> -<![CDATA[cleanupTestCase cleanupTestCase (null) ]]> +<![CDATA[cleanup skipSingle local 1]]> +<![CDATA[init skipSingle local 2]]> +<![CDATA[global: true local: true]]> +<![CDATA[cleanup skipSingle local 2]]> +<![CDATA[cleanupTestCase cleanupTestCase (null)]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml index 5adbb771af..45d0a71a3e 100644 --- a/tests/auto/testlib/selftests/expected_subtest.lightxml +++ b/tests/auto/testlib/selftests/expected_subtest.lightxml @@ -4,82 +4,82 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test1"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[init test1 (null) ]]></Description> + <Description><![CDATA[init test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test1 test1 (null) ]]></Description> + <Description><![CDATA[test1 test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanup test1 (null) ]]></Description> + <Description><![CDATA[cleanup test1 (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test2"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data test2 (null) ]]></Description> + <Description><![CDATA[test2_data test2 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data end ]]></Description> + <Description><![CDATA[test2_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test2 data0 ]]></Description> + <Description><![CDATA[init test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test2 data0 ]]></Description> + <Description><![CDATA[test2 test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test2 data0 ]]></Description> + <Description><![CDATA[cleanup test2 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test2 data1 ]]></Description> + <Description><![CDATA[init test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test2 data1 ]]></Description> + <Description><![CDATA[test2 test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test2 data1 ]]></Description> + <Description><![CDATA[cleanup test2 data1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test2 data2 ]]></Description> + <Description><![CDATA[init test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test2 data2 ]]></Description> + <Description><![CDATA[test2 test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test2 data2 ]]></Description> + <Description><![CDATA[cleanup test2 data2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> @@ -87,37 +87,37 @@ </TestFunction> <TestFunction name="test3"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data test3 (null) ]]></Description> + <Description><![CDATA[test3_data test3 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data end ]]></Description> + <Description><![CDATA[test3_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test3 data0 ]]></Description> + <Description><![CDATA[init test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test3 data0 ]]></Description> + <Description><![CDATA[test2 test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test3 data0 ]]></Description> + <Description><![CDATA[cleanup test3 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test3 data1 ]]></Description> + <Description><![CDATA[init test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test3 data1 ]]></Description> + <Description><![CDATA[test2 test3 data1]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data1]]></DataTag> @@ -127,15 +127,15 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test3 data1 ]]></Description> + <Description><![CDATA[cleanup test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test3 data2 ]]></Description> + <Description><![CDATA[init test3 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test3 data2 ]]></Description> + <Description><![CDATA[test2 test3 data2]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data2]]></DataTag> @@ -145,12 +145,12 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test3 data2 ]]></Description> + <Description><![CDATA[cleanup test3 data2]]></Description> </Message> </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_subtest.txt b/tests/auto/testlib/selftests/expected_subtest.txt index bb88f189ec..bb496bf33c 100644 --- a/tests/auto/testlib/selftests/expected_subtest.txt +++ b/tests/auto/testlib/selftests/expected_subtest.txt @@ -1,50 +1,50 @@ ********* Start testing of tst_Subtest ********* Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ -QDEBUG : tst_Subtest::initTestCase() initTestCase initTestCase (null) +QDEBUG : tst_Subtest::initTestCase() initTestCase initTestCase (null) PASS : tst_Subtest::initTestCase() -QDEBUG : tst_Subtest::test1() init test1 (null) -QDEBUG : tst_Subtest::test1() test1 test1 (null) -QDEBUG : tst_Subtest::test1() cleanup test1 (null) +QDEBUG : tst_Subtest::test1() init test1 (null) +QDEBUG : tst_Subtest::test1() test1 test1 (null) +QDEBUG : tst_Subtest::test1() cleanup test1 (null) PASS : tst_Subtest::test1() -QDEBUG : tst_Subtest::test2() test2_data test2 (null) -QDEBUG : tst_Subtest::test2() test2_data end -QDEBUG : tst_Subtest::test2(data0) init test2 data0 -QDEBUG : tst_Subtest::test2(data0) test2 test2 data0 -QDEBUG : tst_Subtest::test2(data0) test2 end -QDEBUG : tst_Subtest::test2(data0) cleanup test2 data0 +QDEBUG : tst_Subtest::test2() test2_data test2 (null) +QDEBUG : tst_Subtest::test2() test2_data end +QDEBUG : tst_Subtest::test2(data0) init test2 data0 +QDEBUG : tst_Subtest::test2(data0) test2 test2 data0 +QDEBUG : tst_Subtest::test2(data0) test2 end +QDEBUG : tst_Subtest::test2(data0) cleanup test2 data0 PASS : tst_Subtest::test2(data0) -QDEBUG : tst_Subtest::test2(data1) init test2 data1 -QDEBUG : tst_Subtest::test2(data1) test2 test2 data1 -QDEBUG : tst_Subtest::test2(data1) test2 end -QDEBUG : tst_Subtest::test2(data1) cleanup test2 data1 +QDEBUG : tst_Subtest::test2(data1) init test2 data1 +QDEBUG : tst_Subtest::test2(data1) test2 test2 data1 +QDEBUG : tst_Subtest::test2(data1) test2 end +QDEBUG : tst_Subtest::test2(data1) cleanup test2 data1 PASS : tst_Subtest::test2(data1) -QDEBUG : tst_Subtest::test2(data2) init test2 data2 -QDEBUG : tst_Subtest::test2(data2) test2 test2 data2 -QDEBUG : tst_Subtest::test2(data2) test2 end -QDEBUG : tst_Subtest::test2(data2) cleanup test2 data2 +QDEBUG : tst_Subtest::test2(data2) init test2 data2 +QDEBUG : tst_Subtest::test2(data2) test2 test2 data2 +QDEBUG : tst_Subtest::test2(data2) test2 end +QDEBUG : tst_Subtest::test2(data2) cleanup test2 data2 PASS : tst_Subtest::test2(data2) -QDEBUG : tst_Subtest::test3() test3_data test3 (null) -QDEBUG : tst_Subtest::test3() test3_data end -QDEBUG : tst_Subtest::test3(data0) init test3 data0 -QDEBUG : tst_Subtest::test3(data0) test2 test3 data0 -QDEBUG : tst_Subtest::test3(data0) test2 end -QDEBUG : tst_Subtest::test3(data0) cleanup test3 data0 +QDEBUG : tst_Subtest::test3() test3_data test3 (null) +QDEBUG : tst_Subtest::test3() test3_data end +QDEBUG : tst_Subtest::test3(data0) init test3 data0 +QDEBUG : tst_Subtest::test3(data0) test2 test3 data0 +QDEBUG : tst_Subtest::test3(data0) test2 end +QDEBUG : tst_Subtest::test3(data0) cleanup test3 data0 PASS : tst_Subtest::test3(data0) -QDEBUG : tst_Subtest::test3(data1) init test3 data1 -QDEBUG : tst_Subtest::test3(data1) test2 test3 data1 +QDEBUG : tst_Subtest::test3(data1) init test3 data1 +QDEBUG : tst_Subtest::test3(data1) test2 test3 data1 FAIL! : tst_Subtest::test3(data1) Compared values are not the same Actual (str) : hello1 Expected (QString("hello0")): hello0 Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)] -QDEBUG : tst_Subtest::test3(data1) cleanup test3 data1 -QDEBUG : tst_Subtest::test3(data2) init test3 data2 -QDEBUG : tst_Subtest::test3(data2) test2 test3 data2 +QDEBUG : tst_Subtest::test3(data1) cleanup test3 data1 +QDEBUG : tst_Subtest::test3(data2) init test3 data2 +QDEBUG : tst_Subtest::test3(data2) test2 test3 data2 FAIL! : tst_Subtest::test3(data2) Compared values are not the same Actual (str) : hello2 Expected (QString("hello0")): hello0 Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)] -QDEBUG : tst_Subtest::test3(data2) cleanup test3 data2 -QDEBUG : tst_Subtest::cleanupTestCase() cleanupTestCase cleanupTestCase (null) +QDEBUG : tst_Subtest::test3(data2) cleanup test3 data2 +QDEBUG : tst_Subtest::cleanupTestCase() cleanupTestCase cleanupTestCase (null) PASS : tst_Subtest::cleanupTestCase() Totals: 7 passed, 2 failed, 0 skipped ********* Finished testing of tst_Subtest ********* diff --git a/tests/auto/testlib/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml index 094e22383d..b0a5c8a810 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xml +++ b/tests/auto/testlib/selftests/expected_subtest.xml @@ -6,82 +6,82 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test1"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[init test1 (null) ]]></Description> + <Description><![CDATA[init test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test1 test1 (null) ]]></Description> + <Description><![CDATA[test1 test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanup test1 (null) ]]></Description> + <Description><![CDATA[cleanup test1 (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test2"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data test2 (null) ]]></Description> + <Description><![CDATA[test2_data test2 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data end ]]></Description> + <Description><![CDATA[test2_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test2 data0 ]]></Description> + <Description><![CDATA[init test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test2 data0 ]]></Description> + <Description><![CDATA[test2 test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test2 data0 ]]></Description> + <Description><![CDATA[cleanup test2 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test2 data1 ]]></Description> + <Description><![CDATA[init test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test2 data1 ]]></Description> + <Description><![CDATA[test2 test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test2 data1 ]]></Description> + <Description><![CDATA[cleanup test2 data1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test2 data2 ]]></Description> + <Description><![CDATA[init test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test2 data2 ]]></Description> + <Description><![CDATA[test2 test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test2 data2 ]]></Description> + <Description><![CDATA[cleanup test2 data2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> @@ -89,37 +89,37 @@ </TestFunction> <TestFunction name="test3"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data test3 (null) ]]></Description> + <Description><![CDATA[test3_data test3 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data end ]]></Description> + <Description><![CDATA[test3_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test3 data0 ]]></Description> + <Description><![CDATA[init test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test3 data0 ]]></Description> + <Description><![CDATA[test2 test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test3 data0 ]]></Description> + <Description><![CDATA[cleanup test3 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test3 data1 ]]></Description> + <Description><![CDATA[init test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test3 data1 ]]></Description> + <Description><![CDATA[test2 test3 data1]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data1]]></DataTag> @@ -129,15 +129,15 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test3 data1 ]]></Description> + <Description><![CDATA[cleanup test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test3 data2 ]]></Description> + <Description><![CDATA[init test3 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test3 data2 ]]></Description> + <Description><![CDATA[test2 test3 data2]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data2]]></DataTag> @@ -147,12 +147,12 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test3 data2 ]]></Description> + <Description><![CDATA[cleanup test3 data2]]></Description> </Message> </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml index 6f8fc3db45..5f7024e8ba 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xunitxml +++ b/tests/auto/testlib/selftests/expected_subtest.xunitxml @@ -5,83 +5,83 @@ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> </properties> <testcase result="pass" name="initTestCase"> - <!-- message="initTestCase initTestCase (null) " type="qdebug" --> + <!-- message="initTestCase initTestCase (null)" type="qdebug" --> </testcase> <testcase result="pass" name="test1"> - <!-- message="init test1 (null) " type="qdebug" --> - <!-- message="test1 test1 (null) " type="qdebug" --> - <!-- message="cleanup test1 (null) " type="qdebug" --> + <!-- message="init test1 (null)" type="qdebug" --> + <!-- message="test1 test1 (null)" type="qdebug" --> + <!-- message="cleanup test1 (null)" type="qdebug" --> </testcase> <testcase result="pass" name="test2"> - <!-- message="test2_data test2 (null) " type="qdebug" --> - <!-- message="test2_data end " type="qdebug" --> - <!-- tag="data0" message="init test2 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 test2 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 end " type="qdebug" --> - <!-- tag="data0" message="cleanup test2 data0 " type="qdebug" --> - <!-- tag="data1" message="init test2 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 test2 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 end " type="qdebug" --> - <!-- tag="data1" message="cleanup test2 data1 " type="qdebug" --> - <!-- tag="data2" message="init test2 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 test2 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 end " type="qdebug" --> - <!-- tag="data2" message="cleanup test2 data2 " type="qdebug" --> + <!-- message="test2_data test2 (null)" type="qdebug" --> + <!-- message="test2_data end" type="qdebug" --> + <!-- tag="data0" message="init test2 data0" type="qdebug" --> + <!-- tag="data0" message="test2 test2 data0" type="qdebug" --> + <!-- tag="data0" message="test2 end" type="qdebug" --> + <!-- tag="data0" message="cleanup test2 data0" type="qdebug" --> + <!-- tag="data1" message="init test2 data1" type="qdebug" --> + <!-- tag="data1" message="test2 test2 data1" type="qdebug" --> + <!-- tag="data1" message="test2 end" type="qdebug" --> + <!-- tag="data1" message="cleanup test2 data1" type="qdebug" --> + <!-- tag="data2" message="init test2 data2" type="qdebug" --> + <!-- tag="data2" message="test2 test2 data2" type="qdebug" --> + <!-- tag="data2" message="test2 end" type="qdebug" --> + <!-- tag="data2" message="cleanup test2 data2" type="qdebug" --> </testcase> <testcase result="fail" name="test3"> - <!-- message="test3_data test3 (null) " type="qdebug" --> - <!-- message="test3_data end " type="qdebug" --> - <!-- tag="data0" message="init test3 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 test3 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 end " type="qdebug" --> - <!-- tag="data0" message="cleanup test3 data0 " type="qdebug" --> - <!-- tag="data1" message="init test3 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 test3 data1 " type="qdebug" --> + <!-- message="test3_data test3 (null)" type="qdebug" --> + <!-- message="test3_data end" type="qdebug" --> + <!-- tag="data0" message="init test3 data0" type="qdebug" --> + <!-- tag="data0" message="test2 test3 data0" type="qdebug" --> + <!-- tag="data0" message="test2 end" type="qdebug" --> + <!-- tag="data0" message="cleanup test3 data0" type="qdebug" --> + <!-- tag="data1" message="init test3 data1" type="qdebug" --> + <!-- tag="data1" message="test2 test3 data1" type="qdebug" --> <failure tag="data1" message="Compared values are not the same Actual (str) : hello1 Expected (QString("hello0")): hello0" result="fail"/> - <!-- tag="data1" message="cleanup test3 data1 " type="qdebug" --> - <!-- tag="data2" message="init test3 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 test3 data2 " type="qdebug" --> + <!-- tag="data1" message="cleanup test3 data1" type="qdebug" --> + <!-- tag="data2" message="init test3 data2" type="qdebug" --> + <!-- tag="data2" message="test2 test3 data2" type="qdebug" --> <failure tag="data2" message="Compared values are not the same Actual (str) : hello2 Expected (QString("hello0")): hello0" result="fail"/> - <!-- tag="data2" message="cleanup test3 data2 " type="qdebug" --> + <!-- tag="data2" message="cleanup test3 data2" type="qdebug" --> </testcase> <testcase result="pass" name="cleanupTestCase"> - <!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" --> + <!-- message="cleanupTestCase cleanupTestCase (null)" type="qdebug" --> </testcase> <system-err> -<![CDATA[initTestCase initTestCase (null) ]]> -<![CDATA[init test1 (null) ]]> -<![CDATA[test1 test1 (null) ]]> -<![CDATA[cleanup test1 (null) ]]> -<![CDATA[test2_data test2 (null) ]]> -<![CDATA[test2_data end ]]> -<![CDATA[init test2 data0 ]]> -<![CDATA[test2 test2 data0 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data0 ]]> -<![CDATA[init test2 data1 ]]> -<![CDATA[test2 test2 data1 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data1 ]]> -<![CDATA[init test2 data2 ]]> -<![CDATA[test2 test2 data2 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data2 ]]> -<![CDATA[test3_data test3 (null) ]]> -<![CDATA[test3_data end ]]> -<![CDATA[init test3 data0 ]]> -<![CDATA[test2 test3 data0 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test3 data0 ]]> -<![CDATA[init test3 data1 ]]> -<![CDATA[test2 test3 data1 ]]> -<![CDATA[cleanup test3 data1 ]]> -<![CDATA[init test3 data2 ]]> -<![CDATA[test2 test3 data2 ]]> -<![CDATA[cleanup test3 data2 ]]> -<![CDATA[cleanupTestCase cleanupTestCase (null) ]]> +<![CDATA[initTestCase initTestCase (null)]]> +<![CDATA[init test1 (null)]]> +<![CDATA[test1 test1 (null)]]> +<![CDATA[cleanup test1 (null)]]> +<![CDATA[test2_data test2 (null)]]> +<![CDATA[test2_data end]]> +<![CDATA[init test2 data0]]> +<![CDATA[test2 test2 data0]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data0]]> +<![CDATA[init test2 data1]]> +<![CDATA[test2 test2 data1]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data1]]> +<![CDATA[init test2 data2]]> +<![CDATA[test2 test2 data2]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data2]]> +<![CDATA[test3_data test3 (null)]]> +<![CDATA[test3_data end]]> +<![CDATA[init test3 data0]]> +<![CDATA[test2 test3 data0]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test3 data0]]> +<![CDATA[init test3 data1]]> +<![CDATA[test2 test3 data1]]> +<![CDATA[cleanup test3 data1]]> +<![CDATA[init test3 data2]]> +<![CDATA[test2 test3 data2]]> +<![CDATA[cleanup test3 data2]]> +<![CDATA[cleanupTestCase cleanupTestCase (null)]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_verbose1.lightxml b/tests/auto/testlib/selftests/expected_verbose1.lightxml index c49792fec4..799a7d7b17 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose1.lightxml @@ -107,7 +107,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -135,7 +135,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose1.txt b/tests/auto/testlib/selftests/expected_verbose1.txt index 4ba42c1c8e..23962a0ff6 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.txt +++ b/tests/auto/testlib/selftests/expected_verbose1.txt @@ -48,7 +48,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() PASS : tst_Counting::testFailInInit(after) INFO : tst_Counting::testFailInCleanup() entering PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -59,7 +59,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() PASS : tst_Counting::testSkipInInit(after) INFO : tst_Counting::testSkipInCleanup() entering PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_verbose1.xml b/tests/auto/testlib/selftests/expected_verbose1.xml index 7caa915f65..8177a2dc7f 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xml +++ b/tests/auto/testlib/selftests/expected_verbose1.xml @@ -109,7 +109,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -137,7 +137,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose1.xunitxml b/tests/auto/testlib/selftests/expected_verbose1.xunitxml index f317ed5923..72bf047ba8 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose1.xunitxml @@ -38,14 +38,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -56,9 +56,9 @@ <![CDATA[Skipping]]> <![CDATA[Skipping]]> <![CDATA[Skipping]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_verbose2.lightxml b/tests/auto/testlib/selftests/expected_verbose2.lightxml index 2937adbe01..4e5f9952b8 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose2.lightxml @@ -179,7 +179,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -207,7 +207,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose2.txt b/tests/auto/testlib/selftests/expected_verbose2.txt index e9c7838f6d..d8c6e4a218 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.txt +++ b/tests/auto/testlib/selftests/expected_verbose2.txt @@ -84,7 +84,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() PASS : tst_Counting::testFailInInit(after) INFO : tst_Counting::testFailInCleanup() entering PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -95,7 +95,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() PASS : tst_Counting::testSkipInInit(after) INFO : tst_Counting::testSkipInCleanup() entering PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_verbose2.xml b/tests/auto/testlib/selftests/expected_verbose2.xml index bbdca567d3..bf5e7c7570 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xml +++ b/tests/auto/testlib/selftests/expected_verbose2.xml @@ -181,7 +181,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -209,7 +209,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose2.xunitxml b/tests/auto/testlib/selftests/expected_verbose2.xunitxml index a774cb9d9f..6dabbd34fc 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose2.xunitxml @@ -57,14 +57,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -93,9 +93,9 @@ <![CDATA[Skipping]]> <![CDATA[QVERIFY(false)]]> <![CDATA[QVERIFY(false)]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml new file mode 100644 index 0000000000..6ef857c6d0 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml @@ -0,0 +1,49 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectStdTypes"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectStdExceptions"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectMyExceptions"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testFailInt"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="128"> + <Description><![CDATA[Expected exception of type double to be thrown but unknown exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailStdString"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="133"> + <Description><![CDATA[Expected exception of type char* to be thrown but unknown exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailStdRuntimeError"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="138"> + <Description><![CDATA[Expected exception of type std::runtime_error to be thrown but std::exception caught with message: logic error]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailMyException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="143"> + <Description><![CDATA[Expected exception of type MyBaseException to be thrown but std::exception caught with message: logic error]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailMyDerivedException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="148"> + <Description><![CDATA[Expected exception of type std::runtime_error to be thrown but std::exception caught with message: MyDerivedException]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailNoException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="153"> + <Description><![CDATA[Expected exception of type std::exception to be thrown but no exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> +</TestFunction> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.txt b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.txt new file mode 100644 index 0000000000..5c40f62dd2 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.txt @@ -0,0 +1,21 @@ +********* Start testing of tst_VerifyExceptionThrown ********* +Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ +PASS : tst_VerifyExceptionThrown::initTestCase() +PASS : tst_VerifyExceptionThrown::testCorrectStdTypes() +PASS : tst_VerifyExceptionThrown::testCorrectStdExceptions() +PASS : tst_VerifyExceptionThrown::testCorrectMyExceptions() +FAIL! : tst_VerifyExceptionThrown::testFailInt() Expected exception of type double to be thrown but unknown exception caught + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(128)] +FAIL! : tst_VerifyExceptionThrown::testFailStdString() Expected exception of type char* to be thrown but unknown exception caught + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(133)] +FAIL! : tst_VerifyExceptionThrown::testFailStdRuntimeError() Expected exception of type std::runtime_error to be thrown but std::exception caught with message: logic error + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(138)] +FAIL! : tst_VerifyExceptionThrown::testFailMyException() Expected exception of type MyBaseException to be thrown but std::exception caught with message: logic error + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(143)] +FAIL! : tst_VerifyExceptionThrown::testFailMyDerivedException() Expected exception of type std::runtime_error to be thrown but std::exception caught with message: MyDerivedException + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(148)] +FAIL! : tst_VerifyExceptionThrown::testFailNoException() Expected exception of type std::exception to be thrown but no exception caught + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp(153)] +PASS : tst_VerifyExceptionThrown::cleanupTestCase() +Totals: 5 passed, 6 failed, 0 skipped +********* Finished testing of tst_VerifyExceptionThrown ********* diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml new file mode 100644 index 0000000000..df261b72c4 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_VerifyExceptionThrown"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectStdTypes"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectStdExceptions"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testCorrectMyExceptions"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="testFailInt"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="128"> + <Description><![CDATA[Expected exception of type double to be thrown but unknown exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailStdString"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="133"> + <Description><![CDATA[Expected exception of type char* to be thrown but unknown exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailStdRuntimeError"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="138"> + <Description><![CDATA[Expected exception of type std::runtime_error to be thrown but std::exception caught with message: logic error]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailMyException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="143"> + <Description><![CDATA[Expected exception of type MyBaseException to be thrown but std::exception caught with message: logic error]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailMyDerivedException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="148"> + <Description><![CDATA[Expected exception of type std::runtime_error to be thrown but std::exception caught with message: MyDerivedException]]></Description> +</Incident> +</TestFunction> +<TestFunction name="testFailNoException"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp" line="153"> + <Description><![CDATA[Expected exception of type std::exception to be thrown but no exception caught]]></Description> +</Incident> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml new file mode 100644 index 0000000000..f49746a9af --- /dev/null +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="0" failures="6" tests="11" name="tst_VerifyExceptionThrown"> + <properties> + <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> + <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + </properties> + <testcase result="pass" name="initTestCase"/> + <testcase result="pass" name="testCorrectStdTypes"/> + <testcase result="pass" name="testCorrectStdExceptions"/> + <testcase result="pass" name="testCorrectMyExceptions"/> + <testcase result="fail" name="testFailInt"> + <failure message="Expected exception of type double to be thrown but unknown exception caught" result="fail"/> + </testcase> + <testcase result="fail" name="testFailStdString"> + <failure message="Expected exception of type char* to be thrown but unknown exception caught" result="fail"/> + </testcase> + <testcase result="fail" name="testFailStdRuntimeError"> + <failure message="Expected exception of type std::runtime_error to be thrown but std::exception caught with message: logic error" result="fail"/> + </testcase> + <testcase result="fail" name="testFailMyException"> + <failure message="Expected exception of type MyBaseException to be thrown but std::exception caught with message: logic error" result="fail"/> + </testcase> + <testcase result="fail" name="testFailMyDerivedException"> + <failure message="Expected exception of type std::runtime_error to be thrown but std::exception caught with message: MyDerivedException" result="fail"/> + </testcase> + <testcase result="fail" name="testFailNoException"> + <failure message="Expected exception of type std::exception to be thrown but no exception caught" result="fail"/> + </testcase> + <testcase result="pass" name="cleanupTestCase"/> + <system-err/> +</testsuite> diff --git a/tests/auto/testlib/selftests/expected_warnings.lightxml b/tests/auto/testlib/selftests/expected_warnings.lightxml index ad786832ca..2ad9e97449 100644 --- a/tests/auto/testlib/selftests/expected_warnings.lightxml +++ b/tests/auto/testlib/selftests/expected_warnings.lightxml @@ -24,6 +24,12 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[Baba]]></Description> </Message> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[Bubublabla]]></Description> +</Message> +<Message type="qwarn" file="" line="0"> + <Description><![CDATA[Babablabla]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testMissingWarnings"> @@ -37,6 +43,14 @@ <Description><![CDATA[Not all expected messages were received]]></Description> </Incident> </TestFunction> +<TestFunction name="testMissingWarningsRegularExpression"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Did not receive any message matching: "Warning\s\d"]]></Description> +</Message> +<Incident type="fail" file="" line="0"> + <Description><![CDATA[Not all expected messages were received]]></Description> +</Incident> +</TestFunction> <TestFunction name="testMissingWarningsWithData"> <Message type="info" file="" line="0"> <DataTag><![CDATA[first row]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_warnings.txt b/tests/auto/testlib/selftests/expected_warnings.txt index d8064651b0..e73de980cb 100644 --- a/tests/auto/testlib/selftests/expected_warnings.txt +++ b/tests/auto/testlib/selftests/expected_warnings.txt @@ -7,10 +7,14 @@ QDEBUG : tst_Warnings::testWarnings() Debug QDEBUG : tst_Warnings::testWarnings() Debug QDEBUG : tst_Warnings::testWarnings() Baba QDEBUG : tst_Warnings::testWarnings() Baba +QDEBUG : tst_Warnings::testWarnings() Bubublabla +QWARN : tst_Warnings::testWarnings() Babablabla PASS : tst_Warnings::testWarnings() INFO : tst_Warnings::testMissingWarnings() Did not receive message: "Warning0" INFO : tst_Warnings::testMissingWarnings() Did not receive message: "Warning1" FAIL! : tst_Warnings::testMissingWarnings() Not all expected messages were received +INFO : tst_Warnings::testMissingWarningsRegularExpression() Did not receive any message matching: "Warning\s\d" +FAIL! : tst_Warnings::testMissingWarningsRegularExpression() Not all expected messages were received INFO : tst_Warnings::testMissingWarningsWithData(first row) Did not receive message: "Warning0" INFO : tst_Warnings::testMissingWarningsWithData(first row) Did not receive message: "Warning1" FAIL! : tst_Warnings::testMissingWarningsWithData(first row) Not all expected messages were received @@ -18,5 +22,5 @@ INFO : tst_Warnings::testMissingWarningsWithData(second row) Did not receive m INFO : tst_Warnings::testMissingWarningsWithData(second row) Did not receive message: "Warning1" FAIL! : tst_Warnings::testMissingWarningsWithData(second row) Not all expected messages were received PASS : tst_Warnings::cleanupTestCase() -Totals: 3 passed, 3 failed, 0 skipped +Totals: 3 passed, 4 failed, 0 skipped ********* Finished testing of tst_Warnings ********* diff --git a/tests/auto/testlib/selftests/expected_warnings.xml b/tests/auto/testlib/selftests/expected_warnings.xml index 8ad236b52a..14a45ca4fd 100644 --- a/tests/auto/testlib/selftests/expected_warnings.xml +++ b/tests/auto/testlib/selftests/expected_warnings.xml @@ -26,6 +26,12 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[Baba]]></Description> </Message> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[Bubublabla]]></Description> +</Message> +<Message type="qwarn" file="" line="0"> + <Description><![CDATA[Babablabla]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testMissingWarnings"> @@ -39,6 +45,14 @@ <Description><![CDATA[Not all expected messages were received]]></Description> </Incident> </TestFunction> +<TestFunction name="testMissingWarningsRegularExpression"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Did not receive any message matching: "Warning\s\d"]]></Description> +</Message> +<Incident type="fail" file="" line="0"> + <Description><![CDATA[Not all expected messages were received]]></Description> +</Incident> +</TestFunction> <TestFunction name="testMissingWarningsWithData"> <Message type="info" file="" line="0"> <DataTag><![CDATA[first row]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_warnings.xunitxml b/tests/auto/testlib/selftests/expected_warnings.xunitxml index 3e3b9ce18e..7be47174c6 100644 --- a/tests/auto/testlib/selftests/expected_warnings.xunitxml +++ b/tests/auto/testlib/selftests/expected_warnings.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="12" failures="3" tests="5" name="tst_Warnings"> +<testsuite errors="15" failures="4" tests="6" name="tst_Warnings"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -12,12 +12,18 @@ <!-- message="Debug" type="qdebug" --> <!-- message="Baba" type="qdebug" --> <!-- message="Baba" type="qdebug" --> + <!-- message="Bubublabla" type="qdebug" --> + <!-- message="Babablabla" type="qwarn" --> </testcase> <testcase result="fail" name="testMissingWarnings"> <!-- message="Did not receive message: "Warning0"" type="info" --> <!-- message="Did not receive message: "Warning1"" type="info" --> <failure message="Not all expected messages were received" result="fail"/> </testcase> + <testcase result="fail" name="testMissingWarningsRegularExpression"> + <!-- message="Did not receive any message matching: "Warning\s\d"" type="info" --> + <failure message="Not all expected messages were received" result="fail"/> + </testcase> <testcase result="fail" name="testMissingWarningsWithData"> <!-- tag="first row" message="Did not receive message: "Warning0"" type="info" --> <!-- tag="first row" message="Did not receive message: "Warning1"" type="info" --> @@ -34,8 +40,11 @@ <![CDATA[Debug]]> <![CDATA[Baba]]> <![CDATA[Baba]]> +<![CDATA[Bubublabla]]> +<![CDATA[Babablabla]]> <![CDATA[Did not receive message: "Warning0"]]> <![CDATA[Did not receive message: "Warning1"]]> +<![CDATA[Did not receive any message matching: "Warning\s\d"]]> <![CDATA[Did not receive message: "Warning0"]]> <![CDATA[Did not receive message: "Warning1"]]> <![CDATA[Did not receive message: "Warning0"]]> diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri index c9474419eb..7b706735a9 100644 --- a/tests/auto/testlib/selftests/selftests.pri +++ b/tests/auto/testlib/selftests/selftests.pri @@ -41,5 +41,6 @@ SUBPROGRAMS = \ subtest \ verbose1 \ verbose2 \ + verifyexceptionthrown \ warnings \ xunit diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc index 03de05fb89..e7ca7138b2 100644 --- a/tests/auto/testlib/selftests/selftests.qrc +++ b/tests/auto/testlib/selftests/selftests.qrc @@ -134,6 +134,10 @@ <file>expected_verbose2.txt</file> <file>expected_verbose2.xml</file> <file>expected_verbose2.xunitxml</file> + <file>expected_verifyexceptionthrown.lightxml</file> + <file>expected_verifyexceptionthrown.txt</file> + <file>expected_verifyexceptionthrown.xml</file> + <file>expected_verifyexceptionthrown.xunitxml</file> <file>expected_warnings.lightxml</file> <file>expected_warnings.txt</file> <file>expected_warnings.xml</file> diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index e332f01861..1a8e336b55 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -381,6 +381,10 @@ void tst_Selftests::runSubTest_data() << "subtest" << "verbose1" << "verbose2" +#ifndef QT_NO_EXCEPTIONS + // this test will test nothing if the exceptions are disabled + << "verifyexceptionthrown" +#endif //!QT_NO_EXCEPTIONS << "warnings" << "xunit" ; diff --git a/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp b/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp new file mode 100644 index 0000000000..fc57f19c4f --- /dev/null +++ b/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + + +#ifndef QT_NO_EXCEPTIONS +# include <stdexcept> +#endif + + +#ifndef QT_NO_EXCEPTIONS + +class MyBaseException +{ + +}; + +class MyDerivedException: public MyBaseException, public std::domain_error +{ +public: + MyDerivedException(): std::domain_error("MyDerivedException") {} +}; + + +#endif // !QT_NO_EXCEPTIONS + + +class tst_VerifyExceptionThrown: public QObject +{ + Q_OBJECT +private: + void doSomething() const {} + +private slots: +// Remove all test cases if exceptions are not available +#ifndef QT_NO_EXCEPTIONS + void testCorrectStdTypes() const; + void testCorrectStdExceptions() const; + void testCorrectMyExceptions() const; + + void testFailInt() const; + void testFailStdString() const; + void testFailStdRuntimeError() const; + void testFailMyException() const; + void testFailMyDerivedException() const; + + void testFailNoException() const; +#endif // !QT_NO_EXCEPTIONS +}; + + + +#ifndef QT_NO_EXCEPTIONS + +void tst_VerifyExceptionThrown::testCorrectStdTypes() const +{ + QVERIFY_EXCEPTION_THROWN(throw int(5), int); + QVERIFY_EXCEPTION_THROWN(throw float(9.8), float); + QVERIFY_EXCEPTION_THROWN(throw bool(true), bool); + QVERIFY_EXCEPTION_THROWN(throw std::string("some string"), std::string); +} + +void tst_VerifyExceptionThrown::testCorrectStdExceptions() const +{ + // same type + QVERIFY_EXCEPTION_THROWN(throw std::exception(), std::exception); + QVERIFY_EXCEPTION_THROWN(throw std::runtime_error("runtime error"), std::runtime_error); + QVERIFY_EXCEPTION_THROWN(throw std::overflow_error("overflow error"), std::overflow_error); + + // inheritance + QVERIFY_EXCEPTION_THROWN(throw std::overflow_error("overflow error"), std::runtime_error); + QVERIFY_EXCEPTION_THROWN(throw std::overflow_error("overflow error"), std::exception); +} + +void tst_VerifyExceptionThrown::testCorrectMyExceptions() const +{ + // same type + QVERIFY_EXCEPTION_THROWN(throw MyBaseException(), MyBaseException); + QVERIFY_EXCEPTION_THROWN(throw MyDerivedException(), MyDerivedException); + + // inheritance + QVERIFY_EXCEPTION_THROWN(throw MyDerivedException(), MyBaseException); + QVERIFY_EXCEPTION_THROWN(throw MyDerivedException(), std::domain_error); +} + +void tst_VerifyExceptionThrown::testFailInt() const +{ + QVERIFY_EXCEPTION_THROWN(throw int(5), double); +} + +void tst_VerifyExceptionThrown::testFailStdString() const +{ + QVERIFY_EXCEPTION_THROWN(throw std::string("some string"), char*); +} + +void tst_VerifyExceptionThrown::testFailStdRuntimeError() const +{ + QVERIFY_EXCEPTION_THROWN(throw std::logic_error("logic error"), std::runtime_error); +} + +void tst_VerifyExceptionThrown::testFailMyException() const +{ + QVERIFY_EXCEPTION_THROWN(throw std::logic_error("logic error"), MyBaseException); +} + +void tst_VerifyExceptionThrown::testFailMyDerivedException() const +{ + QVERIFY_EXCEPTION_THROWN(throw MyDerivedException(), std::runtime_error); +} + +void tst_VerifyExceptionThrown::testFailNoException() const +{ + QVERIFY_EXCEPTION_THROWN(doSomething(), std::exception); +} + +#endif // !QT_NO_EXCEPTIONS + + + +QTEST_MAIN(tst_VerifyExceptionThrown) + +#include "tst_verifyexceptionthrown.moc" diff --git a/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro new file mode 100644 index 0000000000..51f108c9d7 --- /dev/null +++ b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro @@ -0,0 +1,8 @@ +SOURCES += tst_verifyexceptionthrown.cpp +QT = core testlib + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target +CONFIG += exceptions + +TARGET = verifyexceptionthrown diff --git a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp index 20f53fdc91..4e3620caab 100644 --- a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp +++ b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp @@ -41,6 +41,7 @@ #include <QtCore/QCoreApplication> +#include <QtCore/QRegularExpression> #include <QtTest/QtTest> class tst_Warnings: public QObject @@ -49,6 +50,7 @@ class tst_Warnings: public QObject private slots: void testWarnings(); void testMissingWarnings(); + void testMissingWarningsRegularExpression(); void testMissingWarningsWithData_data(); void testMissingWarningsWithData(); }; @@ -73,6 +75,17 @@ void tst_Warnings::testWarnings() qDebug("Baba"); qDebug("Bubu"); qDebug("Baba"); + + QTest::ignoreMessage(QtDebugMsg, QRegularExpression("^Bubu.*")); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Baba.*")); + qDebug("Bubublabla"); + qWarning("Babablabla"); + qDebug("Bubublabla"); + qWarning("Babablabla"); + + // accept redundant space at end to keep compatibility with Qt < 5.2 + QTest::ignoreMessage(QtDebugMsg, "Bubu "); + qDebug() << "Bubu"; } void tst_Warnings::testMissingWarnings() @@ -84,6 +97,14 @@ void tst_Warnings::testMissingWarnings() qWarning("Warning2"); } +void tst_Warnings::testMissingWarningsRegularExpression() +{ + QTest::ignoreMessage(QtWarningMsg, QRegularExpression("Warning\\d\\d")); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression("Warning\\s\\d")); + + qWarning("Warning11"); +} + void tst_Warnings::testMissingWarningsWithData_data() { QTest::addColumn<int>("dummy"); diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index 779e992881..c68d48b813 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -24,7 +24,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n parse-defines.h \ function-with-attributes.h \ plugin_metadata.h \ - single-quote-digit-separator-n3781.h + single-quote-digit-separator-n3781.h \ + related-metaobjects-in-namespaces.h if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h diff --git a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h new file mode 100644 index 0000000000..0a3e9ed77d --- /dev/null +++ b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QObject> + +namespace QTBUG_2151 { + class A : public QObject { + Q_OBJECT + Q_ENUMS(SomeEnum) + public: + enum SomeEnum { SomeEnumValue = 0 }; + }; + + class B : public QObject + { + Q_OBJECT + Q_PROPERTY(A::SomeEnum blah READ blah) + public: + + A::SomeEnum blah() const { return A::SomeEnumValue; } + }; +} diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 7fae29e5ca..46f3e5a42a 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -76,6 +76,7 @@ #include "cxx11-explicit-override-control.h" #include "parse-defines.h" +#include "related-metaobjects-in-namespaces.h" QT_USE_NAMESPACE @@ -568,6 +569,8 @@ private slots: void preprocessorOnly(); void unterminatedFunctionMacro(); void QTBUG32933_relatedObjectsDontIncludeItself(); + void writeEnumFromUnrelatedClass(); + void relatedMetaObjectsWithinNamespaces(); signals: void sigWithUnsignedArg(unsigned foo); @@ -884,7 +887,7 @@ void tst_Moc::testExtraDataForEnum() const QMetaObject *mobjUser = &EnumUserClass::staticMetaObject; QCOMPARE(mobjUser->enumeratorCount(), 0); - const QMetaObject **objects = mobjUser->d.relatedMetaObjects; + const QMetaObject * const *objects = mobjUser->d.relatedMetaObjects; QVERIFY(objects); QVERIFY(objects[0] == mobjSource); QVERIFY(objects[1] == 0); @@ -3098,12 +3101,67 @@ namespace QTBUG32933_relatedObjectsDontIncludeItself { void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself() { const QMetaObject *mo = &QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::staticMetaObject; - const QMetaObject **objects = mo->d.relatedMetaObjects; + const QMetaObject * const *objects = mo->d.relatedMetaObjects; // the related objects should be empty because the enums is in the same object. QVERIFY(!objects); } +class UnrelatedClass : public QObject +{ + Q_OBJECT + Q_ENUMS(UnrelatedEnum) +public: + enum UnrelatedEnum { + UnrelatedInvalidValue = -1, + UnrelatedValue = 42 + }; +}; + +// The presence of this macro used to confuse moc and prevent +// UnrelatedClass from being listed in the related meta objects. +Q_DECLARE_METATYPE(UnrelatedClass::UnrelatedEnum) + +class TestClassReferencingUnrelatedEnum : public QObject +{ + Q_OBJECT + Q_PROPERTY(UnrelatedClass::UnrelatedEnum enumProperty READ enumProperty WRITE setEnumProperty) +public: + TestClassReferencingUnrelatedEnum() + : m_enumProperty(UnrelatedClass::UnrelatedInvalidValue) + {} + + UnrelatedClass::UnrelatedEnum enumProperty() const { + return m_enumProperty; + } + + void setEnumProperty(UnrelatedClass::UnrelatedEnum arg) { + m_enumProperty = arg; + } + +private: + UnrelatedClass::UnrelatedEnum m_enumProperty; +}; + +void tst_Moc::writeEnumFromUnrelatedClass() +{ + TestClassReferencingUnrelatedEnum obj; + QString enumValueAsString("UnrelatedValue"); + obj.setProperty("enumProperty", enumValueAsString); + QCOMPARE(int(obj.enumProperty()), int(UnrelatedClass::UnrelatedValue)); +} + + + +void tst_Moc::relatedMetaObjectsWithinNamespaces() +{ + const QMetaObject *relatedMo = &QTBUG_2151::A::staticMetaObject; + + const QMetaObject *testMo = &QTBUG_2151::B::staticMetaObject; + QVERIFY(testMo->d.relatedMetaObjects); + QVERIFY(testMo->d.relatedMetaObjects[0] == relatedMo); +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS diff --git a/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h new file mode 100644 index 0000000000..597728e207 --- /dev/null +++ b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h @@ -0,0 +1,50 @@ +/******************************************************************************** +** Form generated from reading UI file 'Dialog_without_Buttons.ui' +** +** Created by: Qt User Interface Compiler version 5.3.0 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef DIALOG_WITHOUT_BUTTONS_TR_H +#define DIALOG_WITHOUT_BUTTONS_TR_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QDialog> +#include <QtWidgets/QHeaderView> +#include <ki18n.h> + +QT_BEGIN_NAMESPACE + +class Ui_Dialog +{ +public: + + void setupUi(QDialog *Dialog) + { + if (Dialog->objectName().isEmpty()) + Dialog->setObjectName(QStringLiteral("Dialog")); + Dialog->resize(400, 300); + + retranslateUi(Dialog); + + QMetaObject::connectSlotsByName(Dialog); + } // setupUi + + void retranslateUi(QDialog *Dialog) + { + Dialog->setWindowTitle(i18n("Dialog", 0)); + } // retranslateUi + +}; + +namespace Ui { + class Dialog: public Ui_Dialog {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // DIALOG_WITHOUT_BUTTONS_TR_H diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp index c6e8466d89..02a19c0c33 100644 --- a/tests/auto/tools/uic/tst_uic.cpp +++ b/tests/auto/tools/uic/tst_uic.cpp @@ -64,9 +64,13 @@ private Q_SLOTS: void run(); void run_data() const; + void runTranslation(); + void compare(); void compare_data() const; + void runCompare(); + private: const QString m_command; QString m_baseline; @@ -220,5 +224,53 @@ void tst_uic::compare_data() const } } +void tst_uic::runTranslation() +{ + QProcess process; + + QDir baseline(m_baseline); + + QDir generated(m_generated.path()); + generated.mkdir(QLatin1String("translation")); + QString generatedFile = generated.absolutePath() + QLatin1String("/translation/Dialog_without_Buttons_tr.h"); + + process.start(m_command, QStringList(baseline.filePath("Dialog_without_Buttons.ui")) + << QString(QLatin1String("-tr")) << "i18n" + << QString(QLatin1String("-include")) << "ki18n.h" + << QString(QLatin1String("-o")) << generatedFile); + QVERIFY2(process.waitForStarted(), msgProcessStartFailed(m_command, process.errorString())); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitStatus(), QProcess::NormalExit); + QCOMPARE(process.exitCode(), 0); + QCOMPARE(QFileInfo(generatedFile).exists(), true); +} + + +void tst_uic::runCompare() +{ + QFile orgFile(m_baseline + QLatin1String("/translation/Dialog_without_Buttons_tr.h")); + + QDir generated(m_generated.path()); + QFile genFile(generated.absolutePath() + QLatin1String("/translation/Dialog_without_Buttons_tr.h")); + + if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QString err(QLatin1String("Could not read file: %1...")); + QFAIL(err.arg(orgFile.fileName()).toUtf8()); + } + + if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QString err(QLatin1String("Could not read file: %1...")); + QFAIL(err.arg(genFile.fileName()).toUtf8()); + } + + QString originalFile = orgFile.readAll(); + originalFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); + + QString generatedFile = genFile.readAll(); + generatedFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); + + QCOMPARE(generatedFile, originalFile); +} + QTEST_MAIN(tst_uic) #include "tst_uic.moc" diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro index acff1df5ba..c5f2c409dd 100644 --- a/tests/auto/widgets/dialogs/dialogs.pro +++ b/tests/auto/widgets/dialogs/dialogs.pro @@ -1,6 +1,5 @@ TEMPLATE=subdirs SUBDIRS=\ - qabstractprintdialog \ qcolordialog \ qdialog \ qerrormessage \ @@ -14,8 +13,6 @@ SUBDIRS=\ qsidebar \ qwizard \ -wince*|!qtHaveModule(printsupport):SUBDIRS -= qabstractprintdialog - !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qsidebar \ diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 9cb391d5f4..3a1f650351 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -424,7 +424,14 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi wchar_t nativeHiddenFile[MAX_PATH]; memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile)); hiddenFile.toWCharArray(nativeHiddenFile); +#ifndef Q_OS_WINRT DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile); +#else // !Q_OS_WINRT + WIN32_FILE_ATTRIBUTE_DATA attributeData; + if (!::GetFileAttributesEx(nativeHiddenFile, GetFileExInfoStandard, &attributeData)) + attributeData.dwFileAttributes = 0xFFFFFFFF; + DWORD currentAttributes = attributeData.dwFileAttributes; +#endif // Q_OS_WINRT if (currentAttributes == 0xFFFFFFFF) { qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile)); return false; diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 0c3b46c5d5..527f62b22d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -5,5 +5,5 @@ QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII -win32:!wince*: LIBS += -luser32 +win32:!wince*:!winrt: LIBS += -luser32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index fc1d0e34cb..de7c528825 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -71,7 +71,7 @@ Q_DECLARE_METATYPE(QPainterPath) #include "../../../qtest-config.h" -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 6366f86250..8f7a3a3255 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -1,3 +1,4 @@ + /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). @@ -47,6 +48,8 @@ #include <qgraphicsscene.h> #include <qgraphicsview.h> #include <qapplication.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qproxystyle.h> class tst_QGraphicsLinearLayout : public QObject { Q_OBJECT @@ -86,6 +89,7 @@ private slots: void removeItem(); void setGeometry_data(); void setGeometry(); + void defaultSpacing(); void setSpacing_data(); void setSpacing(); void setItemSpacing_data(); @@ -909,6 +913,94 @@ void tst_QGraphicsLinearLayout::setGeometry() delete widget; } +class LayoutStyle : public QProxyStyle +{ +public: + LayoutStyle(const QString &key) + : QProxyStyle(key), + horizontalSpacing(-1), verticalSpacing(-1) {} + + virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE + { + if (pm == QStyle::PM_LayoutHorizontalSpacing && horizontalSpacing >= 0) { + return horizontalSpacing; + } else if (pm == QStyle::PM_LayoutVerticalSpacing && verticalSpacing >= 0) { + return verticalSpacing; + } + return QProxyStyle::pixelMetric(pm, option, widget); + } + + int horizontalSpacing; + int verticalSpacing; +}; + +void tst_QGraphicsLinearLayout::defaultSpacing() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + LayoutStyle *style = new LayoutStyle(QLatin1String("windows")); + style->horizontalSpacing = 5; + style->verticalSpacing = 3; + LayoutStyle *style2 = new LayoutStyle(QLatin1String("windows")); + style2->horizontalSpacing = 25; + style2->verticalSpacing = 23; + + QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); + widget->setStyle(style); + + // Horizontal layout + SubQGraphicsLinearLayout *layout = new SubQGraphicsLinearLayout(Qt::Horizontal); + widget->setLayout(layout); + Q_ASSERT(widget->style()); + scene.addItem(widget); + layout->setContentsMargins(0, 0, 0, 0); + view.show(); + + for (int i = 0; i < 2; ++i) { + QGraphicsWidget *w = new QGraphicsWidget; + layout->addItem(w); + } + + // Horizontal layout + qreal styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + QCOMPARE(styleSpacing, qreal(5)); + QCOMPARE(styleSpacing, layout->spacing()); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(105)); + style->horizontalSpacing = 15; + // If the style method changes return value, the layout must be invalidated by the application + layout->invalidate(); + styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + QCOMPARE(styleSpacing, qreal(15)); + QCOMPARE(styleSpacing, layout->spacing()); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(115)); + widget->setStyle(style2); + // If the style itself changes, the layout will pick that up + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(125)); + QCOMPARE(layout->spacing(), qreal(25)); + + // Vertical layout + widget->setStyle(style); + layout->setOrientation(Qt::Vertical); + styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutVerticalSpacing); + QCOMPARE(styleSpacing, qreal(3)); + QCOMPARE(styleSpacing, layout->spacing()); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(103)); + style->verticalSpacing = 13; + // If the style method changes return value, the layout must be invalidated by the application + layout->invalidate(); + styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutVerticalSpacing); + QCOMPARE(styleSpacing, qreal(13)); + QCOMPARE(styleSpacing, layout->spacing()); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(113)); + widget->setStyle(style2); + // If the style itself changes, the layout will pick that up + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(123)); + QCOMPARE(layout->spacing(), qreal(23)); + + + delete widget; +} + void tst_QGraphicsLinearLayout::setSpacing_data() { QTest::addColumn<qreal>("spacing"); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 8d00931ef1..a6022e0d7d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -4,7 +4,7 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc -win32:!wince*: LIBS += -luser32 +win32:!wince*:!winrt: LIBS += -luser32 !wince*:DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 15c92663ec..dfc8465210 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -54,7 +54,7 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index cb935fd2fd..313cadd6a1 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro @@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate QT += widgets testlib SOURCES += tst_qitemdelegate.cpp -win32:!wince*: LIBS += -luser32 +win32:!wince*:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 439725b257..addb226101 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -66,7 +66,7 @@ Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 413304bdcf..1ea8beb8df 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -2,4 +2,4 @@ CONFIG += testcase TARGET = tst_qlistview QT += widgets gui-private widgets-private core-private testlib SOURCES += tst_qlistview.cpp -win32:!wince*: LIBS += -luser32 +win32:!wince*:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 268276bd4a..9f5484983d 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -1484,7 +1484,7 @@ void tst_QListView::wordWrap() QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog { Q_OBJECT @@ -1525,7 +1525,7 @@ private: }; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 // This test only makes sense on windows 2000 and higher. void tst_QListView::setCurrentIndexAfterAppendRowCrash() { diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 83ba1ddcda..d2625c400a 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1758,9 +1758,7 @@ void tst_QTreeWidget::setData() QCOMPARE(qvariant_cast<QTreeWidgetItem*>(args.at(0)), item); QCOMPARE(qvariant_cast<int>(args.at(1)), j); item->setIcon(j, icon); - // #### shouldn't cause dataChanged() - QCOMPARE(itemChangedSpy.count(), 1); - itemChangedSpy.clear(); + QCOMPARE(itemChangedSpy.count(), 0); QString toolTip = QString("toolTip %0").arg(i); item->setToolTip(j, toolTip); diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 091927abe4..e13dfe836f 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -179,6 +179,8 @@ private slots: void globalStaticObjectDestruction(); // run this last void abortQuitOnShow(); + + void settableStyleHints(); // Needs to run last as it changes style hints. }; class EventSpy : public QObject @@ -1949,7 +1951,7 @@ void tst_QApplication::windowsCommandLine_data() void tst_QApplication::windowsCommandLine() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QFETCH(QString, args); QFETCH(QString, expected); @@ -2305,6 +2307,22 @@ void tst_QApplication::abortQuitOnShow() QCOMPARE(app.exec(), 1); } +void tst_QApplication::settableStyleHints() +{ + int argc = 0; + QApplication app(argc, 0); + QApplication::setCursorFlashTime(437); + QCOMPARE(QApplication::cursorFlashTime(), 437); + QApplication::setDoubleClickInterval(128); + QCOMPARE(QApplication::doubleClickInterval(), 128); + QApplication::setStartDragDistance(122000); + QCOMPARE(QApplication::startDragDistance(), 122000); + QApplication::setStartDragTime(834); + QCOMPARE(QApplication::startDragTime(), 834); + QApplication::setKeyboardInputInterval(309); + QCOMPARE(QApplication::keyboardInputInterval(), 309); +} + /* This test is meant to ensure that certain objects (public & commonly used) can safely be used in a Q_GLOBAL_STATIC such that their destructors are @@ -2314,7 +2332,9 @@ Q_GLOBAL_STATIC(QLocale, tst_qapp_locale); #ifndef QT_NO_PROCESS Q_GLOBAL_STATIC(QProcess, tst_qapp_process); #endif +#ifndef QT_NO_FILESYSTEMWATCHER Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher); +#endif #ifndef QT_NO_SHAREDMEMORY Q_GLOBAL_STATIC(QSharedMemory, tst_qapp_sharedMemory); #endif @@ -2337,7 +2357,9 @@ void tst_QApplication::globalStaticObjectDestruction() #ifndef QT_NO_PROCESS QVERIFY(tst_qapp_process()); #endif +#ifndef QT_NO_FILESYSTEMWATCHER QVERIFY(tst_qapp_fileSystemWatcher()); +#endif #ifndef QT_NO_SHAREDMEMORY QVERIFY(tst_qapp_sharedMemory()); #endif diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index a4fcde8a34..3eedfa1d3a 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -20,7 +20,7 @@ x11 { LIBS += $$QMAKE_LIBS_X11 } -!wince*:win32: LIBS += -luser32 -lgdi32 +!wince*:win32:!winrt: LIBS += -luser32 -lgdi32 mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695 linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-30566
\ No newline at end of file diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 9090f97ce6..fc3b0d983c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -117,11 +117,13 @@ static bool qt_wince_is_platform(const QString &platformString) { } static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); } # endif // Q_OS_WINCE_WM -# else // Q_OS_WINCE +# elif !defined(Q_OS_WINRT) // Q_OS_WINCE # define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ QSKIP("desktop is not visible, this test would fail"); -# endif // !Q_OS_WINCE +# else // !Q_OS_WINCE && !Q_OS_WINRT +# define Q_CHECK_PAINTEVENTS +# endif // Q_OS_WINRT #else // Q_OS_WIN # define Q_CHECK_PAINTEVENTS #endif // else Q_OS_WIN @@ -304,7 +306,7 @@ private slots: void subtractOpaqueSiblings(); #endif -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void setGeometry_win(); #endif @@ -374,7 +376,7 @@ private slots: void quitOnCloseAttribute(); void moveRect(); -#if defined (Q_OS_WIN) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) void gdiPainting(); void paintOnScreenPossible(); #endif @@ -592,7 +594,7 @@ void tst_QWidget::getSetCheck() QCOMPARE(true, obj1.autoFillBackground()); var1.reset(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP); @@ -1283,7 +1285,7 @@ void tst_QWidget::visible_setWindowOpacity() testWidget->hide(); QVERIFY( !testWidget->isVisible() ); testWidget->setWindowOpacity(0.5); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QVERIFY(!::IsWindowVisible(winHandleOf(testWidget))); #endif testWidget->setWindowOpacity(1.0); @@ -3623,7 +3625,7 @@ void tst_QWidget::optimizedResize_topLevel() topLevel.partial = false; topLevel.paintedRegion = QRegion(); -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) topLevel.resize(topLevel.size() + QSize(10, 10)); #else // Static contents does not work when programmatically resizing @@ -4555,7 +4557,7 @@ void tst_QWidget::setWindowGeometry() } } -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void tst_QWidget::setGeometry_win() { QWidget widget; @@ -4573,7 +4575,7 @@ void tst_QWidget::setGeometry_win() QVERIFY(rt.left <= 0); QVERIFY(rt.top <= 0); } -#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) +#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) // Since X11 WindowManager operation are all async, and we have no way to know if the window // manager has finished playing with the window geometry, this test can't be reliable on X11. @@ -8118,7 +8120,7 @@ void tst_QWidget::moveRect() child.move(10, 10); // Don't crash. } -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) class GDIWidget : public QDialog { Q_OBJECT @@ -8185,7 +8187,7 @@ void tst_QWidget::paintOnScreenPossible() w2.setAttribute(Qt::WA_PaintOnScreen); QVERIFY(w2.testAttribute(Qt::WA_PaintOnScreen)); } -#endif // Q_OS_WIN +#endif // Q_OS_WIN && !Q_OS_WINRT void tst_QWidget::reparentStaticWidget() { diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index eabb7aaa17..509ccc37b6 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -162,6 +162,7 @@ private slots: void highlightedSignal(); void itemData(); void task_QTBUG_31146_popupCompletion(); + void keyboardSelection(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -1848,7 +1849,7 @@ void tst_QComboBox::flaggedItems_data() itemList << "nine" << "ten"; keyMovementList << Qt::Key_T; - QTest::newRow(testCase.toLatin1() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 9; + QTest::newRow(testCase.toLatin1() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2; keyMovementList.clear(); keyMovementList << Qt::Key_T << Qt::Key_H; @@ -2946,5 +2947,32 @@ void tst_QComboBox::task_QTBUG_31146_popupCompletion() QCOMPARE(comboBox.currentIndex(), 0); } +void tst_QComboBox::keyboardSelection() +{ + QComboBox comboBox; + const int keyboardInterval = QApplication::keyboardInputInterval(); + QStringList list; + list << "OA" << "OB" << "OC" << "OO" << "OP" << "PP"; + comboBox.addItems(list); + + // Clear any remaining keyboard input from previous tests. + QTest::qWait(keyboardInterval); + QTest::keyClicks(&comboBox, "oo", Qt::NoModifier, 50); + QCOMPARE(comboBox.currentText(), list.at(3)); + + QTest::qWait(keyboardInterval); + QTest::keyClicks(&comboBox, "op", Qt::NoModifier, 50); + QCOMPARE(comboBox.currentText(), list.at(4)); + + QTest::keyClick(&comboBox, Qt::Key_P, Qt::NoModifier, keyboardInterval); + QCOMPARE(comboBox.currentText(), list.at(5)); + + QTest::keyClick(&comboBox, Qt::Key_O, Qt::NoModifier, keyboardInterval); + QCOMPARE(comboBox.currentText(), list.at(0)); + + QTest::keyClick(&comboBox, Qt::Key_O, Qt::NoModifier, keyboardInterval); + QCOMPARE(comboBox.currentText(), list.at(1)); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index bfffa357a8..ded3e55283 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -346,7 +346,7 @@ void tst_QDateTimeEdit::cleanupTestCase() void tst_QDateTimeEdit::init() { QLocale::setDefault(QLocale(QLocale::C)); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index b880ebe078..49f058862d 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -145,6 +145,9 @@ private slots: void taskQTBUG_6670_selectAllWithPrefix(); void taskQTBUG_6496_fiddlingWithPrecision(); + void setGroupSeparatorShown_data(); + void setGroupSeparatorShown(); + public slots: void valueChangedHelper(const QString &); void valueChangedHelper(double); @@ -156,6 +159,9 @@ private: typedef QList<double> DoubleList; +Q_DECLARE_METATYPE(QLocale::Language) +Q_DECLARE_METATYPE(QLocale::Country) + tst_QDoubleSpinBox::tst_QDoubleSpinBox() { @@ -1099,5 +1105,45 @@ void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision() QCOMPARE(dsb.maximum(), 0.991); } +void tst_QDoubleSpinBox::setGroupSeparatorShown_data() +{ + QTest::addColumn<QLocale::Language>("lang"); + QTest::addColumn<QLocale::Country>("country"); + + QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates; + QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden; + QTest::newRow("data2") << QLocale::German << QLocale::Germany; + QTest::newRow("data3") << QLocale::Georgian << QLocale::Georgia; + QTest::newRow("data3") << QLocale::Macedonian << QLocale::Macedonia; +} + +void tst_QDoubleSpinBox::setGroupSeparatorShown() +{ + QFETCH(QLocale::Language, lang); + QFETCH(QLocale::Country, country); + + QLocale loc(lang, country); + QLocale::setDefault(loc); + DoubleSpinBox spinBox; + spinBox.setMaximum(99999999); + spinBox.setValue(1300000.00); + spinBox.setGroupSeparatorShown(true); + QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(1300000.00, 'f', 2)); + QCOMPARE(spinBox.isGroupSeparatorShown(), true); + QCOMPARE(spinBox.textFromValue(23421),spinBox.locale().toString(23421.00, 'f', 2)); + + spinBox.setGroupSeparatorShown(false); + QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(1300000.00, 'f', 2).remove( + spinBox.locale().groupSeparator())); + QCOMPARE(spinBox.isGroupSeparatorShown(), false); + + spinBox.setMaximum(72000); + spinBox.lineEdit()->setText(spinBox.locale().toString(32000.64, 'f', 2)); + QCOMPARE(spinBox.value()+1000, 33000.64); + + spinBox.lineEdit()->setText(spinBox.locale().toString(32000.44, 'f', 2)); + QCOMPARE(spinBox.value()+1000, 33000.44); +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index a9f5cb686c..e9cc1e6abd 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -53,7 +53,7 @@ #include "qstandarditemmodel.h" #include <qpa/qplatformtheme.h> #include "qstylehints.h" -#include <private/qguiapplication_p.h> +#include <private/qapplication_p.h> #include "qclipboard.h" #ifdef Q_OS_MAC @@ -71,6 +71,7 @@ #include <qstringlistmodel.h> #include <qsortfilterproxymodel.h> #include <qdebug.h> +#include <qscreen.h> #include "qcommonstyle.h" #include "qstyleoption.h" @@ -87,6 +88,17 @@ QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE +static inline void centerOnScreen(QWidget *w, const QSize &size) +{ + const QPoint offset = QPoint(size.width() / 2, size.height() / 2); + w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); +} + +static inline void centerOnScreen(QWidget *w) +{ + centerOnScreen(w, w->geometry().size()); +} + class StyleOptionTestStyle : public QCommonStyle { private: @@ -300,6 +312,9 @@ private slots: void clearButton(); void sideWidgets(); + void shouldShowPlaceholderText_data(); + void shouldShowPlaceholderText(); + protected slots: void editingFinished(); @@ -313,6 +328,7 @@ private: // keyClicks(..) is moved to QtTestCase void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0); void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0); + QLineEdit *ensureTestWidget(); bool validInput; QString changed_string; @@ -322,7 +338,7 @@ private: int selection_count; int lastCursorPos; int newCursorPos; - QLineEdit *testWidget; + QLineEdit *m_testWidget; int m_keyboardScheme; PlatformInputContext m_platformInputContext; }; @@ -351,7 +367,7 @@ void tst_QLineEdit::getSetCheck() QCOMPARE(true, obj1.dragEnabled()); } -tst_QLineEdit::tst_QLineEdit() : validInput(false), m_keyboardScheme(0) +tst_QLineEdit::tst_QLineEdit() : validInput(false), m_testWidget(0), m_keyboardScheme(0) { if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); @@ -367,23 +383,24 @@ tst_QLineEdit::~tst_QLineEdit() { } +QLineEdit *tst_QLineEdit::ensureTestWidget() +{ + if (!m_testWidget) { + m_testWidget = new QLineEdit; + m_testWidget->setObjectName("testWidget"); + connect(m_testWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onCursorPositionChanged(int,int))); + connect(m_testWidget, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); + connect(m_testWidget, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited(QString))); + connect(m_testWidget, SIGNAL(returnPressed()), this, SLOT(onReturnPressed())); + connect(m_testWidget, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); + connect(m_testWidget, SIGNAL(editingFinished()), this, SLOT(editingFinished())); + m_testWidget->resize(200,50); + } + return m_testWidget; +} + void tst_QLineEdit::initTestCase() { - testWidget = new QLineEdit(0); - testWidget->setObjectName("testWidget"); - connect(testWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onCursorPositionChanged(int,int))); - connect(testWidget, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); - connect(testWidget, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited(QString))); - connect(testWidget, SIGNAL(returnPressed()), this, SLOT(onReturnPressed())); - connect(testWidget, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); - connect(testWidget, SIGNAL(editingFinished()), this, SLOT(editingFinished())); - - testWidget->resize(200,50); - testWidget->show(); - QVERIFY(QTest::qWaitForWindowExposed(testWidget)); - QApplication::setActiveWindow(testWidget); - QTRY_VERIFY(testWidget->hasFocus()); - changed_count = 0; edited_count = 0; selection_count = 0; @@ -394,7 +411,6 @@ void tst_QLineEdit::initTestCase() void tst_QLineEdit::cleanupTestCase() { - delete testWidget; QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); inputMethodPrivate->testContext = 0; } @@ -402,23 +418,17 @@ void tst_QLineEdit::cleanupTestCase() void tst_QLineEdit::init() { return_count = 0; - testWidget->clear(); - testWidget->setEchoMode(QLineEdit::Normal); - testWidget->setMaxLength(32767); - testWidget->setReadOnly(false); - testWidget->setText(""); - testWidget->setInputMask(""); - testWidget->setFrame(true); - testWidget->setValidator(0); - testWidget->setDragEnabled(true); } void tst_QLineEdit::cleanup() { + delete m_testWidget; + m_testWidget = 0; } void tst_QLineEdit::experimental() { + QLineEdit *testWidget = ensureTestWidget(); QIntValidator intValidator(3, 7, 0); testWidget->setValidator(&intValidator); testWidget->setText(""); @@ -436,8 +446,7 @@ void tst_QLineEdit::experimental() void tst_QLineEdit::upperAndLowercase() { - testWidget->setInputMask(""); - testWidget->setText(""); + QLineEdit *testWidget = ensureTestWidget(); QTest::keyClicks(testWidget, "aAzZ`1234567890-=~!@#$%^&*()_+[]{}\\|;:'\",.<>/?"); qApp->processEvents(); @@ -659,6 +668,7 @@ void tst_QLineEdit::setInputMask() QEXPECT_FAIL( "insert blank=input", "To eat blanks or not? Known issue. Task 43172", Abort); // First set the input mask + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(mask); // then either insert using insert() or keyboard @@ -702,12 +712,14 @@ void tst_QLineEdit::inputMask() QFETCH(QString, mask); QFETCH(QString, expectedMask); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(mask); QCOMPARE(testWidget->inputMask(), expectedMask); } void tst_QLineEdit::clearInputMask() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask("000.000.000.000"); QVERIFY(testWidget->inputMask() != QString::null); testWidget->setInputMask(QString::null); @@ -789,6 +801,7 @@ void tst_QLineEdit::keypress_inputMask() QFETCH(QString, expectedText); QFETCH(QString, expectedDisplayText); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(mask); keys.simulate(testWidget); @@ -825,6 +838,7 @@ void tst_QLineEdit::hasAcceptableInputMask() QFETCH(QString, valid); // test that invalid input (for required) work for optionalMask + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(optionalMask); validInput = false; testWidget->setText(invalid); @@ -876,6 +890,7 @@ public: void tst_QLineEdit::hasAcceptableInputValidator() { + QLineEdit *testWidget = ensureTestWidget(); QSignalSpy spyChanged(testWidget, SIGNAL(textChanged(QString))); QSignalSpy spyEdited(testWidget, SIGNAL(textEdited(QString))); @@ -926,6 +941,7 @@ void tst_QLineEdit::maskCharacter() QFETCH(QString, input); QFETCH(bool, expectedValid); + QLineEdit *testWidget = ensureTestWidget(); QFocusEvent lostFocus(QEvent::FocusOut); testWidget->setInputMask(mask); @@ -1076,6 +1092,7 @@ void tst_QLineEdit::undo() QFETCH(QStringList, expectedString); QFETCH(bool, use_keys); + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->isUndoAvailable()); int i; @@ -1167,6 +1184,7 @@ void tst_QLineEdit::redo() QFETCH(IntList, insertIndex); QFETCH(QStringList, expectedString); + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->isUndoAvailable()); QVERIFY(!testWidget->isRedoAvailable()); @@ -1436,6 +1454,7 @@ void tst_QLineEdit::undo_keypressevents() QFETCH(QTestEventList, keys); QFETCH(QStringList, expectedString); + QLineEdit *testWidget = ensureTestWidget(); keys.simulate(testWidget); for (int i=0; i<expectedString.size(); ++i) { @@ -1480,6 +1499,7 @@ void tst_QLineEdit::QTBUG5786_undoPaste() void tst_QLineEdit::clear() { // checking that clear of empty/nullstring doesn't add to undo history + QLineEdit *testWidget = ensureTestWidget(); int max = 5000; while (max > 0 && testWidget->isUndoAvailable()) { max--; @@ -1501,7 +1521,7 @@ void tst_QLineEdit::clear() void tst_QLineEdit::editingFinished() { - if (testWidget->hasAcceptableInput()) + if (m_testWidget->hasAcceptableInput()) validInput = true; else validInput = false; @@ -1523,6 +1543,7 @@ void tst_QLineEdit::text_data() void tst_QLineEdit::text() { QFETCH(QString, insertString); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(insertString); QCOMPARE(testWidget->text(), insertString); } @@ -1537,6 +1558,7 @@ void tst_QLineEdit::textMask_data() void tst_QLineEdit::textMask() { QFETCH( QString, insertString ); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask( "#" ); testWidget->setText( insertString ); QCOMPARE( testWidget->text(), insertString ); @@ -1544,6 +1566,7 @@ void tst_QLineEdit::textMask() void tst_QLineEdit::setText() { + QLineEdit *testWidget = ensureTestWidget(); QSignalSpy editedSpy(testWidget, SIGNAL(textEdited(QString))); QSignalSpy changedSpy(testWidget, SIGNAL(textChanged(QString))); testWidget->setText("hello"); @@ -1613,7 +1636,7 @@ void tst_QLineEdit::displayText_data() m << bool(use_setText); s = key_mode_str + "Password"; m = QLineEdit::Password; - QChar passChar = qApp->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, 0, testWidget); + QChar passChar = qApp->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, 0, m_testWidget); QString input; QString pass; input = "Hello World"; @@ -1645,6 +1668,7 @@ void tst_QLineEdit::displayText() QFETCH(QLineEdit::EchoMode, mode); //QFETCH(bool, use_setText); Currently unused. + QLineEdit *testWidget = ensureTestWidget(); testWidget->setEchoMode(mode); testWidget->setText(insertString); QCOMPARE(testWidget->displayText(), expectedString); @@ -1654,11 +1678,15 @@ void tst_QLineEdit::displayText() void tst_QLineEdit::passwordEchoOnEdit() { QStyleOptionFrameV2 opt; + QLineEdit *testWidget = ensureTestWidget(); QChar fillChar = testWidget->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, testWidget); testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit); testWidget->setFocus(); + centerOnScreen(testWidget); + testWidget->show(); testWidget->raise(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget)); QTRY_VERIFY(testWidget->hasFocus()); QTest::keyPress(testWidget, '0'); @@ -1683,6 +1711,7 @@ void tst_QLineEdit::passwordEchoOnEdit() void tst_QLineEdit::passwordEchoDelay() { + QLineEdit *testWidget = ensureTestWidget(); int delay = qGuiApp->styleHints()->passwordMaskDelay(); #if defined QT_BUILD_INTERNAL QLineEditPrivate *priv = QLineEditPrivate::get(testWidget); @@ -1698,7 +1727,10 @@ void tst_QLineEdit::passwordEchoDelay() testWidget->setEchoMode(QLineEdit::Password); testWidget->setFocus(); + centerOnScreen(testWidget); + testWidget->show(); testWidget->raise(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget)); QTRY_VERIFY(testWidget->hasFocus()); QTest::keyPress(testWidget, '0'); @@ -1757,6 +1789,7 @@ void tst_QLineEdit::maxLength_mask() QFETCH(QString, mask); QFETCH(int, expectedLength); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(mask); QCOMPARE(testWidget->maxLength(), expectedLength); @@ -1789,6 +1822,7 @@ void tst_QLineEdit::maxLength() QFETCH(bool, use_setText); // in some cases we set the maxLength _before_ entering the text. + QLineEdit *testWidget = ensureTestWidget(); if (!insertBeforeSettingMaxLength) testWidget->setMaxLength(length); @@ -1820,6 +1854,7 @@ void tst_QLineEdit::maxLength() void tst_QLineEdit::isReadOnly() { + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->isReadOnly()); // start with a basic text @@ -1863,6 +1898,7 @@ void tst_QLineEdit::noCursorBlinkWhenReadOnly() if (cursorFlashTime == 0) return; BlinkTestLineEdit le; + centerOnScreen(&le); le.show(); le.setFocus(); QTest::qWaitForWindowActive(&le); @@ -1928,6 +1964,7 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo void tst_QLineEdit::cursorPosition() { + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(testWidget->cursorPosition() == 0); // start with a basic text @@ -2015,7 +2052,7 @@ void tst_QLineEdit::cursorPositionChanged_data() QTestEventList keys; keys.addKeyClick(Qt::Key_A); - QTest::newRow("a") << keys << 0 << 1; + QTest::newRow("a") << keys << -1 << 1; keys.clear(); keys.addKeyClick(Qt::Key_A); @@ -2146,6 +2183,7 @@ void tst_QLineEdit::cursorPositionChanged() lastCursorPos = 0; newCursorPos = 0; + QLineEdit *testWidget = ensureTestWidget(); input.simulate(testWidget); QCOMPARE(lastCursorPos, lastPos); QCOMPARE(newCursorPos, newPos); @@ -2156,6 +2194,7 @@ void tst_QLineEdit::selectedText() QString testString = "Abc defg hijklmno, p 'qrst' uvw xyz"; // start with a basic text + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(testString); selection_count = 0; @@ -2225,6 +2264,7 @@ void tst_QLineEdit::textChangedAndTextEdited() changed_count = 0; edited_count = 0; + QLineEdit *testWidget = ensureTestWidget(); QTest::keyClick(testWidget, Qt::Key_A); QCOMPARE(changed_count, 1); QVERIFY(edited_count == changed_count); @@ -2283,6 +2323,7 @@ void tst_QLineEdit::returnPressed() { return_count = 0; + QLineEdit *testWidget = ensureTestWidget(); QTest::keyClick(testWidget, Qt::Key_Return); QVERIFY(return_count == 1); return_count = 0; @@ -2431,6 +2472,7 @@ void tst_QLineEdit::returnPressed_maskvalidator() QFETCH(bool, returnPressed); QEXPECT_FAIL("mask '999', intfix validator(0,999), input '12<cr>'", "QIntValidator has changed behaviour. Does not accept spaces. Task 43082.", Abort); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMask(inputMask); if (hasValidator) @@ -2451,6 +2493,7 @@ void tst_QLineEdit::onReturnPressed() void tst_QLineEdit::setValidator() { // Verify that we can set and re-set a validator. + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->validator()); QIntValidator iv1(0); @@ -2601,6 +2644,7 @@ void tst_QLineEdit::setValidator_QIntValidator() QFETCH(bool, is_valid); QIntValidator intValidator(mini, maxi, 0); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setValidator(&intValidator); QVERIFY(testWidget->text().isEmpty()); //qDebug("1 input: '" + input + "' Exp: '" + expectedText + "'"); @@ -2637,6 +2681,7 @@ void tst_QLineEdit::frame_data() void tst_QLineEdit::frame() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setFrame(false); // verify that the editor is shown without a frame #ifndef NO_PIXMAP_TESTS @@ -2674,6 +2719,7 @@ void tst_QLineEdit::setAlignment_data() void tst_QLineEdit::setAlignment() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("left"); testWidget->setAlignment(Qt::AlignLeft); #ifndef NO_PIXMAP_TESTS @@ -2713,6 +2759,7 @@ void tst_QLineEdit::setAlignment() void tst_QLineEdit::isModified() { + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->isModified()); testWidget->setText("bla"); QVERIFY(!testWidget->isModified()); @@ -2747,6 +2794,7 @@ void tst_QLineEdit::isModified() void tst_QLineEdit::edited() { + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(!testWidget->isModified()); testWidget->setText("bla"); QVERIFY(!testWidget->isModified()); @@ -2778,6 +2826,7 @@ void tst_QLineEdit::edited() void tst_QLineEdit::insert() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->insert("This"); testWidget->insert(" is"); testWidget->insert(" a"); @@ -2854,6 +2903,7 @@ void tst_QLineEdit::setSelection() QFETCH(QString, expectedText); QFETCH(bool, expectedHasSelectedText); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(text); testWidget->setSelection(start, length); QCOMPARE(testWidget->hasSelectedText(), expectedHasSelectedText); @@ -2869,6 +2919,7 @@ void tst_QLineEdit::cut() QSKIP("Autotests run from cron and pasteboard don't get along quite ATM"); // test newlines in cut'n'paste + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("A\nB\nC\n"); testWidget->setSelection(0, 6); testWidget->cut(); @@ -2964,6 +3015,7 @@ void tst_QLineEdit::inputMaskAndValidator() QFETCH(QString, validateText); QFETCH(int, validatePos); + QLineEdit *testWidget = ensureTestWidget(); InputMaskValidator imv(testWidget); testWidget->setValidator(&imv); @@ -2977,6 +3029,7 @@ void tst_QLineEdit::inputMaskAndValidator() void tst_QLineEdit::maxLengthAndInputMask() { // Really a test for #30447 + QLineEdit *testWidget = ensureTestWidget(); QVERIFY(testWidget->inputMask().isNull()); testWidget->setMaxLength(10); QVERIFY(testWidget->maxLength() == 10); @@ -3016,6 +3069,7 @@ Q_DECLARE_METATYPE(LineEdit::State); void tst_QLineEdit::returnPressedKeyEvent() { LineEdit lineedit; + centerOnScreen(&lineedit); lineedit.show(); QCOMPARE((int)lineedit.state, (int)LineEdit::Other); QTest::keyClick(&lineedit, Qt::Key_Enter); @@ -3032,6 +3086,7 @@ void tst_QLineEdit::returnPressedKeyEvent() void tst_QLineEdit::keepSelectionOnTabFocusIn() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("hello world"); { QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); @@ -3049,6 +3104,7 @@ void tst_QLineEdit::keepSelectionOnTabFocusIn() void tst_QLineEdit::readOnlyStyleOption() { + QLineEdit *testWidget = ensureTestWidget(); bool wasReadOnly = testWidget->isReadOnly(); QStyle *oldStyle = testWidget->style(); @@ -3071,6 +3127,7 @@ void tst_QLineEdit::readOnlyStyleOption() void tst_QLineEdit::validateOnFocusOut() { + QLineEdit *testWidget = ensureTestWidget(); QSignalSpy editingFinishedSpy(testWidget, SIGNAL(editingFinished())); testWidget->setValidator(new QIntValidator(100, 999, 0)); QTest::keyPress(testWidget, '1'); @@ -3080,8 +3137,11 @@ void tst_QLineEdit::validateOnFocusOut() QCOMPARE(editingFinishedSpy.count(), 0); testWidget->setFocus(); + centerOnScreen(testWidget); + testWidget->show(); testWidget->activateWindow(); - QTRY_VERIFY(testWidget->hasFocus()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); + QVERIFY(testWidget->hasFocus()); QTest::keyPress(testWidget, '0'); QTRY_COMPARE(testWidget->text(), QString("100")); @@ -3092,6 +3152,7 @@ void tst_QLineEdit::validateOnFocusOut() void tst_QLineEdit::editInvalidText() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->clear(); testWidget->setValidator(new QIntValidator(0, 120, 0)); testWidget->setText("1234"); @@ -3119,6 +3180,7 @@ void tst_QLineEdit::editInvalidText() void tst_QLineEdit::charWithAltOrCtrlModifier() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->clear(); QCOMPARE(testWidget->text(), QString("")); QTest::keyPress(testWidget, Qt::Key_Plus); @@ -3133,6 +3195,7 @@ void tst_QLineEdit::charWithAltOrCtrlModifier() void tst_QLineEdit::leftKeyOnSelectedText() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->clear(); testWidget->setText("0123"); testWidget->setCursorPosition(4); @@ -3155,6 +3218,7 @@ void tst_QLineEdit::leftKeyOnSelectedText() void tst_QLineEdit::inlineCompletion() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->clear(); QStandardItemModel *model = new QStandardItemModel; QStandardItem *root = model->invisibleRootItem(); @@ -3169,6 +3233,9 @@ void tst_QLineEdit::inlineCompletion() QCompleter *completer = new QCompleter(model); completer->setCompletionMode(QCompleter::InlineCompletion); completer->setCaseSensitivity(Qt::CaseInsensitive); + centerOnScreen(testWidget); + testWidget->show(); + QTest::qWaitForWindowExposed(testWidget); testWidget->setFocus(); QTRY_COMPARE(qApp->activeWindow(), (QWidget*)testWidget); testWidget->setCompleter(completer); @@ -3235,6 +3302,7 @@ void tst_QLineEdit::inlineCompletion() void tst_QLineEdit::noTextEditedOnClear() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("Test"); QSignalSpy textEditedSpy(testWidget, SIGNAL(textEdited(QString))); testWidget->clear(); @@ -3298,6 +3366,7 @@ void tst_QLineEdit::textMargin() sizeHint.setHeight(sizeHint.height() + top +bottom); QCOMPARE(testWidget.sizeHint(), sizeHint); testWidget.setFrame(false); + centerOnScreen(&tlw); tlw.show(); int l; @@ -3317,6 +3386,7 @@ void tst_QLineEdit::textMargin() #ifndef QTEST_NO_CURSOR void tst_QLineEdit::cursor() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setReadOnly(false); QCOMPARE(testWidget->cursor().shape(), Qt::IBeamCursor); testWidget->setReadOnly(true); @@ -3556,12 +3626,16 @@ void tst_QLineEdit::task233101_cursorPosAfterInputMethod() void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode() { QStyleOptionFrameV2 opt; + QLineEdit *testWidget = ensureTestWidget(); QChar fillChar = testWidget->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, testWidget); testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit); testWidget->setFocus(); + centerOnScreen(testWidget); + testWidget->show(); QApplication::setActiveWindow(testWidget); - QTRY_VERIFY(testWidget->hasFocus()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); + QVERIFY(testWidget->hasFocus()); QTest::keyPress(testWidget, '0'); QCOMPARE(testWidget->displayText(), QString("0")); @@ -3585,6 +3659,7 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode() void tst_QLineEdit::task248948_redoRemovedSelection() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("a"); testWidget->selectAll(); QTest::keyPress(testWidget, Qt::Key_Delete); @@ -3599,12 +3674,15 @@ void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword() { QString password("Wanna guess?"); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(password); testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit); testWidget->setFocus(); testWidget->selectAll(); + centerOnScreen(testWidget); + testWidget->show(); QApplication::setActiveWindow(testWidget); - QTRY_VERIFY(testWidget->hasFocus()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); QTest::keyPress(testWidget, Qt::Key_Enter); QTRY_COMPARE(testWidget->text(), password); @@ -3614,6 +3692,7 @@ void tst_QLineEdit::taskQTBUG_4679_moveToStartEndOfBlock() { #ifdef Q_OS_MAC const QString text("there are no blocks for lineEdit"); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(text); testWidget->setCursorPosition(5); QCOMPARE(testWidget->cursorPosition(), 5); @@ -3629,6 +3708,7 @@ void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock() { #ifdef Q_OS_MAC const QString text("there are no blocks for lineEdit, select all"); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText(text); testWidget->setCursorPosition(5); QCOMPARE(testWidget->cursorPosition(), 5); @@ -3898,6 +3978,7 @@ void tst_QLineEdit::bidiLogicalMovement() void tst_QLineEdit::selectAndCursorPosition() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("This is a long piece of text"); testWidget->setSelection(0, 5); @@ -3908,6 +3989,10 @@ void tst_QLineEdit::selectAndCursorPosition() void tst_QLineEdit::inputMethod() { + QLineEdit *testWidget = ensureTestWidget(); + centerOnScreen(testWidget); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget)); // widget accepts input QInputMethodQueryEvent queryEvent(Qt::ImEnabled); QApplication::sendEvent(testWidget, &queryEvent); @@ -3942,6 +4027,7 @@ void tst_QLineEdit::inputMethod() void tst_QLineEdit::inputMethodSelection() { + QLineEdit *testWidget = ensureTestWidget(); testWidget->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); testWidget->setSelection(0,0); QSignalSpy selectionSpy(testWidget, SIGNAL(selectionChanged())); @@ -3989,6 +4075,7 @@ void tst_QLineEdit::inputMethodQueryImHints_data() void tst_QLineEdit::inputMethodQueryImHints() { QFETCH(Qt::InputMethodHints, hints); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setInputMethodHints(hints); QVariant value = testWidget->inputMethodQuery(Qt::ImHints); @@ -4031,7 +4118,7 @@ void tst_QLineEdit::undoRedoAndEchoModes() QFETCH(QStringList, expected); // create some history for the QLineEdit - testWidget->clear(); + QLineEdit *testWidget = ensureTestWidget(); testWidget->setEchoMode(QLineEdit::EchoMode(echoMode)); testWidget->insert(input.at(0)); testWidget->selectAll(); @@ -4136,5 +4223,59 @@ void tst_QLineEdit::sideWidgets() lineEdit->addAction(iconAction); } +Q_DECLARE_METATYPE(Qt::AlignmentFlag) +void tst_QLineEdit::shouldShowPlaceholderText_data() +{ + QTest::addColumn<QString>("text"); + QTest::addColumn<bool>("hasFocus"); + QTest::addColumn<Qt::AlignmentFlag>("alignment"); + QTest::addColumn<bool>("shouldShowPlaceholderText"); + + QTest::newRow("empty, non-focused, left") << QString() << false << Qt::AlignLeft << true; + QTest::newRow("empty, focused, left") << QString() << true << Qt::AlignLeft << true; + QTest::newRow("non-empty, non-focused, left") << QStringLiteral("Qt") << false << Qt::AlignLeft << false; + QTest::newRow("non-empty, focused, left") << QStringLiteral("Qt") << true << Qt::AlignLeft << false; + + QTest::newRow("empty, non-focused, center") << QString() << false << Qt::AlignHCenter << true; + QTest::newRow("empty, focused, center") << QString() << true << Qt::AlignHCenter << false; + QTest::newRow("non-empty, non-focused, center") << QStringLiteral("Qt") << false << Qt::AlignHCenter << false; + QTest::newRow("non-empty, focused, center") << QStringLiteral("Qt") << true << Qt::AlignHCenter << false; + + QTest::newRow("empty, non-focused, right") << QString() << false << Qt::AlignRight << true; + QTest::newRow("empty, focused, right") << QString() << true << Qt::AlignRight << true; + QTest::newRow("non-empty, non-focused, right") << QStringLiteral("Qt") << false << Qt::AlignRight << false; + QTest::newRow("non-empty, focused, right") << QStringLiteral("Qt") << true << Qt::AlignRight << false; +} + +void tst_QLineEdit::shouldShowPlaceholderText() +{ +#ifndef QT_BUILD_INTERNAL + QSKIP("This test requires a developer build."); +#else + QFETCH(QString, text); + QFETCH(bool, hasFocus); + QFETCH(Qt::AlignmentFlag, alignment); + QFETCH(bool, shouldShowPlaceholderText); + + QLineEdit lineEdit; + + // avoid "Test input context to commit without focused object" warnings + lineEdit.setAttribute(Qt::WA_InputMethodEnabled, false); + + if (hasFocus) { + lineEdit.show(); + QApplicationPrivate::setFocusWidget(&lineEdit, Qt::NoFocusReason); + } + QCOMPARE(lineEdit.hasFocus(), hasFocus); + + lineEdit.setText(text); + lineEdit.setAlignment(alignment); + + QLineEditPrivate *priv = QLineEditPrivate::get(&lineEdit); + QCOMPARE(priv->shouldShowPlaceholderText(), shouldShowPlaceholderText); +#endif + +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index a21f2d70a0..21034e8f1b 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -144,6 +144,10 @@ private slots: void lineEditReturnPressed(); void positiveSign(); + + void setGroupSeparatorShown_data(); + void setGroupSeparatorShown(); + public slots: void valueChangedHelper(const QString &); void valueChangedHelper(int); @@ -154,6 +158,9 @@ private: typedef QList<int> IntList; +Q_DECLARE_METATYPE(QLocale::Language) +Q_DECLARE_METATYPE(QLocale::Country) + // Testing get/set functions void tst_QSpinBox::getSetCheck() { @@ -1128,5 +1135,47 @@ void tst_QSpinBox::positiveSign() QCOMPARE(spinBox.text(), QLatin1String("+20")); } +void tst_QSpinBox::setGroupSeparatorShown_data() +{ + QTest::addColumn<QLocale::Language>("lang"); + QTest::addColumn<QLocale::Country>("country"); + + QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates; + QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden; + QTest::newRow("data2") << QLocale::German << QLocale::Germany; + QTest::newRow("data3") << QLocale::Georgian << QLocale::Georgia; + QTest::newRow("data3") << QLocale::Macedonian << QLocale::Macedonia; +} + +void tst_QSpinBox::setGroupSeparatorShown() +{ + QFETCH(QLocale::Language, lang); + QFETCH(QLocale::Country, country); + + QLocale loc(lang, country); + QLocale::setDefault(loc); + SpinBox spinBox; + spinBox.setMaximum(99999); + spinBox.setValue(13000); + spinBox.setGroupSeparatorShown(true); + QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(13000)); + QCOMPARE(spinBox.isGroupSeparatorShown(), true); + QCOMPARE(spinBox.textFromValue(23421),spinBox.locale().toString(23421)); + + spinBox.setGroupSeparatorShown(false); + QCOMPARE(spinBox.lineEdit()->text(), QStringLiteral("13000")); + QCOMPARE(spinBox.isGroupSeparatorShown(), false); + + spinBox.setMaximum(72000); + spinBox.lineEdit()->setText(spinBox.locale().toString(32000)); + QCOMPARE(spinBox.value()+1000, 33000); + + spinBox.lineEdit()->setText(QStringLiteral("32000")); + QCOMPARE(spinBox.value()+1000, 33000); + + spinBox.lineEdit()->setText(QStringLiteral("32,000")); + QCOMPARE(spinBox.value()+1000, 33000); +} + QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index 72956a6867..c367959cbc 100644 --- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro +++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro @@ -8,4 +8,4 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qtabwidget.cpp -win32:!wince*:LIBS += -luser32 +win32:!wince*:!winrt:LIBS += -luser32 diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index fa518e6afd..e55438f3d3 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -48,7 +48,7 @@ #include <qlabel.h> #include <QtWidgets/qboxlayout.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) # include <qt_windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 11bb5c88a1..d06807eedb 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -203,6 +203,8 @@ private slots: void highlightLongLine(); + void countTextChangedOnRemove(); + private: void createSelection(); int blockCount() const; @@ -2499,6 +2501,19 @@ void tst_QTextEdit::highlightLongLine() QVERIFY(true); } +//check for bug 15003, are there multiple textChanged() signals on remove? +void tst_QTextEdit::countTextChangedOnRemove() +{ + QTextEdit edit; + edit.insertPlainText("Hello"); + + QSignalSpy spy(&edit, SIGNAL(textChanged())); + + QKeyEvent event(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); + QCoreApplication::instance()->notify(&edit, &event); + + QCOMPARE(spy.count(), 1); +} QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index cbe3ec8798..f6190f20c4 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -76,7 +76,11 @@ const QString PI_PulseTestrBranch(QLS("PulseTestrBranch")); void BaselineProtocol::sysSleep(int ms) { #if defined(Q_OS_WIN) +# ifndef Q_OS_WINRT Sleep(DWORD(ms)); +# else + WaitForSingleObjectEx(GetCurrentThread(), ms, false); +# endif #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); @@ -116,6 +120,7 @@ PlatformInfo PlatformInfo::localHostInfo() pi.insert(PI_OSName, QLS("Other")); #endif +#ifndef QT_NO_PROCESS QProcess git; QString cmd; QStringList args; @@ -151,6 +156,7 @@ PlatformInfo PlatformInfo::localHostInfo() pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb)); } } +#endif // !QT_NO_PROCESS return pi; } diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index 49672a90bf..b2380b0e58 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -176,7 +176,12 @@ private slots: wcscat(appendedPath, L"\\*"); WIN32_FIND_DATA fd; +#ifndef Q_OS_WINRT HANDLE hSearch = FindFirstFileW(appendedPath, &fd); +#else + HANDLE hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, + FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif QVERIFY(hSearch != INVALID_HANDLE_VALUE); QBENCHMARK { diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index 5188658bdb..691e822379 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -106,7 +106,12 @@ static int posix_helper(const wchar_t *dirpath) wchar_t appendedPath[MAX_PATH]; wcscpy(appendedPath, dirpath); wcscat(appendedPath, L"\\*"); +#ifndef Q_OS_WINRT hSearch = FindFirstFile(appendedPath, &fd); +#else + hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, + FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif appendedPath[origDirPathLength] = 0; if (hSearch == INVALID_HANDLE_VALUE) { diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index bb4a921fc7..82bca1541d 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -230,7 +230,12 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) wchar_t szSearchPath[MAX_PATH]; QString::fromLatin1(path).toWCharArray(szSearchPath); wcscat(szSearchPath, L"\\*"); +#ifndef Q_OS_WINRT HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); +#else + HANDLE dir = FindFirstFileEx(szSearchPath, FindExInfoStandard, &m_fileSearchResult, + FindExSearchLimitToDirectories, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif m_bFirstSearchResult = true; #else DIR *dir = ::opendir(path.constData()); diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 0beffebfb7..e0ae29fbee 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -310,7 +310,11 @@ void tst_qfile::readBigFile() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; @@ -319,7 +323,12 @@ void tst_qfile::readBigFile() do { ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); } while(numberOfBytesRead != 0); +#ifndef Q_OS_WINRT SetFilePointer(hndl, 0, NULL, FILE_BEGIN); +#else + LARGE_INTEGER offset = { 0 }; + SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); +#endif } delete[] nativeBuffer; CloseHandle(hndl); @@ -400,11 +409,20 @@ void tst_qfile::seek() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); QBENCHMARK { i=(i+1)%sp_size; +#ifndef Q_OS_WINRT SetFilePointer(hndl, seekpos[i], NULL, 0); +#else + LARGE_INTEGER offset = { seekpos[i] }; + SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); +#endif } CloseHandle(hndl); #else @@ -489,7 +507,11 @@ void tst_qfile::open() wchar_t* cfilename = (wchar_t*)filename.utf16(); QBENCHMARK { +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); CloseHandle(hndl); } @@ -698,7 +720,11 @@ void tst_qfile::readSmallFiles() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 594e5b7478..de1aaea177 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -54,7 +54,7 @@ class qfileinfo : public QObject private slots: void existsTemporary(); void existsStatic(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceMounpoint(); #endif @@ -84,7 +84,7 @@ void qfileinfo::existsStatic() QBENCHMARK { QFileInfo::exists(appPath); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void qfileinfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index 47227ef630..52c60f9484 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -95,7 +95,11 @@ void NativeMutexUnlock(NativeMutexType *mutex) typedef CRITICAL_SECTION NativeMutexType; void NativeMutexInitialize(NativeMutexType *mutex) { +#ifndef Q_OS_WINRT InitializeCriticalSection(mutex); +#else + InitializeCriticalSectionEx(mutex, 0, 0); +#endif } void NativeMutexDestroy(NativeMutexType *mutex) { diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp index 55967b9215..d5919ebe5a 100644 --- a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp @@ -55,156 +55,88 @@ public: } private slots: - void oscillate_data(); - void oscillate(); - - void thrash_data(); - void thrash(); - -public: - static QWaitCondition local, remote; - enum Turn {LocalTurn, RemoteTurn}; - static Turn turn; + void oscillate_mutex_data(); + void oscillate_mutex(); + void oscillate_writelock_data(); + void oscillate_writelock(); }; -QWaitCondition tst_QWaitCondition::local; -QWaitCondition tst_QWaitCondition::remote; -tst_QWaitCondition::Turn tst_QWaitCondition::turn = tst_QWaitCondition::LocalTurn; +int turn; +const int threadCount = 10; +QWaitCondition cond; + +template <class Mutex, class Locker> class OscillateThread : public QThread { public: - bool m_done; - bool m_useMutex; - unsigned long m_timeout; - bool m_wakeOne; - int count; - - OscillateThread(bool useMutex, unsigned long timeout, bool wakeOne) - : m_done(false), m_useMutex(useMutex), m_timeout(timeout), m_wakeOne(wakeOne) - {} + Mutex *mutex; + int m_threadid; + int timeout; + void run() { - QMutex mtx; - QReadWriteLock rwl; - count = 0; - - forever { - if (m_done) - break; - if (m_useMutex) { - mtx.lock(); - while (tst_QWaitCondition::turn == tst_QWaitCondition::LocalTurn) - tst_QWaitCondition::remote.wait(&mtx, m_timeout); - mtx.unlock(); - } else { - rwl.lockForWrite(); - while (tst_QWaitCondition::turn == tst_QWaitCondition::LocalTurn) - tst_QWaitCondition::remote.wait(&rwl, m_timeout); - rwl.unlock(); + for (int count = 0; count < 5000; ++count) { + + Locker lock(mutex); + while (m_threadid != turn) { + cond.wait(mutex, timeout); } - tst_QWaitCondition::turn = tst_QWaitCondition::LocalTurn; - if (m_wakeOne) - tst_QWaitCondition::local.wakeOne(); - else - tst_QWaitCondition::local.wakeAll(); - count++; + turn = (turn+1) % threadCount; + cond.wakeAll(); } } }; -void tst_QWaitCondition::oscillate_data() -{ - QTest::addColumn<bool>("useMutex"); - QTest::addColumn<unsigned long>("timeout"); - QTest::addColumn<bool>("wakeOne"); - - QTest::newRow("mutex, timeout, one") << true << 1000ul << true; - QTest::newRow("readWriteLock, timeout, one") << false << 1000ul << true; - QTest::newRow("mutex, timeout, all") << true << 1000ul << false; - QTest::newRow("readWriteLock, timeout, all") << false << 1000ul << false; - QTest::newRow("mutex, forever, one") << true << ULONG_MAX << true; - QTest::newRow("readWriteLock, forever, one") << false << ULONG_MAX << true; - QTest::newRow("mutex, forever, all") << true << ULONG_MAX << false; - QTest::newRow("readWriteLock, forever, all") << false << ULONG_MAX << false; -} - -void tst_QWaitCondition::oscillate() -{ - QMutex mtx; - QReadWriteLock rwl; +template <class Mutex, class Locker> +void oscillate(unsigned long timeout) { - QFETCH(bool, useMutex); - QFETCH(unsigned long, timeout); - QFETCH(bool, wakeOne); - - turn = LocalTurn; - OscillateThread thrd(useMutex, timeout, wakeOne); - thrd.start(); + OscillateThread<Mutex, Locker> thrd[threadCount]; + Mutex m; + for (int i = 0; i < threadCount; ++i) { + thrd[i].mutex = &m; + thrd[i].m_threadid = i; + thrd[i].timeout = timeout; + } QBENCHMARK { - if (useMutex) - mtx.lock(); - else - rwl.lockForWrite(); - turn = RemoteTurn; - if (wakeOne) - remote.wakeOne(); - else - remote.wakeAll(); - if (useMutex) { - while (turn == RemoteTurn) - local.wait(&mtx, timeout); - mtx.unlock(); - } else { - while (turn == RemoteTurn) - local.wait(&rwl, timeout); - rwl.unlock(); + for (int i = 0; i < threadCount; ++i) { + thrd[i].start(); + } + for (int i = 0; i < threadCount; ++i) { + thrd[i].wait(); } } - thrd.m_done = true; - remote.wakeAll(); - thrd.wait(); - - QCOMPARE(0, 0); } -void tst_QWaitCondition::thrash_data() +void tst_QWaitCondition::oscillate_mutex_data() { - oscillate_data(); + QTest::addColumn<unsigned long>("timeout"); + + QTest::newRow("0") << 0ul; + QTest::newRow("1") << 1ul; + QTest::newRow("1000") << 1000ul; + QTest::newRow("forever") << ULONG_MAX; } -void tst_QWaitCondition::thrash() +void tst_QWaitCondition::oscillate_mutex() { - QMutex mtx; - mtx.lock(); - - QFETCH(bool, useMutex); QFETCH(unsigned long, timeout); - QFETCH(bool, wakeOne); - - turn = LocalTurn; - OscillateThread thrd(useMutex, timeout, wakeOne); - thrd.start(); - local.wait(&mtx, 1000ul); - mtx.unlock(); - - QBENCHMARK { - turn = RemoteTurn; - if (wakeOne) - remote.wakeOne(); - else - remote.wakeAll(); - } + oscillate<QMutex, QMutexLocker>(timeout); +} - thrd.m_done = true; - turn = RemoteTurn; - remote.wakeAll(); - thrd.wait(); +void tst_QWaitCondition::oscillate_writelock_data() +{ + oscillate_mutex_data(); +} - QCOMPARE(0, 0); +void tst_QWaitCondition::oscillate_writelock() +{ + QFETCH(unsigned long, timeout); + oscillate<QReadWriteLock, QWriteLocker>(timeout); } + QTEST_MAIN(tst_QWaitCondition) #include "tst_qwaitcondition.moc" diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro index d7f65a911d..4e602ceb4e 100644 --- a/tests/benchmarks/corelib/thread/thread.pro +++ b/tests/benchmarks/corelib/thread/thread.pro @@ -3,3 +3,4 @@ SUBDIRS = \ qmutex \ qthreadstorage \ qthreadpool \ + qwaitcondition \ diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index 5ed6651052..fb95ecb5b4 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -88,7 +88,9 @@ void tst_QTcpServer::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_NETWORKPROXY QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif } void tst_QTcpServer::initTestCase() @@ -100,16 +102,22 @@ void tst_QTcpServer::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } } void tst_QTcpServer::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } //---------------------------------------------------------------------------------- diff --git a/tests/manual/qpainfo/main.cpp b/tests/manual/qpainfo/main.cpp index 0f5119bab3..257b340467 100644 --- a/tests/manual/qpainfo/main.cpp +++ b/tests/manual/qpainfo/main.cpp @@ -180,7 +180,8 @@ int main(int argc, char **argv) << " startDragVelocity=" << styleHints->startDragVelocity() << " keyboardInputInterval=" << styleHints->keyboardInputInterval() << " keyboardAutoRepeatRate=" << styleHints->keyboardAutoRepeatRate() << " cursorFlashTime=" << styleHints->cursorFlashTime() << " showIsFullScreen=" << styleHints->showIsFullScreen() << " passwordMaskDelay=" << styleHints->passwordMaskDelay() - << " fontSmoothingGamma=" << styleHints->fontSmoothingGamma() << " useRtlExtensions=" << styleHints->useRtlExtensions() << '\n'; + << " fontSmoothingGamma=" << styleHints->fontSmoothingGamma() << " useRtlExtensions=" << styleHints->useRtlExtensions() + << " mousePressAndHoldInterval=" << styleHints->mousePressAndHoldInterval() << '\n'; const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme(); std::cout << "\nTheme:\n Styles: " << platformTheme->themeHint(QPlatformTheme::StyleNames).toStringList(); diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h index 7aa72cc28e..a68130a324 100644 --- a/tests/shared/filesystem.h +++ b/tests/shared/filesystem.h @@ -92,7 +92,7 @@ public: return file.isNull() ? qint64(-1) : file->write(relativeFileName.toUtf8()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) static void createNtfsJunction(QString target, QString linkName) { typedef struct { |