diff options
Diffstat (limited to 'tests/auto')
218 files changed, 9107 insertions, 2195 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index b864b065e6..b5486307a7 100644 --- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -127,14 +127,11 @@ void tst_QtConcurrentMap::map() QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished(); QCOMPARE(numberList, QList<Number>() << 4 << 8 << 12); -#ifdef Q_COMPILER_LAMBDA // lambda QtConcurrent::map(list, [](int &x){x *= 2;}).waitForFinished(); QCOMPARE(list, QList<int>() << 128 << 256 << 384); QtConcurrent::map(list.begin(), list.end(), [](int &x){x *= 2;}).waitForFinished(); QCOMPARE(list, QList<int>() << 256 << 512 << 768); -#endif - } // functors don't take arguments by reference, making these no-ops @@ -160,13 +157,11 @@ void tst_QtConcurrentMap::map() QtConcurrent::map(list.begin(), list.end(), multiplyBy2Immutable).waitForFinished(); QCOMPARE(list, QList<int>() << 1 << 2 << 3); -#ifdef Q_COMPILER_LAMBDA // lambda QtConcurrent::map(list, [](int x){x *= 2;}).waitForFinished(); QCOMPARE(list, QList<int>() << 1 << 2 << 3); QtConcurrent::map(list.begin(), list.end(), [](int x){x *= 2;}).waitForFinished(); QCOMPARE(list, QList<int>() << 1 << 2 << 3); -#endif } // Linked lists and forward iterators @@ -2026,12 +2021,12 @@ int fn(int &i) return i; } -int fnConstNoExcept(const int &i) Q_DECL_NOTHROW +int fnConstNoExcept(const int &i) noexcept { return i; } -int fnNoExcept(int &i) Q_DECL_NOTHROW +int fnNoExcept(int &i) noexcept { return i; } @@ -2046,12 +2041,12 @@ QString changeType(int &) return QString(); } -QString changeTypeConstNoExcept(const int &) Q_DECL_NOTHROW +QString changeTypeConstNoExcept(const int &) noexcept { return QString(); } -QString changeTypeNoExcept(int &) Q_DECL_NOTHROW +QString changeTypeNoExcept(int &) noexcept { return QString(); } @@ -2066,12 +2061,12 @@ int changeTypeQStringList(QStringList &) return 0; } -int changeTypeQStringListConstNoExcept(const QStringList &) Q_DECL_NOTHROW +int changeTypeQStringListConstNoExcept(const QStringList &) noexcept { return 0; } -int changeTypeQStringListNoExcept(QStringList &) Q_DECL_NOTHROW +int changeTypeQStringListNoExcept(QStringList &) noexcept { return 0; } @@ -2101,22 +2096,22 @@ public: return QString(); } - MemFnTester fnNoExcept() Q_DECL_NOTHROW + MemFnTester fnNoExcept() noexcept { return MemFnTester(); } - MemFnTester fnConstNoExcept() const Q_DECL_NOTHROW + MemFnTester fnConstNoExcept() const noexcept { return MemFnTester(); } - QString changeTypeNoExcept() Q_DECL_NOTHROW + QString changeTypeNoExcept() noexcept { return QString(); } - QString changeTypeConstNoExcept() const Q_DECL_NOTHROW + QString changeTypeConstNoExcept() const noexcept { return QString(); } diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp index 1596a9fafd..39d17e0a24 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -48,12 +48,8 @@ private slots: #ifndef QT_NO_EXCEPTIONS void exceptions(); #endif -#ifdef Q_COMPILER_DECLTYPE void functor(); -#endif -#ifdef Q_COMPILER_LAMBDA void lambda(); -#endif }; void light() @@ -126,23 +122,23 @@ public: class ANoExcept { public: - int member0() Q_DECL_NOTHROW { return 10; } - int member1(int in) Q_DECL_NOTHROW { return in; } + int member0() noexcept { return 10; } + int member1(int in) noexcept { return in; } typedef int result_type; - int operator()() Q_DECL_NOTHROW { return 10; } - int operator()(int in) Q_DECL_NOTHROW { return in; } + int operator()() noexcept { return 10; } + int operator()(int in) noexcept { return in; } }; class AConstNoExcept { public: - int member0() const Q_DECL_NOTHROW { return 10; } - int member1(int in) const Q_DECL_NOTHROW { return in; } + int member0() const noexcept { return 10; } + int member1(int in) const noexcept { return in; } typedef int result_type; - int operator()() const Q_DECL_NOTHROW { return 10; } - int operator()(int in) const Q_DECL_NOTHROW { return in; } + int operator()() const noexcept { return 10; } + int operator()(int in) const noexcept { return in; } }; void tst_QtConcurrentRun::returnValue() @@ -648,7 +644,6 @@ void tst_QtConcurrentRun::exceptions() } #endif -#ifdef Q_COMPILER_DECLTYPE // Compiler supports decltype struct Functor { int operator()() { return 42; } @@ -706,9 +701,7 @@ void tst_QtConcurrentRun::functor() QtConcurrent::run(&pool, f, 1,2,3,4,5).waitForFinished(); } } -#endif -#ifdef Q_COMPILER_LAMBDA // Compiler supports lambda void tst_QtConcurrentRun::lambda() { @@ -717,14 +710,12 @@ void tst_QtConcurrentRun::lambda() QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15)); QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5); -#ifdef Q_COMPILER_INITIALIZER_LISTS { QString str { "Hello World Foo" }; QFuture<QStringList> f1 = QtConcurrent::run([&](){ return str.split(' '); }); auto r = f1.result(); QCOMPARE(r, QStringList({"Hello", "World", "Foo"})); } -#endif // and now with explicit pool: QThreadPool pool; @@ -733,16 +724,13 @@ void tst_QtConcurrentRun::lambda() QCOMPARE(QtConcurrent::run(&pool, [](int a, double b){ return a + b; }, 12, 15).result(), double(12+15)); QCOMPARE(QtConcurrent::run(&pool, [](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5); -#ifdef Q_COMPILER_INITIALIZER_LISTS { QString str { "Hello World Foo" }; QFuture<QStringList> f1 = QtConcurrent::run(&pool, [&](){ return str.split(' '); }); auto r = f1.result(); QCOMPARE(r, QStringList({"Hello", "World", "Foo"})); } -#endif } -#endif QTEST_MAIN(tst_QtConcurrentRun) #include "tst_qtconcurrentrun.moc" diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index 72b086350e..1568855032 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -142,7 +142,6 @@ void tst_QFlags::signedness() std::is_signed<Qt::Alignment::Int>::value)); } -#if defined(Q_COMPILER_CLASS_ENUM) enum class MyStrictEnum { StrictZero, StrictOne, StrictTwo, StrictFour=4 }; Q_DECLARE_FLAGS( MyStrictFlags, MyStrictEnum ) Q_DECLARE_OPERATORS_FOR_FLAGS( MyStrictFlags ) @@ -154,11 +153,9 @@ Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isComplex ); Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isStatic ); Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isLarge ); Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isPointer ); -#endif void tst_QFlags::classEnum() { -#if defined(Q_COMPILER_CLASS_ENUM) // The main aim of the test is making sure it compiles // The QCOMPARE are there as an extra MyStrictEnum e1 = MyStrictEnum::StrictOne; @@ -257,27 +254,19 @@ void tst_QFlags::classEnum() // Just to make sure it compiles if (false) qDebug() << f3; -#endif } void tst_QFlags::initializerLists() { -#if defined(Q_COMPILER_INITIALIZER_LISTS) Qt::MouseButtons bts = { Qt::LeftButton, Qt::RightButton }; QVERIFY(bts.testFlag(Qt::LeftButton)); QVERIFY(bts.testFlag(Qt::RightButton)); QVERIFY(!bts.testFlag(Qt::MiddleButton)); -#if defined(Q_COMPILER_CLASS_ENUM) MyStrictNoOpFlags flags = { MyStrictNoOpEnum::StrictOne, MyStrictNoOpEnum::StrictFour }; QVERIFY(flags.testFlag(MyStrictNoOpEnum::StrictOne)); QVERIFY(flags.testFlag(MyStrictNoOpEnum::StrictFour)); QVERIFY(!flags.testFlag(MyStrictNoOpEnum::StrictTwo)); -#endif // Q_COMPILER_CLASS_ENUM - -#else - QSKIP("This test requires C++11 initializer_list support."); -#endif // Q_COMPILER_INITIALIZER_LISTS } void tst_QFlags::testSetFlags() diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp index 241dccb90e..6894fd4cc3 100644 --- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp +++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2016 by Southwest Research Institute (R) ** Contact: https://www.qt.io/licensing/ ** @@ -48,6 +49,7 @@ private slots: void arithOps(); void floatToFloat16(); void floatFromFloat16(); + void limits(); }; void tst_qfloat16::fuzzyCompare_data() @@ -345,5 +347,164 @@ void tst_qfloat16::floatFromFloat16() QCOMPARE(out[i], expected[i]); } +static qfloat16 powf16(qfloat16 base, int raise) +{ + const qfloat16 one(1.f); + if (raise < 0) { + raise = -raise; + base = one / base; + } + qfloat16 answer = (raise & 1) ? base : one; + while (raise > 0) { + raise >>= 1; + base *= base; + if (raise & 1) + answer *= base; + } + return answer; +} + +void tst_qfloat16::limits() +{ + // *NOT* using QCOMPARE() on finite qfloat16 values, since that uses fuzzy + // comparison, and we need exact here. + using Bounds = std::numeric_limits<qfloat16>; + QVERIFY(Bounds::is_specialized); + QVERIFY(Bounds::is_signed); + QVERIFY(!Bounds::is_integer); + QVERIFY(!Bounds::is_exact); + QVERIFY(Bounds::is_iec559); + QVERIFY(Bounds::is_bounded); + QVERIFY(!Bounds::is_modulo); + QVERIFY(!Bounds::traps); + QVERIFY(Bounds::has_infinity); + QVERIFY(Bounds::has_quiet_NaN); + QVERIFY(Bounds::has_signaling_NaN); + QCOMPARE(Bounds::has_denorm, std::denorm_present); + QCOMPARE(Bounds::round_style, std::round_to_nearest); + QCOMPARE(Bounds::radix, 2); + // Untested: has_denorm_loss + + // A few common values: + const qfloat16 zero(0), one(1), ten(10); + QVERIFY(qIsFinite(zero)); + QVERIFY(!qIsInf(zero)); + QVERIFY(!qIsNaN(zero)); + QCOMPARE(qFpClassify(zero), FP_ZERO); + QVERIFY(qIsFinite(one)); + QVERIFY(!qIsInf(one)); + QCOMPARE(qFpClassify(one), FP_NORMAL); + QVERIFY(!qIsNaN(one)); + QVERIFY(qIsFinite(ten)); + QVERIFY(!qIsInf(ten)); + QVERIFY(!qIsNaN(ten)); + QCOMPARE(qFpClassify(ten), FP_NORMAL); + + // digits in the mantissa, including the implicit 1 before the binary dot at its left: + QVERIFY(qfloat16(1 << (Bounds::digits - 1)) + one > qfloat16(1 << (Bounds::digits - 1))); + QVERIFY(qfloat16(1 << Bounds::digits) + one == qfloat16(1 << Bounds::digits)); + + // There is a wilful of-by-one in how m(ax|in)_exponent are defined; they're + // the lowest and highest n for which radix^{n-1} are normal and finite. + const qfloat16 two(Bounds::radix); + qfloat16 bit = powf16(two, Bounds::max_exponent - 1); + QVERIFY(qIsFinite(bit)); + QVERIFY(qIsInf(bit * two)); + bit = powf16(two, Bounds::min_exponent - 1); + QVERIFY(bit.isNormal()); + QCOMPARE(qFpClassify(bit), FP_NORMAL); + QVERIFY(!(bit / two).isNormal()); + QCOMPARE(qFpClassify(bit / two), FP_SUBNORMAL); + QVERIFY(bit / two > zero); + + // Base ten (with no matching off-by-one idiocy): + // the lowest negative number n such that 10^n is a valid normalized value + qfloat16 low10(powf16(ten, Bounds::min_exponent10)); + QVERIFY(low10 > zero); + QVERIFY(low10.isNormal()); + low10 /= ten; + QVERIFY(low10 == zero || !low10.isNormal()); + // the largest positive number n such that 10^n is a representable finite value + qfloat16 high10(powf16(ten, Bounds::max_exponent10)); + QVERIFY(high10 > zero); + QVERIFY(qIsFinite(high10)); + QVERIFY(!qIsFinite(high10 * ten)); + QCOMPARE(qFpClassify(high10), FP_NORMAL); + + // How many digits are significant ? (Casts avoid linker errors ...) + QCOMPARE(int(Bounds::digits10), 3); // 9.79e-4 has enough sigificant digits: + qfloat16 below(9.785e-4f), above(9.794e-4f); +#if 0 // Sadly, the QEMU x-compile for arm64 "optimises" comparisons: + const bool overOptimised = false; +#else + const bool overOptimised = (below != above); + if (overOptimised) + QEXPECT_FAIL("", "Over-optimised on QEMU", Continue); +#endif // (but it did, so should, pass everywhere else, confirming digits10 is indeed 3). + QVERIFY(below == above); + QCOMPARE(int(Bounds::max_digits10), 5); // we need 5 to distinguish these two: + QVERIFY(qfloat16(1000.5f) != qfloat16(1001.4f)); + + // Actual limiting values of the type: + const qfloat16 rose(one + Bounds::epsilon()); + QVERIFY(rose > one); + if (overOptimised) + QEXPECT_FAIL("", "Over-optimised on QEMU", Continue); + QVERIFY(one + Bounds::epsilon() / rose == one); + QVERIFY(qIsInf(Bounds::infinity())); + QVERIFY(!qIsNaN(Bounds::infinity())); + QVERIFY(!qIsFinite(Bounds::infinity())); + QCOMPARE(Bounds::infinity(), Bounds::infinity()); + QCOMPARE(qFpClassify(Bounds::infinity()), FP_INFINITE); + + QVERIFY(Bounds::infinity() > -Bounds::infinity()); + QVERIFY(Bounds::infinity() > zero); + QVERIFY(qIsInf(-Bounds::infinity())); + QVERIFY(!qIsNaN(-Bounds::infinity())); + QVERIFY(!qIsFinite(-Bounds::infinity())); + QCOMPARE(-Bounds::infinity(), -Bounds::infinity()); + QCOMPARE(qFpClassify(-Bounds::infinity()), FP_INFINITE); + + QVERIFY(-Bounds::infinity() < zero); + QVERIFY(qIsNaN(Bounds::quiet_NaN())); + QVERIFY(!qIsInf(Bounds::quiet_NaN())); + QVERIFY(!qIsFinite(Bounds::quiet_NaN())); + QVERIFY(!(Bounds::quiet_NaN() == Bounds::quiet_NaN())); + QCOMPARE(Bounds::quiet_NaN(), Bounds::quiet_NaN()); + QCOMPARE(qFpClassify(Bounds::quiet_NaN()), FP_NAN); + + QVERIFY(Bounds::max() > zero); + QVERIFY(qIsFinite(Bounds::max())); + QVERIFY(!qIsInf(Bounds::max())); + QVERIFY(!qIsNaN(Bounds::max())); + QVERIFY(qIsInf(Bounds::max() * rose)); + QCOMPARE(qFpClassify(Bounds::max()), FP_NORMAL); + + QVERIFY(Bounds::lowest() < zero); + QVERIFY(qIsFinite(Bounds::lowest())); + QVERIFY(!qIsInf(Bounds::lowest())); + QVERIFY(!qIsNaN(Bounds::lowest())); + QVERIFY(qIsInf(Bounds::lowest() * rose)); + QCOMPARE(qFpClassify(Bounds::lowest()), FP_NORMAL); + + QVERIFY(Bounds::min() > zero); + QVERIFY(Bounds::min().isNormal()); + QVERIFY(!(Bounds::min() / rose).isNormal()); + QVERIFY(qIsFinite(Bounds::min())); + QVERIFY(!qIsInf(Bounds::min())); + QVERIFY(!qIsNaN(Bounds::min())); + QCOMPARE(qFpClassify(Bounds::min()), FP_NORMAL); + + QVERIFY(Bounds::denorm_min() > zero); + QVERIFY(!Bounds::denorm_min().isNormal()); + QVERIFY(qIsFinite(Bounds::denorm_min())); + QVERIFY(!qIsInf(Bounds::denorm_min())); + QVERIFY(!qIsNaN(Bounds::denorm_min())); + if (overOptimised) + QEXPECT_FAIL("", "Over-optimised on QEMU", Continue); + QCOMPARE(Bounds::denorm_min() / rose, zero); + QCOMPARE(qFpClassify(Bounds::denorm_min()), FP_SUBNORMAL); +} + QTEST_APPLESS_MAIN(tst_qfloat16) #include "tst_qfloat16.moc" diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c index 0719c4b921..c7124454d0 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.c +++ b/tests/auto/corelib/global/qglobal/qglobal.c @@ -85,7 +85,7 @@ int tst_QtVersion() return QT_VERSION; } -const char *tst_qVersion() Q_DECL_NOTHROW +const char *tst_qVersion() Q_DECL_NOEXCEPT { #if !defined(QT_NAMESPACE) return qVersion(); diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 56da047147..5e5492de59 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -456,12 +456,8 @@ typedef int (Empty::*memFun) (); } while (false) \ /**/ -#ifdef Q_COMPILER_RVALUE_REFS #define TEST_AlignOf_RValueRef(type, alignment) \ TEST_AlignOf_impl(type, alignment) -#else -#define TEST_AlignOf_RValueRef(type, alignment) do {} while (false) -#endif #define TEST_AlignOf_impl(type, alignment) \ do { \ diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index d3ed1a6d0d..f212fe6f27 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -254,19 +254,15 @@ public: int rvalue() && { ADD("TestClass1::rvalue"); return 0; } int const_rvalue() const && { ADD("TestClass1::const_rvalue"); return 0; } #endif -#ifdef Q_COMPILER_DECLTYPE int decltype_param(int x = 0, decltype(x) = 0) { ADD("TestClass1::decltype_param"); return x; } template<typename T> int decltype_template_param(T x = 0, decltype(x) = 0) { ADD("TestClass1::decltype_template_param"); return x; } template<typename T> void decltype_template_param2(T x, decltype(x + QString())) { ADD("TestClass1::decltype_template_param2"); } -# ifdef Q_COMPILER_AUTO_FUNCTION auto decltype_return(int x = 0) -> decltype(x) { ADD("TestClass1::decltype_return"); return x; } template <typename T> auto decltype_template_return(T x = 0) -> decltype(x) { ADD("TestClass1::decltype_template_return"); return x; } -# endif -#endif public: TestClass1() @@ -323,15 +319,11 @@ public: std::move(*this).rvalue(); std::move(*this).const_rvalue(); #endif -#ifdef Q_COMPILER_DECLTYPE decltype_param(); decltype_template_param(0); decltype_template_param2(QByteArray(), QString()); -# ifdef Q_COMPILER_AUTO_FUNCTION decltype_return(); decltype_template_return(0); -# endif -#endif } }; diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 03300c6dbe..0a84b1fdd8 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -42,7 +42,8 @@ class tst_QNumeric: public QObject private slots: void fuzzyCompare_data(); void fuzzyCompare(); - void qNan(); + void qNanInf(); + void classifyfp(); void floatDistance_data(); void floatDistance(); void floatDistance_double_data(); @@ -91,7 +92,7 @@ void tst_QNumeric::fuzzyCompare() # pragma GCC optimize "no-fast-math" #endif -void tst_QNumeric::qNan() +void tst_QNumeric::qNanInf() { #if defined __FAST_MATH__ && (__GNUC__ * 100 + __GNUC_MINOR__ < 404) QSKIP("Non-conformant fast math mode is enabled, cannot run test"); @@ -99,9 +100,16 @@ void tst_QNumeric::qNan() double nan = qQNaN(); QVERIFY(!(0 > nan)); QVERIFY(!(0 < nan)); + QVERIFY(!(0 == nan)); + QVERIFY(!(nan == nan)); QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); QVERIFY(qIsNaN(-nan)); + QVERIFY(qIsNaN(1.0 / nan)); + QVERIFY(qIsNaN(0.0 / nan)); + QVERIFY(qIsNaN(0.0 * nan)); + QCOMPARE(nan, nan); + QCOMPARE(nan, -nan); Q_STATIC_ASSERT(sizeof(double) == 8); #ifdef Q_LITTLE_ENDIAN @@ -113,17 +121,56 @@ void tst_QNumeric::qNan() QVERIFY(!qIsFinite(nan)); QVERIFY(!qIsInf(nan)); QVERIFY(qIsNaN(nan)); + QVERIFY(qIsNaN(-nan)); + QVERIFY(!(nan == nan)); + QVERIFY(qIsNaN(0.0 * nan)); + QCOMPARE(qFpClassify(nan), FP_NAN); + QCOMPARE(nan, nan); + QCOMPARE(nan, -nan); + QCOMPARE(nan, qQNaN()); double inf = qInf(); QVERIFY(inf > 0); QVERIFY(-inf < 0); QVERIFY(qIsInf(inf)); + QCOMPARE(inf, inf); + QCOMPARE(-inf, -inf); QVERIFY(qIsInf(-inf)); - QVERIFY(qIsInf(2*inf)); - QCOMPARE(1/inf, 0.0); - QVERIFY(qIsNaN(0*nan)); - QVERIFY(qIsNaN(0*inf)); - QVERIFY(qFuzzyCompare(1/inf, 0.0)); + QVERIFY(qIsInf(inf + 1)); + QVERIFY(qIsInf(inf - 1)); + QVERIFY(qIsInf(inf * 2.0)); + QVERIFY(qIsInf(inf / 2.0)); + QVERIFY(qFuzzyCompare(1.0 / inf, 0.0)); + QCOMPARE(1.0 / inf, 0.0); + QVERIFY(qIsNaN(0.0 * inf)); +} + +void tst_QNumeric::classifyfp() +{ + QCOMPARE(qFpClassify(qQNaN()), FP_NAN); + + QCOMPARE(qFpClassify(qInf()), FP_INFINITE); + QCOMPARE(qFpClassify(-qInf()), FP_INFINITE); + QCOMPARE(qFpClassify(DBL_MAX * 2.0), FP_INFINITE); + QCOMPARE(qFpClassify(FLT_MAX * 2.f), FP_INFINITE); + QCOMPARE(qFpClassify(DBL_MAX * -2.0), FP_INFINITE); + QCOMPARE(qFpClassify(FLT_MAX * -2.f), FP_INFINITE); + + QCOMPARE(qFpClassify(1.0), FP_NORMAL); + QCOMPARE(qFpClassify(DBL_MAX), FP_NORMAL); + QCOMPARE(qFpClassify(-DBL_MAX), FP_NORMAL); + QCOMPARE(qFpClassify(DBL_MIN), FP_NORMAL); + QCOMPARE(qFpClassify(-DBL_MIN), FP_NORMAL); + QCOMPARE(qFpClassify(DBL_MIN / 2.0), FP_SUBNORMAL); + QCOMPARE(qFpClassify(DBL_MIN / -2.0), FP_SUBNORMAL); + + QCOMPARE(qFpClassify(1.f), FP_NORMAL); + QCOMPARE(qFpClassify(FLT_MAX), FP_NORMAL); + QCOMPARE(qFpClassify(-FLT_MAX), FP_NORMAL); + QCOMPARE(qFpClassify(FLT_MIN), FP_NORMAL); + QCOMPARE(qFpClassify(-FLT_MIN), FP_NORMAL); + QCOMPARE(qFpClassify(FLT_MIN / 2.f), FP_SUBNORMAL); + QCOMPARE(qFpClassify(FLT_MIN / -2.f), FP_SUBNORMAL); } void tst_QNumeric::floatDistance_data() @@ -461,13 +508,13 @@ template <typename Int> static void mulOverflow_template() QCOMPARE(mul_overflow(Int(max / 2), Int(3), &r), true); QCOMPARE(mul_overflow(mid1, Int(mid2 + 1), &r), true); QCOMPARE(mul_overflow(Int(max / 2 + 2), Int(2), &r), true); + QCOMPARE(mul_overflow(Int(max - max / 2), Int(2), &r), true); QCOMPARE(mul_overflow(Int(1ULL << (std::numeric_limits<Int>::digits - 1)), Int(2), &r), true); if (min) { QCOMPARE(mul_overflow(min, Int(2), &r), true); QCOMPARE(mul_overflow(Int(min / 2), Int(3), &r), true); QCOMPARE(mul_overflow(Int(min / 2 - 1), Int(2), &r), true); - QCOMPARE(mul_overflow(Int(min + min/2), Int(2), &r), true); } #endif } diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 7b8b1df166..a818c6c09d 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -309,7 +309,7 @@ void tst_QDebug::stateSaver() const QDebug d = qDebug(); { QDebugStateSaver saver(d); - d.nospace() << hex << right << qSetFieldWidth(3) << qSetPadChar('0') << 42; + d.nospace() << Qt::hex << Qt::right << qSetFieldWidth(3) << qSetPadChar('0') << 42; } d << 42; } @@ -327,7 +327,7 @@ void tst_QDebug::stateSaver() const { QDebug d = qDebug(); - d.noquote().nospace() << QStringLiteral("Hello") << hex << 42; + d.noquote().nospace() << QStringLiteral("Hello") << Qt::hex << 42; { QDebugStateSaver saver(d); d.resetFormat(); @@ -660,7 +660,7 @@ void tst_QDebug::textStreamModifiers() const QString file, function; int line = 0; MessageHandlerSetter mhs(myMessageHandler); - { qDebug() << hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); } + { qDebug() << Qt::hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); } #ifndef QT_NO_MESSAGELOGCONTEXT file = __FILE__; line = __LINE__ - 2; function = Q_FUNC_INFO; #endif @@ -678,7 +678,7 @@ void tst_QDebug::resetFormat() const MessageHandlerSetter mhs(myMessageHandler); { QDebug d = qDebug(); - d.nospace().noquote() << hex << int(0xf); + d.nospace().noquote() << Qt::hex << int(0xf); d.resetFormat() << int(0xf) << QStringLiteral("foo"); } #ifndef QT_NO_MESSAGELOGCONTEXT diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index b703a8839f..2aebc67dcf 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -349,21 +349,21 @@ void tst_QDir::mkdirRmdir_data() QTest::addColumn<QString>("path"); QTest::addColumn<bool>("recurse"); - QStringList dirs; - dirs << "testdir/one" - << "testdir/two/three/four" - << "testdir/../testdir/three"; - QTest::newRow("plain") << QDir::currentPath() + "/" + dirs.at(0) << false; - QTest::newRow("recursive") << QDir::currentPath() + "/" + dirs.at(1) << true; - QTest::newRow("with-..") << QDir::currentPath() + "/" + dirs.at(2) << false; - - QTest::newRow("relative-plain") << dirs.at(0) << false; - QTest::newRow("relative-recursive") << dirs.at(1) << true; - QTest::newRow("relative-with-..") << dirs.at(2) << false; - - // Ensure that none of these directories already exist - for (int i = 0; i < dirs.count(); ++i) - QVERIFY(!QFile::exists(dirs.at(i))); + const struct { + const char *name; // shall have a prefix added + const char *path; // relative + bool recurse; + } cases[] = { + { "plain", "testdir/one", false }, + { "recursive", "testdir/two/three/four", true }, + { "with-..", "testdir/../testdir/three", false }, + }; + + for (const auto &it : cases) { + QVERIFY(!QFile::exists(it.path)); + QTest::addRow("absolute-%s", it.name) << (QDir::currentPath() + "/") + it.path << it.recurse; + QTest::addRow("relative-%s", it.name) << QString::fromLatin1(it.path) << it.recurse; + } } void tst_QDir::mkdirRmdir() diff --git a/tests/auto/corelib/io/qfile/test.pro b/tests/auto/corelib/io/qfile/test.pro index 95389ab3e2..7a2767bf3c 100644 --- a/tests/auto/corelib/io/qfile/test.pro +++ b/tests/auto/corelib/io/qfile/test.pro @@ -23,4 +23,4 @@ TESTDATA += \ Makefile forCopying.txt forRenaming.txt \ resources/file1.ext1 -win32:!winrt: LIBS += -lole32 -luuid +win32:!winrt: QMAKE_USE += ole32 uuid diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 678a80c3f7..4f010f37c2 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2099,7 +2099,7 @@ void tst_QFile::i18nFileName() QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData()); QTextStream ts(&file); ts.setCodec("UTF-8"); - ts << fileName << endl; + ts << fileName << Qt::endl; } { QFile file(fileName); @@ -2149,7 +2149,7 @@ void tst_QFile::longFileName() QFile file(fileName); QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData()); QTextStream ts(&file); - ts << fileName << endl; + ts << fileName << Qt::endl; } { QFile file(fileName); diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index 496729f9f1..d181d16a3e 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -5,4 +5,4 @@ SOURCES = tst_qfileinfo.cpp RESOURCES += qfileinfo.qrc \ testdata.qrc -win32:!winrt: LIBS += -ladvapi32 -lnetapi32 +win32:!winrt: QMAKE_USE += advapi32 netapi32 diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index a92b4bd1cb..64075a94f0 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1182,7 +1182,7 @@ void tst_QFileInfo::fileTimes() QTest::qSleep(sleepTime); beforeWrite = QDateTime::currentDateTime().addMSecs(-fsClockSkew); QTextStream ts(&file); - ts << fileName << endl; + ts << fileName << Qt::endl; } { QFileInfo fileInfo(fileName); diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro index da2660fd02..e33e22b36f 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro @@ -3,4 +3,4 @@ TARGET = tst_qlockfile SOURCES += tst_qlockfile.cpp QT = core-private testlib concurrent -win32:!winrt:LIBS += -ladvapi32 +win32:!winrt: QMAKE_USE += advapi32 diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 11a9b3f189..79ac6b0fc4 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -104,7 +104,7 @@ public: for (int a = 0; a < _configitemEntryOrder.count(); a++) { out << _configitemEntryOrder[a] << " = " - << _values.value(_configitemEntryOrder[a]) << endl; + << _values.value(_configitemEntryOrder[a]) << Qt::endl; } out.flush(); return ret.toLatin1(); @@ -369,11 +369,9 @@ private slots: } Q_LOGGING_CATEGORY(TST_MACRO_1, "tst.macro.1") -#ifdef Q_COMPILER_VARIADIC_MACROS Q_LOGGING_CATEGORY(TST_MACRO_2, "tst.macro.2", QtDebugMsg) Q_LOGGING_CATEGORY(TST_MACRO_3, "tst.macro.3", QtFatalMsg) Q_LOGGING_CATEGORY(TST_MACRO_4, "tst.macro.4", QtInfoMsg) -#endif void QLoggingCategoryMacro() { @@ -384,7 +382,6 @@ private slots: QCOMPARE(cat1.isWarningEnabled(), true); QCOMPARE(cat1.isCriticalEnabled(), true); -#ifdef Q_COMPILER_VARIADIC_MACROS const QLoggingCategory &cat2 = TST_MACRO_2(); QCOMPARE(cat2.categoryName(), "tst.macro.2"); QCOMPARE(cat2.isDebugEnabled(), true); @@ -405,7 +402,6 @@ private slots: QCOMPARE(cat4.isInfoEnabled(), true); QCOMPARE(cat4.isWarningEnabled(), true); QCOMPARE(cat4.isCriticalEnabled(), true); -#endif } void qCDebugMacros() diff --git a/tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro b/tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro index 935f43630c..e41ed0a425 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro @@ -1,6 +1,6 @@ win32 { SOURCES = main_win.cpp - LIBS += -luser32 + QMAKE_USE += user32 } CONFIG -= qt app_bundle diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index 2cfcb4794e..964c47f6ae 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -1,6 +1,6 @@ win32 { SOURCES = main_win.cpp - LIBS += -luser32 + QMAKE_USE += user32 } unix { SOURCES = main_unix.cpp diff --git a/tests/auto/corelib/io/qsettings/qsettings.pro b/tests/auto/corelib/io/qsettings/qsettings.pro index 79552b62df..98ea337e7f 100644 --- a/tests/auto/corelib/io/qsettings/qsettings.pro +++ b/tests/auto/corelib/io/qsettings/qsettings.pro @@ -5,7 +5,7 @@ SOURCES = tst_qsettings.cpp RESOURCES += qsettings.qrc INCLUDEPATH += $$PWD/../../kernel/qmetatype -msvc: LIBS += advapi32.lib +msvc: QMAKE_USE += advapi32 darwin: LIBS += -framework CoreFoundation DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index cf4ab4902d..67d8c55b04 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -215,7 +215,7 @@ void tst_QTemporaryFile::fileTemplate() if (!fileTemplate.isEmpty()) file.setFileTemplate(fileTemplate); - QCOMPARE(file.open(), true); + QVERIFY2(file.open(), qPrintable(file.errorString())); QString fileName = QFileInfo(file).fileName(); if (prefix.length()) diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 0b8686560c..3919472b96 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -333,7 +333,7 @@ template <class C> C sorted(C c) { std::sort(c.begin(), c.end()); - return qMove(c); + return std::move(c); } void tst_QStringListModel::setData_emits_both_roles() diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index 295a42aa9c..159761c0c6 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -3,6 +3,6 @@ TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp -win32:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 qtConfig(glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index e2bb7dab2a..28458c43c7 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1499,7 +1499,7 @@ public: typedef MyObject* MyObjectPtr; Q_DECLARE_METATYPE(MyObjectPtr) -#if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER) +#if !defined(TST_QMETATYPE_BROKEN_COMPILER) static QByteArray createTypeName(const char *begin, const char *va) { QByteArray tn(begin); @@ -1697,7 +1697,7 @@ void tst_QMetaType::automaticTemplateRegistration() QVERIFY(qRegisterMetaType<UnregisteredTypeList>("UnregisteredTypeList") > 0); } -#if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER) +#if !defined(TST_QMETATYPE_BROKEN_COMPILER) #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F) \ F(bool) \ @@ -1776,7 +1776,7 @@ void tst_QMetaType::automaticTemplateRegistration() CREATE_AND_VERIFY_CONTAINER(QHash, void*, void*) CREATE_AND_VERIFY_CONTAINER(QHash, const void*, const void*) -#endif // Q_COMPILER_VARIADIC_MACROS +#endif // !defined(TST_QMETATYPE_BROKEN_COMPILER) #define TEST_OWNING_SMARTPOINTER(SMARTPOINTER, ELEMENT_TYPE, FLAG_TEST, FROMVARIANTFUNCTION) \ { \ @@ -2565,9 +2565,7 @@ Q_DECLARE_METATYPE(UndefinedFunction0); Q_DECLARE_METATYPE(UndefinedFunction1); Q_DECLARE_METATYPE(UndefinedFunction2); Q_DECLARE_METATYPE(UndefinedFunction3); -#ifdef Q_COMPILER_VARIADIC_TEMPLATES Q_DECLARE_METATYPE(UndefinedFunction4); -#endif QTEST_MAIN(tst_QMetaType) #include "tst_qmetatype.moc" diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 31268c5cf3..e0394a5d25 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -154,6 +154,8 @@ private slots: void mutableFunctor(); void checkArgumentsForNarrowing(); void nullReceiver(); + void functorReferencesConnection(); + void disconnectDisconnects(); }; struct QObjectCreatedOnShutdown @@ -3409,12 +3411,11 @@ void tst_QObject::disconnectSelfInSlotAndDeleteAfterEmit() void tst_QObject::dumpObjectInfo() { QObject a, b; - QObject::connect(&a, SIGNAL(destroyed(QObject*)), &b, SLOT(deleteLater())); - a.disconnect(&b); + QObject::connect(&a, &QObject::destroyed, &b, &QObject::deleteLater); QTest::ignoreMessage(QtDebugMsg, "OBJECT QObject::unnamed"); QTest::ignoreMessage(QtDebugMsg, " SIGNALS OUT"); QTest::ignoreMessage(QtDebugMsg, " signal: destroyed(QObject*)"); - QTest::ignoreMessage(QtDebugMsg, " <Disconnected receiver>"); + QTest::ignoreMessage(QtDebugMsg, " <functor or function pointer>"); QTest::ignoreMessage(QtDebugMsg, " SIGNALS IN"); QTest::ignoreMessage(QtDebugMsg, " <None>"); a.dumpObjectInfo(); // should not crash @@ -4793,13 +4794,13 @@ class LotsOfSignalsAndSlots: public QObject public slots: void slot_v() {} - void slot_v_noexcept() Q_DECL_NOTHROW {} + void slot_v_noexcept() noexcept {} void slot_vi(int) {} - void slot_vi_noexcept() Q_DECL_NOTHROW {} + void slot_vi_noexcept() noexcept {} void slot_vii(int, int) {} void slot_viii(int, int, int) {} int slot_i() { return 0; } - int slot_i_noexcept() Q_DECL_NOTHROW { return 0; } + int slot_i_noexcept() noexcept { return 0; } int slot_ii(int) { return 0; } int slot_iii(int, int) { return 0; } int slot_iiii(int, int, int) { return 0; } @@ -4813,18 +4814,18 @@ class LotsOfSignalsAndSlots: public QObject void slot_vPFvvE(fptr) {} void const_slot_v() const {}; - void const_slot_v_noexcept() const Q_DECL_NOTHROW {} + void const_slot_v_noexcept() const noexcept {} void const_slot_vi(int) const {}; - void const_slot_vi_noexcept(int) const Q_DECL_NOTHROW {} + void const_slot_vi_noexcept(int) const noexcept {} static void static_slot_v() {} - static void static_slot_v_noexcept() Q_DECL_NOTHROW {} + static void static_slot_v_noexcept() noexcept {} static void static_slot_vi(int) {} - static void static_slot_vi_noexcept(int) Q_DECL_NOTHROW {} + static void static_slot_vi_noexcept(int) noexcept {} static void static_slot_vii(int, int) {} static void static_slot_viii(int, int, int) {} static int static_slot_i() { return 0; } - static int static_slot_i_noexcept() Q_DECL_NOTHROW { return 0; } + static int static_slot_i_noexcept() noexcept { return 0; } static int static_slot_ii(int) { return 0; } static int static_slot_iii(int, int) { return 0; } static int static_slot_iiii(int, int, int) { return 0; } @@ -4987,11 +4988,11 @@ void tst_QObject::connectCxx0xTypeMatching() } -void receiverFunction_noexcept() Q_DECL_NOTHROW {} -struct Functor_noexcept { void operator()() Q_DECL_NOTHROW {} }; +void receiverFunction_noexcept() noexcept {} +struct Functor_noexcept { void operator()() noexcept {} }; void tst_QObject::connectCxx17Noexcept() { - // this is about connecting signals to slots with the Q_DECL_NOTHROW qualifier + // this is about connecting signals to slots with the noexcept qualifier // as semantics changed due to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html typedef LotsOfSignalsAndSlots Foo; Foo obj; @@ -6028,7 +6029,6 @@ void tst_QObject::connectFunctorArgDifference() QStringListModel model; connect(&model, &QStringListModel::rowsInserted, SlotFunctor()); -#if defined(Q_COMPILER_LAMBDA) connect(&timer, &QTimer::timeout, [=](){}); connect(&timer, &QTimer::objectNameChanged, [=](const QString &){}); connect(qApp, &QCoreApplication::aboutToQuit, [=](){}); @@ -6036,7 +6036,6 @@ void tst_QObject::connectFunctorArgDifference() connect(&timer, &QTimer::objectNameChanged, [=](){}); connect(&model, &QStringListModel::rowsInserted, [=](){}); connect(&model, &QStringListModel::rowsInserted, [=](const QModelIndex &){}); -#endif QVERIFY(true); } @@ -6074,7 +6073,6 @@ void tst_QObject::connectFunctorQueued() e.exec(); QCOMPARE(status, 2); -#if defined(Q_COMPILER_LAMBDA) status = 1; connect(&obj, &SenderObject::signal1, this, [&status] { status = 2; }, Qt::QueuedConnection); @@ -6082,7 +6080,6 @@ void tst_QObject::connectFunctorQueued() QCOMPARE(status, 1); e.exec(); QCOMPARE(status, 2); -#endif } void tst_QObject::connectFunctorWithContext() @@ -6116,7 +6113,6 @@ void tst_QObject::connectFunctorWithContext() e.exec(); QCOMPARE(status, 2); -#if defined(Q_COMPILER_LAMBDA) status = 1; connect(&obj, &SenderObject::signal1, this, [this, &status, &obj] { status = 2; QCOMPARE(sender(), &obj); }, Qt::QueuedConnection); @@ -6124,7 +6120,6 @@ void tst_QObject::connectFunctorWithContext() QCOMPARE(status, 1); e.exec(); QCOMPARE(status, 2); -#endif // Free context->deleteLater(); @@ -6434,7 +6429,7 @@ void connectFunctorOverload_impl(Signal signal, int expOverload, QList<QVariant> void tst_QObject::connectFunctorOverloads() { -#if defined (Q_COMPILER_DECLTYPE) && defined (Q_COMPILER_VARIADIC_TEMPLATES) +#if defined (Q_COMPILER_VARIADIC_TEMPLATES) connectFunctorOverload_impl<ComplexFunctor>(&FunctorArgDifferenceObject::signal_ii, 1, (QList<QVariant>() << 1 << 2)); connectFunctorOverload_impl<ComplexFunctor>(&FunctorArgDifferenceObject::signal_iiS, 1, @@ -6608,7 +6603,6 @@ void tst_QObject::disconnectDoesNotLeakFunctor() } QCOMPARE(countedStructObjectsCount, 0); { -#if defined(Q_COMPILER_LAMBDA) CountedStruct s; QCOMPARE(countedStructObjectsCount, 1); QTimer timer; @@ -6618,7 +6612,6 @@ void tst_QObject::disconnectDoesNotLeakFunctor() QCOMPARE(countedStructObjectsCount, 2); QVERIFY(QObject::disconnect(c)); QCOMPARE(countedStructObjectsCount, 1); -#endif // Q_COMPILER_LAMBDA } QCOMPARE(countedStructObjectsCount, 0); } @@ -6666,7 +6659,6 @@ void tst_QObject::contextDoesNotLeakFunctor() } QCOMPARE(countedStructObjectsCount, 0); { -#if defined(Q_COMPILER_LAMBDA) CountedStruct s; QEventLoop e; ContextObject *context = new ContextObject; @@ -6679,7 +6671,6 @@ void tst_QObject::contextDoesNotLeakFunctor() context->deleteLater(); e.exec(); QCOMPARE(countedStructObjectsCount, 1); -#endif // Q_COMPILER_LAMBDA } QCOMPARE(countedStructObjectsCount, 0); } @@ -7487,6 +7478,167 @@ void tst_QObject::nullReceiver() QVERIFY(!connect(&o, SIGNAL(destroyed()), nullObj, SLOT(deleteLater()))); } +void tst_QObject::functorReferencesConnection() +{ + countedStructObjectsCount = 0; + QMetaObject::Connection globalCon; + { + GetSenderObject obj; + CountedStruct counted(&obj); + QCOMPARE(countedStructObjectsCount, 1); + auto c = QSharedPointer<QMetaObject::Connection>::create(); + int slotCalled = 0; + *c = connect(&obj, &GetSenderObject::aSignal, &obj, [&slotCalled, c, counted] { + QObject::disconnect(*c); + slotCalled++; + }); + globalCon = *c; // keep a handle to the connection somewhere; + QVERIFY(globalCon); + QCOMPARE(countedStructObjectsCount, 2); + obj.triggerSignal(); + QCOMPARE(slotCalled, 1); + QCOMPARE(countedStructObjectsCount, 1); + QVERIFY(!globalCon); + obj.triggerSignal(); + QCOMPARE(slotCalled, 1); + QCOMPARE(countedStructObjectsCount, 1); + } + QCOMPARE(countedStructObjectsCount, 0); + + { + GetSenderObject obj; + CountedStruct counted(&obj); + QCOMPARE(countedStructObjectsCount, 1); + auto *rec = new QObject; + int slotCalled = 0; + globalCon = connect(&obj, &GetSenderObject::aSignal, rec, [&slotCalled, rec, counted] { + delete rec; + slotCalled++; + }); + QCOMPARE(countedStructObjectsCount, 2); + obj.triggerSignal(); + QCOMPARE(slotCalled, 1); + QCOMPARE(countedStructObjectsCount, 1); + QVERIFY(!globalCon); + obj.triggerSignal(); + QCOMPARE(slotCalled, 1); + QCOMPARE(countedStructObjectsCount, 1); + } + QCOMPARE(countedStructObjectsCount, 0); + { + int slotCalled = 0; + QEventLoop eventLoop; + { + // Sender will be destroyed when the labda goes out of scope lambda, so it will exit the event loop + auto sender = QSharedPointer<GetSenderObject>::create(); + connect(sender.data(), &QObject::destroyed, &eventLoop, &QEventLoop::quit, Qt::QueuedConnection); + globalCon = connect(sender.data(), &GetSenderObject::aSignal, this, [&slotCalled, sender, &globalCon, this] { + ++slotCalled; + // This signal will be connected, but should never be called as the sender will be destroyed before + auto c2 = connect(sender.data(), &GetSenderObject::aSignal, [] { QFAIL("Should not be called"); }); + QVERIFY(c2); + QVERIFY(QObject::disconnect(sender.data(), nullptr, this, nullptr)); + QVERIFY(!globalCon); // this connection has been disconnected + QVERIFY(c2); // sender should not have been deleted yet, only after the emission is done + }); + QMetaObject::invokeMethod(sender.data(), &GetSenderObject::triggerSignal, Qt::QueuedConnection); + QMetaObject::invokeMethod(sender.data(), &GetSenderObject::triggerSignal, Qt::QueuedConnection); + QMetaObject::invokeMethod(sender.data(), &GetSenderObject::triggerSignal, Qt::QueuedConnection); + } + eventLoop.exec(); + QCOMPARE(slotCalled, 1); + } + + { + GetSenderObject obj; + CountedStruct counted(&obj); + QCOMPARE(countedStructObjectsCount, 1); + auto c1 = QSharedPointer<QMetaObject::Connection>::create(); + auto c2 = QSharedPointer<QMetaObject::Connection>::create(); + int slot1Called = 0; + int slot3Called = 0; + *c1 = connect(&obj, &GetSenderObject::aSignal, &obj, [&slot1Called, &slot3Called, &obj, c1, c2, counted] { + auto c3 = connect(&obj, &GetSenderObject::aSignal, [counted, &slot3Called] { + slot3Called++; + }); + // top-level + the one in the 3 others lambdas + QCOMPARE(countedStructObjectsCount, 4); + QObject::disconnect(*c2); + slot1Called++; + }); + connect(&obj, &GetSenderObject::aSignal, [] {}); // just a dummy signal to fill the connection list + *c2 = connect(&obj, &GetSenderObject::aSignal, [counted, c2] { QFAIL("should not be called"); }); + QVERIFY(c1 && c2); + QCOMPARE(countedStructObjectsCount, 3); // top-level + c1 + c2 + obj.triggerSignal(); + QCOMPARE(slot1Called, 1); + QCOMPARE(slot3Called, 0); + QCOMPARE(countedStructObjectsCount, 3); // top-level + c1 + c3 + QObject::disconnect(*c1); + QCOMPARE(countedStructObjectsCount, 2); // top-level + c3 + obj.triggerSignal(); + QCOMPARE(slot1Called, 1); + QCOMPARE(slot3Called, 1); + } + { + struct DestroyEmit { + Q_DISABLE_COPY(DestroyEmit); + explicit DestroyEmit(SenderObject *obj) : obj(obj) {} + SenderObject *obj; + ~DestroyEmit() { + obj->emitSignal1(); + } + }; + SenderObject obj; + int slot1Called = 0; + int slot2Called = 0; + int slot3Called = 0; + auto c1 = QSharedPointer<QMetaObject::Connection>::create(); + auto de = QSharedPointer<DestroyEmit>::create(&obj); + *c1 = connect(&obj, &SenderObject::signal1, [&slot1Called, &slot3Called, de, c1, &obj] { + connect(&obj, &SenderObject::signal1, [&slot3Called] { slot3Called++; }); + slot1Called++; + QObject::disconnect(*c1); + }); + de.clear(); + connect(&obj, &SenderObject::signal1, [&slot2Called] { slot2Called++; }); + obj.emitSignal1(); + QCOMPARE(slot1Called, 1); + QCOMPARE(slot2Called, 2); // because also called from ~DestroyEmit + QCOMPARE(slot3Called, 1); + } +} + +void tst_QObject::disconnectDisconnects() +{ + // Test what happens if the destructor of an functor slot also disconnects more slot; + + SenderObject s1; + QScopedPointer<QObject> receiver(new QObject); + + auto s2 = QSharedPointer<SenderObject>::create(); + QPointer<QObject> s2_tracker = s2.data(); + int count = 0; + connect(&s1, &SenderObject::signal1, [&count] { count++; }); // α + connect(&s1, &SenderObject::signal1, receiver.data(), [s2] { QFAIL("!!"); }); // β + connect(s2.data(), &SenderObject::signal1, receiver.data(), [] { QFAIL("!!"); }); + connect(&s1, &SenderObject::signal2, receiver.data(), [] { QFAIL("!!"); }); + connect(s2.data(), &SenderObject::signal2, receiver.data(), [] { QFAIL("!!"); }); + connect(&s1, &SenderObject::signal1, [&count] { count++; }); // γ + connect(&s1, &SenderObject::signal2, [&count] { count++; }); // δ + s2.clear(); + + QVERIFY(s2_tracker); + receiver + .reset(); // this will delete the receiver which must also delete s2 as β is disconnected + QVERIFY(!s2_tracker); + // test that the data structures are still in order + s1.emitSignal1(); + QCOMPARE(count, 2); // α + γ + s1.emitSignal2(); + QCOMPARE(count, 3); // + δ +} + // Test for QtPrivate::HasQ_OBJECT_Macro Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value); Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value); diff --git a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp index fd18f00cd0..39b03ade61 100644 --- a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp +++ b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp @@ -66,7 +66,6 @@ void tst_QSignalBlocker::signalBlocking() void tst_QSignalBlocker::moveAssignment() { -#ifdef Q_COMPILER_RVALUE_REFS QObject o1, o2; // move-assignment: both block other objects @@ -157,10 +156,6 @@ void tst_QSignalBlocker::moveAssignment() 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) diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 3b10547dc4..b7c87418c7 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -73,7 +73,12 @@ private slots: void recurseOnTimeoutAndStopTimer(); void singleShotToFunctors(); void singleShot_chrono(); + void singleShot_static(); void crossThreadSingleShotToFunctor(); + void timerOrder(); + void timerOrder_data(); + void timerOrderBackgroundThread(); + void timerOrderBackgroundThread_data() { timerOrder_data(); } void dontBlockEvents(); void postedEventsShouldNotStarveTimers(); @@ -768,7 +773,7 @@ public: quitEventLoop_noexcept(); } - static void quitEventLoop_noexcept() Q_DECL_NOTHROW + static void quitEventLoop_noexcept() noexcept { QVERIFY(!_e.isNull()); _e->quit(); @@ -1033,5 +1038,121 @@ void tst_QTimer::callOnTimeout() QVERIFY(!connection); } -QTEST_MAIN(tst_QTimer) +class OrderHelper : public QObject +{ + Q_OBJECT +public: + enum CallType + { + String, + PMF, + Functor, + FunctorNoCtx + }; + Q_ENUM(CallType) + QVector<CallType> calls; + + void triggerCall(CallType callType) + { + switch (callType) + { + case String: + QTimer::singleShot(0, this, SLOT(stringSlot())); + break; + case PMF: + QTimer::singleShot(0, this, &OrderHelper::pmfSlot); + break; + case Functor: + QTimer::singleShot(0, this, [this]() { functorSlot(); }); + break; + case FunctorNoCtx: + QTimer::singleShot(0, [this]() { functorNoCtxSlot(); }); + break; + } + } + +public slots: + void stringSlot() { calls << String; } + void pmfSlot() { calls << PMF; } + void functorSlot() { calls << Functor; } + void functorNoCtxSlot() { calls << FunctorNoCtx; } +}; + +Q_DECLARE_METATYPE(OrderHelper::CallType) + +void tst_QTimer::timerOrder() +{ + QFETCH(QVector<OrderHelper::CallType>, calls); + + OrderHelper helper; + + for (const auto call : calls) + helper.triggerCall(call); + + QTRY_COMPARE(helper.calls, calls); +} + +void tst_QTimer::timerOrder_data() +{ + QTest::addColumn<QVector<OrderHelper::CallType>>("calls"); + + QVector<OrderHelper::CallType> calls = { + OrderHelper::String, OrderHelper::PMF, + OrderHelper::Functor, OrderHelper::FunctorNoCtx + }; + std::sort(calls.begin(), calls.end()); + + int permutation = 0; + do { + QTest::addRow("permutation=%d", permutation) << calls; + ++permutation; + } while (std::next_permutation(calls.begin(), calls.end())); +} + +void tst_QTimer::timerOrderBackgroundThread() +{ +#if !QT_CONFIG(cxx11_future) + QSKIP("This test requires QThread::create"); +#else + auto *thread = QThread::create([this]() { timerOrder(); }); + thread->start(); + QVERIFY(thread->wait()); + delete thread; +#endif +} + +struct StaticSingleShotUser +{ + StaticSingleShotUser() + { + for (auto call : calls()) + helper.triggerCall(call); + } + OrderHelper helper; + + static QVector<OrderHelper::CallType> calls() + { + return {OrderHelper::String, OrderHelper::PMF, + OrderHelper::Functor, OrderHelper::FunctorNoCtx}; + } +}; + +static StaticSingleShotUser *s_staticSingleShotUser = nullptr; + +void tst_QTimer::singleShot_static() +{ + QCoreApplication::processEvents(); + QCOMPARE(s_staticSingleShotUser->helper.calls, s_staticSingleShotUser->calls()); +} + +// NOTE: to prevent any static initialization order fiasco, we handle QTEST_MAIN +// ourselves, but instantiate the staticSingleShotUser before qApp + +int main(int argc, char *argv[]) +{ + StaticSingleShotUser staticSingleShotUser; + s_staticSingleShotUser = &staticSingleShotUser; + QTEST_MAIN_IMPL(tst_QTimer) +} + #include "tst_qtimer.moc" diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 4da34c407e..6ae8fd0010 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -59,12 +59,6 @@ class CustomNonQObject; -#if defined(Q_COMPILER_CLASS_ENUM) -#define ENUM_SIZE(X) : X -#else -#define ENUM_SIZE(X) -#endif - class tst_QVariant : public QObject { Q_OBJECT @@ -82,15 +76,15 @@ public: enum MetaEnumTest_Enum1 : qint64 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_ENUM(MetaEnumTest_Enum1) - enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 }; + enum MetaEnumTest_Enum3 : qint64 { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 }; Q_ENUM(MetaEnumTest_Enum3) - enum MetaEnumTest_Enum4 ENUM_SIZE(quint64) { MetaEnumTest_Enum4_value = 47, MetaEnumTest_Enum4_bigValue = (Q_INT64_C(1) << 52) + 45 }; + enum MetaEnumTest_Enum4 : quint64 { MetaEnumTest_Enum4_value = 47, MetaEnumTest_Enum4_bigValue = (Q_INT64_C(1) << 52) + 45 }; Q_ENUM(MetaEnumTest_Enum4) - enum MetaEnumTest_Enum5 ENUM_SIZE(uint) { MetaEnumTest_Enum5_value = 47 }; + enum MetaEnumTest_Enum5 : uint { MetaEnumTest_Enum5_value = 47 }; Q_ENUM(MetaEnumTest_Enum5) - enum MetaEnumTest_Enum6 ENUM_SIZE(uchar) { MetaEnumTest_Enum6_value = 47 }; + enum MetaEnumTest_Enum6 : uchar { MetaEnumTest_Enum6_value = 47 }; Q_ENUM(MetaEnumTest_Enum6) - enum MetaEnumTest_Enum8 ENUM_SIZE(short) { MetaEnumTest_Enum8_value = 47 }; + enum MetaEnumTest_Enum8 : short { MetaEnumTest_Enum8_value = 47 }; Q_ENUM(MetaEnumTest_Enum8) private slots: @@ -2761,6 +2755,14 @@ void tst_QVariant::qvariant_cast_QObject_derived() QCOMPARE(data.value<CustomQObjectDerived *>(), object); QCOMPARE(data.value<CustomQObject *>(), object); } + { + QObject *object = new CustomQObjectDerivedNoMetaType(this); + QVariant data = QVariant::fromValue(object); + QVERIFY(data.canConvert<CustomQObjectDerivedNoMetaType*>()); + QVERIFY(data.convert(qMetaTypeId<CustomQObjectDerivedNoMetaType*>())); + QCOMPARE(data.value<CustomQObjectDerivedNoMetaType*>(), object); + QCOMPARE(data.isNull(), false); + } } struct QObjectWrapper @@ -4692,7 +4694,6 @@ Q_DECLARE_METATYPE(EnumTest_Enum0) enum EnumTest_Enum1 : qint64 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_DECLARE_METATYPE(EnumTest_Enum1) -#if defined(Q_COMPILER_CLASS_ENUM) enum EnumTest_Enum3 : qint64 { EnumTest_Enum3_value = -47, EnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5 }; Q_DECLARE_METATYPE(EnumTest_Enum3) enum EnumTest_Enum4 : quint64 { EnumTest_Enum4_value = 47, EnumTest_Enum4_bigValue = (Q_INT64_C(1) << 52) + 45 }; @@ -4705,7 +4706,6 @@ enum class EnumTest_Enum7 { EnumTest_Enum7_value = 47, ensureSignedEnum7 = -1 }; Q_DECLARE_METATYPE(EnumTest_Enum7) enum EnumTest_Enum8 : short { EnumTest_Enum8_value = 47 }; Q_DECLARE_METATYPE(EnumTest_Enum8) -#endif template<typename Enum> void testVariant(Enum value, bool *ok) { @@ -4764,7 +4764,6 @@ void tst_QVariant::enums() QVERIFY(ok); testVariant(EnumTest_Enum1_bigValue, &ok); QVERIFY(ok); -#if defined(Q_COMPILER_CLASS_ENUM) testVariant(EnumTest_Enum3::EnumTest_Enum3_value, &ok); QVERIFY(ok); testVariant(EnumTest_Enum3::EnumTest_Enum3_bigValue, &ok); @@ -4783,7 +4782,6 @@ void tst_QVariant::enums() QVERIFY(ok); testVariant(EnumTest_Enum3::EnumTest_Enum3_value, &ok); QVERIFY(ok); -#endif } template<typename Enum> void testVariantMeta(Enum value, bool *ok, const char *string) diff --git a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp index c74bce3b5b..e1357245f3 100644 --- a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp +++ b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp @@ -91,11 +91,7 @@ static QStringList qMimeTypeGlobPatterns() // ------------------------------------------------------------------------------------------------ -#ifndef Q_COMPILER_RVALUE_REFS -QMIMETYPE_BUILDER -#else QMIMETYPE_BUILDER_FROM_RVALUE_REFS -#endif // ------------------------------------------------------------------------------------------------ diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp index d891839b1e..6d163ea336 100644 --- a/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp @@ -31,7 +31,7 @@ class StaticPlugin : public QObject { Q_OBJECT - Q_PLUGIN_METADATA(IID "SomeIID") + Q_PLUGIN_METADATA(IID "SomeIID" URI "qt.test.pluginloader.staticplugin") public: StaticPlugin() {} }; diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 4316ea14ea..b06000d9c4 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -552,6 +552,7 @@ void tst_QPluginLoader::staticPlugins() QCOMPARE(metaData.value("version").toInt(), QT_VERSION); QCOMPARE(metaData.value("IID").toString(), "SomeIID"); QCOMPARE(metaData.value("ExtraMetaData"), QJsonArray({ "StaticPlugin", "foo" })); + QCOMPARE(metaData.value("URI").toString(), "qt.test.pluginloader.staticplugin"); } diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 083e78375a..548b6d0059 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -2754,9 +2754,6 @@ void tst_QtJson::testJsonValueRefDefault() void tst_QtJson::arrayInitializerList() { -#ifndef Q_COMPILER_INITIALIZER_LISTS - QSKIP("initializer_list is enabled only with c++11 support"); -#else QVERIFY(QJsonArray{}.isEmpty()); QCOMPARE(QJsonArray{"one"}.count(), 1); QCOMPARE(QJsonArray{1}.count(), 1); @@ -2802,14 +2799,10 @@ void tst_QtJson::arrayInitializerList() QCOMPARE(QJsonValue(a43["one"]), QJsonValue(1)); } } -#endif } void tst_QtJson::objectInitializerList() { -#ifndef Q_COMPILER_INITIALIZER_LISTS - QSKIP("initializer_list is enabled only with c++11 support"); -#else QVERIFY(QJsonObject{}.isEmpty()); { // one property @@ -2849,7 +2842,6 @@ void tst_QtJson::objectInitializerList() QCOMPARE(QJsonValue(nested[0]), QJsonValue("innerValue")); QCOMPARE(QJsonValue(nested[1]), QJsonValue(2.1)); } -#endif } void tst_QtJson::unicodeKeys() diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index d204727bbd..19cdd42a74 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -181,6 +181,8 @@ private slots: void streamRealDataTypes(); + void enumTest(); + void floatingPointPrecision(); void compatibility_Qt3(); @@ -3409,6 +3411,90 @@ void tst_QDataStream::floatingPointNaN() } } +void tst_QDataStream::enumTest() +{ + QByteArray ba; + + enum class E1 : qint8 + { + A, + B, + C + }; + { + QDataStream stream(&ba, QIODevice::WriteOnly); + stream << E1::A; + QCOMPARE(ba.size(), int(sizeof(E1))); + } + { + QDataStream stream(ba); + E1 e; + stream >> e; + QCOMPARE(e, E1::A); + } + ba.clear(); + + enum class E2 : qint16 + { + A, + B, + C + }; + { + QDataStream stream(&ba, QIODevice::WriteOnly); + stream << E2::B; + QCOMPARE(ba.size(), int(sizeof(E2))); + } + { + QDataStream stream(ba); + E2 e; + stream >> e; + QCOMPARE(e, E2::B); + } + ba.clear(); + + enum class E4 : qint32 + { + A, + B, + C + }; + { + QDataStream stream(&ba, QIODevice::WriteOnly); + stream << E4::C; + QCOMPARE(ba.size(), int(sizeof(E4))); + } + { + QDataStream stream(ba); + E4 e; + stream >> e; + QCOMPARE(e, E4::C); + } + ba.clear(); + + + enum E + { + A, + B, + C, + D + }; + { + QDataStream stream(&ba, QIODevice::WriteOnly); + stream << E::D; + QCOMPARE(ba.size(), 4); + } + { + QDataStream stream(ba); + E e; + stream >> e; + QCOMPARE(e, E::D); + } + ba.clear(); + +} + void tst_QDataStream::floatingPointPrecision() { QByteArray ba; diff --git a/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/main.cpp b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/main.cpp index 41ea5e56f0..2d4aa452ca 100644 --- a/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/main.cpp +++ b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) do { line = qin.readLine(); if (!line.isNull()) - qerr << line << flush; + qerr << line << Qt::flush; } while (!line.isNull()); return 0; } diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index 8bb35554c8..c4fb623130 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -245,7 +245,7 @@ private: void runOnExit() { QByteArray buffer; - QTextStream(&buffer) << "This will try to use QTextCodec::codecForLocale" << endl; + QTextStream(&buffer) << "This will try to use QTextCodec::codecForLocale" << Qt::endl; } Q_DESTRUCTOR_FUNCTION(runOnExit) @@ -1102,7 +1102,7 @@ void tst_QTextStream::hexTest() QByteArray array; QTextStream stream(&array); - stream << showbase << hex << number; + stream << Qt::showbase << Qt::hex << number; stream.flush(); QCOMPARE(array, data); } @@ -1132,7 +1132,7 @@ void tst_QTextStream::binTest() QByteArray array; QTextStream stream(&array); - stream << showbase << bin << number; + stream << Qt::showbase << Qt::bin << number; stream.flush(); QCOMPARE(array.constData(), data.constData()); } @@ -1155,7 +1155,7 @@ void tst_QTextStream::octTest() QByteArray array; QTextStream stream(&array); - stream << showbase << oct << number; + stream << Qt::showbase << Qt::oct << number; stream.flush(); QCOMPARE(array, data); } @@ -1196,7 +1196,7 @@ void tst_QTextStream::ws_manipulator() QTextStream stream(&string); char a, b, c, d; - stream >> a >> ws >> b >> ws >> c >> ws >> d; + stream >> a >> Qt::ws >> b >> Qt::ws >> c >> Qt::ws >> d; QCOMPARE(a, 'a'); QCOMPARE(b, 'b'); QCOMPARE(c, 'c'); @@ -1506,9 +1506,9 @@ void tst_QTextStream::readStdin() stdinProcess.setReadChannel(QProcess::StandardError); QTextStream stream(&stdinProcess); - stream << "1" << endl; - stream << "2" << endl; - stream << "3" << endl; + stream << "1" << Qt::endl; + stream << "2" << Qt::endl; + stream << "3" << Qt::endl; stdinProcess.closeWriteChannel(); @@ -1534,7 +1534,7 @@ void tst_QTextStream::readAllFromStdin() QTextStream stream(&stdinProcess); stream.setCodec("ISO-8859-1"); - stream << "hello world" << flush; + stream << "hello world" << Qt::flush; stdinProcess.closeWriteChannel(); @@ -1623,18 +1623,18 @@ void tst_QTextStream::forcePoint() { QString str; QTextStream stream(&str); - stream << fixed << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; + stream << Qt::fixed << Qt::forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000 1 0 -1.000000 -1")); str.clear(); stream.seek(0); - stream << scientific << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; + stream << Qt::scientific << Qt::forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000e+00 1 0 -1.000000e+00 -1")); str.clear(); stream.seek(0); stream.setRealNumberNotation(QTextStream::SmartNotation); - stream << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; + stream << Qt::forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.00000 1 0 -1.00000 -1")); } @@ -1644,7 +1644,7 @@ void tst_QTextStream::forceSign() { QString str; QTextStream stream(&str); - stream << forcesign << 1.2 << ' ' << -1.2 << ' ' << 0; + stream << Qt::forcesign << 1.2 << ' ' << -1.2 << ' ' << 0; QCOMPARE(str, QString("+1.2 -1.2 +0")); } @@ -1663,19 +1663,22 @@ void tst_QTextStream::read0d0d0a() Q_DECLARE_METATYPE(QTextStreamFunction); +// Also tests that we can have namespaces that conflict with our QTextStream constants. +namespace ws { QTextStream &noop(QTextStream &s) { return s; } +} void tst_QTextStream::numeralCase_data() { - QTextStreamFunction noop_ = noop; - QTextStreamFunction bin_ = bin; - QTextStreamFunction oct_ = oct; - QTextStreamFunction hex_ = hex; - QTextStreamFunction base = showbase; - QTextStreamFunction ucb = uppercasebase; - QTextStreamFunction lcb = lowercasebase; - QTextStreamFunction ucd = uppercasedigits; - QTextStreamFunction lcd = lowercasedigits; + QTextStreamFunction noop_ = ws::noop; + QTextStreamFunction bin = Qt::bin; + QTextStreamFunction oct = Qt::oct; + QTextStreamFunction hex = Qt::hex; + QTextStreamFunction base = Qt::showbase; + QTextStreamFunction ucb = Qt::uppercasebase; + QTextStreamFunction lcb = Qt::lowercasebase; + QTextStreamFunction ucd = Qt::uppercasedigits; + QTextStreamFunction lcd = Qt::lowercasedigits; QTest::addColumn<QTextStreamFunction>("func1"); QTest::addColumn<QTextStreamFunction>("func2"); @@ -1686,30 +1689,30 @@ void tst_QTextStream::numeralCase_data() QTest::newRow("dec 1") << noop_ << noop_ << noop_ << noop_ << 31 << "31"; QTest::newRow("dec 2") << noop_ << base << noop_ << noop_ << 31 << "31"; - QTest::newRow("hex 1") << hex_ << noop_ << noop_ << noop_ << 31 << "1f"; - QTest::newRow("hex 2") << hex_ << noop_ << noop_ << lcd << 31 << "1f"; - QTest::newRow("hex 3") << hex_ << noop_ << ucb << noop_ << 31 << "1f"; - QTest::newRow("hex 4") << hex_ << noop_ << noop_ << ucd << 31 << "1F"; - QTest::newRow("hex 5") << hex_ << noop_ << lcb << ucd << 31 << "1F"; - QTest::newRow("hex 6") << hex_ << noop_ << ucb << ucd << 31 << "1F"; - QTest::newRow("hex 7") << hex_ << base << noop_ << noop_ << 31 << "0x1f"; - QTest::newRow("hex 8") << hex_ << base << lcb << lcd << 31 << "0x1f"; - QTest::newRow("hex 9") << hex_ << base << ucb << noop_ << 31 << "0X1f"; - QTest::newRow("hex 10") << hex_ << base << ucb << lcd << 31 << "0X1f"; - QTest::newRow("hex 11") << hex_ << base << noop_ << ucd << 31 << "0x1F"; - QTest::newRow("hex 12") << hex_ << base << lcb << ucd << 31 << "0x1F"; - QTest::newRow("hex 13") << hex_ << base << ucb << ucd << 31 << "0X1F"; - - QTest::newRow("bin 1") << bin_ << noop_ << noop_ << noop_ << 31 << "11111"; - QTest::newRow("bin 2") << bin_ << base << noop_ << noop_ << 31 << "0b11111"; - QTest::newRow("bin 3") << bin_ << base << lcb << noop_ << 31 << "0b11111"; - QTest::newRow("bin 4") << bin_ << base << ucb << noop_ << 31 << "0B11111"; - QTest::newRow("bin 5") << bin_ << base << noop_ << ucd << 31 << "0b11111"; - QTest::newRow("bin 6") << bin_ << base << lcb << ucd << 31 << "0b11111"; - QTest::newRow("bin 7") << bin_ << base << ucb << ucd << 31 << "0B11111"; - - QTest::newRow("oct 1") << oct_ << noop_ << noop_ << noop_ << 31 << "37"; - QTest::newRow("oct 2") << oct_ << base << noop_ << noop_ << 31 << "037"; + QTest::newRow("hex 1") << hex << noop_ << noop_ << noop_ << 31 << "1f"; + QTest::newRow("hex 2") << hex << noop_ << noop_ << lcd << 31 << "1f"; + QTest::newRow("hex 3") << hex << noop_ << ucb << noop_ << 31 << "1f"; + QTest::newRow("hex 4") << hex << noop_ << noop_ << ucd << 31 << "1F"; + QTest::newRow("hex 5") << hex << noop_ << lcb << ucd << 31 << "1F"; + QTest::newRow("hex 6") << hex << noop_ << ucb << ucd << 31 << "1F"; + QTest::newRow("hex 7") << hex << base << noop_ << noop_ << 31 << "0x1f"; + QTest::newRow("hex 8") << hex << base << lcb << lcd << 31 << "0x1f"; + QTest::newRow("hex 9") << hex << base << ucb << noop_ << 31 << "0X1f"; + QTest::newRow("hex 10") << hex << base << ucb << lcd << 31 << "0X1f"; + QTest::newRow("hex 11") << hex << base << noop_ << ucd << 31 << "0x1F"; + QTest::newRow("hex 12") << hex << base << lcb << ucd << 31 << "0x1F"; + QTest::newRow("hex 13") << hex << base << ucb << ucd << 31 << "0X1F"; + + QTest::newRow("bin 1") << bin << noop_ << noop_ << noop_ << 31 << "11111"; + QTest::newRow("bin 2") << bin << base << noop_ << noop_ << 31 << "0b11111"; + QTest::newRow("bin 3") << bin << base << lcb << noop_ << 31 << "0b11111"; + QTest::newRow("bin 4") << bin << base << ucb << noop_ << 31 << "0B11111"; + QTest::newRow("bin 5") << bin << base << noop_ << ucd << 31 << "0b11111"; + QTest::newRow("bin 6") << bin << base << lcb << ucd << 31 << "0b11111"; + QTest::newRow("bin 7") << bin << base << ucb << ucd << 31 << "0B11111"; + + QTest::newRow("oct 1") << oct << noop_ << noop_ << noop_ << 31 << "37"; + QTest::newRow("oct 2") << oct << base << noop_ << noop_ << 31 << "037"; } void tst_QTextStream::numeralCase() @@ -1782,9 +1785,9 @@ void tst_QTextStream::nanInf() QString s; QTextStream out(&s); out << qInf() << ' ' << -qInf() << ' ' << qQNaN() - << uppercasedigits << ' ' + << Qt::uppercasedigits << ' ' << qInf() << ' ' << -qInf() << ' ' << qQNaN() - << flush; + << Qt::flush; QCOMPARE(s, QString("inf -inf nan INF -INF NAN")); } @@ -1821,7 +1824,7 @@ void tst_QTextStream::utf8IncompleteAtBufferBoundary() out.setFieldWidth(3); for (int i = 0; i < 1000; ++i) { - out << i << lineContents << endl; + out << i << lineContents << Qt::endl; } } data.close(); @@ -1859,9 +1862,9 @@ void tst_QTextStream::writeSeekWriteNoBOM() int number = 0; QString sizeStr = QLatin1String("Size=") + QString::number(number).rightJustified(10, QLatin1Char('0')); - stream << sizeStr << endl; - stream << "Version=" << QString::number(14) << endl; - stream << "blah blah blah" << endl; + stream << sizeStr << Qt::endl; + stream << "Version=" << QString::number(14) << Qt::endl; + stream << "blah blah blah" << Qt::endl; stream.flush(); QCOMPARE(out.buffer().constData(), "Size=0000000000\nVersion=14\nblah blah blah\n"); @@ -1871,7 +1874,7 @@ void tst_QTextStream::writeSeekWriteNoBOM() stream.seek(0); sizeStr = QLatin1String("Size=") + QString::number(number).rightJustified(10, QLatin1Char('0')); - stream << sizeStr << endl; + stream << sizeStr << Qt::endl; stream.flush(); // Check buffer is still OK @@ -2723,7 +2726,7 @@ void tst_QTextStream::generateBOM() QTextStream stream(&file); stream.setCodec(QTextCodec::codecForName("UTF-16LE")); - stream << "Hello" << endl; + stream << "Hello" << Qt::endl; file.close(); QVERIFY(file.open(QFile::ReadOnly)); @@ -2737,7 +2740,7 @@ void tst_QTextStream::generateBOM() QTextStream stream(&file); stream.setCodec(QTextCodec::codecForName("UTF-16LE")); - stream << bom << "Hello" << endl; + stream << Qt::bom << "Hello" << Qt::endl; file.close(); QVERIFY(file.open(QFile::ReadOnly)); diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 8fdf91b090..92a0d8bbfa 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -115,7 +115,7 @@ static QByteArray makeCanonical(const QString &filename, writeDtd << "<!DOCTYPE "; writeDtd << docType; writeDtd << " ["; - writeDtd << endl; + writeDtd << Qt::endl; for (const QXmlStreamNotationDeclaration ¬ation : sorted_by_name(notationDeclarations)) { writeDtd << "<!NOTATION "; writeDtd << notation.name().toString(); @@ -134,11 +134,11 @@ static QByteArray makeCanonical(const QString &filename, } } writeDtd << '>'; - writeDtd << endl; + writeDtd << Qt::endl; } writeDtd << "]>"; - writeDtd << endl; + writeDtd << Qt::endl; writer.writeDTD(dtd); } } else if (reader.isStartElement()) { @@ -253,7 +253,7 @@ public: qFatal("%s: aId must not be an empty string", Q_FUNC_INFO); } - void swap(MissedBaseline &other) Q_DECL_NOTHROW + void swap(MissedBaseline &other) noexcept { qSwap(id, other.id); qSwap(expected, other.expected); @@ -740,7 +740,7 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) const auto attributes = reader.attributes(); if (attributes.size()) { for (const QXmlStreamAttribute &attribute : attributes) { - writer << endl << " Attribute("; + writer << Qt::endl << " Attribute("; if (!attribute.name().isEmpty()) writer << " name=\"" << attribute.name().toString() << '"'; if (!attribute.namespaceUri().isEmpty()) @@ -751,37 +751,37 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) writer << " prefix=\"" << attribute.prefix().toString() << '"'; if (!attribute.value().isEmpty()) writer << " value=\"" << attribute.value().toString() << '"'; - writer << " )" << endl; + writer << " )" << Qt::endl; } } const auto namespaceDeclarations = reader.namespaceDeclarations(); if (namespaceDeclarations.size()) { for (const QXmlStreamNamespaceDeclaration &namespaceDeclaration : namespaceDeclarations) { - writer << endl << " NamespaceDeclaration("; + writer << Qt::endl << " NamespaceDeclaration("; if (!namespaceDeclaration.prefix().isEmpty()) writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << '"'; if (!namespaceDeclaration.namespaceUri().isEmpty()) writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << '"'; - writer << " )" << endl; + writer << " )" << Qt::endl; } } const auto notationDeclarations = reader.notationDeclarations(); if (notationDeclarations.size()) { for (const QXmlStreamNotationDeclaration ¬ationDeclaration : notationDeclarations) { - writer << endl << " NotationDeclaration("; + writer << Qt::endl << " NotationDeclaration("; if (!notationDeclaration.name().isEmpty()) writer << " name=\"" << notationDeclaration.name().toString() << '"'; if (!notationDeclaration.systemId().isEmpty()) writer << " systemId=\"" << notationDeclaration.systemId().toString() << '"'; if (!notationDeclaration.publicId().isEmpty()) writer << " publicId=\"" << notationDeclaration.publicId().toString() << '"'; - writer << " )" << endl; + writer << " )" << Qt::endl; } } const auto entityDeclarations = reader.entityDeclarations(); if (entityDeclarations.size()) { for (const QXmlStreamEntityDeclaration &entityDeclaration : entityDeclarations) { - writer << endl << " EntityDeclaration("; + writer << Qt::endl << " EntityDeclaration("; if (!entityDeclaration.name().isEmpty()) writer << " name=\"" << entityDeclaration.name().toString() << '"'; if (!entityDeclaration.notationName().isEmpty()) @@ -792,13 +792,13 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) writer << " publicId=\"" << entityDeclaration.publicId().toString() << '"'; if (!entityDeclaration.value().isEmpty()) writer << " value=\"" << entityDeclaration.value().toString() << '"'; - writer << " )" << endl; + writer << " )" << Qt::endl; } } - writer << " )" << endl; + writer << " )" << Qt::endl; } if (reader.hasError()) - writer << "ERROR: " << reader.errorString() << endl; + writer << "ERROR: " << reader.errorString() << Qt::endl; return outarray; } @@ -1169,7 +1169,7 @@ int main(int argc, char *argv[]) bool error = false; QByteArray canonical = makeCanonical(argv[2], "doc", error); QTextStream myStdOut(stdout); - myStdOut << canonical << endl; + myStdOut << canonical << Qt::endl; exit(0); } diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 810698fb4e..55a672aae1 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -6680,13 +6680,13 @@ void tst_QStateMachine::dontProcessSlotsWhenMachineIsNotRunning() } emitter; initialState.addTransition(&emitter, &Emitter::signalWithNoArg, &finalState); - QTimer::singleShot(0, [&]() { - metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg"); - metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg"); - }); machine.addState(&initialState); machine.addState(&finalState); machine.setInitialState(&initialState); + connect(&machine, &QStateMachine::started, &emitter, [&]() { + metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg"); + metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg"); + }); connect(&machine, &QStateMachine::finished, &emitter.thread, &QThread::quit); machine.start(); QSignalSpy emittedSpy(&emitter, &SignalEmitter::signalWithNoArg); diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index 32e5b8ee56..3a98732f9d 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -291,10 +291,10 @@ void tst_QAtomicIntegerXX::copy() QCOMPARE(copy2.load(), atomic.load()); // move - QAtomicInteger<T> copy3(qMove(copy)); + QAtomicInteger<T> copy3(std::move(copy)); QCOMPARE(copy3.load(), atomic.load()); - QAtomicInteger<T> copy4 = qMove(copy2); + QAtomicInteger<T> copy4 = std::move(copy2); QCOMPARE(copy4.load(), atomic.load()); } @@ -317,11 +317,11 @@ void tst_QAtomicIntegerXX::assign() // move QAtomicInteger<T> copy3; - copy3 = qMove(copy); + copy3 = std::move(copy); QCOMPARE(copy3.load(), atomic.load()); QAtomicInteger<T> copy4; - copy4 = qMove(copy2); + copy4 = std::move(copy2); QCOMPARE(copy4.load(), atomic.load()); } diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index d73dcc1b6d..f72b662c94 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1330,6 +1330,8 @@ void tst_QThread::quitLock() QCOMPARE(job->thread(), &thread); loop.exec(); QVERIFY(exitThreadCalled); + + delete job; } void tst_QThread::create() diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 838431cd5a..27b49602fc 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -1322,6 +1322,7 @@ void tst_QThreadPool::waitForDoneAfterTake() QRunnable *runnable = createTask(emptyFunct); manager.start(runnable); QVERIFY(manager.tryTake(runnable)); + delete runnable; } // Add another runnable that will not be removed diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index b40b1f0624..734b018b39 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -580,73 +580,73 @@ void tst_Collections::list() list1 << 0 << 1 << 2 << 3; list1.removeFirst(); - list1.swap(0, 0); + list1.swapItemsAt(0, 0); QVERIFY(list1 == QList<int>() << 1 << 2 << 3); - list1.swap(1, 1); + list1.swapItemsAt(1, 1); QVERIFY(list1 == QList<int>() << 1 << 2 << 3); - list1.swap(2, 2); + list1.swapItemsAt(2, 2); QVERIFY(list1 == QList<int>() << 1 << 2 << 3); - list1.swap(0, 1); + list1.swapItemsAt(0, 1); QVERIFY(list1 == QList<int>() << 2 << 1 << 3); - list1.swap(0, 2); + list1.swapItemsAt(0, 2); QVERIFY(list1 == QList<int>() << 3 << 1 << 2); - list1.swap(1, 2); + list1.swapItemsAt(1, 2); QVERIFY(list1 == QList<int>() << 3 << 2 << 1); - list1.swap(1, 2); + list1.swapItemsAt(1, 2); QVERIFY(list1 == QList<int>() << 3 << 1 << 2); QList<QString> list2; list2 << "1" << "2" << "3"; - list2.swap(0, 0); + list2.swapItemsAt(0, 0); QVERIFY(list2 == QList<QString>() << "1" << "2" << "3"); - list2.swap(1, 1); + list2.swapItemsAt(1, 1); QVERIFY(list2 == QList<QString>() << "1" << "2" << "3"); - list2.swap(2, 2); + list2.swapItemsAt(2, 2); QVERIFY(list2 == QList<QString>() << "1" << "2" << "3"); - list2.swap(0, 1); + list2.swapItemsAt(0, 1); QVERIFY(list2 == QList<QString>() << "2" << "1" << "3"); - list2.swap(0, 2); + list2.swapItemsAt(0, 2); QVERIFY(list2 == QList<QString>() << "3" << "1" << "2"); - list2.swap(1, 2); + list2.swapItemsAt(1, 2); QVERIFY(list2 == QList<QString>() << "3" << "2" << "1"); - list2.swap(1, 2); + list2.swapItemsAt(1, 2); QVERIFY(list2 == QList<QString>() << "3" << "1" << "2"); QList<double> list3; list3 << 1.0 << 2.0 << 3.0; - list3.swap(0, 0); + list3.swapItemsAt(0, 0); QVERIFY(list3 == QList<double>() << 1.0 << 2.0 << 3.0); - list3.swap(1, 1); + list3.swapItemsAt(1, 1); QVERIFY(list3 == QList<double>() << 1.0 << 2.0 << 3.0); - list3.swap(2, 2); + list3.swapItemsAt(2, 2); QVERIFY(list3 == QList<double>() << 1.0 << 2.0 << 3.0); - list3.swap(0, 1); + list3.swapItemsAt(0, 1); QVERIFY(list3 == QList<double>() << 2.0 << 1.0 << 3.0); - list3.swap(0, 2); + list3.swapItemsAt(0, 2); QVERIFY(list3 == QList<double>() << 3.0 << 1.0 << 2.0); - list3.swap(1, 2); + list3.swapItemsAt(1, 2); QVERIFY(list3 == QList<double>() << 3.0 << 2.0 << 1.0); - list3.swap(1, 2); + list3.swapItemsAt(1, 2); QVERIFY(list3 == QList<double>() << 3.0 << 1.0 << 2.0); } @@ -2425,7 +2425,7 @@ void testContainer() c1 = newInstance<Container>(); QVERIFY(c1.size() == 4); QVERIFY(c1 == newInstance<Container>()); - Container c2 = qMove(c1); + Container c2 = std::move(c1); QVERIFY(c2.size() == 4); QVERIFY(c2 == newInstance<Container>()); } @@ -2531,14 +2531,18 @@ void tst_Collections::conversions() QCOMPARE(list2.size(), 4); QVERIFY(list2 == (QList<QString>() << STUFF)); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QSet<QString> set1 = list1.toSet(); +#else + QSet<QString> set1(list1.begin(), list1.end()); +#endif QCOMPARE(set1.size(), 3); QVERIFY(set1.contains("A")); QVERIFY(set1.contains("B")); QVERIFY(set1.contains("C")); QVERIFY(!set1.contains("D")); - QList<QString> list3 = set1.toList(); + QList<QString> list3 = set1.values(); QCOMPARE(list3.size(), 3); QVERIFY(list3.contains("A")); QVERIFY(list3.contains("B")); @@ -2546,9 +2550,11 @@ void tst_Collections::conversions() QVERIFY(!list3.contains("D")); QVERIFY(QList<int>().toVector().isEmpty()); - QVERIFY(QList<int>().toSet().isEmpty()); QVERIFY(QVector<int>().toList().isEmpty()); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + QVERIFY(QList<int>().toSet().isEmpty()); QVERIFY(QSet<int>().toList().isEmpty()); +#endif } { @@ -2563,14 +2569,22 @@ void tst_Collections::conversions() QCOMPARE(list2.size(), 4); QVERIFY(list2 == (QList<QString>() << STUFF)); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QSet<QString> set1 = QSet<QString>::fromList(list1); +#else + QSet<QString> set1(list1.begin(), list1.end()); +#endif QCOMPARE(set1.size(), 3); QVERIFY(set1.contains("A")); QVERIFY(set1.contains("B")); QVERIFY(set1.contains("C")); QVERIFY(!set1.contains("D")); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QList<QString> list3 = QList<QString>::fromSet(set1); +#else + QList<QString> list3 = set1.values(); +#endif QCOMPARE(list3.size(), 3); QVERIFY(list3.contains("A")); QVERIFY(list3.contains("B")); @@ -2578,9 +2592,11 @@ void tst_Collections::conversions() QVERIFY(!list3.contains("D")); QVERIFY(QVector<int>::fromList(QList<int>()).isEmpty()); - QVERIFY(QSet<int>::fromList(QList<int>()).isEmpty()); QVERIFY(QList<int>::fromVector(QVector<int>()).isEmpty()); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + QVERIFY(QSet<int>::fromList(QList<int>()).isEmpty()); QVERIFY(QList<int>::fromSet(QSet<int>()).isEmpty()); +#endif } #undef STUFF } @@ -2776,15 +2792,21 @@ void tst_Collections::vector_stl() for (int i = 0; i < elements.count(); ++i) vector << elements.at(i); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) std::vector<QString> stdVector = vector.toStdVector(); - +#else + std::vector<QString> stdVector(vector.begin(), vector.end()); +#endif QCOMPARE(int(stdVector.size()), elements.size()); std::vector<QString>::const_iterator it = stdVector.begin(); for (uint j = 0; j < stdVector.size() && it != stdVector.end(); ++j, ++it) QCOMPARE(*it, vector[j]); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QCOMPARE(QVector<QString>::fromStdVector(stdVector), vector); +#endif + QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector); } void tst_Collections::linkedlist_stl_data() @@ -2830,7 +2852,11 @@ void tst_Collections::list_stl() for (int i = 0; i < elements.count(); ++i) list << elements.at(i); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) std::list<QString> stdList = list.toStdList(); +#else + std::list<QString> stdList(list.begin(), list.end()); +#endif QCOMPARE(int(stdList.size()), elements.size()); @@ -2838,7 +2864,10 @@ void tst_Collections::list_stl() for (uint j = 0; j < stdList.size() && it != stdList.end(); ++j, ++it) QCOMPARE(*it, list[j]); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QCOMPARE(QList<QString>::fromStdList(stdList), list); +#endif + QCOMPARE(QList<QString>(stdList.begin(), stdList.end()), list); } template <typename T> diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index 3b8111f1a3..4b085d387d 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -34,13 +34,446 @@ #include "qstring.h" #include "qvarlengtharray.h" #include "qvector.h" +#include "qhash.h" +#include "qdebug.h" +#include <algorithm> +#include <functional> #include <vector> // for reference +#include <list> +#include <set> +#include <map> + +// MSVC has these containers from the Standard Library, but it lacks +// a __has_include mechanism (that we need to use for other stdlibs). +// For the sake of increasing our test coverage, work around the issue. + +#ifdef Q_CC_MSVC +#define COMPILER_HAS_STDLIB_INCLUDE(x) 1 +#else +#define COMPILER_HAS_STDLIB_INCLUDE(x) QT_HAS_INCLUDE(x) +#endif + +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) +#include <forward_list> +#endif +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) +#include <unordered_set> +#endif +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) +#include <unordered_map> +#endif + +struct Movable +{ + explicit Movable(int i = 0) Q_DECL_NOTHROW + : i(i) + { + ++instanceCount; + } + + Movable(const Movable &m) + : i(m.i) + { + ++instanceCount; + } + + ~Movable() + { + --instanceCount; + } + + int i; + static int instanceCount; +}; + +int Movable::instanceCount = 0; +bool operator==(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i; } +bool operator!=(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; } +bool operator<(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; } + +uint qHash(Movable m, uint seed = 0) Q_DECL_NOTHROW { return qHash(m.i, seed); } +QDebug &operator<<(QDebug &d, Movable m) +{ + const QDebugStateSaver saver(d); + return d.nospace() << "Movable(" << m.i << ")"; +} + +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE); +QT_END_NAMESPACE + +struct Complex +{ + explicit Complex(int i = 0) Q_DECL_NOTHROW + : i(i) + { + ++instanceCount; + } + + Complex(const Complex &c) + : i(c.i) + { + ++instanceCount; + } + + ~Complex() + { + --instanceCount; + } + + int i; + static int instanceCount; +}; + +int Complex::instanceCount = 0; +bool operator==(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i; } +bool operator!=(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; } +bool operator<(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; } + +uint qHash(Complex c, uint seed = 0) Q_DECL_NOTHROW { return qHash(c.i, seed); } +QDebug &operator<<(QDebug &d, Complex c) +{ + const QDebugStateSaver saver(d); + return d.nospace() << "Complex(" << c.i << ")"; +} + + +struct DuplicateStrategyTestType +{ + explicit DuplicateStrategyTestType(int i = 0) Q_DECL_NOTHROW + : i(i), + j(++counter) + { + } + + int i; + int j; + + static int counter; +}; + +int DuplicateStrategyTestType::counter = 0; + +// only look at the i member, not j. j allows us to identify which instance +// gets inserted in containers that don't allow for duplicates +bool operator==(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +{ + return lhs.i == rhs.i; +} + +bool operator!=(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +{ + return lhs.i != rhs.i; +} + +bool operator<(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +{ + return lhs.i < rhs.i; +} + +uint qHash(DuplicateStrategyTestType c, uint seed = 0) Q_DECL_NOTHROW +{ + return qHash(c.i, seed); +} + +bool reallyEqual(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +{ + return lhs.i == rhs.i && lhs.j == rhs.j; +} + +QDebug &operator<<(QDebug &d, DuplicateStrategyTestType c) +{ + const QDebugStateSaver saver(d); + return d.nospace() << "DuplicateStrategyTestType(" << c.i << "," << c.j << ")"; +} + + +namespace std { +template<> +struct hash<Movable> +{ + std::size_t operator()(Movable m) const Q_DECL_NOTHROW + { + return hash<int>()(m.i); + } +}; + +template<> +struct hash<Complex> +{ + std::size_t operator()(Complex m) const Q_DECL_NOTHROW + { + return hash<int>()(m.i); + } +}; + +template<> +struct hash<DuplicateStrategyTestType> +{ + std::size_t operator()(DuplicateStrategyTestType m) const Q_DECL_NOTHROW + { + return hash<int>()(m.i); + } +}; +} + +// work around the fact that QVarLengthArray has a non-type +// template parameter, and that breaks non_associative_container_duplicates_strategy +template<typename T> +class VarLengthArray : public QVarLengthArray<T> +{ +public: +#ifdef Q_COMPILER_INHERITING_CONSTRUCTORS + using QVarLengthArray<T>::QVarLengthArray; +#else + template<typename InputIterator> + VarLengthArray(InputIterator first, InputIterator last) + : QVarLengthArray<T>(first, last) + { + } + + VarLengthArray(std::initializer_list<T> args) + : QVarLengthArray<T>(args) + { + } +#endif +}; class tst_ContainerApiSymmetry : public QObject { Q_OBJECT + int m_movableInstanceCount; + int m_complexInstanceCount; + +private Q_SLOTS: + void init(); + void cleanup(); + +private: + template <typename Container> + void ranged_ctor_non_associative_impl() const; + + template<template<typename ... T> class Container> + void non_associative_container_duplicates_strategy() const; + + template <typename Container> + void ranged_ctor_associative_impl() const; + +private Q_SLOTS: + // non associative + void ranged_ctor_std_vector_int() { ranged_ctor_non_associative_impl<std::vector<int>>(); } + void ranged_ctor_std_vector_char() { ranged_ctor_non_associative_impl<std::vector<char>>(); } + void ranged_ctor_std_vector_QChar() { ranged_ctor_non_associative_impl<std::vector<QChar>>(); } + void ranged_ctor_std_vector_Movable() { ranged_ctor_non_associative_impl<std::vector<Movable>>(); } + void ranged_ctor_std_vector_Complex() { ranged_ctor_non_associative_impl<std::vector<Complex>>(); } + void ranged_ctor_std_vector_duplicates_strategy() { non_associative_container_duplicates_strategy<std::vector>(); } + + void ranged_ctor_QVector_int() { ranged_ctor_non_associative_impl<QVector<int>>(); } + void ranged_ctor_QVector_char() { ranged_ctor_non_associative_impl<QVector<char>>(); } + void ranged_ctor_QVector_QChar() { ranged_ctor_non_associative_impl<QVector<QChar>>(); } + void ranged_ctor_QVector_Movable() { ranged_ctor_non_associative_impl<QVector<Movable>>(); } + void ranged_ctor_QVector_Complex() { ranged_ctor_non_associative_impl<QVector<Complex>>(); } + void ranged_ctor_QVector_duplicates_strategy() { non_associative_container_duplicates_strategy<QVector>(); } + + void ranged_ctor_QVarLengthArray_int() { ranged_ctor_non_associative_impl<QVarLengthArray<int>>(); } + void ranged_ctor_QVarLengthArray_Movable() { ranged_ctor_non_associative_impl<QVarLengthArray<Movable>>(); } + void ranged_ctor_QVarLengthArray_Complex() { ranged_ctor_non_associative_impl<QVarLengthArray<Complex>>(); } + void ranged_ctor_QVarLengthArray_duplicates_strategy() { non_associative_container_duplicates_strategy<VarLengthArray>(); } // note the VarLengthArray passed + + void ranged_ctor_QList_int() { ranged_ctor_non_associative_impl<QList<int>>(); } + void ranged_ctor_QList_Movable() { ranged_ctor_non_associative_impl<QList<Movable>>(); } + void ranged_ctor_QList_Complex() { ranged_ctor_non_associative_impl<QList<Complex>>(); } + void ranged_ctor_QList_duplicates_strategy() { non_associative_container_duplicates_strategy<QList>(); } + + void ranged_ctor_std_list_int() { ranged_ctor_non_associative_impl<std::list<int>>(); } + void ranged_ctor_std_list_Movable() { ranged_ctor_non_associative_impl<std::list<Movable>>(); } + void ranged_ctor_std_list_Complex() { ranged_ctor_non_associative_impl<std::list<Complex>>(); } + void ranged_ctor_std_list_duplicates_strategy() { non_associative_container_duplicates_strategy<std::list>(); } + + void ranged_ctor_std_forward_list_int() { +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) + ranged_ctor_non_associative_impl<std::forward_list<int>>(); +#else + QSKIP("<forward_list> is needed for this test"); +#endif + } + + void ranged_ctor_std_forward_list_Movable() { +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) + ranged_ctor_non_associative_impl<std::forward_list<Movable>>(); +#else + QSKIP("<forward_list> is needed for this test"); +#endif + } + + void ranged_ctor_std_forward_list_Complex() { +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) + ranged_ctor_non_associative_impl<std::forward_list<Complex>>(); +#else + QSKIP("<forward_list> is needed for this test"); +#endif + } + + void ranged_ctor_std_forward_list_duplicates_strategy() { +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) + non_associative_container_duplicates_strategy<std::forward_list>(); +#else + QSKIP("<forward_list> is needed for this test"); +#endif + } + + void ranged_ctor_QLinkedList_int() { ranged_ctor_non_associative_impl<QLinkedList<int>>(); } + void ranged_ctor_QLinkedList_Movable() { ranged_ctor_non_associative_impl<QLinkedList<Movable>>(); } + void ranged_ctor_QLinkedList_Complex() { ranged_ctor_non_associative_impl<QLinkedList<Complex>>(); } + void ranged_ctor_QLinkedList_duplicates_strategy() { non_associative_container_duplicates_strategy<QLinkedList>(); } + + void ranged_ctor_std_set_int() { ranged_ctor_non_associative_impl<std::set<int>>(); } + void ranged_ctor_std_set_Movable() { ranged_ctor_non_associative_impl<std::set<Movable>>(); } + void ranged_ctor_std_set_Complex() { ranged_ctor_non_associative_impl<std::set<Complex>>(); } + void ranged_ctor_std_set_duplicates_strategy() { non_associative_container_duplicates_strategy<std::set>(); } + + void ranged_ctor_std_multiset_int() { ranged_ctor_non_associative_impl<std::multiset<int>>(); } + void ranged_ctor_std_multiset_Movable() { ranged_ctor_non_associative_impl<std::multiset<Movable>>(); } + void ranged_ctor_std_multiset_Complex() { ranged_ctor_non_associative_impl<std::multiset<Complex>>(); } + void ranged_ctor_std_multiset_duplicates_strategy() { non_associative_container_duplicates_strategy<std::multiset>(); } + + void ranged_ctor_std_unordered_set_int() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_set<int>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_std_unordered_set_Movable() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_set<Movable>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_std_unordered_set_Complex() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_set<Complex>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_unordered_set_duplicates_strategy() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + non_associative_container_duplicates_strategy<std::unordered_set>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + + void ranged_ctor_std_unordered_multiset_int() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_multiset<int>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_std_unordered_multiset_Movable() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_multiset<Movable>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_std_unordered_multiset_Complex() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + ranged_ctor_non_associative_impl<std::unordered_multiset<Complex>>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_std_unordered_multiset_duplicates_strategy() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) + non_associative_container_duplicates_strategy<std::unordered_multiset>(); +#else + QSKIP("<unordered_set> is needed for this test"); +#endif + } + + void ranged_ctor_QSet_int() { ranged_ctor_non_associative_impl<QSet<int>>(); } + void ranged_ctor_QSet_Movable() { ranged_ctor_non_associative_impl<QSet<Movable>>(); } + void ranged_ctor_QSet_Complex() { ranged_ctor_non_associative_impl<QSet<Complex>>(); } + void ranged_ctor_QSet_duplicates_strategy() { non_associative_container_duplicates_strategy<QSet>(); } + + // associative + void ranged_ctor_std_map_int() { ranged_ctor_associative_impl<std::map<int, int>>(); } + void ranged_ctor_std_map_Movable() { ranged_ctor_associative_impl<std::map<Movable, int>>(); } + void ranged_ctor_std_map_Complex() { ranged_ctor_associative_impl<std::map<Complex, int>>(); } + + void ranged_ctor_std_multimap_int() { ranged_ctor_associative_impl<std::multimap<int, int>>(); } + void ranged_ctor_std_multimap_Movable() { ranged_ctor_associative_impl<std::multimap<Movable, int>>(); } + void ranged_ctor_std_multimap_Complex() { ranged_ctor_associative_impl<std::multimap<Complex, int>>(); } + + void ranged_ctor_unordered_map_int() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_map<int, int>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_unordered_map_Movable() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_map<Movable, Movable>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_unordered_map_Complex() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_map<Complex, Complex>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_QHash_int() { ranged_ctor_associative_impl<QHash<int, int>>(); } + void ranged_ctor_QHash_Movable() { ranged_ctor_associative_impl<QHash<Movable, int>>(); } + void ranged_ctor_QHash_Complex() { ranged_ctor_associative_impl<QHash<Complex, int>>(); } + + void ranged_ctor_unordered_multimap_int() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_multimap<int, int>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_unordered_multimap_Movable() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_multimap<Movable, Movable>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_unordered_multimap_Complex() { +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_map>) + ranged_ctor_associative_impl<std::unordered_multimap<Complex, Complex>>(); +#else + QSKIP("<unordered_map> is needed for this test"); +#endif + } + + void ranged_ctor_QMultiHash_int() { ranged_ctor_associative_impl<QMultiHash<int, int>>(); } + void ranged_ctor_QMultiHash_Movable() { ranged_ctor_associative_impl<QMultiHash<Movable, int>>(); } + void ranged_ctor_QMultiHash_Complex() { ranged_ctor_associative_impl<QMultiHash<Complex, int>>(); } + private: template <typename Container> void front_back_impl() const; @@ -58,6 +491,296 @@ private Q_SLOTS: void front_back_QByteArray() { front_back_impl<QByteArray>(); } }; +void tst_ContainerApiSymmetry::init() +{ + m_movableInstanceCount = Movable::instanceCount; + m_complexInstanceCount = Complex::instanceCount; +} + +void tst_ContainerApiSymmetry::cleanup() +{ + // very simple leak check + QCOMPARE(Movable::instanceCount, m_movableInstanceCount); + QCOMPARE(Complex::instanceCount, m_complexInstanceCount); +} + +template <typename Container> +Container createContainerReference() +{ + using V = typename Container::value_type; + + return {V(0), V(1), V(2), V(0)}; +} + +template <typename Container> +void tst_ContainerApiSymmetry::ranged_ctor_non_associative_impl() const +{ + using V = typename Container::value_type; + + // the double V(0) is deliberate + const auto reference = createContainerReference<Container>(); + + // plain array + const V values1[] = { V(0), V(1), V(2), V(0) }; + + const Container c1(values1, values1 + sizeof(values1)/sizeof(values1[0])); + + // from QList + QList<V> l2; + l2 << V(0) << V(1) << V(2) << V(0); + + const Container c2a(l2.begin(), l2.end()); + const Container c2b(l2.cbegin(), l2.cend()); + + // from std::list + std::list<V> l3; + l3.push_back(V(0)); + l3.push_back(V(1)); + l3.push_back(V(2)); + l3.push_back(V(0)); + const Container c3a(l3.begin(), l3.end()); + + // from const std::list + const std::list<V> l3c = l3; + const Container c3b(l3c.begin(), l3c.end()); + + // from itself + const Container c4(reference.begin(), reference.end()); + + QCOMPARE(c1, reference); + QCOMPARE(c2a, reference); + QCOMPARE(c2b, reference); + QCOMPARE(c3a, reference); + QCOMPARE(c3b, reference); + QCOMPARE(c4, reference); +} + + +// type traits for detecting whether a non-associative container +// accepts duplicated values, and if it doesn't, whether construction/insertion +// prefer the new values (overwriting) or the old values (rejecting) + +struct ContainerAcceptsDuplicateValues {}; +struct ContainerOverwritesDuplicateValues {}; +struct ContainerRejectsDuplicateValues {}; + +template<typename Container> +struct ContainerDuplicatedValuesStrategy {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::vector<T...>> : ContainerAcceptsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<QVector<T...>> : ContainerAcceptsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<QVarLengthArray<T...>> : ContainerAcceptsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<VarLengthArray<T...>> : ContainerAcceptsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<QList<T...>> : ContainerAcceptsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::list<T...>> : ContainerAcceptsDuplicateValues {}; + +#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>) +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {}; +#endif + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {}; + +// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::set<T...>> : ContainerRejectsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::multiset<T...>> : ContainerAcceptsDuplicateValues {}; + +#if COMPILER_HAS_STDLIB_INCLUDE(<unordered_set>) +// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::unordered_set<T...>> : ContainerRejectsDuplicateValues {}; + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<std::unordered_multiset<T...>> : ContainerAcceptsDuplicateValues {}; +#endif + +template<typename ... T> +struct ContainerDuplicatedValuesStrategy<QSet<T...>> : ContainerRejectsDuplicateValues {}; + +template<typename Container> +void non_associative_container_check_duplicates_impl(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c, ContainerAcceptsDuplicateValues) +{ + // do a deep check for equality, not ordering + QVERIFY(std::distance(reference.begin(), reference.end()) == std::distance(c.begin(), c.end())); + QVERIFY(std::is_permutation(reference.begin(), reference.end(), c.begin(), &reallyEqual)); +} + +enum class IterationOnReference +{ + ForwardIteration, + ReverseIteration +}; + +template<typename Container> +void non_associative_container_check_duplicates_impl_no_duplicates(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c, IterationOnReference ior) +{ + std::vector<DuplicateStrategyTestType> valuesAlreadySeen; + + // iterate on reference forward or backwards, depending on ior. this will give + // us the expected semantics when checking for duplicated values into c + auto it = [&reference, ior]() { + switch (ior) { + case IterationOnReference::ForwardIteration: return reference.begin(); + case IterationOnReference::ReverseIteration: return reference.end() - 1; + }; + return std::initializer_list<DuplicateStrategyTestType>::const_iterator(); + }(); + + const auto &end = [&reference, ior]() { + switch (ior) { + case IterationOnReference::ForwardIteration: return reference.end(); + case IterationOnReference::ReverseIteration: return reference.begin() - 1; + }; + return std::initializer_list<DuplicateStrategyTestType>::const_iterator(); + }(); + + while (it != end) { + const auto &value = *it; + + // check that there is indeed the same value in the container (using operator==) + const auto &valueInContainerIterator = std::find(c.begin(), c.end(), value); + QVERIFY(valueInContainerIterator != c.end()); + QVERIFY(value == *valueInContainerIterator); + + // if the value is a duplicate, we don't expect to find it in the container + // (when doing a deep comparison). otherwise it should be there + + const auto &valuesAlreadySeenIterator = std::find(valuesAlreadySeen.cbegin(), valuesAlreadySeen.cend(), value); + const bool valueIsDuplicated = (valuesAlreadySeenIterator != valuesAlreadySeen.cend()); + + const auto &reallyEqualCheck = [&value](const DuplicateStrategyTestType &v) { return reallyEqual(value, v); }; + QCOMPARE(std::find_if(c.begin(), c.end(), reallyEqualCheck) == c.end(), valueIsDuplicated); + + valuesAlreadySeen.push_back(value); + + switch (ior) { + case IterationOnReference::ForwardIteration: + ++it; + break; + case IterationOnReference::ReverseIteration: + --it; + break; + }; + } + +} + +template<typename Container> +void non_associative_container_check_duplicates_impl(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c, ContainerRejectsDuplicateValues) +{ + non_associative_container_check_duplicates_impl_no_duplicates(reference, c, IterationOnReference::ForwardIteration); +} + +template<typename Container> +void non_associative_container_check_duplicates_impl(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c, ContainerOverwritesDuplicateValues) +{ + non_associative_container_check_duplicates_impl_no_duplicates(reference, c, IterationOnReference::ReverseIteration); +} + +template<typename Container> +void non_associative_container_check_duplicates(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c) +{ + non_associative_container_check_duplicates_impl(reference, c, ContainerDuplicatedValuesStrategy<Container>()); +} + +template<template<class ... T> class Container> +void tst_ContainerApiSymmetry::non_associative_container_duplicates_strategy() const +{ + // first and last are "duplicates" -- they compare equal for operator==, + // but they differ when using reallyEqual + const std::initializer_list<DuplicateStrategyTestType> reference{ DuplicateStrategyTestType{0}, + DuplicateStrategyTestType{1}, + DuplicateStrategyTestType{2}, + DuplicateStrategyTestType{0} }; + Container<DuplicateStrategyTestType> c1{reference}; + non_associative_container_check_duplicates(reference, c1); + + Container<DuplicateStrategyTestType> c2{reference.begin(), reference.end()}; + non_associative_container_check_duplicates(reference, c2); +} + +template <typename Container> +void tst_ContainerApiSymmetry::ranged_ctor_associative_impl() const +{ + using K = typename Container::key_type; + using V = typename Container::mapped_type; + + // The double K(0) is deliberate. The order of the elements matters: + // * for unique-key STL containers, the first one should be the one inserted (cf. LWG 2844) + // * for unique-key Qt containers, the last one should be the one inserted + // * for multi-key sorted containers, the order of insertion of identical keys is also the + // iteration order (which establishes the equality of the containers) + // (although nothing of this is being tested here, that deserves its own testing) + const Container reference{ + { K(0), V(1000) }, + { K(1), V(1001) }, + { K(2), V(1002) }, + { K(0), V(1003) } + }; + + // Note that using anything not convertible to std::pair doesn't work for + // std containers. Their ranged construction is defined in terms of + // insert(value_type), which for std associative containers is + // std::pair<const K, T>. + + // plain array + const std::pair<K, V> values1[] = { + std::make_pair(K(0), V(1000)), + std::make_pair(K(1), V(1001)), + std::make_pair(K(2), V(1002)), + std::make_pair(K(0), V(1003)) + }; + + const Container c1(values1, values1 + sizeof(values1)/sizeof(values1[0])); + + // from QList + QList<std::pair<K, V>> l2; + l2 << std::make_pair(K(0), V(1000)) + << std::make_pair(K(1), V(1001)) + << std::make_pair(K(2), V(1002)) + << std::make_pair(K(0), V(1003)); + + const Container c2a(l2.begin(), l2.end()); + const Container c2b(l2.cbegin(), l2.cend()); + + // from std::list + std::list<std::pair<K, V>> l3; + l3.push_back(std::make_pair(K(0), V(1000))); + l3.push_back(std::make_pair(K(1), V(1001))); + l3.push_back(std::make_pair(K(2), V(1002))); + l3.push_back(std::make_pair(K(0), V(1003))); + const Container c3a(l3.begin(), l3.end()); + + // from const std::list + const std::list<std::pair<K, V>> l3c = l3; + const Container c3b(l3c.begin(), l3c.end()); + + // from itself + const Container c4(reference.begin(), reference.end()); + + QCOMPARE(c1, reference); + QCOMPARE(c2a, reference); + QCOMPARE(c2b, reference); + QCOMPARE(c3a, reference); + QCOMPARE(c3b, reference); + QCOMPARE(c4, reference); +} + template <typename Container> Container make(int size) { diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 72299402f0..06db0e8546 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -208,7 +208,7 @@ void printHeader(QStringList &headers) for (int h = 0; h < headers.count(); ++h) { cout << setw(20) << setiosflags(ios_base::left) << headers.at(h).toLatin1().constData(); } - cout << endl; + cout << Qt::endl; } template <typename ContainerType> @@ -220,7 +220,7 @@ void print(ContainerType testContainer) cout << value << " "; } - cout << endl; + cout << Qt::endl; } template <typename Algorithm, typename DataType> @@ -252,7 +252,7 @@ void testAlgorithm(Algorithm algorithm, QStringList &dataSetTypes) lessThan << setiosflags(ios_base::left) << setw(10) << result.lessThanRefCount / result.numSorts; cout << numSorts.str() << lessThan.str(); } - cout << endl; + cout << Qt::endl; } } #endif @@ -765,21 +765,21 @@ public: #if Q_TEST_PERFORMANCE void tst_QAlgorithms::performance() { - cout << endl << "Quick sort" << endl; + cout << Qt::endl << "Quick sort" << Qt::endl; testAlgorithm<QuickSortHelper<TestInt>, TestInt>(QuickSortHelper<TestInt>(), dataSetTypes); - cout << endl << "stable sort" << endl; + cout << Qt::endl << "stable sort" << Qt::endl; testAlgorithm<StableSortHelper<TestInt>, TestInt>(StableSortHelper<TestInt>(), dataSetTypes); - cout << endl << "std::sort" << endl; + cout << Qt::endl << "std::sort" << Qt::endl; testAlgorithm<StlSortHelper<TestInt>, TestInt>(StlSortHelper<TestInt>(), dataSetTypes); - cout << endl << "std::stable_sort" << endl; + cout << Qt::endl << "std::stable_sort" << Qt::endl; testAlgorithm<StlStableSortHelper<TestInt>, TestInt>(StlStableSortHelper<TestInt>(), dataSetTypes); /* - cout << endl << "Sorting lists of ints" << endl; - cout << endl << "Quick sort" << endl; + cout << Qt::endl << "Sorting lists of ints" << Qt::endl; + cout << Qt::endl << "Quick sort" << Qt::endl; testAlgorithm<QuickSortHelper<int>, int>(QuickSortHelper<int>(), dataSetTypes); - cout << endl << "std::sort" << endl; + cout << Qt::endl << "std::sort" << Qt::endl; testAlgorithm<StlSortHelper<int>, int>(StlSortHelper<int>(), dataSetTypes); - cout << endl << "std::stable_sort" << endl; + cout << Qt::endl << "std::stable_sort" << Qt::endl; testAlgorithm<StlStableSortHelper<int>, int>(StlStableSortHelper<int>(), dataSetTypes); */ } diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index a00c962510..6ae2aab5b9 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -78,12 +78,8 @@ private slots: void fromRawData_data(); void fromRawData(); void literals(); -#if defined(Q_COMPILER_VARIADIC_MACROS) && defined(Q_COMPILER_LAMBDA) void variadicLiterals(); -#endif -#ifdef Q_COMPILER_RVALUE_REFS void rValueReferences(); -#endif void grow(); }; @@ -1618,9 +1614,7 @@ void tst_QArrayData::literals() QCOMPARE(v.size(), size_t(11)); // v.capacity() is unspecified, for now -#if defined(Q_COMPILER_VARIADIC_MACROS) && defined(Q_COMPILER_LAMBDA) QVERIFY(v.isStatic()); -#endif #if !defined(QT_NO_UNSHARABLE_CONTAINERS) QVERIFY(v.isSharable()); @@ -1633,7 +1627,6 @@ void tst_QArrayData::literals() } } -#if defined(Q_COMPILER_VARIADIC_MACROS) && defined(Q_COMPILER_LAMBDA) // Variadic Q_ARRAY_LITERAL need to be available in the current configuration. void tst_QArrayData::variadicLiterals() { @@ -1682,9 +1675,7 @@ void tst_QArrayData::variadicLiterals() QCOMPARE(const_(v)[i], i); } } -#endif -#ifdef Q_COMPILER_RVALUE_REFS // std::remove_reference is in C++11, but requires library support template <class T> struct RemoveReference { typedef T Type; }; template <class T> struct RemoveReference<T &> { typedef T Type; }; @@ -1767,7 +1758,6 @@ void tst_QArrayData::rValueReferences() QCOMPARE(v3.size(), size_t(1)); QCOMPARE(v3.front(), 42); } -#endif void tst_QArrayData::grow() { diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 1ed41793dc..987b3058e3 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -138,9 +138,7 @@ private slots: void reserveExtended(); void movablity_data(); void movablity(); -#if defined(Q_COMPILER_LAMBDA) void literals(); -#endif void toUpperLower_data(); void toUpperLower(); void isUpper(); @@ -1361,6 +1359,9 @@ void tst_QByteArray::toDouble_data() QTest::newRow("trailing spaces") << QByteArray("1.2345 \n\r\t") << 1.2345 << true; QTest::newRow("leading junk") << QByteArray("x1.2345") << 0.0 << false; QTest::newRow("trailing junk") << QByteArray("1.2345x") << 0.0 << false; + + QTest::newRow("raw, null plus junk") << QByteArray::fromRawData("1.2\0 junk", 9) << 0.0 << false; + QTest::newRow("raw, null-terminator not included") << QByteArray::fromRawData("2.3", 3) << 2.3 << true; } void tst_QByteArray::toDouble() @@ -2189,7 +2190,6 @@ void tst_QByteArray::movablity() QVERIFY(true); } -#if defined(Q_COMPILER_LAMBDA) // Only tested on c++0x compliant compiler or gcc void tst_QByteArray::literals() { @@ -2210,7 +2210,6 @@ void tst_QByteArray::literals() QVERIFY(str2.constData() == s); QVERIFY(str2.data() != s); } -#endif void tst_QByteArray::toUpperLower_data() { @@ -2242,28 +2241,28 @@ void tst_QByteArray::toUpperLower() QCOMPARE(input.toLower(), lower); QByteArray copy = input; - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = input; copy.detach(); - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = input; - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = input; copy.detach(); - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = lower; - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = lower; copy.detach(); - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = upper; - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = upper; copy.detach(); - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); } void tst_QByteArray::isUpper() diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp index 2d2c536453..09ce41337e 100644 --- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp +++ b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp @@ -194,22 +194,22 @@ void tst_QByteArrayList::operator_plus() const { QByteArrayList bal1 = lhs; const QByteArrayList bal2 = rhs; - QCOMPARE(qMove(bal1) + bal2, expectedResult); + QCOMPARE(std::move(bal1) + bal2, expectedResult); } { QList<QByteArray> lba1 = lhs; const QByteArrayList bal2 = rhs; - QCOMPARE(qMove(lba1) + bal2, expectedResult); + QCOMPARE(std::move(lba1) + bal2, expectedResult); } { QByteArrayList bal1 = lhs; const QList<QByteArray> lba2 = rhs; - QCOMPARE(qMove(bal1) + lba2, expectedResult); + QCOMPARE(std::move(bal1) + lba2, expectedResult); } { QList<QByteArray> lba1 = lhs; const QList<QByteArray> lba2 = rhs; - QCOMPARE(qMove(lba1) + lba2, QList<QByteArray>(expectedResult)); // check we don't mess with old code + QCOMPARE(std::move(lba1) + lba2, QList<QByteArray>(expectedResult)); // check we don't mess with old code } // operator += for const lvalues @@ -232,7 +232,7 @@ void tst_QByteArrayList::operator_plus() const QByteArrayList t1 = lhs; QByteArrayList t2 = rhs; - QCOMPARE(qMove(t1) + t2, expectedResult); + QCOMPARE(std::move(t1) + t2, expectedResult); } void tst_QByteArrayList::operator_plus_data() const @@ -287,7 +287,6 @@ void tst_QByteArrayList::indexOf() const void tst_QByteArrayList::initializerList() const { -#ifdef Q_COMPILER_INITIALIZER_LISTS // constructor QByteArrayList v1 = {QByteArray("hello"),"world",QByteArray("plop")}; QCOMPARE(v1, (QByteArrayList() << "hello" << "world" << "plop")); @@ -296,9 +295,6 @@ void tst_QByteArrayList::initializerList() const QByteArrayList v2; v2 = {QByteArray("hello"),"world",QByteArray("plop")}; QCOMPARE(v2, v1); -#else - QSKIP("This test requires C++11 initializer_list support in the compiler."); -#endif } QTEST_APPLESS_MAIN(tst_QByteArrayList) diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index 72f88a235d..2ae9c6e159 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -47,7 +47,6 @@ private Q_SLOTS: void state(); }; -#ifdef Q_COMPILER_RVALUE_REFS static bool dpointer_is_null(QCollator &c) { char mem[sizeof c]; @@ -58,11 +57,9 @@ static bool dpointer_is_null(QCollator &c) return false; return true; } -#endif void tst_QCollator::moveSemantics() { -#ifdef Q_COMPILER_RVALUE_REFS const QLocale de_AT(QLocale::German, QLocale::Austria); QCollator c1(de_AT); @@ -78,9 +75,6 @@ void tst_QCollator::moveSemantics() c1 = std::move(c2); QCOMPARE(c1.locale(), de_AT); QVERIFY(dpointer_is_null(c2)); -#else - QSKIP("The compiler is not in C++11 mode or does not support move semantics."); -#endif } diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 7980f1f8f4..de51c866e1 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -44,6 +44,7 @@ private slots: // In-process tests void testInvalidOptions(); + void testDuplicateOption(); void testPositionalArguments(); void testBooleanOption_data(); void testBooleanOption(); @@ -104,6 +105,15 @@ void tst_QCommandLineParser::testInvalidOptions() QVERIFY(!parser.addOption(QCommandLineOption(QStringLiteral("-v"), QStringLiteral("Displays version information.")))); } +void tst_QCommandLineParser::testDuplicateOption() +{ + QCoreApplication app(empty_argc, empty_argv); + QCommandLineParser parser; + QVERIFY(parser.addOption(QCommandLineOption(QStringLiteral("h"), QStringLiteral("Hostname."), QStringLiteral("hostname")))); + QTest::ignoreMessage(QtWarningMsg, "QCommandLineParser: already having an option named \"h\""); + parser.addHelpOption(); +} + void tst_QCommandLineParser::testPositionalArguments() { QCoreApplication app(empty_argc, empty_argv); @@ -489,7 +499,7 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes() void tst_QCommandLineParser::testCpp11StyleInitialization() { -#if defined(Q_COMPILER_INITIALIZER_LISTS) && defined(Q_COMPILER_UNIFORM_INIT) +#if defined(Q_COMPILER_UNIFORM_INIT) QCoreApplication app(empty_argc, empty_argv); QCommandLineParser parser; diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp index 31a5f93822..9b45e17a28 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp @@ -68,7 +68,7 @@ void tst_QContiguousCache::assignment() // copy: cc1 = cc2; // move: - cc1 = qMove(cc2); + cc1 = std::move(cc2); } void tst_QContiguousCache::empty() diff --git a/tests/auto/corelib/tools/qdate/qdate.pro b/tests/auto/corelib/tools/qdate/qdate.pro index dd7c6cb888..925c3b4c78 100644 --- a/tests/auto/corelib/tools/qdate/qdate.pro +++ b/tests/auto/corelib/tools/qdate/qdate.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qdate -QT = core testlib +QT = core-private testlib SOURCES = tst_qdate.cpp diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index ce1e5730dd..0ef494b229 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -27,6 +27,7 @@ ** ****************************************************************************/ +#include <private/qglobal_p.h> // for the icu feature test #include <QtTest/QtTest> #include <qdatetime.h> #include <qlocale.h> @@ -54,6 +55,13 @@ private slots: void weekNumber_invalid(); void weekNumber_data(); void weekNumber(); +#if QT_CONFIG(timezone) + void startOfDay_endOfDay_data(); + void startOfDay_endOfDay(); +#endif + void startOfDay_endOfDay_fixed_data(); + void startOfDay_endOfDay_fixed(); + void startOfDay_endOfDay_bounds(); void julianDaysLimits(); void addDays_data(); void addDays(); @@ -83,6 +91,7 @@ private slots: void negativeYear() const; void printNegativeYear() const; void roundtripGermanLocale() const; +#if QT_CONFIG(textdate) void shortDayName() const; void standaloneShortDayName() const; void longDayName() const; @@ -91,6 +100,7 @@ private slots: void standaloneShortMonthName() const; void longMonthName() const; void standaloneLongMonthName() const; +#endif // textdate void roundtrip() const; void qdebug() const; private: @@ -456,6 +466,164 @@ void tst_QDate::weekNumber_invalid() QCOMPARE( dt.weekNumber( &yearNumber ), 0 ); } +#if QT_CONFIG(timezone) +void tst_QDate::startOfDay_endOfDay_data() +{ + QTest::addColumn<QDate>("date"); // Typically a spring-forward. + // A zone in which that date's start and end are worth checking: + QTest::addColumn<QByteArray>("zoneName"); + // The start and end times in that zone: + QTest::addColumn<QTime>("start"); + QTest::addColumn<QTime>("end"); + + const QTime initial(0, 0), final(23, 59, 59, 999), invalid(QDateTime().time()); + + QTest::newRow("epoch") + << QDate(1970, 1, 1) << QByteArray("UTC") + << initial << final; + QTest::newRow("Brazil") + << QDate(2008, 10, 19) << QByteArray("America/Sao_Paulo") + << QTime(1, 0) << final; +#if QT_CONFIG(icu) || !defined(Q_OS_WIN) // MS's TZ APIs lack data + QTest::newRow("Sofia") + << QDate(1994, 3, 27) << QByteArray("Europe/Sofia") + << QTime(1, 0) << final; +#endif + QTest::newRow("Kiritimati") + << QDate(1994, 12, 31) << QByteArray("Pacific/Kiritimati") + << invalid << invalid; + QTest::newRow("Samoa") + << QDate(2011, 12, 30) << QByteArray("Pacific/Apia") + << invalid << invalid; + // TODO: find other zones with transitions at/crossing midnight. +} + +void tst_QDate::startOfDay_endOfDay() +{ + QFETCH(QDate, date); + QFETCH(QByteArray, zoneName); + QFETCH(QTime, start); + QFETCH(QTime, end); + const QTimeZone zone(zoneName); + const bool isSystem = QTimeZone::systemTimeZone() == zone; + QDateTime front(date.startOfDay(zone)), back(date.endOfDay(zone)); + if (end.isValid()) + QCOMPARE(date.addDays(1).startOfDay(zone).addMSecs(-1), back); + if (start.isValid()) + QCOMPARE(date.addDays(-1).endOfDay(zone).addMSecs(1), front); + do { // Avoids duplicating these tests for local-time when it *is* zone: + if (start.isValid()) { + QCOMPARE(front.date(), date); + QCOMPARE(front.time(), start); + } + if (end.isValid()) { + QCOMPARE(back.date(), date); + QCOMPARE(back.time(), end); + } + if (front.timeSpec() == Qt::LocalTime) + break; + front = date.startOfDay(Qt::LocalTime); + back = date.endOfDay(Qt::LocalTime); + } while (isSystem); + if (end.isValid()) + QCOMPARE(date.addDays(1).startOfDay(Qt::LocalTime).addMSecs(-1), back); + if (start.isValid()) + QCOMPARE(date.addDays(-1).endOfDay(Qt::LocalTime).addMSecs(1), front); + if (!isSystem) { + // These might fail if system zone coincides with zone; but only if it + // did something similarly unusual on the date picked for this test. + if (start.isValid()) { + QCOMPARE(front.date(), date); + QCOMPARE(front.time(), QTime(0, 0)); + } + if (end.isValid()) { + QCOMPARE(back.date(), date); + QCOMPARE(back.time(), QTime(23, 59, 59, 999)); + } + } +} +#endif // timezone + +void tst_QDate::startOfDay_endOfDay_fixed_data() +{ + const qint64 kilo(1000); + using Bounds = std::numeric_limits<qint64>; + const QDateTime + first(QDateTime::fromMSecsSinceEpoch(Bounds::min() + 1, Qt::UTC)), + start32sign(QDateTime::fromMSecsSinceEpoch(-0x80000000L * kilo, Qt::UTC)), + end32sign(QDateTime::fromMSecsSinceEpoch(0x80000000L * kilo, Qt::UTC)), + end32unsign(QDateTime::fromMSecsSinceEpoch(0x100000000L * kilo, Qt::UTC)), + last(QDateTime::fromMSecsSinceEpoch(Bounds::max(), Qt::UTC)); + + const struct { + const char *name; + QDate date; + } data[] = { + { "epoch", QDate(1970, 1, 1) }, + { "y2k-leap-day", QDate(2000, 2, 29) }, + // Just outside the start and end of 32-bit time_t: + { "pre-sign32", QDate(start32sign.date().year(), 1, 1) }, + { "post-sign32", QDate(end32sign.date().year(), 12, 31) }, + { "post-uint32", QDate(end32unsign.date().year(), 12, 31) }, + // Just inside the start and end of QDateTime's range: + { "first-full", first.date().addDays(1) }, + { "last-full", last.date().addDays(-1) } + }; + + QTest::addColumn<QDate>("date"); + for (const auto &r : data) + QTest::newRow(r.name) << r.date; +} + +void tst_QDate::startOfDay_endOfDay_fixed() +{ + const QTime early(0, 0), late(23, 59, 59, 999); + QFETCH(QDate, date); + + QDateTime start(date.startOfDay(Qt::UTC)); + QDateTime end(date.endOfDay(Qt::UTC)); + QCOMPARE(start.date(), date); + QCOMPARE(end.date(), date); + QCOMPARE(start.time(), early); + QCOMPARE(end.time(), late); + QCOMPARE(date.addDays(1).startOfDay(Qt::UTC).addMSecs(-1), end); + QCOMPARE(date.addDays(-1).endOfDay(Qt::UTC).addMSecs(1), start); + for (int offset = -60 * 16; offset <= 60 * 16; offset += 65) { + start = date.startOfDay(Qt::OffsetFromUTC, offset); + end = date.endOfDay(Qt::OffsetFromUTC, offset); + QCOMPARE(start.date(), date); + QCOMPARE(end.date(), date); + QCOMPARE(start.time(), early); + QCOMPARE(end.time(), late); + QCOMPARE(date.addDays(1).startOfDay(Qt::OffsetFromUTC, offset).addMSecs(-1), end); + QCOMPARE(date.addDays(-1).endOfDay(Qt::OffsetFromUTC, offset).addMSecs(1), start); + } +} + +void tst_QDate::startOfDay_endOfDay_bounds() +{ + // Check the days in which QDateTime's range starts and ends: + using Bounds = std::numeric_limits<qint64>; + const QDateTime + first(QDateTime::fromMSecsSinceEpoch(Bounds::min(), Qt::UTC)), + last(QDateTime::fromMSecsSinceEpoch(Bounds::max(), Qt::UTC)), + epoch(QDateTime::fromMSecsSinceEpoch(0, Qt::UTC)); + // First, check these *are* the start and end of QDateTime's range: + QVERIFY(first.isValid()); + QVERIFY(last.isValid()); + QVERIFY(first < epoch); + QVERIFY(last > epoch); + // QDateTime's addMSecs doesn't check against {und,ov}erflow ... + QVERIFY(!first.addMSecs(-1).isValid() || first.addMSecs(-1) > first); + QVERIFY(!last.addMSecs(1).isValid() || last.addMSecs(1) < last); + + // Now test start/end methods with them: + QCOMPARE(first.date().endOfDay(Qt::UTC).time(), QTime(23, 59, 59, 999)); + QCOMPARE(last.date().startOfDay(Qt::UTC).time(), QTime(0, 0)); + QVERIFY(!first.date().startOfDay(Qt::UTC).isValid()); + QVERIFY(!last.date().endOfDay(Qt::UTC).isValid()); +} + void tst_QDate::julianDaysLimits() { qint64 min = std::numeric_limits<qint64>::min(); @@ -1038,18 +1206,18 @@ void tst_QDate::fromStringFormat_data() // Undo this (inline the C-locale versions) for ### Qt 6 // Get localized names: - QString january = QDate::longMonthName(1); - QString february = QDate::longMonthName(2); - QString march = QDate::longMonthName(3); - QString august = QDate::longMonthName(8); - QString mon = QDate::shortDayName(1); - QString monday = QDate::longDayName(1); - QString tuesday = QDate::longDayName(2); - QString wednesday = QDate::longDayName(3); - QString thursday = QDate::longDayName(4); - QString friday = QDate::longDayName(5); - QString saturday = QDate::longDayName(6); - QString sunday = QDate::longDayName(7); + QString january = QLocale::system().monthName(1, QLocale::LongFormat); + QString february = QLocale::system().monthName(2, QLocale::LongFormat); + QString march = QLocale::system().monthName(3, QLocale::LongFormat); + QString august = QLocale::system().monthName(8, QLocale::LongFormat); + QString mon = QLocale::system().dayName(1, QLocale::ShortFormat); + QString monday = QLocale::system().dayName(1, QLocale::LongFormat); + QString tuesday = QLocale::system().dayName(2, QLocale::LongFormat); + QString wednesday = QLocale::system().dayName(3, QLocale::LongFormat); + QString thursday = QLocale::system().dayName(4, QLocale::LongFormat); + QString friday = QLocale::system().dayName(5, QLocale::LongFormat); + QString saturday = QLocale::system().dayName(6, QLocale::LongFormat); + QString sunday = QLocale::system().dayName(7, QLocale::LongFormat); QTest::newRow("data0") << QString("") << QString("") << defDate(); QTest::newRow("data1") << QString(" ") << QString("") << invalidDate(); @@ -1305,6 +1473,10 @@ void tst_QDate::roundtripGermanLocale() const theDateTime.fromString(theDateTime.toString(Qt::TextDate), Qt::TextDate); } +#if QT_CONFIG(textdate) +QT_WARNING_PUSH // the methods tested here are all deprecated +QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") + void tst_QDate::shortDayName() const { QCOMPARE(QDate::shortDayName(0), QString()); @@ -1432,6 +1604,8 @@ void tst_QDate::standaloneLongMonthName() const QCOMPARE(QDate::longMonthName(i, QDate::StandaloneFormat), locale.standaloneMonthName(i, QLocale::LongFormat)); } } +QT_WARNING_POP +#endif // textdate void tst_QDate::roundtrip() const { diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index 0196dd2d23..3af6132695 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -30,9 +30,7 @@ #include <qeasingcurve.h> -#ifdef Q_COMPILER_RVALUE_REFS // cpp11() slot -# include <utility> // for std::move() -#endif +#include <utility> // for std::move() class tst_QEasingCurve : public QObject { @@ -55,6 +53,8 @@ private slots: void testCbrtFloat(); void cpp11(); void quadraticEquation(); + void streamInOut_data(); + void streamInOut(); }; void tst_QEasingCurve::type() @@ -792,7 +792,6 @@ void tst_QEasingCurve::testCbrtFloat() void tst_QEasingCurve::cpp11() { -#ifdef Q_COMPILER_RVALUE_REFS { QEasingCurve ec( QEasingCurve::InOutBack ); QEasingCurve copy = std::move(ec); // move ctor @@ -807,7 +806,6 @@ void tst_QEasingCurve::cpp11() QCOMPARE( copy.type(), QEasingCurve::InOutBack ); QCOMPARE( ec.type(), type ); } -#endif } void tst_QEasingCurve::quadraticEquation() { @@ -879,5 +877,36 @@ void tst_QEasingCurve::quadraticEquation() { } } +void tst_QEasingCurve::streamInOut_data() +{ + QTest::addColumn<int>("version"); + QTest::addColumn<bool>("equality"); + + QTest::newRow("5.11") << int(QDataStream::Qt_5_11) << false; + QTest::newRow("5.13") << int(QDataStream::Qt_5_13) << true; +} + +void tst_QEasingCurve::streamInOut() +{ + QFETCH(int, version); + QFETCH(bool, equality); + + QEasingCurve orig; + orig.addCubicBezierSegment(QPointF(0.43, 0.0025), QPointF(0.38, 0.51), QPointF(0.57, 0.99)); + + QEasingCurve copy; + + QByteArray data; + QDataStream dsw(&data,QIODevice::WriteOnly); + QDataStream dsr(&data,QIODevice::ReadOnly); + + dsw.setVersion(version); + dsr.setVersion(version); + dsw << orig; + dsr >> copy; + + QCOMPARE(copy == orig, equality); +} + QTEST_MAIN(tst_QEasingCurve) #include "tst_qeasingcurve.moc" diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 0015efacfa..d70d488e96 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -1480,7 +1480,6 @@ void tst_QHash::twoArguments_qHash() void tst_QHash::initializerList() { -#ifdef Q_COMPILER_INITIALIZER_LISTS QHash<int, QString> hash = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}}; QCOMPARE(hash.count(), 2); QCOMPARE(hash[1], QString("hello")); @@ -1507,9 +1506,6 @@ void tst_QHash::initializerList() QMultiHash<int, float> emptyPairs2{{}, {}}; QVERIFY(!emptyPairs2.isEmpty()); -#else - QSKIP("Compiler doesn't support initializer lists"); -#endif } void tst_QHash::eraseValidIteratorOnSharedHash() diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp index ae65d8f697..915a24a1f6 100644 --- a/tests/auto/corelib/tools/qline/tst_qline.cpp +++ b/tests/auto/corelib/tools/qline/tst_qline.cpp @@ -205,7 +205,7 @@ void tst_QLine::testIntersection() QPointF ip; - QLineF::IntersectType itype = a.intersect(b, &ip); + QLineF::IntersectionType itype = a.intersect(b, &ip); QCOMPARE(int(itype), type); if (type != QLineF::NoIntersection) { diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp index f17d6695f0..deb3b68c5c 100644 --- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp +++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp @@ -1005,7 +1005,6 @@ void tst_QLinkedList::testSTLIteratorsComplex() const void tst_QLinkedList::initializeList() const { -#ifdef Q_COMPILER_INITIALIZER_LISTS QLinkedList<int> v1 { 2, 3, 4 }; QCOMPARE(v1, QLinkedList<int>() << 2 << 3 << 4); QCOMPARE(v1, (QLinkedList<int> { 2, 3, 4})); @@ -1014,7 +1013,6 @@ void tst_QLinkedList::initializeList() const QLinkedList<QLinkedList<int>> v3; v3 << v1 << (QLinkedList<int>() << 1) << QLinkedList<int>() << v1; QCOMPARE(v3, v2); -#endif } diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index b3f8130d27..5a485e88d2 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -364,12 +364,14 @@ private slots: void takeLastOptimal() const; void takeLastMovable() const; void takeLastComplex() const; +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) void toSetOptimal() const; void toSetMovable() const; void toSetComplex() const; void toStdListOptimal() const; void toStdListMovable() const; void toStdListComplex() const; +#endif void toVectorOptimal() const; void toVectorMovable() const; void toVectorComplex() const; @@ -426,8 +428,10 @@ private: template<typename T> void takeAt() const; template<typename T> void takeFirst() const; template<typename T> void takeLast() const; +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) template<typename T> void toSet() const; template<typename T> void toStdList() const; +#endif template<typename T> void toVector() const; template<typename T> void value() const; @@ -1457,11 +1461,11 @@ void tst_QList::swap() const list << T_FOO << T_BAR << T_BAZ; // swap - list.swap(0, 2); + list.swapItemsAt(0, 2); QCOMPARE(list, QList<T>() << T_BAZ << T_BAR << T_FOO); // swap again - list.swap(1, 2); + list.swapItemsAt(1, 2); QCOMPARE(list, QList<T>() << T_BAZ << T_FOO << T_BAR); QList<T> list2; @@ -1595,6 +1599,7 @@ void tst_QList::takeLastComplex() const QCOMPARE(liveCount, Complex::getLiveCount()); } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) template<typename T> void tst_QList::toSet() const { @@ -1669,6 +1674,7 @@ void tst_QList::toStdListComplex() const toStdList<Complex>(); QCOMPARE(liveCount, Complex::getLiveCount()); } +#endif template<typename T> void tst_QList::toVector() const @@ -1871,7 +1877,6 @@ void tst_QList::testSTLIteratorsComplex() const void tst_QList::initializeList() const { -#ifdef Q_COMPILER_INITIALIZER_LISTS QList<int> v1{2,3,4}; QCOMPARE(v1, QList<int>() << 2 << 3 << 4); QCOMPARE(v1, (QList<int>{2,3,4})); @@ -1880,7 +1885,6 @@ void tst_QList::initializeList() const QList<QList<int>> v3; v3 << v1 << (QList<int>() << 1) << QList<int>() << v1; QCOMPARE(v3, v2); -#endif } template<typename T> diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index b39444e76f..d66fd28779 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp @@ -1319,7 +1319,6 @@ void tst_QMap::checkMostLeftNode() void tst_QMap::initializerList() { -#ifdef Q_COMPILER_INITIALIZER_LISTS QMap<int, QString> map = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}}; QCOMPARE(map.count(), 2); QCOMPARE(map[1], QString("hello")); @@ -1346,9 +1345,6 @@ void tst_QMap::initializerList() QMultiMap<float, float> emptyPairs2{{}, {}}; QVERIFY(!emptyPairs2.isEmpty()); -#else - QSKIP("Compiler doesn't support initializer lists"); -#endif } void tst_QMap::testInsertWithHint() diff --git a/tests/auto/corelib/tools/qpair/qpair.pro b/tests/auto/corelib/tools/qpair/qpair.pro index 659be887d3..d684a24a57 100644 --- a/tests/auto/corelib/tools/qpair/qpair.pro +++ b/tests/auto/corelib/tools/qpair/qpair.pro @@ -2,3 +2,6 @@ CONFIG += testcase TARGET = tst_qpair QT = core testlib SOURCES = tst_qpair.cpp + +# Force C++17 if available (needed due to Q_COMPILER_DEDUCTION_GUIDES) +contains(QT_CONFIG, c++1z): CONFIG += c++1z diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index dedc353e67..3c972329bc 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -39,6 +39,7 @@ private Q_SLOTS: void testConstexpr(); void testConversions(); void taskQTBUG_48780_pairContainingCArray(); + void testDeducationRules(); }; class C { C() {} char _[4]; }; @@ -202,5 +203,30 @@ void tst_QPair::taskQTBUG_48780_pairContainingCArray() Q_UNUSED(pair); } +void tst_QPair::testDeducationRules() +{ +#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606 + QPair p1{1, 2}; + static_assert(std::is_same<decltype(p1)::first_type, decltype(1)>::value); + static_assert(std::is_same<decltype(p1)::second_type, decltype(2)>::value); + QCOMPARE(p1.first, 1); + QCOMPARE(p1.second, 2); + + QPair p2{QString("string"), 2}; + static_assert(std::is_same<decltype(p2)::first_type, QString>::value); + static_assert(std::is_same<decltype(p2)::second_type, decltype(2)>::value); + QCOMPARE(p2.first, "string"); + QCOMPARE(p2.second, 2); + + QPair p3(p2); + static_assert(std::is_same<decltype(p3)::first_type, decltype(p2)::first_type>::value); + static_assert(std::is_same<decltype(p3)::second_type, decltype(p2)::second_type>::value); + QCOMPARE(p3.first, "string"); + QCOMPARE(p3.second, 2); +#else + QSKIP("Unsupported"); +#endif +} + QTEST_APPLESS_MAIN(tst_QPair) #include "tst_qpair.moc" diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp index 656dd6a6e3..9b607db608 100644 --- a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp +++ b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp @@ -46,6 +46,7 @@ private Q_SLOTS: void rollbackToPreviousCommit(); void exceptions(); void earlyExitScope(); + void moveOnly(); private: void earlyExitScope_helper(int exitpoint, int &member); }; @@ -190,5 +191,17 @@ void tst_QScopedValueRollback::earlyExitScope_helper(int exitpoint, int& member) r.commit(); } +void tst_QScopedValueRollback::moveOnly() +{ + std::unique_ptr<int> uniquePtr; + std::unique_ptr<int> newVal(new int(5)); + QVERIFY(!uniquePtr); + { + QScopedValueRollback<std::unique_ptr<int>> r(uniquePtr, std::move(newVal)); + QVERIFY(uniquePtr); + } + QVERIFY(!uniquePtr); +} + QTEST_MAIN(tst_QScopedValueRollback) #include "tst_qscopedvaluerollback.moc" diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp index 0b60350380..31b4c0449e 100644 --- a/tests/auto/corelib/tools/qset/tst_qset.cpp +++ b/tests/auto/corelib/tools/qset/tst_qset.cpp @@ -955,7 +955,6 @@ void tst_QSet::makeSureTheComfortFunctionsCompile() void tst_QSet::initializerList() { -#ifdef Q_COMPILER_INITIALIZER_LISTS QSet<int> set = {1, 1, 2, 3, 4, 5}; QCOMPARE(set.count(), 5); QVERIFY(set.contains(1)); @@ -976,9 +975,6 @@ void tst_QSet::initializerList() QSet<int> set3{{}, {}, {}}; QVERIFY(!set3.isEmpty()); -#else - QSKIP("Compiler doesn't support initializer lists"); -#endif } void tst_QSet::qhash() @@ -1011,15 +1007,7 @@ void tst_QSet::qhash() // check that sets of sets work: // { -#ifdef Q_COMPILER_INITIALIZER_LISTS QSet<QSet<int> > intSetSet = { { 0, 1, 2 }, { 0, 1 }, { 1, 2 } }; -#else - QSet<QSet<int> > intSetSet; - QSet<int> intSet01, intSet12; - intSet01 << 0 << 1; - intSet12 << 1 << 2; - intSetSet << intSet01 << intSet12 << (intSet01|intSet12); -#endif QCOMPARE(intSetSet.size(), 3); } } diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index ade9c5e754..42792b5310 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -78,6 +78,7 @@ private slots: void sharedPointerFromQObjectWithWeak(); void weakQObjectFromSharedPointer(); void objectCast(); + void objectCastStdSharedPtr(); void differentPointers(); void virtualBaseDifferentPointers(); #ifndef QTEST_NO_RTTI @@ -89,9 +90,7 @@ private slots: #endif void constCorrectness(); void customDeleter(); -#ifdef Q_COMPILER_LAMBDA void lambdaCustomDeleter(); -#endif void creating(); void creatingCvQualified(); void creatingVariadic(); @@ -226,13 +225,11 @@ struct NoDefaultConstructorConstRef2 NoDefaultConstructorConstRef2(const QByteArray &ba, int i = 42) : str(QString::fromLatin1(ba)), i(i) {} }; -#ifdef Q_COMPILER_RVALUE_REFS struct NoDefaultConstructorRRef1 { int &i; NoDefaultConstructorRRef1(int &&i) : i(i) {} }; -#endif void tst_QSharedPointer::basics_data() { @@ -501,7 +498,6 @@ void tst_QSharedPointer::swap() void tst_QSharedPointer::moveSemantics() { -#ifdef Q_COMPILER_RVALUE_REFS QSharedPointer<int> p1, p2(new int(42)), control = p2; QVERIFY(p1 != control); QVERIFY(p1.isNull()); @@ -554,9 +550,6 @@ void tst_QSharedPointer::moveSemantics() QVERIFY(w1.isNull()); QVERIFY(w2.isNull()); QVERIFY(w3.isNull()); -#else - QSKIP("This test requires C++11 rvalue/move semantics support in the compiler."); -#endif } void tst_QSharedPointer::useOfForwardDeclared() @@ -573,10 +566,10 @@ void tst_QSharedPointer::useOfForwardDeclared() // move assignment: QSharedPointer<ForwardDeclared> sp4; - sp4 = qMove(sp); + sp4 = std::move(sp); // and move constuction: - QSharedPointer<ForwardDeclared> sp5 = qMove(sp2); + QSharedPointer<ForwardDeclared> sp5 = std::move(sp2); // swapping: sp4.swap(sp3); @@ -1115,6 +1108,60 @@ void tst_QSharedPointer::objectCast() safetyCheck(); } + +void tst_QSharedPointer::objectCastStdSharedPtr() +{ + { + OtherObject *data = new OtherObject; + std::shared_ptr<QObject> baseptr = std::shared_ptr<QObject>(data); + QVERIFY(baseptr.get() == data); + + // perform successful object cast + std::shared_ptr<OtherObject> ptr = qobject_pointer_cast<OtherObject>(baseptr); + QVERIFY(ptr.get()); + QVERIFY(ptr.get() == data); + + QVERIFY(baseptr.get() == data); + } + + { + OtherObject *data = new OtherObject; + std::shared_ptr<QObject> baseptr = std::shared_ptr<QObject>(data); + QVERIFY(baseptr.get() == data); + + // perform successful object cast + std::shared_ptr<OtherObject> ptr = qobject_pointer_cast<OtherObject>(std::move(baseptr)); + QVERIFY(ptr.get()); + QVERIFY(ptr.get() == data); + + QVERIFY(!baseptr.get()); + } + + { + QObject *data = new QObject; + std::shared_ptr<QObject> baseptr = std::shared_ptr<QObject>(data); + QVERIFY(baseptr.get() == data); + + // perform unsuccessful object cast + std::shared_ptr<OtherObject> ptr = qobject_pointer_cast<OtherObject>(baseptr); + QVERIFY(!ptr.get()); + + QVERIFY(baseptr.get() == data); + } + + { + QObject *data = new QObject; + std::shared_ptr<QObject> baseptr = std::shared_ptr<QObject>(data); + QVERIFY(baseptr.get() == data); + + // perform unsuccessful object cast + std::shared_ptr<OtherObject> ptr = qobject_pointer_cast<OtherObject>(std::move(baseptr)); + QVERIFY(!ptr.get()); + + QVERIFY(baseptr.get() == data); + } +} + void tst_QSharedPointer::differentPointers() { { @@ -1670,7 +1717,6 @@ void tst_QSharedPointer::customDeleter() safetyCheck(); } -#ifdef Q_COMPILER_LAMBDA // The compiler needs to be in C++11 mode and to support lambdas void tst_QSharedPointer::lambdaCustomDeleter() { @@ -1698,7 +1744,6 @@ void tst_QSharedPointer::lambdaCustomDeleter() } safetyCheck(); } -#endif void customQObjectDeleterFn(QObject *obj) { @@ -2233,11 +2278,9 @@ void tst_QSharedPointer::invalidConstructs_data() << &QTest::QExternalTest::tryCompileFail << "struct IncompatibleCustomDeleter { void operator()(int *); };\n" "QSharedPointer<Data> ptr(new Data, IncompatibleCustomDeleter());\n"; -#ifdef Q_COMPILER_LAMBDA QTest::newRow("incompatible-custom-lambda-deleter") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer<Data> ptr(new Data, [](int *) {});\n"; -#endif } void tst_QSharedPointer::invalidConstructs() diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index e8ed22e427..79f5a8c46d 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -482,8 +482,8 @@ private slots: void indexOf2(); void indexOf3_data(); // void indexOf3(); - void sprintf(); - void sprintfS(); + void asprintf(); + void asprintfS(); void fill(); void truncate(); void chop_data(); @@ -578,7 +578,7 @@ private slots: #ifdef QT_USE_ICU void toUpperLower_icu(); #endif -#if !defined(QT_NO_UNICODE_LITERAL) && defined(Q_COMPILER_LAMBDA) +#if !defined(QT_NO_UNICODE_LITERAL) void literals(); #endif void eightBitLiterals_data(); @@ -612,7 +612,7 @@ QString verifyZeroTermination(const QString &str) int strSize = str.size(); QChar strTerminator = str.constData()[strSize]; if (QChar('\0') != strTerminator) - return QString::fromAscii( + return QString::fromLatin1( "*** Result ('%1') not null-terminated: 0x%2 ***").arg(str) .arg(strTerminator.unicode(), 4, 16, QChar('0')); @@ -625,11 +625,11 @@ QString verifyZeroTermination(const QString &str) const_cast<QChar *>(strData)[strSize] = QChar('x'); if (QChar('x') != str.constData()[strSize]) { - return QString::fromAscii("*** Failed to replace null-terminator in " + return QString::fromLatin1("*** Failed to replace null-terminator in " "result ('%1') ***").arg(str); } if (str != strCopy) { - return QString::fromAscii( "*** Result ('%1') differs from its copy " + return QString::fromLatin1( "*** Result ('%1') differs from its copy " "after null-terminator was replaced ***").arg(str); } const_cast<QChar *>(strData)[strSize] = QChar('\0'); // Restore sanity @@ -1075,9 +1075,8 @@ void tst_QString::isNull() QString a; QVERIFY(a.isNull()); - const char *zero = 0; - a.sprintf( zero ); - QVERIFY(!a.isNull()); + const char *zero = nullptr; + QVERIFY(!QString::asprintf(zero).isNull()); } QT_WARNING_POP @@ -1263,75 +1262,66 @@ static inline const void *ptrValue(quintptr v) return reinterpret_cast<const void *>(v); } -void tst_QString::sprintf() +void tst_QString::asprintf() { QString a; - a.sprintf("COMPARE"); - QCOMPARE(a, QLatin1String("COMPARE")); - a.sprintf("%%%d",1); - QCOMPARE(a, QLatin1String("%1")); - QCOMPARE(a.sprintf("X%dY",2), QLatin1String("X2Y")); - QCOMPARE(a.sprintf("X%9iY", 50000 ), QLatin1String("X 50000Y")); - QCOMPARE(a.sprintf("X%-9sY","hello"), QLatin1String("Xhello Y")); - QCOMPARE(a.sprintf("X%-9iY", 50000 ), QLatin1String("X50000 Y")); - QCOMPARE(a.sprintf("%lf", 1.23), QLatin1String("1.230000")); - QCOMPARE(a.sprintf("%lf", 1.23456789), QLatin1String("1.234568")); - QCOMPARE(a.sprintf("%p", ptrValue(0xbfffd350)), QLatin1String("0xbfffd350")); - QCOMPARE(a.sprintf("%p", ptrValue(0)), QLatin1String("0x0")); + QCOMPARE(QString::asprintf("COMPARE"), QLatin1String("COMPARE")); + QCOMPARE(QString::asprintf("%%%d", 1), QLatin1String("%1")); + QCOMPARE(QString::asprintf("X%dY",2), QLatin1String("X2Y")); + QCOMPARE(QString::asprintf("X%9iY", 50000 ), QLatin1String("X 50000Y")); + QCOMPARE(QString::asprintf("X%-9sY","hello"), QLatin1String("Xhello Y")); + QCOMPARE(QString::asprintf("X%-9iY", 50000 ), QLatin1String("X50000 Y")); + QCOMPARE(QString::asprintf("%lf", 1.23), QLatin1String("1.230000")); + QCOMPARE(QString::asprintf("%lf", 1.23456789), QLatin1String("1.234568")); + QCOMPARE(QString::asprintf("%p", ptrValue(0xbfffd350)), QLatin1String("0xbfffd350")); + QCOMPARE(QString::asprintf("%p", ptrValue(0)), QLatin1String("0x0")); int i = 6; long l = -2; float f = 4.023f; - QString S1; - S1.sprintf("%d %ld %f",i,l,f); - QCOMPARE(S1, QLatin1String("6 -2 4.023000")); + QCOMPARE(QString::asprintf("%d %ld %f", i, l, f), QLatin1String("6 -2 4.023000")); double d = -514.25683; - S1.sprintf("%f",d); - QCOMPARE(S1, QLatin1String("-514.256830")); + QCOMPARE(QString::asprintf("%f", d), QLatin1String("-514.256830")); } -void tst_QString::sprintfS() +void tst_QString::asprintfS() { - QString a; - QCOMPARE(a.sprintf("%.3s", "Hello" ), QLatin1String("Hel")); - QCOMPARE(a.sprintf("%10.3s", "Hello" ), QLatin1String(" Hel")); - QCOMPARE(a.sprintf("%.10s", "Hello" ), QLatin1String("Hello")); - QCOMPARE(a.sprintf("%10.10s", "Hello" ), QLatin1String(" Hello")); - QCOMPARE(a.sprintf("%-10.10s", "Hello" ), QLatin1String("Hello ")); - QCOMPARE(a.sprintf("%-10.3s", "Hello" ), QLatin1String("Hel ")); - QCOMPARE(a.sprintf("%-5.5s", "Hello" ), QLatin1String("Hello")); + QCOMPARE(QString::asprintf("%.3s", "Hello" ), QLatin1String("Hel")); + QCOMPARE(QString::asprintf("%10.3s", "Hello" ), QLatin1String(" Hel")); + QCOMPARE(QString::asprintf("%.10s", "Hello" ), QLatin1String("Hello")); + QCOMPARE(QString::asprintf("%10.10s", "Hello" ), QLatin1String(" Hello")); + QCOMPARE(QString::asprintf("%-10.10s", "Hello" ), QLatin1String("Hello ")); + QCOMPARE(QString::asprintf("%-10.3s", "Hello" ), QLatin1String("Hel ")); + QCOMPARE(QString::asprintf("%-5.5s", "Hello" ), QLatin1String("Hello")); // Check utf8 conversion for %s - QCOMPARE(a.sprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305")); + QCOMPARE(QString::asprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305")); int n1; - a.sprintf("%s%n%s", "hello", &n1, "goodbye"); + QCOMPARE(QString::asprintf("%s%n%s", "hello", &n1, "goodbye"), QString("hellogoodbye")); QCOMPARE(n1, 5); - QCOMPARE(a, QString("hellogoodbye")); qlonglong n2; - a.sprintf("%s%s%lln%s", "foo", "bar", &n2, "whiz"); + QCOMPARE(QString::asprintf("%s%s%lln%s", "foo", "bar", &n2, "whiz"), QString("foobarwhiz")); QCOMPARE((int)n2, 6); - QCOMPARE(a, QString("foobarwhiz")); { // %ls - QCOMPARE(a.sprintf("%.3ls", qUtf16Printable("Hello")), QLatin1String("Hel")); - QCOMPARE(a.sprintf("%10.3ls", qUtf16Printable("Hello")), QLatin1String(" Hel")); - QCOMPARE(a.sprintf("%.10ls", qUtf16Printable("Hello")), QLatin1String("Hello")); - QCOMPARE(a.sprintf("%10.10ls", qUtf16Printable("Hello")), QLatin1String(" Hello")); - QCOMPARE(a.sprintf("%-10.10ls", qUtf16Printable("Hello")), QLatin1String("Hello ")); - QCOMPARE(a.sprintf("%-10.3ls", qUtf16Printable("Hello")), QLatin1String("Hel ")); - QCOMPARE(a.sprintf("%-5.5ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + QCOMPARE(QString::asprintf("%.3ls", qUtf16Printable("Hello")), QLatin1String("Hel")); + QCOMPARE(QString::asprintf("%10.3ls", qUtf16Printable("Hello")), QLatin1String(" Hel")); + QCOMPARE(QString::asprintf("%.10ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + QCOMPARE(QString::asprintf("%10.10ls", qUtf16Printable("Hello")), QLatin1String(" Hello")); + QCOMPARE(QString::asprintf("%-10.10ls", qUtf16Printable("Hello")), QLatin1String("Hello ")); + QCOMPARE(QString::asprintf("%-10.3ls", qUtf16Printable("Hello")), QLatin1String("Hel ")); + QCOMPARE(QString::asprintf("%-5.5ls", qUtf16Printable("Hello")), QLatin1String("Hello")); // Check utf16 is preserved for %ls - QCOMPARE(a.sprintf("%ls", + QCOMPARE(QString::asprintf("%ls", qUtf16Printable("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")), QLatin1String("\366\344\374\326\304\334\370\346\345\330\306\305")); int n; - a.sprintf("%ls%n%s", qUtf16Printable("hello"), &n, "goodbye"); + QCOMPARE(QString::asprintf("%ls%n%s", qUtf16Printable("hello"), &n, "goodbye"), QLatin1String("hellogoodbye")); QCOMPARE(n, 5); - QCOMPARE(a, QLatin1String("hellogoodbye")); } } @@ -2212,12 +2202,12 @@ void tst_QString::toUpper() // call rvalue-ref while shared (the original mustn't change) QString copy = s; - QCOMPARE(qMove(copy).toUpper(), QString("GROSSSTRASSE")); + QCOMPARE(std::move(copy).toUpper(), QString("GROSSSTRASSE")); QCOMPARE(s, QString::fromUtf8("Gro\xc3\x9fstra\xc3\x9f""e")); // call rvalue-ref version on detached case copy.clear(); - QCOMPARE(qMove(s).toUpper(), QString("GROSSSTRASSE")); + QCOMPARE(std::move(s).toUpper(), QString("GROSSSTRASSE")); } QString lower, upper; @@ -2427,11 +2417,11 @@ void tst_QString::trimmed() QCOMPARE(a.trimmed(), QLatin1String("a")); a="Text"; - QCOMPARE(qMove(a).trimmed(), QLatin1String("Text")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("Text")); a=" "; - QCOMPARE(qMove(a).trimmed(), QLatin1String("")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("")); a=" a "; - QCOMPARE(qMove(a).trimmed(), QLatin1String("a")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("a")); } void tst_QString::simplified_data() @@ -2486,13 +2476,13 @@ void tst_QString::simplified() // without detaching: QString copy1 = full; - QCOMPARE(qMove(full).simplified(), simple); + QCOMPARE(std::move(full).simplified(), simple); QCOMPARE(full, orig_full); // force a detach if (!full.isEmpty()) full[0] = full[0]; - QCOMPARE(qMove(full).simplified(), simple); + QCOMPARE(std::move(full).simplified(), simple); } void tst_QString::insert_data(bool emptyIsNoop) @@ -3789,7 +3779,7 @@ void tst_QString::startsWith() QVERIFY( !a.startsWith("C") ); QVERIFY( !a.startsWith("ABCDEF") ); QVERIFY( a.startsWith("") ); - QVERIFY( a.startsWith(QString::null) ); + QVERIFY( a.startsWith(QString()) ); QVERIFY( a.startsWith('A') ); QVERIFY( a.startsWith(QLatin1Char('A')) ); QVERIFY( a.startsWith(QChar('A')) ); @@ -3816,7 +3806,7 @@ void tst_QString::startsWith() QVERIFY( !a.startsWith("c", Qt::CaseInsensitive) ); QVERIFY( !a.startsWith("abcdef", Qt::CaseInsensitive) ); QVERIFY( a.startsWith("", Qt::CaseInsensitive) ); - QVERIFY( a.startsWith(QString::null, Qt::CaseInsensitive) ); + QVERIFY( a.startsWith(QString(), Qt::CaseInsensitive) ); QVERIFY( a.startsWith('a', Qt::CaseInsensitive) ); QVERIFY( a.startsWith('A', Qt::CaseInsensitive) ); QVERIFY( a.startsWith(QLatin1Char('a'), Qt::CaseInsensitive) ); @@ -3855,7 +3845,7 @@ void tst_QString::startsWith() a = ""; QVERIFY( a.startsWith("") ); - QVERIFY( a.startsWith(QString::null) ); + QVERIFY( a.startsWith(QString()) ); QVERIFY( !a.startsWith("ABC") ); QVERIFY( a.startsWith(QLatin1String("")) ); @@ -3868,7 +3858,7 @@ void tst_QString::startsWith() a = QString(); QVERIFY( !a.startsWith("") ); - QVERIFY( a.startsWith(QString::null) ); + QVERIFY( a.startsWith(QString()) ); QVERIFY( !a.startsWith("ABC") ); QVERIFY( !a.startsWith(QLatin1String("")) ); @@ -3897,7 +3887,7 @@ void tst_QString::endsWith() QVERIFY( !a.endsWith("C") ); QVERIFY( !a.endsWith("ABCDEF") ); QVERIFY( a.endsWith("") ); - QVERIFY( a.endsWith(QString::null) ); + QVERIFY( a.endsWith(QString()) ); QVERIFY( a.endsWith('B') ); QVERIFY( a.endsWith(QLatin1Char('B')) ); QVERIFY( a.endsWith(QChar('B')) ); @@ -3924,7 +3914,7 @@ void tst_QString::endsWith() QVERIFY( !a.endsWith("c", Qt::CaseInsensitive) ); QVERIFY( !a.endsWith("abcdef", Qt::CaseInsensitive) ); QVERIFY( a.endsWith("", Qt::CaseInsensitive) ); - QVERIFY( a.endsWith(QString::null, Qt::CaseInsensitive) ); + QVERIFY( a.endsWith(QString(), Qt::CaseInsensitive) ); QVERIFY( a.endsWith('b', Qt::CaseInsensitive) ); QVERIFY( a.endsWith('B', Qt::CaseInsensitive) ); QVERIFY( a.endsWith(QLatin1Char('b'), Qt::CaseInsensitive) ); @@ -3966,7 +3956,7 @@ void tst_QString::endsWith() a = ""; QVERIFY( a.endsWith("") ); - QVERIFY( a.endsWith(QString::null) ); + QVERIFY( a.endsWith(QString()) ); QVERIFY( !a.endsWith("ABC") ); QVERIFY( !a.endsWith(QLatin1Char(0)) ); QVERIFY( !a.endsWith(QLatin1Char('x')) ); @@ -3978,7 +3968,7 @@ void tst_QString::endsWith() a = QString(); QVERIFY( !a.endsWith("") ); - QVERIFY( a.endsWith(QString::null) ); + QVERIFY( a.endsWith(QString()) ); QVERIFY( !a.endsWith("ABC") ); QVERIFY( !a.endsWith(QLatin1String("")) ); @@ -4534,7 +4524,7 @@ void tst_QString::toLatin1Roundtrip() // try the rvalue version of toLatin1() QString s = unicodesrc; - QCOMPARE(qMove(s).toLatin1(), latin1); + QCOMPARE(std::move(s).toLatin1(), latin1); // and verify that the moved-from object can still be used s = "foo"; @@ -4838,7 +4828,7 @@ void tst_QString::arg() QCOMPARE( QString("%1").arg("hello", 10), QLatin1String(" hello") ); QCOMPARE( QString("%1%1").arg("hello"), QLatin1String("hellohello") ); QCOMPARE( QString("%2%1").arg("hello"), QLatin1String("%2hello") ); - QCOMPARE( QString("%1%1").arg(QString::null), QLatin1String("") ); + QCOMPARE( QString("%1%1").arg(QString()), QLatin1String("") ); QCOMPARE( QString("%2%1").arg(""), QLatin1String("%2") ); QCOMPARE( QString("%2 %L1").arg(12345.6789).arg(12345.6789), @@ -4934,9 +4924,7 @@ void tst_QString::doubleOut() QCOMPARE(QString::number(micro), expect); QCOMPARE(QString("%1").arg(micro), expect); { - QString text; - text.sprintf("%g", micro); - QCOMPARE(text, expect); + QCOMPARE(QString::asprintf("%g", micro), expect); } { QString text; @@ -5480,8 +5468,6 @@ void tst_QString::tortureSprintfDouble() { const SprintfDoubleData *data = g_sprintf_double_data; - QString s; - for (; data->fmt != 0; ++data) { double d; char *buff = (char *)&d; @@ -5496,7 +5482,7 @@ void tst_QString::tortureSprintfDouble() for (uint i = 0; i < 8; ++i) buff[7 - i] = data->bytes[i]; # endif - s.sprintf(data->fmt, d); + const QString s = QString::asprintf(data->fmt, d); #ifdef QT_NO_FPU // reduced precision when running with hardfloats in qemu if (d - 0.1 < 1e12) QSKIP("clib sprintf doesn't fill with 0's on this platform"); @@ -6450,32 +6436,24 @@ void tst_QString::QCharRefDetaching() const void tst_QString::sprintfZU() const { { - QString string; size_t s = 6; - string.sprintf("%zu", s); - QCOMPARE(string, QString::fromLatin1("6")); + QCOMPARE(QString::asprintf("%zu", s), QString::fromLatin1("6")); } { - QString string; - string.sprintf("%s\n", "foo"); - QCOMPARE(string, QString::fromLatin1("foo\n")); + QCOMPARE(QString::asprintf("%s\n", "foo"), QString::fromLatin1("foo\n")); } { /* This code crashed. I don't know how to reduce it further. In other words, * both %zu and %s needs to be present. */ size_t s = 6; - QString string; - string.sprintf("%zu%s", s, "foo"); - QCOMPARE(string, QString::fromLatin1("6foo")); + QCOMPARE(QString::asprintf("%zu%s", s, "foo"), QString::fromLatin1("6foo")); } { size_t s = 6; - QString string; - string.sprintf("%zu %s\n", s, "foo"); - QCOMPARE(string, QString::fromLatin1("6 foo\n")); + QCOMPARE(QString::asprintf("%zu %s\n", s, "foo"), QString::fromLatin1("6 foo\n")); } } @@ -6643,7 +6621,7 @@ void tst_QString::toUpperLower_icu() } #endif -#if !defined(QT_NO_UNICODE_LITERAL) && defined(Q_COMPILER_LAMBDA) +#if !defined(QT_NO_UNICODE_LITERAL) // Only tested on c++0x compliant compiler or gcc void tst_QString::literals() { diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp index cb1fd9eb7d..b52c15fd73 100644 --- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -416,6 +416,47 @@ private Q_SLOTS: void toUcs4_QStringRef() { toUcs4_impl<QStringRef>(); } void toUcs4_QStringView_data() { toUcs4_data(); } void toUcs4_QStringView() { toUcs4_impl<QStringView>(); } + +private: + template <typename Haystack, typename Needle> void indexOf_impl() const; + void indexOf_data(); + +private Q_SLOTS: + void indexOf_QString_QString_data() { indexOf_data(); } + void indexOf_QString_QString() { indexOf_impl<QString, QString>(); } + void indexOf_QString_QLatin1String_data() { indexOf_data(); } + void indexOf_QString_QLatin1String() { indexOf_impl<QString, QLatin1String>(); } + void indexOf_QString_QStringRef_data() { indexOf_data(); } + void indexOf_QString_QStringRef() { indexOf_impl<QString, QStringRef>(); } + void indexOf_QString_QStringView_data() { indexOf_data(); } + void indexOf_QString_QStringView() { indexOf_impl<QString, QStringView>(); } + + void indexOf_QLatin1String_QString_data() { indexOf_data(); } + void indexOf_QLatin1String_QString() { indexOf_impl<QLatin1String, QString>(); } + void indexOf_QLatin1String_QLatin1String_data() { indexOf_data(); } + void indexOf_QLatin1String_QLatin1String() { indexOf_impl<QLatin1String, QLatin1String>(); } + void indexOf_QLatin1String_QStringRef_data() { indexOf_data(); } + void indexOf_QLatin1String_QStringRef() { indexOf_impl<QLatin1String, QStringRef>(); } + void indexOf_QLatin1String_QStringView_data() { indexOf_data(); } + void indexOf_QLatin1String_QStringView() { indexOf_impl<QLatin1String, QStringView>(); } + + void indexOf_QStringRef_QString_data() { indexOf_data(); } + void indexOf_QStringRef_QString() { indexOf_impl<QStringRef, QString>(); } + void indexOf_QStringRef_QLatin1String_data() { indexOf_data(); } + void indexOf_QStringRef_QLatin1String() { indexOf_impl<QStringRef, QLatin1String>(); } + void indexOf_QStringRef_QStringRef_data() { indexOf_data(); } + void indexOf_QStringRef_QStringRef() { indexOf_impl<QStringRef, QStringRef>(); } + void indexOf_QStringRef_QStringView_data() { indexOf_data(); } + void indexOf_QStringRef_QStringView() { indexOf_impl<QStringRef, QStringView>(); } + + void indexOf_QStringView_QString_data() { indexOf_data(); } + void indexOf_QStringView_QString() { indexOf_impl<QStringView, QString>(); } + void indexOf_QStringView_QLatin1String_data() { indexOf_data(); } + void indexOf_QStringView_QLatin1String() { indexOf_impl<QStringView, QLatin1String>(); } + void indexOf_QStringView_QStringRef_data() { indexOf_data(); } + void indexOf_QStringView_QStringRef() { indexOf_impl<QStringView, QStringRef>(); } + void indexOf_QStringView_QStringView_data() { indexOf_data(); } + void indexOf_QStringView_QStringView() { indexOf_impl<QStringView, QStringView>(); } }; void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty) @@ -540,6 +581,7 @@ void tst_QStringApiSymmetry::compare_impl() const } static QString empty = QLatin1String(""); +static QString null; // the tests below rely on the fact that these objects' names match their contents: static QString a = QStringLiteral("a"); static QString A = QStringLiteral("A"); @@ -1216,6 +1258,109 @@ void tst_QStringApiSymmetry::toUcs4_impl() QCOMPARE(unicode.isEmpty(), ucs4.isEmpty()); } +void tst_QStringApiSymmetry::indexOf_data() +{ + QTest::addColumn<QString>("haystackU16"); + QTest::addColumn<QLatin1String>("haystackL1"); + QTest::addColumn<QString>("needleU16"); + QTest::addColumn<QLatin1String>("needleL1"); + QTest::addColumn<qsizetype>("startpos"); + QTest::addColumn<qsizetype>("resultCS"); + QTest::addColumn<qsizetype>("resultCIS"); + + constexpr qsizetype zeroPos = 0; + constexpr qsizetype minus1Pos = -1; + + QTest::addRow("haystack: null, needle: null") << null << QLatin1String() + << null << QLatin1String() << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: empty, needle: null") << empty << QLatin1String("") + << null << QLatin1String() << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: a, needle: null") << a << QLatin1String("a") + << null << QLatin1String() << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: null, needle: empty") << null << QLatin1String() + << empty << QLatin1String("") << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: a, needle: empty") << a << QLatin1String("a") + << empty << QLatin1String("") << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: empty, needle: empty") << empty << QLatin1String("") + << empty << QLatin1String("") << zeroPos << zeroPos << zeroPos; + QTest::addRow("haystack: empty, needle: a") << empty << QLatin1String("") + << a << QLatin1String("a") << zeroPos << minus1Pos << minus1Pos; + QTest::addRow("haystack: null, needle: a") << null << QLatin1String() + << a << QLatin1String("a") << zeroPos << minus1Pos << minus1Pos; + + +#define ROW(h, n, st, cs, cis) \ + QTest::addRow("haystack: %s, needle: %s", #h, #n) << h << QLatin1String(#h) \ + << n << QLatin1String(#n) \ + << qsizetype(st) << qsizetype(cs) << qsizetype(cis) + + ROW(abc, a, 0, 0, 0); + ROW(abc, A, 0, -1, 0); + ROW(abc, a, 1, -1, -1); + ROW(abc, A, 1, -1, -1); + ROW(abc, b, 0, 1, 1); + ROW(abc, B, 0, -1, 1); + ROW(abc, b, 1, 1, 1); + ROW(abc, B, 1, -1, 1); + ROW(abc, B, 2, -1, -1); + + ROW(ABC, A, 0, 0, 0); + ROW(ABC, a, 0, -1, 0); + ROW(ABC, A, 1, -1, -1); + ROW(ABC, a, 1, -1, -1); + ROW(ABC, B, 0, 1, 1); + ROW(ABC, b, 0, -1, 1); + ROW(ABC, B, 1, 1, 1); + ROW(ABC, b, 1, -1, 1); + ROW(ABC, B, 2, -1, -1); + + ROW(aBc, bc, 0, -1, 1); + ROW(aBc, Bc, 0, 1, 1); + ROW(aBc, bC, 0, -1, 1); + ROW(aBc, BC, 0, -1, 1); + + ROW(AbC, bc, 0, -1, 1); + ROW(AbC, Bc, 0, -1, 1); + ROW(AbC, bC, 0, 1, 1); + ROW(AbC, BC, 0, -1, 1); + ROW(AbC, BC, 1, -1, 1); + ROW(AbC, BC, 2, -1, -1); +#undef ROW + +} + +template <typename Haystack, typename Needle> +void tst_QStringApiSymmetry::indexOf_impl() const +{ + QFETCH(const QString, haystackU16); + QFETCH(const QLatin1String, haystackL1); + QFETCH(const QString, needleU16); + QFETCH(const QLatin1String, needleL1); + QFETCH(const qsizetype, startpos); + QFETCH(const qsizetype, resultCS); + QFETCH(const qsizetype, resultCIS); + + const auto haystackU8 = haystackU16.toUtf8(); + const auto needleU8 = needleU16.toUtf8(); + + const auto haystack = make<Haystack>(QStringRef(&haystackU16), haystackL1, haystackU8); + const auto needle = make<Needle>(QStringRef(&needleU16), needleL1, needleU8); + + using size_type = typename Haystack::size_type; + + QCOMPARE(haystack.indexOf(needle, startpos), size_type(resultCS)); + QCOMPARE(haystack.indexOf(needle, startpos, Qt::CaseSensitive), size_type(resultCS)); + QCOMPARE(haystack.indexOf(needle, startpos, Qt::CaseInsensitive), size_type(resultCIS)); + + if (needle.size() == 1) + { + QCOMPARE(haystack.indexOf(needle[0], startpos), size_type(resultCS)); + QCOMPARE(haystack.indexOf(needle[0], startpos, Qt::CaseSensitive), size_type(resultCS)); + QCOMPARE(haystack.indexOf(needle[0], startpos, Qt::CaseInsensitive), size_type(resultCIS)); + } +} + + QTEST_APPLESS_MAIN(tst_QStringApiSymmetry) #include "tst_qstringapisymmetry.moc" diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index 42bdf62a93..2b5aa8e98b 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -30,13 +30,17 @@ #include <qregexp.h> #include <qregularexpression.h> #include <qstringlist.h> +#include <qvector.h> #include <locale.h> +#include <algorithm> + class tst_QStringList : public QObject { Q_OBJECT private slots: + void constructors(); void sort(); void filter(); void replaceInStrings(); @@ -59,13 +63,44 @@ private slots: void joinChar() const; void joinChar_data() const; -#ifdef Q_COMPILER_INITIALIZER_LISTS void initializeList() const; -#endif }; extern const char email[]; +void tst_QStringList::constructors() +{ + { + QStringList list; + QVERIFY(list.isEmpty()); + QCOMPARE(list.size(), 0); + QVERIFY(list == QStringList()); + } + { + QString str = "abc"; + QStringList list(str); + QVERIFY(!list.isEmpty()); + QCOMPARE(list.size(), 1); + QCOMPARE(list.at(0), str); + } + { + QStringList list{ "a", "b", "c" }; + QVERIFY(!list.isEmpty()); + QCOMPARE(list.size(), 3); + QCOMPARE(list.at(0), "a"); + QCOMPARE(list.at(1), "b"); + QCOMPARE(list.at(2), "c"); + } + { + const QVector<QString> reference{ "a", "b", "c" }; + QCOMPARE(reference.size(), 3); + + QStringList list(reference.cbegin(), reference.cend()); + QCOMPARE(list.size(), reference.size()); + QVERIFY(std::equal(list.cbegin(), list.cend(), reference.cbegin())); + } +} + void tst_QStringList::indexOf_regExp() { QStringList list; @@ -482,8 +517,6 @@ void tst_QStringList::joinEmptiness() const QVERIFY(string.isNull()); } -#ifdef Q_COMPILER_INITIALIZER_LISTS -// C++0x support is required void tst_QStringList::initializeList() const { @@ -491,7 +524,6 @@ void tst_QStringList::initializeList() const QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop")); QCOMPARE(v1, (QStringList{"hello","world","plop"})); } -#endif QTEST_APPLESS_MAIN(tst_QStringList) #include "tst_qstringlist.moc" diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp index 8a55f54449..2d577bb0ab 100644 --- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp +++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp @@ -100,6 +100,11 @@ void tst_QStringMatcher::indexIn() matcher.setPattern(needle); QCOMPARE(matcher.indexIn(haystack, from), indexIn); + + const auto needleSV = QStringView(needle); + QStringMatcher matcherSV(needleSV); + + QCOMPARE(matcherSV.indexIn(QStringView(haystack), from), indexIn); } void tst_QStringMatcher::setCaseSensitivity_data() @@ -128,6 +133,7 @@ void tst_QStringMatcher::setCaseSensitivity() matcher.setCaseSensitivity(static_cast<Qt::CaseSensitivity> (cs)); QCOMPARE(matcher.indexIn(haystack, from), indexIn); + QCOMPARE(matcher.indexIn(QStringView(haystack), from), indexIn); } void tst_QStringMatcher::assignOperator() diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index 3e5724213e..3403c5bf7f 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -95,8 +95,9 @@ void tst_QTime::addSecs_data() QTest::newRow("Data0") << QTime(0,0,0) << 200 << QTime(0,3,20); QTest::newRow("Data1") << QTime(0,0,0) << 20 << QTime(0,0,20); - QTest::newRow("overflow") << QTime(0,0,0) << (INT_MAX / 1000 + 1) - << QTime(0,0,0).addSecs((INT_MAX / 1000 + 1) % 86400); + QTest::newRow("overflow") + << QTime(0,0,0) << (INT_MAX / 1000 + 1) + << QTime::fromMSecsSinceStartOfDay(((INT_MAX / 1000 + 1) % 86400) * 1000); } void tst_QTime::addSecs() diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index bb6c48a2ed..9904719f7c 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -480,11 +480,10 @@ void tst_QTimeZone::transitionEachZone_data() { 1288488600, -4, 8, 2010 } // 2010-10-31 01:30 UTC; Europe, Russia }; - QString name; const auto zones = QTimeZone::availableTimeZoneIds(); for (int k = sizeof(table) / sizeof(table[0]); k-- > 0; ) { for (const QByteArray &zone : zones) { - name.sprintf("%s@%d", zone.constData(), table[k].year); + const QString name = QString::asprintf("%s@%d", zone.constData(), table[k].year); QTest::newRow(name.toUtf8().constData()) << zone << table[k].baseSecs @@ -916,6 +915,14 @@ void tst_QTimeZone::tzTest() QTzTimeZonePrivate tzp("Europe/Berlin"); QVERIFY(tzp.isValid()); + // Test POSIX-format value for $TZ: + QTzTimeZonePrivate tzposix("MET-1METDST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"); + QVERIFY(tzposix.isValid()); + + QTimeZone tzBrazil("BRT+3"); // parts of Northern Brazil, as a POSIX rule + QVERIFY(tzBrazil.isValid()); + QCOMPARE(tzBrazil.offsetFromUtc(QDateTime(QDate(1111, 11, 11).startOfDay())), -10800); + // Test display names by type, either ICU or abbreviation only QLocale enUS("en_US"); // Only test names in debug mode, names used can vary by ICU version installed diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 5737db760c..fff8c75a90 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -908,7 +908,6 @@ void tst_QVarLengthArray::initializeListComplex() template<typename T> void tst_QVarLengthArray::initializeList() { -#ifdef Q_COMPILER_INITIALIZER_LISTS T val1(110); T val2(105); T val3(101); @@ -945,9 +944,6 @@ void tst_QVarLengthArray::initializeList() v6 = {}; // assign empty QCOMPARE(v6.size(), 0); -#else - QSKIP("This tests requires a compiler that supports initializer lists."); -#endif } void tst_QVarLengthArray::insertMove() diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index a7faeb5ca5..11c255b184 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -206,6 +206,9 @@ private slots: void assignmentInt() const; void assignmentMovable() const; void assignmentCustom() const; + void assignFromInitializerListInt() const; + void assignFromInitializerListMovable() const; + void assignFromInitializerListCustom() const; void addInt() const; void addMovable() const; void addCustom() const; @@ -254,7 +257,6 @@ private slots: void fromListInt() const; void fromListMovable() const; void fromListCustom() const; - void fromStdVector() const; void indexOf() const; void insertInt() const; void insertMovable() const; @@ -293,7 +295,10 @@ private slots: void swapMovable() const; void swapCustom() const; void toList() const; +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + void fromStdVector() const; void toStdVector() const; +#endif void value() const; void testOperators() const; @@ -326,10 +331,13 @@ private slots: void insertMove() const; + void swapItemsAt() const; + private: template<typename T> void copyConstructor() const; template<typename T> void add() const; template<typename T> void append() const; + template<typename T> void assignFromInitializerList() const; template<typename T> void capacity() const; template<typename T> void clear() const; template<typename T> void count() const; @@ -543,6 +551,40 @@ void tst_QVector::assignmentCustom() const } template<typename T> +void tst_QVector::assignFromInitializerList() const +{ + T val1(SimpleValue<T>::at(1)); + T val2(SimpleValue<T>::at(2)); + T val3(SimpleValue<T>::at(3)); + + QVector<T> v1 = {val1, val2, val3}; + QCOMPARE(v1, QVector<T>() << val1 << val2 << val3); + QCOMPARE(v1, (QVector<T> {val1, val2, val3})); + + v1 = {}; + QCOMPARE(v1.size(), 0); +} + +void tst_QVector::assignFromInitializerListInt() const +{ + assignFromInitializerList<int>(); +} + +void tst_QVector::assignFromInitializerListMovable() const +{ + const int instancesCount = Movable::counter.loadAcquire(); + assignFromInitializerList<Movable>(); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); +} + +void tst_QVector::assignFromInitializerListCustom() const +{ + const int instancesCount = Custom::counter.loadAcquire(); + assignFromInitializerList<Custom>(); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); +} + +template<typename T> void tst_QVector::add() const { { @@ -667,7 +709,6 @@ void tst_QVector::appendCustom() const void tst_QVector::appendRvalue() const { -#ifdef Q_COMPILER_RVALUE_REFS QVector<QString> v; v.append("hello"); QString world = "world"; @@ -675,9 +716,6 @@ void tst_QVector::appendRvalue() const QVERIFY(world.isEmpty()); QCOMPARE(v.front(), QString("hello")); QCOMPARE(v.back(), QString("world")); -#else - QSKIP("This test requires that C++11 move semantics support is enabled in the compiler"); -#endif } void tst_QVector::at() const @@ -1392,6 +1430,7 @@ void tst_QVector::fromListCustom() const QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) void tst_QVector::fromStdVector() const { // stl = :( @@ -1405,6 +1444,7 @@ void tst_QVector::fromStdVector() const // test it converts ok QCOMPARE(myvec, QVector<QString>() << "aaa" << "bbb" << "ninjas" << "pirates"); } +#endif void tst_QVector::indexOf() const { @@ -2297,6 +2337,7 @@ void tst_QVector::toList() const QCOMPARE(myvec, QVector<QString>() << "A" << "B" << "C"); } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) void tst_QVector::toStdVector() const { QVector<QString> myvec; @@ -2309,6 +2350,7 @@ void tst_QVector::toStdVector() const QCOMPARE(myvec, QVector<QString>() << "A" << "B" << "C"); } +#endif void tst_QVector::value() const { @@ -2515,7 +2557,6 @@ void tst_QVector::reallocAfterCopy() template<typename T> void tst_QVector::initializeList() { -#ifdef Q_COMPILER_INITIALIZER_LISTS T val1(SimpleValue<T>::at(1)); T val2(SimpleValue<T>::at(2)); T val3(SimpleValue<T>::at(3)); @@ -2532,7 +2573,6 @@ void tst_QVector::initializeList() QVector<T> v4({}); QCOMPARE(v4.size(), 0); -#endif } void tst_QVector::initializeListInt() @@ -2952,5 +2992,22 @@ void tst_QVector::insertMove() const QCOMPARE(Movable::counter.loadAcquire(), instancesCount); } +void tst_QVector::swapItemsAt() const +{ + QVector<int> v; + v << 0 << 1 << 2 << 3; + + v.swapItemsAt(0, 2); + QCOMPARE(v.at(0), 2); + QCOMPARE(v.at(2), 0); + + auto copy = v; + copy.swapItemsAt(0, 2); + QCOMPARE(v.at(0), 2); + QCOMPARE(v.at(2), 0); + QCOMPARE(copy.at(0), 0); + QCOMPARE(copy.at(2), 2); +} + QTEST_MAIN(tst_QVector) #include "tst_qvector.moc" diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index 05579dce6e..7c4d1071ce 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -260,12 +260,10 @@ void tst_QVersionNumber::constructorExplicit() QCOMPARE(v5.segments(), v6.segments()); -#ifdef Q_COMPILER_INITIALIZER_LISTS QVersionNumber v7(4, 5, 6); QVersionNumber v8 = {4, 5, 6}; QCOMPARE(v7.segments(), v8.segments()); -#endif } void tst_QVersionNumber::constructorCopy_data() @@ -436,7 +434,7 @@ void tst_QVersionNumber::normalized() QFETCH(QVersionNumber, expected); QCOMPARE(version.normalized(), expected); - QCOMPARE(qMove(version).normalized(), expected); + QCOMPARE(std::move(version).normalized(), expected); } void tst_QVersionNumber::isNormalized_data() @@ -586,30 +584,28 @@ void tst_QVersionNumber::serialize() void tst_QVersionNumber::moveSemantics() { -#ifdef Q_COMPILER_RVALUE_REFS // QVersionNumber(QVersionNumber &&) { QVersionNumber v1(1, 2, 3); - QVersionNumber v2 = qMove(v1); + QVersionNumber v2 = std::move(v1); QCOMPARE(v2, QVersionNumber(1, 2, 3)); } // QVersionNumber &operator=(QVersionNumber &&) { QVersionNumber v1(1, 2, 3); QVersionNumber v2; - v2 = qMove(v1); + v2 = std::move(v1); QCOMPARE(v2, QVersionNumber(1, 2, 3)); } // QVersionNumber(QVector<int> &&) { QVector<int> segments = QVector<int>() << 1 << 2 << 3; QVersionNumber v1(segments); - QVersionNumber v2(qMove(segments)); + QVersionNumber v2(std::move(segments)); QVERIFY(!v1.isNull()); QVERIFY(!v2.isNull()); QCOMPARE(v1, v2); } -#endif #ifdef Q_COMPILER_REF_QUALIFIERS // normalized() { @@ -620,7 +616,7 @@ void tst_QVersionNumber::moveSemantics() QVERIFY(!v.isNull()); QVERIFY(!nv.isNull()); QVERIFY(nv.isNormalized()); - nv = qMove(v).normalized(); + nv = std::move(v).normalized(); QVERIFY(!nv.isNull()); QVERIFY(nv.isNormalized()); } @@ -632,13 +628,10 @@ void tst_QVersionNumber::moveSemantics() segments = v.segments(); QVERIFY(!v.isNull()); QVERIFY(!segments.empty()); - segments = qMove(v).segments(); + segments = std::move(v).segments(); QVERIFY(!segments.empty()); } #endif -#if !defined(Q_COMPILER_RVALUE_REFS) && !defined(Q_COMPILER_REF_QUALIFIERS) - QSKIP("This test requires C++11 move semantics support in the compiler."); -#endif } void tst_QVersionNumber::qtVersion() diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index 2a975e67d1..c6da33cce0 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -46,6 +46,7 @@ SUBDIRS=\ qringbuffer \ qscopedpointer \ qscopedvaluerollback \ + qscopeguard \ qset \ qsharedpointer \ qsize \ diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index b40866892e..0593cfbc23 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -7,7 +7,7 @@ qtConfig(c++11): CONFIG += c++11 android:!android-embedded: RESOURCES += qimage.qrc -win32:!winrt: LIBS += -lgdi32 -luser32 +win32:!winrt: QMAKE_USE += user32 gdi32 darwin: LIBS += -framework CoreGraphics TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 4d41b5e873..441ec17412 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -1852,7 +1852,9 @@ void tst_QImage::smoothScale4_data() QTest::addColumn<QImage::Format>("format"); QTest::newRow("RGB32") << QImage::Format_RGB32; +#if QT_CONFIG(raster_64bit) QTest::newRow("RGBx64") << QImage::Format_RGBX64; +#endif } void tst_QImage::smoothScale4() @@ -3403,7 +3405,7 @@ void tst_QImage::ditherGradient_data() QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129; // Test we get the same results for opaque input in the ARGBPM implementation. - rgb32 = qMove(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied); + rgb32 = std::move(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied); QTest::newRow("argb32pm -> argb4444pm (no dither)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << 0 << 16; QTest::newRow("argb32pm -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33; QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33; @@ -3412,6 +3414,7 @@ void tst_QImage::ditherGradient_data() QTest::newRow("argb32pm -> argb6666pm (no dither)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << 0 << 64; QTest::newRow("argb32pm -> argb6666pm (dithering)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 129; +#if QT_CONFIG(raster_64bit) QImage rgb30(1024, 16, QImage::Format_RGB30); QLinearGradient gradient30(QRectF(rgb30.rect()).topLeft(), QRectF(rgb30.rect()).topRight()); gradient30.setColorAt(0.0, QColor(0, 0, 0)); @@ -3424,6 +3427,7 @@ void tst_QImage::ditherGradient_data() QTest::newRow("rgb30 -> rgb32 (dithering)") << rgb30 << QImage::Format_RGB32 << int(Qt::PreferDither | Qt::OrderedDither) << 513; QTest::newRow("rgb30 -> rgb888 (no dither)") << rgb30 << QImage::Format_RGB888 << 0 << 256; QTest::newRow("rgb30 -> rgb888 (dithering)") << rgb30 << QImage::Format_RGB888 << int(Qt::PreferDither | Qt::OrderedDither) << 513; +#endif } void tst_QImage::ditherGradient() diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index e6a020af1a..c9219dad1d 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 -win32:!winrt:LIBS += -lgdi32 -luser32 +win32:!winrt: QMAKE_USE += user32 gdi32 RESOURCES += qpixmap.qrc TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index 550f70890e..bc8bc38da6 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -734,7 +734,7 @@ void tst_QStandardItemModel::data() currentRoles.clear(); // bad args m_model->setData(QModelIndex(), "bla", Qt::DisplayRole); - QCOMPARE(currentRoles, {}); + QCOMPARE(currentRoles, QVector<int>{}); QIcon icon; for (int r=0; r < m_model->rowCount(); ++r) { @@ -742,9 +742,9 @@ void tst_QStandardItemModel::data() m_model->setData(m_model->index(r,c), "initialitem", Qt::DisplayRole); QCOMPARE(currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole})); m_model->setData(m_model->index(r,c), "tooltip", Qt::ToolTipRole); - QCOMPARE(currentRoles, {Qt::ToolTipRole}); + QCOMPARE(currentRoles, QVector<int>{Qt::ToolTipRole}); m_model->setData(m_model->index(r,c), icon, Qt::DecorationRole); - QCOMPARE(currentRoles, {Qt::DecorationRole}); + QCOMPARE(currentRoles, QVector<int>{Qt::DecorationRole}); } } @@ -761,7 +761,7 @@ void tst_QStandardItemModel::clearItemData() { currentRoles.clear(); QVERIFY(!m_model->clearItemData(QModelIndex())); - QCOMPARE(currentRoles, {}); + QCOMPARE(currentRoles, QVector<int>{}); const QModelIndex idx = m_model->index(0, 0); const QMap<int, QVariant> oldData = m_model->itemData(idx); m_model->setData(idx, QLatin1String("initialitem"), Qt::DisplayRole); @@ -773,7 +773,7 @@ void tst_QStandardItemModel::clearItemData() QCOMPARE(idx.data(Qt::ToolTipRole), QVariant()); QCOMPARE(idx.data(Qt::DisplayRole), QVariant()); QCOMPARE(idx.data(Qt::EditRole), QVariant()); - QCOMPARE(currentRoles, {}); + QCOMPARE(currentRoles, QVector<int>{}); m_model->setItemData(idx, oldData); currentRoles.clear(); } diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro index 7e98704aea..293a6a8581 100644 --- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro +++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro @@ -5,4 +5,4 @@ QT += core-private network gui-private testlib SOURCES += tst_noqteventloop.cpp -qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32 +qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index a304981cd1..09fec89de4 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -989,9 +989,13 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents() QCoreApplication::postEvent(&testReceiver, new QEvent(QEvent::User)); QCOMPARE(testReceiver.customEvents, 0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QStaticPlugin testPluginInfo(qt_plugin_instance, qt_plugin_query_metadata); +#else QStaticPlugin testPluginInfo; testPluginInfo.instance = qt_plugin_instance; testPluginInfo.rawMetaData = qt_plugin_query_metadata; +#endif qRegisterStaticPluginFunction(testPluginInfo); int argc = 3; char *argv[] = { const_cast<char*>(QTest::currentAppName()), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") }; diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp index bad021c3b0..9a4c560a08 100644 --- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp +++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp @@ -121,7 +121,7 @@ static QByteArray modifiersTestRowName(const QString &keySequence) if (uc > 32 && uc < 128) str << '"' << c << '"'; else - str << "U+" << hex << uc << dec; + str << "U+" << Qt::hex << uc << Qt::dec; if (i < size - 1) str << ','; } diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 7f29b1c24e..6ce6422f48 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -141,21 +141,20 @@ void tst_QPalette::copySemantics() void tst_QPalette::moveSemantics() { -#ifdef Q_COMPILER_RVALUE_REFS QPalette src(Qt::red), dst; const QPalette control = src; QVERIFY(src != dst); QCOMPARE(src, control); QVERIFY(!dst.isCopyOf(src)); QVERIFY(!dst.isCopyOf(control)); - dst = qMove(src); // move assignment + dst = std::move(src); // move assignment QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too QVERIFY(dst.isCopyOf(control)); QCOMPARE(dst, control); src = control; // check moved-from 'src' can still be assigned to (doesn't crash) QVERIFY(src.isCopyOf(dst)); QVERIFY(src.isCopyOf(control)); - QPalette dst2(qMove(src)); // move construction + QPalette dst2(std::move(src)); // move construction QVERIFY(!src.isCopyOf(dst)); QVERIFY(!src.isCopyOf(dst2)); QVERIFY(!src.isCopyOf(control)); @@ -163,9 +162,6 @@ void tst_QPalette::moveSemantics() QVERIFY(dst2.isCopyOf(dst)); QVERIFY(dst2.isCopyOf(control)); // check moved-from 'src' can still be destroyed (doesn't crash) -#else - QSKIP("Compiler doesn't support C++11 move semantics"); -#endif } void tst_QPalette::setBrush() diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro index 844b3e8507..e7931ca773 100644 --- a/tests/auto/gui/kernel/qwindow/qwindow.pro +++ b/tests/auto/gui/kernel/qwindow/qwindow.pro @@ -5,4 +5,4 @@ QT += core-private gui-private testlib SOURCES += tst_qwindow.cpp -qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32 +qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/gui/painting/painting.pro b/tests/auto/gui/painting/painting.pro index 831fffab30..26e84c1b15 100644 --- a/tests/auto/gui/painting/painting.pro +++ b/tests/auto/gui/painting/painting.pro @@ -3,6 +3,7 @@ SUBDIRS=\ qpainterpath \ qpainterpathstroker \ qcolor \ + qcolorspace \ qbrush \ qregion \ qpagelayout \ diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 17289e0b85..4d92bdd382 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -33,7 +33,7 @@ #include <qcolor.h> #include <qdebug.h> -#include <private/qcolorprofile_p.h> +#include <private/qcolortrclut_p.h> #include <private/qdrawingprimitive_sse2_p.h> #include <qrgba64.h> @@ -70,6 +70,7 @@ private slots: void setBlue(); void setRgb(); + void setRgbF(); void setRgba(); void setHsv(); void setCmyk(); @@ -187,28 +188,28 @@ void tst_QColor::getSetCheck() // void QColor::setRedF(qreal) obj1.setRedF(0.0); QCOMPARE(obj1.redF(), qreal(0.0)); - obj1.setRedF(-0.2); - QCOMPARE(obj1.redF(), qreal(0.0)); // range<0.0, 1.0 - obj1.setRedF(1.1); - QCOMPARE(obj1.redF(), qreal(1.0)); // range<0.0, 1.0 + obj1.setRedF(-0.25); + QCOMPARE(obj1.redF(), qreal(-0.25)); + obj1.setRedF(1.25); + QCOMPARE(obj1.redF(), qreal(1.25)); // qreal QColor::greenF() // void QColor::setGreenF(qreal) obj1.setGreenF(0.0); QCOMPARE(obj1.greenF(), qreal(0.0)); - obj1.setGreenF(-0.2); - QCOMPARE(obj1.greenF(), qreal(0.0)); // range<0.0, 1.0 - obj1.setGreenF(1.1); - QCOMPARE(obj1.greenF(), qreal(1.0)); // range<0.0, 1.0 + obj1.setGreenF(-0.25); + QCOMPARE(obj1.greenF(), qreal(-0.25)); + obj1.setGreenF(1.5); + QCOMPARE(obj1.greenF(), qreal(1.5)); // qreal QColor::blueF() // void QColor::setBlueF(qreal) obj1.setBlueF(0.0); QCOMPARE(obj1.blueF(), qreal(0.0)); - obj1.setBlueF(-0.2); - QCOMPARE(obj1.blueF(), qreal(0.0)); // range<0.0, 1.0 - obj1.setBlueF(1.1); - QCOMPARE(obj1.blueF(), qreal(1.0)); // range<0.0, 1.0 + obj1.setBlueF(-0.5); + QCOMPARE(obj1.blueF(), qreal(-0.5)); + obj1.setBlueF(2.0); + QCOMPARE(obj1.blueF(), qreal(2.0)); // QRgb QColor::rgba() // void QColor::setRgba(QRgb) @@ -677,30 +678,81 @@ void tst_QColor::setRgb() { QColor color; - for (int A = 0; A <= USHRT_MAX; ++A) { - { - // 0-255 - int a = A >> 8; - QRgb rgb = qRgba(0, 0, 0, a); + for (int a = 0; a <= 255; ++a) { + QRgb rgb = qRgba(0, 0, 0, a); - color.setRgb(0, 0, 0, a); - QCOMPARE(color.alpha(), a); - QCOMPARE(color.rgb(), qRgb(0, 0, 0)); + color.setRgb(0, 0, 0, a); + QCOMPARE(color.alpha(), a); + QCOMPARE(color.rgb(), qRgb(0, 0, 0)); - color.setRgb(rgb); - QCOMPARE(color.alpha(), 255); - QCOMPARE(color.rgb(), qRgb(0, 0, 0)); + color.setRgb(rgb); + QCOMPARE(color.alpha(), 255); + QCOMPARE(color.rgb(), qRgb(0, 0, 0)); - int r, g, b, a2; - color.setRgb(0, 0, 0, a); - color.getRgb(&r, &g, &b, &a2); - QCOMPARE(a2, a); + int r, g, b, a2; + color.setRgb(0, 0, 0, a); + color.getRgb(&r, &g, &b, &a2); + QCOMPARE(a2, a); - QColor c(0, 0, 0); - c.setAlpha(a); - QCOMPARE(c.alpha(), a); - } + QColor c(0, 0, 0); + c.setAlpha(a); + QCOMPARE(c.alpha(), a); + } + for (int r = 0; r <= 255; ++r) { + QRgb rgb = qRgb(r, 0, 0); + + color.setRgb(r, 0, 0); + QCOMPARE(color.red(), r); + QCOMPARE(color.rgb(), rgb); + + color.setRgb(rgb); + QCOMPARE(color.red(), r); + QCOMPARE(color.rgb(), rgb); + + int r2, g, b, a; + color.getRgb(&r2, &g, &b, &a); + QCOMPARE(r2, r); + } + + for (int g = 0; g <= 255; ++g) { + QRgb rgb = qRgb(0, g, 0); + + color.setRgb(0, g, 0); + QCOMPARE(color.green(), g); + QCOMPARE(color.rgb(), rgb); + + color.setRgb(rgb); + QCOMPARE(color.green(), g); + QCOMPARE(color.rgb(), rgb); + + int r, g2, b, a; + color.getRgb(&r, &g2, &b, &a); + QCOMPARE(g2, g); + } + + for (int b = 0; b <= 255; ++b) { + QRgb rgb = qRgb(0, 0, b); + + color.setRgb(0, 0, b); + QCOMPARE(color.blue(), b); + QCOMPARE(color.rgb(), rgb); + + color.setRgb(rgb); + QCOMPARE(color.blue(), b); + QCOMPARE(color.rgb(), rgb); + + int r, g, b2, a; + color.getRgb(&r, &g, &b2, &a); + QCOMPARE(b2, b); + } +} + +void tst_QColor::setRgbF() +{ + QColor color; + + for (int A = 0; A <= USHRT_MAX; ++A) { { // 0.0-1.0 qreal a = A / qreal(USHRT_MAX); @@ -720,24 +772,6 @@ void tst_QColor::setRgb() for (int R = 0; R <= USHRT_MAX; ++R) { { - // 0-255 - int r = R >> 8; - QRgb rgb = qRgb(r, 0, 0); - - color.setRgb(r, 0, 0); - QCOMPARE(color.red(), r); - QCOMPARE(color.rgb(), rgb); - - color.setRgb(rgb); - QCOMPARE(color.red(), r); - QCOMPARE(color.rgb(), rgb); - - int r2, g, b, a; - color.getRgb(&r2, &g, &b, &a); - QCOMPARE(r2, r); - } - - { // 0.0-1.0 qreal r = R / qreal(USHRT_MAX); color.setRgbF(r, 0.0, 0.0); @@ -751,24 +785,6 @@ void tst_QColor::setRgb() for (int G = 0; G <= USHRT_MAX; ++G) { { - // 0-255 - int g = G >> 8; - QRgb rgb = qRgb(0, g, 0); - - color.setRgb(0, g, 0); - QCOMPARE(color.green(), g); - QCOMPARE(color.rgb(), rgb); - - color.setRgb(rgb); - QCOMPARE(color.green(), g); - QCOMPARE(color.rgb(), rgb); - - int r, g2, b, a; - color.getRgb(&r, &g2, &b, &a); - QCOMPARE(g2, g); - } - - { // 0.0-1.0 qreal g = G / qreal(USHRT_MAX); color.setRgbF(0.0, g, 0.0); @@ -782,32 +798,53 @@ void tst_QColor::setRgb() for (int B = 0; B <= USHRT_MAX; ++B) { { - // 0-255 - int b = B >> 8; - QRgb rgb = qRgb(0, 0, b); + // 0.0-1.0 + qreal b = B / qreal(USHRT_MAX); + color.setRgbF(0.0, 0.0, b); + QCOMPARE(color.blueF(), b); - color.setRgb(0, 0, b); - QCOMPARE(color.blue(), b); - QCOMPARE(color.rgb(), rgb); + qreal r, g, b2, a; + color.getRgbF(&r, &g, &b2, &a); + QCOMPARE(b2, b); + } + } - color.setRgb(rgb); - QCOMPARE(color.blue(), b); - QCOMPARE(color.rgb(), rgb); + for (int R = -128; R <= 512; ++R) { + { + // extended RGB + qreal r = R / qreal(256); + color.setRgbF(r, 0.0, 0.0); + QCOMPARE(qfloat16(color.redF()), qfloat16(r)); - int r, g, b2, a; - color.getRgb(&r, &g, &b2, &a); - QCOMPARE(b2, b); + qreal r2, g, b, a; + color.getRgbF(&r2, &g, &b, &a); + QCOMPARE(qfloat16(r2), qfloat16(r)); } + } + for (int G = -128; G <= 512; ++G) { { - // 0.0-1.0 - qreal b = B / qreal(USHRT_MAX); + // extended RGB + qreal g = G / qreal(256); + color.setRgbF(0.0, g, 0.0); + QCOMPARE(qfloat16(color.greenF()), qfloat16(g)); + + qreal r, g2, b, a; + color.getRgbF(&r, &g2, &b, &a); + QCOMPARE(qfloat16(g2), qfloat16(g)); + } + } + + for (int B = -128; B <= 512; ++B) { + { + // extended RGB + qreal b = B / qreal(256); color.setRgbF(0.0, 0.0, b); - QCOMPARE(color.blueF(), b); + QCOMPARE(qfloat16(color.blueF()), qfloat16(b)); qreal r, g, b2, a; color.getRgbF(&r, &g, &b2, &a); - QCOMPARE(b2, b); + QCOMPARE(qfloat16(b2), qfloat16(b)); } } } @@ -1632,14 +1669,13 @@ void tst_QColor::qcolorprofile_data() QTest::newRow("gamma=1.7") << qreal(1.7) << 2; QTest::newRow("gamma=2.0") << qreal(2.0) << 8; QTest::newRow("gamma=2.31") << qreal(2.31) << 33; - QTest::newRow("SRgb") << qreal(0.0) << 7; } void tst_QColor::qcolorprofile() { QFETCH(qreal, gammaC); QFETCH(int, tolerance); - QColorProfile *cp = (gammaC == 0) ? QColorProfile::fromSRgb(): QColorProfile::fromGamma(gammaC); + QColorTrcLut *cp = QColorTrcLut::fromGamma(gammaC); // Test we are accurate for most values after converting through gamma-correction. int error = 0; diff --git a/tests/auto/gui/painting/qcolorspace/qcolorspace.pro b/tests/auto/gui/painting/qcolorspace/qcolorspace.pro new file mode 100644 index 0000000000..14bd699bf7 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/qcolorspace.pro @@ -0,0 +1,9 @@ +CONFIG += testcase +QT += testlib gui-private core-private + +TARGET = tst_qcolorspace +SOURCES += tst_qcolorspace.cpp + +RESOURCES += $$files(resources/*) + +TESTDATA += resources/* diff --git a/tests/auto/gui/painting/qcolorspace/resources/ProPhoto.jpg b/tests/auto/gui/painting/qcolorspace/resources/ProPhoto.jpg Binary files differnew file mode 100644 index 0000000000..481d35ca8e --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/ProPhoto.jpg diff --git a/tests/auto/gui/painting/qcolorspace/resources/sRGB2014.icc b/tests/auto/gui/painting/qcolorspace/resources/sRGB2014.icc Binary files differnew file mode 100644 index 0000000000..49afbfef10 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/sRGB2014.icc diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp new file mode 100644 index 0000000000..7a88eb18b2 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +#include <qcolorspace.h> +#include <qimage.h> +#include <qimagereader.h> + +#include <private/qcolorspace_p.h> + +Q_DECLARE_METATYPE(QColorSpace::ColorSpaceId) +Q_DECLARE_METATYPE(QColorSpace::Gamut) +Q_DECLARE_METATYPE(QColorSpace::TransferFunction) + +class tst_QColorSpace : public QObject +{ + Q_OBJECT + +public: + tst_QColorSpace(); + +private slots: + void namedColorSpaces_data(); + void namedColorSpaces(); + + void toIccProfile_data(); + void toIccProfile(); + + void fromIccProfile(); + + void imageConversion_data(); + void imageConversion(); + + void loadImage(); + + void gamut(); + void primariesXyz(); + void primaries2_data(); + void primaries2(); + void invalidPrimaries(); +}; + +tst_QColorSpace::tst_QColorSpace() +{ } + + +void tst_QColorSpace::namedColorSpaces_data() +{ + QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId"); + QTest::addColumn<QColorSpace::Gamut>("gamutId"); + QTest::addColumn<QColorSpace::TransferFunction>("transferFunctionId"); + + QTest::newRow("sRGB") << QColorSpace::SRgb + << QColorSpace::Gamut::SRgb + << QColorSpace::TransferFunction::SRgb; + QTest::newRow("sRGB Linear") << QColorSpace::SRgbLinear + << QColorSpace::Gamut::SRgb + << QColorSpace::TransferFunction::Linear; + QTest::newRow("Adobe RGB") << QColorSpace::AdobeRgb + << QColorSpace::Gamut::AdobeRgb + << QColorSpace::TransferFunction::Gamma; + QTest::newRow("Display-P3") << QColorSpace::DisplayP3 + << QColorSpace::Gamut::DciP3D65 + << QColorSpace::TransferFunction::SRgb; + QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb + << QColorSpace::Gamut::ProPhotoRgb + << QColorSpace::TransferFunction::ProPhotoRgb; + QTest::newRow("BT.2020") << QColorSpace::Bt2020 + << QColorSpace::Gamut::Bt2020 + << QColorSpace::TransferFunction::Bt2020; +} + +void tst_QColorSpace::namedColorSpaces() +{ + QFETCH(QColorSpace::ColorSpaceId, colorSpaceId); + QFETCH(QColorSpace::Gamut, gamutId); + QFETCH(QColorSpace::TransferFunction, transferFunctionId); + + QColorSpace colorSpace = colorSpaceId; + + QVERIFY(colorSpace.isValid()); + + QCOMPARE(colorSpace.colorSpaceId(), colorSpaceId); + QCOMPARE(colorSpace.gamut(), gamutId); + QCOMPARE(colorSpace.transferFunction(), transferFunctionId); +} + + +void tst_QColorSpace::toIccProfile_data() +{ + namedColorSpaces_data(); +} + +void tst_QColorSpace::toIccProfile() +{ + QFETCH(QColorSpace::ColorSpaceId, colorSpaceId); + QFETCH(QColorSpace::Gamut, gamutId); + QFETCH(QColorSpace::TransferFunction, transferFunctionId); + + Q_UNUSED(gamutId); + Q_UNUSED(transferFunctionId); + + QColorSpace colorSpace = colorSpaceId; + QByteArray iccProfile = colorSpace.iccProfile(); + QVERIFY(!iccProfile.isEmpty()); + + QColorSpace colorSpace2 = QColorSpace::fromIccProfile(iccProfile); + QVERIFY(colorSpace2.isValid()); + + QCOMPARE(colorSpace2, colorSpace); + + QByteArray iccProfile2 = colorSpace2.iccProfile(); + QVERIFY(!iccProfile2.isEmpty()); + + QCOMPARE(iccProfile2, iccProfile); +} + +void tst_QColorSpace::fromIccProfile() +{ + // Read the official sRGB ICCv2 profile: + QString prefix = QFINDTESTDATA("resources/"); + QFile file(prefix + "sRGB2014.icc"); + file.open(QIODevice::ReadOnly); + QByteArray iccProfile = file.readAll(); + QColorSpace stdSRgb = QColorSpace::fromIccProfile(iccProfile); + QVERIFY(stdSRgb.isValid()); + + QCOMPARE(stdSRgb.gamut(), QColorSpace::Gamut::SRgb); + QCOMPARE(stdSRgb.transferFunction(), QColorSpace::TransferFunction::SRgb); + QCOMPARE(stdSRgb.colorSpaceId(), QColorSpace::SRgb); + + QCOMPARE(stdSRgb, QColorSpace(QColorSpace::SRgb)); +} + +void tst_QColorSpace::imageConversion_data() +{ + QTest::addColumn<QColorSpace::ColorSpaceId>("fromColorSpace"); + QTest::addColumn<QColorSpace::ColorSpaceId>("toColorSpace"); + QTest::addColumn<int>("tolerance"); + + QTest::newRow("sRGB -> Display-P3") << QColorSpace::SRgb << QColorSpace::DisplayP3 << 0; + QTest::newRow("sRGB -> Adobe RGB") << QColorSpace::SRgb << QColorSpace::AdobeRgb << 2; + QTest::newRow("Display-P3 -> sRGB") << QColorSpace::DisplayP3 << QColorSpace::SRgb << 0; + QTest::newRow("Adobe RGB -> sRGB") << QColorSpace::AdobeRgb << QColorSpace::SRgb << 2; + QTest::newRow("Display-P3 -> Adobe RGB") << QColorSpace::DisplayP3 << QColorSpace::AdobeRgb << 2; + QTest::newRow("Display-P3 -> BT.2020") << QColorSpace::DisplayP3 << QColorSpace::Bt2020 << 4; + QTest::newRow("sRGB -> sRGB Linear") << QColorSpace::SRgb << QColorSpace::SRgbLinear << 0; +} + +void tst_QColorSpace::imageConversion() +{ + QFETCH(QColorSpace::ColorSpaceId, fromColorSpace); + QFETCH(QColorSpace::ColorSpaceId, toColorSpace); + QFETCH(int, tolerance); + + QImage testImage(256, 1, QImage::Format_RGB32); + + for (int i = 0; i < 256; ++i) + testImage.setPixel(i, 0, qRgb(i, i, i)); + + testImage.setColorSpace(fromColorSpace); + QCOMPARE(testImage.colorSpace(), QColorSpace(fromColorSpace)); + + testImage.convertToColorSpace(toColorSpace); + QCOMPARE(testImage.colorSpace(), QColorSpace(toColorSpace)); + + int lastRed = 0; + int lastGreen = 0; + int lastBlue = 0; + for (int i = 0; i < 256; ++i) { + QRgb p = testImage.pixel(i, 0); + QVERIFY(qRed(p) >= lastRed); + QVERIFY(qGreen(p) >= lastGreen); + QVERIFY(qBlue(p) >= lastBlue); + lastRed = qRed(p); + lastGreen = qGreen(p); + lastBlue = qBlue(p); + } + + lastRed = 0; + lastGreen = 0; + lastBlue = 0; + testImage.convertToColorSpace(fromColorSpace); + QCOMPARE(testImage.colorSpace(), QColorSpace(fromColorSpace)); + for (int i = 0; i < 256; ++i) { + QRgb p = testImage.pixel(i, 0); + QVERIFY(qAbs(qRed(p) - qGreen(p)) <= tolerance); + QVERIFY(qAbs(qRed(p) - qBlue(p)) <= tolerance); + QVERIFY((lastRed - qRed(p)) <= (tolerance / 2)); + QVERIFY((lastGreen - qGreen(p)) <= (tolerance / 2)); + QVERIFY((lastBlue - qBlue(p)) <= (tolerance / 2)); + lastRed = qRed(p); + lastGreen = qGreen(p); + lastBlue = qBlue(p); + } +} + + +void tst_QColorSpace::loadImage() +{ + QString prefix = QFINDTESTDATA("resources/"); + QImageReader reader(prefix + "ProPhoto.jpg"); + QImage image = reader.read(); + + QVERIFY(!image.isNull()); + QVERIFY(image.colorSpace().isValid()); + QCOMPARE(image.colorSpace().colorSpaceId(), QColorSpace::ProPhotoRgb); + QVERIFY(!image.colorSpace().iccProfile().isEmpty()); + + QColorSpace defaultProPhotoRgb = QColorSpace::ProPhotoRgb; + QVERIFY(!defaultProPhotoRgb.iccProfile().isEmpty()); + + // Test the iccProfile getter returns the ICC profile from the image + // which since we didn't write it, isn't identical to our defaults. + QVERIFY(defaultProPhotoRgb.iccProfile() != image.colorSpace().iccProfile()); + + QColorTransform transform = image.colorSpace().transformationToColorSpace(QColorSpace::SRgb); + qreal maxRed = 0; + qreal maxBlue = 0; + qreal maxRed2 = 0; + qreal maxBlue2 = 0; + for (int y = 0; y < image.height(); ++y) { + for (int x = 0; x < image.width(); ++x) { + QColor p = image.pixelColor(x, y); + maxRed = std::max(maxRed, p.redF()); + maxBlue = std::max(maxBlue, p.blueF()); + p = transform.map(p); + maxRed2 = std::max(maxRed2, p.redF()); + maxBlue2 = std::max(maxBlue2, p.blueF()); + + } + } + // ProPhotoRgb can be a lot more red and blue than SRgb can, so it will have lower values. + QVERIFY(maxRed2 > maxRed); + QVERIFY(maxBlue2 > maxBlue); +} + +void tst_QColorSpace::gamut() +{ + QColor black = QColor::fromRgbF(0.0, 0.0, 0.0); + QColor white = QColor::fromRgbF(1.0, 1.0, 1.0); + QColor red = QColor::fromRgbF(1.0, 0.0, 0.0); + QColor green = QColor::fromRgbF(0.0, 1.0, 0.0); + QColor blue = QColor::fromRgbF(0.0, 0.0, 1.0); + + QColorTransform toAdobeRgb = QColorSpace(QColorSpace::SRgb).transformationToColorSpace(QColorSpace::AdobeRgb); + + QColor tblack = toAdobeRgb.map(black); + QColor twhite = toAdobeRgb.map(white); + QColor tred = toAdobeRgb.map(red); + QColor tgreen = toAdobeRgb.map(green); + QColor tblue = toAdobeRgb.map(blue); + + // Black is black + QCOMPARE(tblack, black); + + // This white hasn't changed + QCOMPARE(twhite, white); + + // Adobe's red and blue gamut corners are the same as sRGB's + // So, a color in the red corner, will stay in the red corner + // the same for blue, but not for green. + QVERIFY(tred.greenF() < 0.001); + QVERIFY(tred.blueF() < 0.001); + QVERIFY(tblue.redF() < 0.001); + QVERIFY(tblue.greenF() < 0.001); + QVERIFY(tgreen.redF() > 0.2); + QVERIFY(tgreen.blueF() > 0.2); +} + +void tst_QColorSpace::primariesXyz() +{ + QColorSpace sRgb = QColorSpace::SRgb; + QColorSpace adobeRgb = QColorSpace::AdobeRgb; + QColorSpace displayP3 = QColorSpace::DisplayP3; + QColorSpace proPhotoRgb = QColorSpace::ProPhotoRgb; + QColorSpace bt2020 = QColorSpace::Bt2020; + + // Check if our calculated matrices, match the precalculated ones. + QCOMPARE(sRgb.d_func()->toXyz, QColorMatrix::toXyzFromSRgb()); + QCOMPARE(adobeRgb.d_func()->toXyz, QColorMatrix::toXyzFromAdobeRgb()); + QCOMPARE(displayP3.d_func()->toXyz, QColorMatrix::toXyzFromDciP3D65()); + QCOMPARE(proPhotoRgb.d_func()->toXyz, QColorMatrix::toXyzFromProPhotoRgb()); + QCOMPARE(bt2020.d_func()->toXyz, QColorMatrix::toXyzFromBt2020()); +} + +void tst_QColorSpace::primaries2_data() +{ + QTest::addColumn<QColorSpace::Gamut>("gamut"); + + QTest::newRow("sRGB") << QColorSpace::Gamut::SRgb; + QTest::newRow("DCI-P3 (D65)") << QColorSpace::Gamut::DciP3D65; + QTest::newRow("Adobe RGB (1998)") << QColorSpace::Gamut::AdobeRgb; + QTest::newRow("ProPhoto RGB") << QColorSpace::Gamut::ProPhotoRgb; + QTest::newRow("BT.2020") << QColorSpace::Gamut::Bt2020; +} + +void tst_QColorSpace::primaries2() +{ + QFETCH(QColorSpace::Gamut, gamut); + QColorSpacePrimaries primaries(gamut); + + QColorSpace original(gamut, QColorSpace::TransferFunction::Linear); + QColorSpace custom1(primaries.whitePoint, primaries.redPoint, + primaries.greenPoint, primaries.bluePoint, QColorSpace::TransferFunction::Linear); + QCOMPARE(original, custom1); + + // A custom color swizzled color-space: + QColorSpace custom2(primaries.whitePoint, primaries.bluePoint, + primaries.greenPoint, primaries.redPoint, QColorSpace::TransferFunction::Linear); + + QVERIFY(custom1 != custom2); + QColor color1(255, 127, 63); + QColor color2 = custom1.transformationToColorSpace(custom2).map(color1); + QCOMPARE(color2.red(), color1.blue()); + QCOMPARE(color2.green(), color1.green()); + QCOMPARE(color2.blue(), color1.red()); + QCOMPARE(color2.alpha(), color1.alpha()); + QColor color3 = custom2.transformationToColorSpace(custom1).map(color2); + QCOMPARE(color3.red(), color1.red()); + QCOMPARE(color3.green(), color1.green()); + QCOMPARE(color3.blue(), color1.blue()); + QCOMPARE(color3.alpha(), color1.alpha()); +} + +void tst_QColorSpace::invalidPrimaries() +{ + QColorSpace custom(QPointF(), QPointF(), QPointF(), QPointF(), QColorSpace::TransferFunction::Linear); + QVERIFY(!custom.isValid()); + QCOMPARE(custom.colorSpaceId(), QColorSpace::Undefined); +} + +QTEST_MAIN(tst_QColorSpace) +#include "tst_qcolorspace.moc" diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index bc0baed15c..cec164b8b2 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -185,10 +185,12 @@ private slots: void gradientPixelFormat_data(); void gradientPixelFormat(); +#if QT_CONFIG(raster_64bit) void linearGradientRgb30_data(); void linearGradientRgb30(); void radialGradientRgb30_data(); void radialGradientRgb30(); +#endif void fpe_pixmapTransform(); void fpe_zeroLengthLines(); @@ -3946,6 +3948,7 @@ void tst_QPainter::gradientInterpolation() } } +#if QT_CONFIG(raster_64bit) void tst_QPainter::linearGradientRgb30_data() { QTest::addColumn<QColor>("stop0"); @@ -4004,6 +4007,7 @@ void tst_QPainter::radialGradientRgb30() QVERIFY(qGray(p1.rgb()) >= qGray(p2.rgb())); } } +#endif void tst_QPainter::drawPolygon() { @@ -4884,14 +4888,18 @@ void tst_QPainter::blendARGBonRGB_data() << QPainter::CompositionMode_SourceOver << qRgba(255, 0, 0, 85) << 85; QTest::newRow("ARGB_PM over RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32_Premultiplied << QPainter::CompositionMode_SourceOver << qRgba(85, 0, 0, 85) << 85; +#if QT_CONFIG(raster_64bit) QTest::newRow("ARGB source RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32 << QPainter::CompositionMode_Source << qRgba(255, 0, 0, 85) << 85; QTest::newRow("ARGB source RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32 << QPainter::CompositionMode_Source << qRgba(255, 0, 0, 120) << 85; +#endif QTest::newRow("ARGB_PM source RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32_Premultiplied << QPainter::CompositionMode_Source << qRgba(85, 0, 0, 85) << 85; +#if QT_CONFIG(raster_64bit) QTest::newRow("ARGB_PM source RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32_Premultiplied << QPainter::CompositionMode_Source << qRgba(180, 0, 0, 180) << 170; +#endif QTest::newRow("ARGB source-in RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32 << QPainter::CompositionMode_SourceIn << qRgba(255, 0, 0, 85) << 85; QTest::newRow("ARGB_PM source-in RGB30") << QImage::Format_RGB30 << QImage::Format_ARGB32_Premultiplied diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index ef65d653ce..295ae27d17 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -95,7 +95,7 @@ void tst_QPen::move() QPen p1(Qt::black); // check that moving does the right thing: - QPen p2 = qMove(p1); // could be move or copy construction, so don't check p1's state + QPen p2 = std::move(p1); // could be move or copy construction, so don't check p1's state QCOMPARE(p2.color(), QColor(Qt::black)); // this, executed ehre, would crash: @@ -110,7 +110,7 @@ void tst_QPen::move() QCOMPARE(p1.color(), QColor(Qt::yellow)); // check that moved-from QPens p2, p3 can still be safely destroyed: - QPen p5 = qMove(p2); + QPen p5 = std::move(p2); // intentionally no more statements beyond this point } @@ -120,7 +120,7 @@ void tst_QPen::move_assign() QPen p1(Qt::black), p2(Qt::white); // check that moving does the right thing: - p2 = qMove(p1); // could be move or copy assignment, so don't check p1's state + p2 = std::move(p1); // could be move or copy assignment, so don't check p1's state QCOMPARE(p2.color(), QColor(Qt::black)); // check that move-assigned-from QPen p1 can still be used, albeit @@ -137,7 +137,7 @@ void tst_QPen::move_assign() // check that moved-from QPens p2, p3 can still be safely destroyed: QPen p5; - p5 = qMove(p2); + p5 = std::move(p2); // intentionally no more statements beyond this point } diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index f8dfdbd3b0..b82b277781 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -200,7 +200,7 @@ static void dumpGlConfiguration(QOpenGLContext &context, QTextStream &str) << "\nShading language : " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION)) << "\nFormat : " << context.format(); - QList<QByteArray> extensionList = context.extensions().toList(); + QList<QByteArray> extensionList = context.extensions().values(); std::sort(extensionList.begin(), extensionList.end()); const int extensionCount = extensionList.size(); str << "\n\nFound " << extensionCount << " extensions:\n"; @@ -233,9 +233,9 @@ void tst_QOpenGlConfig::testGlConfiguration() static inline QByteArray msgSetMismatch(const QSet<QString> &expected, const QSet<QString> &actual) { - const QString result = QStringList(expected.toList()).join(QLatin1Char(',')) + const QString result = QStringList(expected.values()).join(QLatin1Char(',')) + QLatin1String(" != ") - + QStringList(actual.toList()).join(QLatin1Char(',')); + + QStringList(actual.values()).join(QLatin1Char(',')); return result.toLatin1(); } diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 064e37f73c..2b69801b59 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -211,8 +211,8 @@ void tst_QFontDatabase::widthTwoTimes() f.setPixelSize(pixelSize); QFontMetrics fm(f); - int w1 = fm.charWidth(text, 0); - int w2 = fm.charWidth(text, 0); + int w1 = fm.horizontalAdvance(text, 0); + int w2 = fm.horizontalAdvance(text, 0); QCOMPARE(w1, w2); } diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index d00dc251d8..b091edb64d 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -681,7 +681,7 @@ static bool checkPixels(const QImage &image, if (pixel != expectedRgb1 && pixel != expectedRgb2) { QString message; QDebug(&message) << "Color mismatch in image" << image - << "at" << x << ',' << y << ':' << showbase << hex << pixel + << "at" << x << ',' << y << ':' << Qt::showbase << Qt::hex << pixel << "(expected: " << expectedRgb1 << ',' << expectedRgb2 << ')'; *errorMessage = message.toLocal8Bit(); return false; diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 9c477589f9..9610e5b830 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -138,6 +138,7 @@ private slots: void noModificationOfInputString(); void superscriptCrash_qtbug53911(); void showLineAndParagraphSeparatorsCrash(); + void koreanWordWrap(); private: QFont testFont; @@ -2309,5 +2310,30 @@ void tst_QTextLayout::nbspWithFormat() QCOMPARE(layout.lineAt(1).textLength(), s2.length() + 1 + s3.length()); } +void tst_QTextLayout::koreanWordWrap() +{ + QString s = QString::fromUtf8("안녕하세요 여러분!"); + QTextLayout layout; + QTextOption option = layout.textOption(); + option.setWrapMode(QTextOption::WordWrap); + option.setFlags(QTextOption::Flag(QTextOption::IncludeTrailingSpaces)); + layout.setTextOption(option); + layout.setText(s); + + QFontMetrics metrics(layout.font()); + + layout.beginLayout(); + forever { + QTextLine line = layout.createLine(); + if (!line.isValid()) + break; + line.setLineWidth(metrics.width(s) * 0.8); + } + layout.endLayout(); + QCOMPARE(layout.lineCount(), 2); + QCOMPARE(layout.lineAt(0).textLength(), 6); + QCOMPARE(layout.lineAt(1).textLength(), 4); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/headingBulletsContinuations.md b/tests/auto/gui/text/qtextmarkdownimporter/data/headingBulletsContinuations.md new file mode 100644 index 0000000000..99eb633d17 --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownimporter/data/headingBulletsContinuations.md @@ -0,0 +1,28 @@ +# heading +- bullet 1 + continuation line 1, indented via tab +- bullet 2 + continuation line 2, indented via 4 spaces +- bullet 3 + + continuation paragraph 3, indented via tab + + - bullet 3.1 + + continuation paragraph 3.1, indented via 4 spaces + + - bullet 3.2 + continuation line, indented via 2 tabs +- bullet 4 + + continuation paragraph 4, indented via 4 spaces + and continuing onto another line too + +- bullet 5 + + continuation paragraph 5, indented via 2 spaces and continuing onto another + line too + +- bullet 6 + +plain old paragraph at the end diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md b/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md new file mode 100644 index 0000000000..7a0d5388ad --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md @@ -0,0 +1,17 @@ +Heading +------- +*** +stars +- bullet + ** not a bullet or a rule, just two stars +- [ ] unchecked + + --- indented too far, so not a rule +* * * +stars with tabs between +*** +stars with whitespace after +--- +hyphens with whitespace after +_____ +underscores with whitespace after diff --git a/tests/auto/gui/text/qtextmarkdownimporter/qtextmarkdownimporter.pro b/tests/auto/gui/text/qtextmarkdownimporter/qtextmarkdownimporter.pro new file mode 100644 index 0000000000..7b7fb61244 --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownimporter/qtextmarkdownimporter.pro @@ -0,0 +1,9 @@ +CONFIG += testcase +TARGET = tst_qtextmarkdownimporter +QT += core-private gui-private testlib +SOURCES += tst_qtextmarkdownimporter.cpp +TESTDATA += \ + data/thematicBreaks.md \ + data/headingBulletsContinuations.md \ + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp new file mode 100644 index 0000000000..8f51a7a474 --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QTextDocument> +#include <QTextCursor> +#include <QTextBlock> +#include <QTextList> +#include <QTextTable> +#include <QBuffer> +#include <QDebug> + +#include <private/qtextmarkdownimporter_p.h> + +// #define DEBUG_WRITE_HTML + +Q_LOGGING_CATEGORY(lcTests, "qt.text.tests") + +static const QChar LineBreak = QChar(0x2028); +static const QChar Tab = QLatin1Char('\t'); +static const QChar Space = QLatin1Char(' '); +static const QChar Period = QLatin1Char('.'); + +class tst_QTextMarkdownImporter : public QObject +{ + Q_OBJECT + +private slots: + void headingBulletsContinuations(); + void thematicBreaks(); +}; + +void tst_QTextMarkdownImporter::headingBulletsContinuations() +{ + const QStringList expectedBlocks = QStringList() << + "" << // we could do without this blank line before the heading, but currently it happens + "heading" << + "bullet 1 continuation line 1, indented via tab" << + "bullet 2 continuation line 2, indented via 4 spaces" << + "bullet 3" << + "continuation paragraph 3, indented via tab" << + "bullet 3.1" << + "continuation paragraph 3.1, indented via 4 spaces" << + "bullet 3.2 continuation line, indented via 2 tabs" << + "bullet 4" << + "continuation paragraph 4, indented via 4 spaces and continuing onto another line too" << + "bullet 5" << + // indenting by only 2 spaces is perhaps non-standard but currently is OK + "continuation paragraph 5, indented via 2 spaces and continuing onto another line too" << + "bullet 6" << + "plain old paragraph at the end"; + + QFile f(QFINDTESTDATA("data/headingBulletsContinuations.md")); + QVERIFY(f.open(QFile::ReadOnly | QIODevice::Text)); + QString md = QString::fromUtf8(f.readAll()); + f.close(); + + QTextDocument doc; + QTextMarkdownImporter(QTextMarkdownImporter::DialectGitHub).import(&doc, md); + QTextFrame::iterator iterator = doc.rootFrame()->begin(); + QTextFrame *currentFrame = iterator.currentFrame(); + QStringList::const_iterator expectedIt = expectedBlocks.constBegin(); + int i = 0; + while (!iterator.atEnd()) { + // There are no child frames + QCOMPARE(iterator.currentFrame(), currentFrame); + // Check whether we got the right child block + QTextBlock block = iterator.currentBlock(); + QCOMPARE(block.text().contains(LineBreak), false); + QCOMPARE(block.text().contains(Tab), false); + QVERIFY(!block.text().startsWith(Space)); + int expectedIndentation = 0; + if (block.text().contains(QLatin1String("continuation paragraph"))) + expectedIndentation = (block.text().contains(Period) ? 2 : 1); + qCDebug(lcTests) << i << "child block" << block.text() << "indentation" << block.blockFormat().indent(); + QVERIFY(expectedIt != expectedBlocks.constEnd()); + QCOMPARE(block.text(), *expectedIt); + if (i > 2) + QCOMPARE(block.blockFormat().indent(), expectedIndentation); + ++iterator; + ++expectedIt; + ++i; + } + QCOMPARE(expectedIt, expectedBlocks.constEnd()); + +#ifdef DEBUG_WRITE_HTML + { + QFile out("/tmp/headingBulletsContinuations.html"); + out.open(QFile::WriteOnly); + out.write(doc.toHtml().toLatin1()); + out.close(); + } +#endif +} + +void tst_QTextMarkdownImporter::thematicBreaks() +{ + int horizontalRuleCount = 0; + int textLinesCount = 0; + + QFile f(QFINDTESTDATA("data/thematicBreaks.md")); + QVERIFY(f.open(QFile::ReadOnly | QIODevice::Text)); + QString md = QString::fromUtf8(f.readAll()); + f.close(); + + QTextDocument doc; + QTextMarkdownImporter(QTextMarkdownImporter::DialectGitHub).import(&doc, md); + QTextFrame::iterator iterator = doc.rootFrame()->begin(); + QTextFrame *currentFrame = iterator.currentFrame(); + int i = 0; + while (!iterator.atEnd()) { + // There are no child frames + QCOMPARE(iterator.currentFrame(), currentFrame); + // Check whether the block is text or a horizontal rule + QTextBlock block = iterator.currentBlock(); + if (block.blockFormat().hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) + ++horizontalRuleCount; + else if (!block.text().isEmpty()) + ++textLinesCount; + qCDebug(lcTests) << i << (block.blockFormat().hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) ? QLatin1String("- - -") : block.text()); + ++iterator; + ++i; + } + QCOMPARE(horizontalRuleCount, 5); + QCOMPARE(textLinesCount, 9); + +#ifdef DEBUG_WRITE_HTML + { + QFile out("/tmp/thematicBreaks.html"); + out.open(QFile::WriteOnly); + out.write(doc.toHtml().toLatin1()); + out.close(); + } +#endif +} + +QTEST_MAIN(tst_QTextMarkdownImporter) +#include "tst_qtextmarkdownimporter.moc" diff --git a/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST new file mode 100644 index 0000000000..fc9e5a9efe --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST @@ -0,0 +1,3 @@ +[rewriteDocument] +winrt # QTBUG-54623 + diff --git a/tests/auto/gui/text/qtextmarkdownwriter/data/blockquotes.md b/tests/auto/gui/text/qtextmarkdownwriter/data/blockquotes.md new file mode 100644 index 0000000000..f429fcc21b --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownwriter/data/blockquotes.md @@ -0,0 +1,39 @@ +In 1958, Mahatma Gandhi was quoted as follows: + +> The Earth provides enough to satisfy every man's need but not for every man's +> greed. + +In [The CommonMark Specification](https://spec.commonmark.org/0.29/) John +MacFarlane writes: + +> What distinguishes Markdown from many other lightweight markup syntaxes, +> which are often easier to write, is its readability. As Gruber writes: + +> > The overriding design goal for Markdown's formatting syntax is to make it +> > as readable as possible. The idea is that a Markdown-formatted document should +> > be publishable as-is, as plain text, without looking like it's been marked up +> > with tags or formatting instructions. ( +> > [http://daringfireball.net/projects/markdown/](http://daringfireball.net/projects/markdown/)) + +> The point can be illustrated by comparing a sample of AsciiDoc with an +> equivalent sample of Markdown. Here is a sample of AsciiDoc from the AsciiDoc +> manual: + +> 1. List item one. +> + +> List item one continued with a second paragraph followed by an +> Indented block. +> + +> ................. +> $ ls *.sh +> $ mv *.sh ~/tmp +> ................. +> + +> List item continued with a third paragraph. +> +> 2. List item two continued with an open block. +> ... +> +The quotation includes an embedded quotation and a code quotation and ends with +an ellipsis due to being incomplete. + diff --git a/tests/auto/gui/text/qtextmarkdownwriter/data/example.md b/tests/auto/gui/text/qtextmarkdownwriter/data/example.md new file mode 100644 index 0000000000..0c3f34e09d --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownwriter/data/example.md @@ -0,0 +1,95 @@ +# QTextEdit + +The QTextEdit widget is an advanced editor that supports formatted rich text. +It can be used to display HTML and other rich document formats. Internally, +QTextEdit uses the QTextDocument class to describe both the high-level +structure of each document and the low-level formatting of paragraphs. + +If you are viewing this document in the textedit example, you can edit this +document to explore Qt's rich text editing features. We have included some +comments in each of the following sections to encourage you to experiment. + +## Font and Paragraph Styles + +QTextEdit supports **bold**, *italic*, and ~~strikethrough~~ font styles, and can +display multicolored text. Font families such as Times New Roman and `Courier` +can also be used directly. *If you place the cursor in a region of styled text, +the controls in the tool bars will change to reflect the current style.* + +Paragraphs can be formatted so that the text is left-aligned, right-aligned, +centered, or fully justified. + +*Try changing the alignment of some text and resize the editor to see how the +text layout changes.* + +## Lists + +Different kinds of lists can be included in rich text documents. Standard +bullet lists can be nested, using different symbols for each level of the list: + +- Disc symbols are typically used for top-level list items. + * Circle symbols can be used to distinguish between items in lower-level + lists. + + Square symbols provide a reasonable alternative to discs and circles. + +Ordered lists can be created that can be used for tables of contents. Different +characters can be used to enumerate items, and we can use both Roman and Arabic +numerals in the same list structure: + +1. Introduction +2. Qt Tools + 1) Qt Assistant + 2) Qt Designer + 1. Form Editor + 2. Component Architecture + 3) Qt Linguist + +The list will automatically be renumbered if you add or remove items. *Try +adding new sections to the above list or removing existing item to see the +numbers change.* + +## Images + +Inline images are treated like ordinary ranges of characters in the text +editor, so they flow with the surrounding text. Images can also be selected in +the same way as text, making it easy to cut, copy, and paste them. + +![image](images/logo32.png) *Try to select this image by clicking and dragging +over it with the mouse, or use the text cursor to select it by holding down +Shift and using the arrow keys. You can then cut or copy it, and paste it into +different parts of this document.* + +## Tables + +QTextEdit can arrange and format tables, supporting features such as row and +column spans, text formatting within cells, and size constraints for columns. + + +| |Development Tools |Programming Techniques |Graphical User Interfaces| +|-------------|------------------------------------|---------------------------|-------------------------| +|9:00 - 11:00 |Introduction to Qt ||| +|11:00 - 13:00|Using qmake |Object-oriented Programming|Layouts in Qt | +|13:00 - 15:00|Qt Designer Tutorial |Extreme Programming |Writing Custom Styles | +|15:00 - 17:00|Qt Linguist and Internationalization| | | + +*Try adding text to the cells in the table and experiment with the alignment of +the paragraphs.* + +## Hyperlinks + +QTextEdit is designed to support hyperlinks between documents, and this feature +is used extensively in +[Qt Assistant](http://doc.qt.io/qt-5/qtassistant-index.html). Hyperlinks are +automatically created when an HTML file is imported into an editor. Since the +rich text framework supports hyperlinks natively, they can also be created +programatically. + +## Undo and Redo + +Full support for undo and redo operations is built into QTextEdit and the +underlying rich text framework. Operations on a document can be packaged +together to make editing a more comfortable experience for the user. + +*Try making changes to this document and press `Ctrl+Z` to undo them. You can +always recover the original contents of the document.* + diff --git a/tests/auto/gui/text/qtextmarkdownwriter/qtextmarkdownwriter.pro b/tests/auto/gui/text/qtextmarkdownwriter/qtextmarkdownwriter.pro new file mode 100644 index 0000000000..6144710b99 --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownwriter/qtextmarkdownwriter.pro @@ -0,0 +1,9 @@ +CONFIG += testcase +TARGET = tst_qtextmarkdownwriter +QT += core-private gui-private testlib +SOURCES += tst_qtextmarkdownwriter.cpp +TESTDATA += \ + data/example.md \ + data/blockquotes.md \ + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp new file mode 100644 index 0000000000..9998794762 --- /dev/null +++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp @@ -0,0 +1,456 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QTextDocument> +#include <QTextCursor> +#include <QTextBlock> +#include <QTextList> +#include <QTextTable> +#include <QBuffer> +#include <QDebug> + +#include <private/qtextmarkdownwriter_p.h> + +// #define DEBUG_WRITE_OUTPUT + +class tst_QTextMarkdownWriter : public QObject +{ + Q_OBJECT +public slots: + void init(); + void cleanup(); + +private slots: + void testWriteParagraph_data(); + void testWriteParagraph(); + void testWriteList(); + void testWriteNestedBulletLists_data(); + void testWriteNestedBulletLists(); + void testWriteNestedNumericLists(); + void testWriteTable(); + void rewriteDocument_data(); + void rewriteDocument(); + void fromHtml_data(); + void fromHtml(); + +private: + QString documentToUnixMarkdown(); + +private: + QTextDocument *document; +}; + +void tst_QTextMarkdownWriter::init() +{ + document = new QTextDocument(); +} + +void tst_QTextMarkdownWriter::cleanup() +{ + delete document; +} + +void tst_QTextMarkdownWriter::testWriteParagraph_data() +{ + QTest::addColumn<QString>("input"); + QTest::addColumn<QString>("output"); + + QTest::newRow("empty") << "" << + ""; + QTest::newRow("spaces") << "foobar word" << + "foobar word\n\n"; + QTest::newRow("starting spaces") << " starting spaces" << + " starting spaces\n\n"; + QTest::newRow("trailing spaces") << "trailing spaces " << + "trailing spaces \n\n"; + QTest::newRow("tab") << "word\ttab x" << + "word\ttab x\n\n"; + QTest::newRow("tab2") << "word\t\ttab\tx" << + "word\t\ttab\tx\n\n"; + QTest::newRow("misc") << "foobar word\ttab x" << + "foobar word\ttab x\n\n"; + QTest::newRow("misc2") << "\t \tFoo" << + "\t \tFoo\n\n"; +} + +void tst_QTextMarkdownWriter::testWriteParagraph() +{ + QFETCH(QString, input); + QFETCH(QString, output); + + QTextCursor cursor(document); + cursor.insertText(input); + + QCOMPARE(documentToUnixMarkdown(), output); +} + +void tst_QTextMarkdownWriter::testWriteList() +{ + QTextCursor cursor(document); + QTextList *list = cursor.createList(QTextListFormat::ListDisc); + cursor.insertText("ListItem 1"); + list->add(cursor.block()); + cursor.insertBlock(); + cursor.insertText("ListItem 2"); + list->add(cursor.block()); + + QCOMPARE(documentToUnixMarkdown(), QString::fromLatin1( + "- ListItem 1\n- ListItem 2\n")); +} + +void tst_QTextMarkdownWriter::testWriteNestedBulletLists_data() +{ + QTest::addColumn<bool>("checkbox"); + QTest::addColumn<bool>("checked"); + QTest::addColumn<bool>("continuationLine"); + QTest::addColumn<bool>("continuationParagraph"); + QTest::addColumn<QString>("expectedOutput"); + + QTest::newRow("plain bullets") << false << false << false << false << + "- ListItem 1\n * ListItem 2\n + ListItem 3\n- ListItem 4\n * ListItem 5\n"; + QTest::newRow("bullets with continuation lines") << false << false << true << false << + "- ListItem 1\n * ListItem 2\n + ListItem 3 with text that won't fit on one line and thus needs a\n continuation\n- ListItem 4\n * ListItem 5 with text that won't fit on one line and thus needs a\n continuation\n"; + QTest::newRow("bullets with continuation paragraphs") << false << false << false << true << + "- ListItem 1\n\n * ListItem 2\n + ListItem 3\n\n continuation\n\n- ListItem 4\n\n * ListItem 5\n\n continuation\n\n"; + QTest::newRow("unchecked") << true << false << false << false << + "- [ ] ListItem 1\n * [ ] ListItem 2\n + [ ] ListItem 3\n- [ ] ListItem 4\n * [ ] ListItem 5\n"; + QTest::newRow("checked") << true << true << false << false << + "- [x] ListItem 1\n * [x] ListItem 2\n + [x] ListItem 3\n- [x] ListItem 4\n * [x] ListItem 5\n"; + QTest::newRow("checked with continuation lines") << true << true << true << false << + "- [x] ListItem 1\n * [x] ListItem 2\n + [x] ListItem 3 with text that won't fit on one line and thus needs a\n continuation\n- [x] ListItem 4\n * [x] ListItem 5 with text that won't fit on one line and thus needs a\n continuation\n"; + QTest::newRow("checked with continuation paragraphs") << true << true << false << true << + "- [x] ListItem 1\n\n * [x] ListItem 2\n + [x] ListItem 3\n\n continuation\n\n- [x] ListItem 4\n\n * [x] ListItem 5\n\n continuation\n\n"; +} + +void tst_QTextMarkdownWriter::testWriteNestedBulletLists() +{ + QFETCH(bool, checkbox); + QFETCH(bool, checked); + QFETCH(bool, continuationParagraph); + QFETCH(bool, continuationLine); + QFETCH(QString, expectedOutput); + + QTextCursor cursor(document); + QTextBlockFormat blockFmt = cursor.blockFormat(); + if (checkbox) { + blockFmt.setMarker(checked ? QTextBlockFormat::Checked : QTextBlockFormat::Unchecked); + cursor.setBlockFormat(blockFmt); + } + + QTextList *list1 = cursor.createList(QTextListFormat::ListDisc); + cursor.insertText("ListItem 1"); + list1->add(cursor.block()); + + QTextListFormat fmt2; + fmt2.setStyle(QTextListFormat::ListCircle); + fmt2.setIndent(2); + QTextList *list2 = cursor.insertList(fmt2); + cursor.insertText("ListItem 2"); + + QTextListFormat fmt3; + fmt3.setStyle(QTextListFormat::ListSquare); + fmt3.setIndent(3); + cursor.insertList(fmt3); + cursor.insertText(continuationLine ? + "ListItem 3 with text that won't fit on one line and thus needs a continuation" : + "ListItem 3"); + if (continuationParagraph) { + QTextBlockFormat blockFmt; + blockFmt.setIndent(2); + cursor.insertBlock(blockFmt); + cursor.insertText("continuation"); + } + + cursor.insertBlock(blockFmt); + cursor.insertText("ListItem 4"); + list1->add(cursor.block()); + + cursor.insertBlock(); + cursor.insertText(continuationLine ? + "ListItem 5 with text that won't fit on one line and thus needs a continuation" : + "ListItem 5"); + list2->add(cursor.block()); + if (continuationParagraph) { + QTextBlockFormat blockFmt; + blockFmt.setIndent(2); + cursor.insertBlock(blockFmt); + cursor.insertText("continuation"); + } + + QString output = documentToUnixMarkdown(); +#ifdef DEBUG_WRITE_OUTPUT + { + QFile out("/tmp/" + QLatin1String(QTest::currentDataTag()) + ".md"); + out.open(QFile::WriteOnly); + out.write(output.toUtf8()); + out.close(); + } +#endif + QCOMPARE(documentToUnixMarkdown(), expectedOutput); +} + +void tst_QTextMarkdownWriter::testWriteNestedNumericLists() +{ + QTextCursor cursor(document); + + QTextList *list1 = cursor.createList(QTextListFormat::ListDecimal); + cursor.insertText("ListItem 1"); + list1->add(cursor.block()); + + QTextListFormat fmt2; + fmt2.setStyle(QTextListFormat::ListLowerAlpha); + fmt2.setNumberSuffix(QLatin1String(")")); + fmt2.setIndent(2); + QTextList *list2 = cursor.insertList(fmt2); + cursor.insertText("ListItem 2"); + + QTextListFormat fmt3; + fmt3.setStyle(QTextListFormat::ListDecimal); + fmt3.setIndent(3); + cursor.insertList(fmt3); + cursor.insertText("ListItem 3"); + + cursor.insertBlock(); + cursor.insertText("ListItem 4"); + list1->add(cursor.block()); + + cursor.insertBlock(); + cursor.insertText("ListItem 5"); + list2->add(cursor.block()); + + // There's no QTextList API to set the starting number so we hard-coded all lists to start at 1 (QTBUG-65384) + QCOMPARE(documentToUnixMarkdown(), QString::fromLatin1( + "1. ListItem 1\n 1) ListItem 2\n 1. ListItem 3\n2. ListItem 4\n 2) ListItem 5\n")); +} + +void tst_QTextMarkdownWriter::testWriteTable() +{ + QTextCursor cursor(document); + QTextTable * table = cursor.insertTable(4, 3); + cursor = table->cellAt(0, 0).firstCursorPosition(); + // valid Markdown tables need headers, but QTextTable doesn't make that distinction + // so QTextMarkdownWriter assumes the first row of any table is a header + cursor.insertText("one"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("two"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("three"); + cursor.movePosition(QTextCursor::NextCell); + + cursor.insertText("alice"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("bob"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("carl"); + cursor.movePosition(QTextCursor::NextCell); + + cursor.insertText("dennis"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("eric"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("fiona"); + cursor.movePosition(QTextCursor::NextCell); + + cursor.insertText("gina"); + /* + |one |two |three| + |------|----|-----| + |alice |bob |carl | + |dennis|eric|fiona| + |gina | | | + */ + + QString md = documentToUnixMarkdown(); + +#ifdef DEBUG_WRITE_OUTPUT + { + QFile out("/tmp/table.md"); + out.open(QFile::WriteOnly); + out.write(md.toUtf8()); + out.close(); + } +#endif + + QString expected = QString::fromLatin1( + "\n|one |two |three|\n|------|----|-----|\n|alice |bob |carl |\n|dennis|eric|fiona|\n|gina | | |\n\n"); + QCOMPARE(md, expected); + + // create table with merged cells + document->clear(); + cursor = QTextCursor(document); + table = cursor.insertTable(3, 3); + table->mergeCells(0, 0, 1, 2); + table->mergeCells(1, 1, 1, 2); + cursor = table->cellAt(0, 0).firstCursorPosition(); + cursor.insertText("a"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("b"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("c"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("d"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("e"); + cursor.movePosition(QTextCursor::NextCell); + cursor.insertText("f"); + /* + +---+-+ + |a |b| + +---+-+ + |c| d| + +-+-+-+ + |e|f| | + +-+-+-+ + + generates + + |a ||b| + |-|-|-| + |c|d || + |e|f| | + + */ + + md = documentToUnixMarkdown(); + +#ifdef DEBUG_WRITE_OUTPUT + { + QFile out("/tmp/table-merged-cells.md"); + out.open(QFile::WriteOnly); + out.write(md.toUtf8()); + out.close(); + } +#endif + + QCOMPARE(md, QString::fromLatin1("\n|a ||b|\n|-|-|-|\n|c|d ||\n|e|f| |\n\n")); +} + +void tst_QTextMarkdownWriter::rewriteDocument_data() +{ + QTest::addColumn<QString>("inputFile"); + + QTest::newRow("block quotes") << "blockquotes.md"; + QTest::newRow("example") << "example.md"; +} + +void tst_QTextMarkdownWriter::rewriteDocument() +{ + QFETCH(QString, inputFile); + QTextDocument doc; + QFile f(QFINDTESTDATA("data/" + inputFile)); + QVERIFY(f.open(QFile::ReadOnly | QIODevice::Text)); + QString orig = QString::fromUtf8(f.readAll()); + f.close(); + doc.setMarkdown(orig); + QString md = doc.toMarkdown(); + +#ifdef DEBUG_WRITE_OUTPUT + QFile out("/tmp/rewrite-" + inputFile); + out.open(QFile::WriteOnly); + out.write(md.toUtf8()); + out.close(); +#endif + + QCOMPARE(md, orig); +} + +void tst_QTextMarkdownWriter::fromHtml_data() +{ + QTest::addColumn<QString>("expectedInput"); + QTest::addColumn<QString>("expectedOutput"); + + QTest::newRow("long URL") << + "<span style=\"font-style:italic;\">https://www.example.com/dir/subdir/subsubdir/subsubsubdir/subsubsubsubdir/subsubsubsubsubdir/</span>" << + "*https://www.example.com/dir/subdir/subsubdir/subsubsubdir/subsubsubsubdir/subsubsubsubsubdir/*\n\n"; + QTest::newRow("non-emphasis inline asterisk") << "3 * 4" << "3 * 4\n\n"; + QTest::newRow("arithmetic") << "(2 * a * x + b)^2 = b^2 - 4 * a * c" << "(2 * a * x + b)^2 = b^2 - 4 * a * c\n\n"; + QTest::newRow("escaped asterisk after newline") << + "The first sentence of this paragraph holds 80 characters, then there's a star. * This is wrapped, but is <em>not</em> a bullet point." << + "The first sentence of this paragraph holds 80 characters, then there's a star.\n\\* This is wrapped, but is *not* a bullet point.\n\n"; + QTest::newRow("escaped plus after newline") << + "The first sentence of this paragraph holds 80 characters, then there's a plus. + This is wrapped, but is <em>not</em> a bullet point." << + "The first sentence of this paragraph holds 80 characters, then there's a plus.\n\\+ This is wrapped, but is *not* a bullet point.\n\n"; + QTest::newRow("escaped hyphen after newline") << + "The first sentence of this paragraph holds 80 characters, then there's a minus. - This is wrapped, but is <em>not</em> a bullet point." << + "The first sentence of this paragraph holds 80 characters, then there's a minus.\n\\- This is wrapped, but is *not* a bullet point.\n\n"; + QTest::newRow("list items with indented continuations") << + "<ul><li>bullet<p>continuation paragraph</p></li><li>another bullet<br/>continuation line</li></ul>" << + "- bullet\n\n continuation paragraph\n\n- another bullet\n continuation line\n"; + QTest::newRow("nested list items with continuations") << + "<ul><li>bullet<p>continuation paragraph</p></li><li>another bullet<br/>continuation line</li><ul><li>bullet<p>continuation paragraph</p></li><li>another bullet<br/>continuation line</li></ul></ul>" << + "- bullet\n\n continuation paragraph\n\n- another bullet\n continuation line\n\n - bullet\n\n continuation paragraph\n\n - another bullet\n continuation line\n"; + QTest::newRow("nested ordered list items with continuations") << + "<ol><li>item<p>continuation paragraph</p></li><li>another item<br/>continuation line</li><ol><li>item<p>continuation paragraph</p></li><li>another item<br/>continuation line</li></ol><li>another</li><li>another</li></ol>" << + "1. item\n\n continuation paragraph\n\n2. another item\n continuation line\n\n 1. item\n\n continuation paragraph\n\n 2. another item\n continuation line\n\n3. another\n4. another\n"; + QTest::newRow("thematic break") << + "something<hr/>something else" << + "something\n\n- - -\nsomething else\n\n"; + QTest::newRow("block quote") << + "<p>In 1958, Mahatma Gandhi was quoted as follows:</p><blockquote>The Earth provides enough to satisfy every man's need but not for every man's greed.</blockquote>" << + "In 1958, Mahatma Gandhi was quoted as follows:\n\n> The Earth provides enough to satisfy every man's need but not for every man's\n> greed.\n\n"; + // TODO +// QTest::newRow("escaped number and paren after double newline") << +// "<p>(The first sentence of this paragraph is a line, the next paragraph has a number</p>13) but that's not part of an ordered list" << +// "(The first sentence of this paragraph is a line, the next paragraph has a number\n\n13\\) but that's not part of an ordered list\n\n"; +// QTest::newRow("preformats with embedded backticks") << +// "<pre>none `one` ``two``</pre><pre>```three``` ````four````</pre>plain" << +// "``` none `one` ``two`` ```\n\n````` ```three``` ````four```` `````\n\nplain\n\n"; +} + +void tst_QTextMarkdownWriter::fromHtml() +{ + QFETCH(QString, expectedInput); + QFETCH(QString, expectedOutput); + + document->setHtml(expectedInput); + QString output = documentToUnixMarkdown(); + +#ifdef DEBUG_WRITE_OUTPUT + { + QFile out("/tmp/" + QLatin1String(QTest::currentDataTag()) + ".md"); + out.open(QFile::WriteOnly); + out.write(output.toUtf8()); + out.close(); + } +#endif + + QCOMPARE(output, expectedOutput); +} + +QString tst_QTextMarkdownWriter::documentToUnixMarkdown() +{ + QString ret; + QTextStream ts(&ret, QIODevice::WriteOnly); + QTextMarkdownWriter writer(ts, QTextDocument::MarkdownDialectGitHub); + writer.writeAll(document); + return ret; +} + +QTEST_MAIN(tst_QTextMarkdownWriter) +#include "tst_qtextmarkdownwriter.moc" diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro index 6b033fb506..794d9ea8d3 100644 --- a/tests/auto/gui/text/text.pro +++ b/tests/auto/gui/text/text.pro @@ -28,12 +28,16 @@ SUBDIRS=\ win32:SUBDIRS -= qtextpiecetable +qtConfig(textmarkdownreader): SUBDIRS += qtextmarkdownimporter +qtConfig(textmarkdownwriter): SUBDIRS += qtextmarkdownwriter + !qtConfig(private_tests): SUBDIRS -= \ qfontcache \ qcssparser \ qtextlayout \ qtextpiecetable \ qzip \ + qtextmarkdownwriter \ qtextodfwriter !qtHaveModule(xml): SUBDIRS -= \ diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index f162c3ae9f..bf632c9846 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -72,15 +72,20 @@ public: } #ifdef QT_NETWORK_LIB - static QHostAddress serverIP() + static QHostAddress getServerIpImpl(const QString &serverName) { - const QHostInfo info = QHostInfo::fromName(serverName()); + const QHostInfo info = QHostInfo::fromName(serverName); if (info.error()) { QTest::qFail(qPrintable(info.errorString()), __FILE__, __LINE__); return QHostAddress(); } return info.addresses().constFirst(); } + + static QHostAddress serverIP() + { + return getServerIpImpl(serverName()); + } #endif static bool compareReplyIMAP(QByteArray const& actual) @@ -214,4 +219,67 @@ public: return serverName(); #endif } + static QString imapServerName() + { +#ifdef QT_TEST_SERVER_NAME + return QString("cyrus.") % serverDomainName(); +#else + return serverName(); +#endif + } + + static QString echoServerName() + { +#ifdef QT_TEST_SERVER_NAME + return QString("echo.") % serverDomainName(); +#else + return serverName(); +#endif + } + + static QString firewallServerName() + { +#ifdef QT_TEST_SERVER_NAME + return QString("iptables.") % serverDomainName(); +#else + return serverName(); +#endif + } + +#ifdef QT_NETWORK_LIB + static QHostAddress imapServerIp() + { + return getServerIpImpl(imapServerName()); + } + + static QHostAddress httpServerIp() + { + return getServerIpImpl(httpServerName()); + } + + static QHostAddress httpProxyServerIp() + { + return getServerIpImpl(httpProxyServerName()); + } + + static QHostAddress socksProxyServerIp() + { + return getServerIpImpl(socksProxyServerName()); + } + + static QHostAddress ftpProxyServerIp() + { + return getServerIpImpl(ftpProxyServerName()); + } + + static QHostAddress ftpServerIp() + { + return getServerIpImpl(ftpServerName()); + } + + static QHostAddress firewallServerIp() + { + return getServerIpImpl(firewallServerName()); + } +#endif }; diff --git a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro index 1874f001ab..c722100ead 100644 --- a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro @@ -5,3 +5,5 @@ SOURCES += tst_qabstractnetworkcache.cpp TESTDATA += tests/* +CONFIG += unsupported/testserver +QT_TEST_SERVER_LIST = apache2 diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index b8d9adf7a1..182e3e9547 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -39,7 +39,7 @@ #include <algorithm> -#define TESTFILE QLatin1String("http://") + QtNetworkSettings::serverName() + QLatin1String("/qtest/cgi-bin/") +#define TESTFILE QLatin1String("http://") + QtNetworkSettings::httpServerName() + QLatin1String("/qtest/cgi-bin/") class tst_QAbstractNetworkCache : public QObject { @@ -127,8 +127,13 @@ Q_DECLARE_METATYPE(QNetworkRequest::CacheLoadControl) void tst_QAbstractNetworkCache::initTestCase() { +#if defined(QT_TEST_SERVER) + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); +#else if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); +#endif + #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro index d32b651b86..84e6f857a1 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -4,3 +4,6 @@ SOURCES += tst_qhttpnetworkconnection.cpp requires(qtConfig(private_tests)) QT = core-private network-private testlib + +CONFIG += unsupported/testserver +QT_TEST_SERVER_LIST = apache2 diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 84766f5484..0a9320118d 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -50,6 +50,7 @@ private: bool finishedCalled; bool finishedWithErrorCalled; QNetworkReply::NetworkError netErrorCode; + QString (*httpServerName)() = QtNetworkSettings::httpServerName; private Q_SLOTS: void initTestCase(); @@ -101,7 +102,11 @@ private Q_SLOTS: void tst_QHttpNetworkConnection::initTestCase() { +#if defined(QT_TEST_SERVER) + QVERIFY(QtNetworkSettings::verifyConnection(httpServerName(), 80)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } void tst_QHttpNetworkConnection::options_data() @@ -126,10 +131,9 @@ void tst_QHttpNetworkConnection::head_data() QTest::addColumn<QString>("statusString"); QTest::addColumn<int>("contentLength"); - QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962; - - QTest::newRow("failure-path") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1; - QTest::newRow("failure-protocol") << "" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1; + QTest::newRow("success-internal") << "http://" << httpServerName() << "/qtest/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962; + QTest::newRow("failure-path") << "http://" << httpServerName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1; + QTest::newRow("failure-protocol") << "" << httpServerName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1; } void tst_QHttpNetworkConnection::head() @@ -175,10 +179,10 @@ void tst_QHttpNetworkConnection::get_data() QTest::addColumn<int>("contentLength"); QTest::addColumn<int>("downloadSize"); - QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962 << 25962; + QTest::newRow("success-internal") << "http://" << httpServerName() << "/qtest/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962 << 25962; - QTest::newRow("failure-path") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1 << -1; - QTest::newRow("failure-protocol") << "" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1 << -1; + QTest::newRow("failure-path") << "http://" << httpServerName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1 << -1; + QTest::newRow("failure-protocol") << "" << httpServerName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1 << -1; } void tst_QHttpNetworkConnection::get() @@ -244,8 +248,8 @@ void tst_QHttpNetworkConnection::put_data() QTest::addColumn<QString>("data"); QTest::addColumn<bool>("succeed"); - QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/dav/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<true; - QTest::newRow("fail-internal") << "http://" << QtNetworkSettings::serverName() << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false; + QTest::newRow("success-internal") << "http://" << httpServerName() << "/dav/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<true; + QTest::newRow("fail-internal") << "http://" << httpServerName() << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false; QTest::newRow("fail-host") << "http://" << "invalid.test.qt-project.org" << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false; } @@ -324,8 +328,8 @@ void tst_QHttpNetworkConnection::post_data() QTest::addColumn<int>("contentLength"); QTest::addColumn<int>("downloadSize"); - QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7; - QTest::newRow("failure-internal") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << -1; + QTest::newRow("success-internal") << "http://" << httpServerName() << "/qtest/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7; + QTest::newRow("failure-internal") << "http://" << httpServerName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << -1; } void tst_QHttpNetworkConnection::post() @@ -449,11 +453,11 @@ void tst_QHttpNetworkConnection::get401_data() QTest::addColumn<QString>("password"); QTest::addColumn<int>("statusCode"); - QTest::newRow("no-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << false << "" << ""<<401; - QTest::newRow("invalid-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "test" << "test"<<401; - QTest::newRow("valid-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; - QTest::newRow("digest-authentication-invalid") << "http://" << QtNetworkSettings::serverName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "wrong" << "wrong"<<401; - QTest::newRow("digest-authentication-valid") << "http://" << QtNetworkSettings::serverName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; + QTest::newRow("no-credentials") << "http://" << httpServerName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << false << "" << ""<<401; + QTest::newRow("invalid-credentials") << "http://" << httpServerName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "test" << "test"<<401; + QTest::newRow("valid-credentials") << "http://" << httpServerName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; + QTest::newRow("digest-authentication-invalid") << "http://" << httpServerName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "wrong" << "wrong"<<401; + QTest::newRow("digest-authentication-valid") << "http://" << httpServerName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; } void tst_QHttpNetworkConnection::get401() @@ -508,9 +512,9 @@ void tst_QHttpNetworkConnection::compression_data() QTest::addColumn<bool>("autoCompress"); QTest::addColumn<QString>("contentCoding"); - QTest::newRow("success-autogzip-temp") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs/rfc2616.html" << ushort(80) << false << 200 << "OK" << -1 << 418321 << true << ""; - QTest::newRow("success-nogzip-temp") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs/rfc2616.html" << ushort(80) << false << 200 << "OK" << 418321 << 418321 << false << "identity"; - QTest::newRow("success-manualgzip-temp") << "http://" << QtNetworkSettings::serverName() << "/qtest/deflate/rfc2616.html" << ushort(80) << false << 200 << "OK" << 119124 << 119124 << false << "gzip"; + QTest::newRow("success-autogzip-temp") << "http://" << httpServerName() << "/qtest/rfcs/rfc2616.html" << ushort(80) << false << 200 << "OK" << -1 << 418321 << true << ""; + QTest::newRow("success-nogzip-temp") << "http://" << httpServerName() << "/qtest/rfcs/rfc2616.html" << ushort(80) << false << 200 << "OK" << 418321 << 418321 << false << "identity"; + QTest::newRow("success-manualgzip-temp") << "http://" << httpServerName() << "/qtest/deflate/rfc2616.html" << ushort(80) << false << 200 << "OK" << 119124 << 119124 << false << "gzip"; } @@ -586,9 +590,9 @@ void tst_QHttpNetworkConnection::ignoresslerror_data() // fluke's certificate is signed by a non-standard authority. // Since we don't introduce that CA into the SSL verification chain, // connecting should fail. - QTest::newRow("success-init") << "https://" << QtNetworkSettings::serverName() << "/" << ushort(443) << true << true << false << 200; - QTest::newRow("success-fromSignal") << "https://" << QtNetworkSettings::serverName() << "/" << ushort(443) << true << false << true << 200; - QTest::newRow("failure") << "https://" << QtNetworkSettings::serverName() << "/" << ushort(443) << true << false << false << 100; + QTest::newRow("success-init") << "https://" << httpServerName() << "/" << ushort(443) << true << true << false << 200; + QTest::newRow("success-fromSignal") << "https://" << httpServerName() << "/" << ushort(443) << true << false << true << 200; + QTest::newRow("failure") << "https://" << httpServerName() << "/" << ushort(443) << true << false << false << 100; } void tst_QHttpNetworkConnection::ignoresslerror() @@ -635,7 +639,7 @@ void tst_QHttpNetworkConnection::nossl_data() QTest::addColumn<bool>("encrypt"); QTest::addColumn<QNetworkReply::NetworkError>("networkError"); - QTest::newRow("protocol-error") << "https://" << QtNetworkSettings::serverName() << "/" << ushort(443) << true <<QNetworkReply::ProtocolUnknownError; + QTest::newRow("protocol-error") << "https://" << httpServerName() << "/" << ushort(443) << true <<QNetworkReply::ProtocolUnknownError; } void tst_QHttpNetworkConnection::nossl() @@ -696,7 +700,7 @@ void tst_QHttpNetworkConnection::getMultiple() QFETCH(bool, pipeliningAllowed); QFETCH(int, requestCount); - QHttpNetworkConnection connection(connectionCount, QtNetworkSettings::serverName()); + QHttpNetworkConnection connection(connectionCount, httpServerName()); QList<QHttpNetworkRequest*> requests; QList<QHttpNetworkReply*> replies; @@ -705,7 +709,7 @@ void tst_QHttpNetworkConnection::getMultiple() // depending on what you use the results will vary. // for the "real" results, use a URL that has "internet latency" for you. Then (6 connections, pipelining) will win. // for LAN latency, you will possibly get that (1 connection, no pipelining) is the fastest - QHttpNetworkRequest *request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); + QHttpNetworkRequest *request = new QHttpNetworkRequest("http://" + httpServerName() + "/qtest/rfc3252.txt"); if (pipeliningAllowed) request->setPipeliningAllowed(true); requests.append(request); @@ -723,7 +727,7 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities( quint16 requestCount = 100; // use 2 connections. - QHttpNetworkConnection connection(2, QtNetworkSettings::serverName()); + QHttpNetworkConnection connection(2, httpServerName()); QList<QHttpNetworkRequest*> requests; QList<QHttpNetworkReply*> replies; @@ -731,9 +735,9 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities( for (int i = 0; i < requestCount; i++) { QHttpNetworkRequest *request = 0; if (i % 3) - request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Get); + request = new QHttpNetworkRequest("http://" + httpServerName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Get); else - request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Head); + request = new QHttpNetworkRequest("http://" + httpServerName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Head); if (i % 2 || i % 3) request->setPipeliningAllowed(true); @@ -800,9 +804,9 @@ void tst_QHttpNetworkConnection::getMultipleWithPriorities() { quint16 requestCount = 100; // use 2 connections. - QHttpNetworkConnection connection(2, QtNetworkSettings::serverName()); + QHttpNetworkConnection connection(2, httpServerName()); GetMultipleWithPrioritiesReceiver receiver(requestCount); - QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); + QUrl url("http://" + httpServerName() + "/qtest/rfc3252.txt"); QList<QHttpNetworkRequest*> requests; QList<QHttpNetworkReply*> replies; @@ -854,10 +858,10 @@ void tst_QHttpNetworkConnection::getEmptyWithPipelining() { quint16 requestCount = 50; // use 2 connections. - QHttpNetworkConnection connection(2, QtNetworkSettings::serverName()); + QHttpNetworkConnection connection(2, httpServerName()); GetEmptyWithPipeliningReceiver receiver(requestCount); - QUrl url("http://" + QtNetworkSettings::serverName() + "/cgi-bin/echo.cgi"); // a get on this = getting an empty file + QUrl url("http://" + httpServerName() + "/cgi-bin/echo.cgi"); // a get on this = getting an empty file QList<QHttpNetworkRequest*> requests; QList<QHttpNetworkReply*> replies; @@ -901,8 +905,8 @@ void tst_QHttpNetworkConnection::getAndEverythingShouldBePipelined() { quint16 requestCount = 100; // use 1 connection. - QHttpNetworkConnection connection(1, QtNetworkSettings::serverName()); - QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); + QHttpNetworkConnection connection(1, httpServerName()); + QUrl url("http://" + httpServerName() + "/qtest/rfc3252.txt"); QList<QHttpNetworkRequest*> requests; QList<QHttpNetworkReply*> replies; @@ -937,8 +941,8 @@ void tst_QHttpNetworkConnection::getAndThenDeleteObject_data() void tst_QHttpNetworkConnection::getAndThenDeleteObject() { // yes, this will leak if the testcase fails. I don't care. It must not fail then :P - QHttpNetworkConnection *connection = new QHttpNetworkConnection(QtNetworkSettings::serverName()); - QHttpNetworkRequest request("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile"); + QHttpNetworkConnection *connection = new QHttpNetworkConnection(httpServerName()); + QHttpNetworkRequest request("http://" + httpServerName() + "/qtest/bigfile"); QHttpNetworkReply *reply = connection->sendRequest(request); reply->setDownstreamLimited(true); diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 6c3443a735..1ef2c118b9 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -60,12 +60,13 @@ private slots: class MyCookieJar: public QNetworkCookieJar { public: - inline QList<QNetworkCookie> allCookies() const - { return QNetworkCookieJar::allCookies(); } - inline void setAllCookies(const QList<QNetworkCookie> &cookieList) - { QNetworkCookieJar::setAllCookies(cookieList); } + ~MyCookieJar() override; + using QNetworkCookieJar::allCookies; + using QNetworkCookieJar::setAllCookies; }; +MyCookieJar::~MyCookieJar() = default; + void tst_QNetworkCookieJar::getterSetter() { MyCookieJar jar; diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro index 9d36352abc..4cc1f6431e 100644 --- a/tests/auto/network/access/qnetworkreply/test/test.pro +++ b/tests/auto/network/access/qnetworkreply/test/test.pro @@ -15,5 +15,5 @@ TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \ !android:!winrt: TEST_HELPER_INSTALLS = ../echo/echo +CONFIG += unsupported/testserver QT_TEST_SERVER_LIST = vsftpd apache2 ftp-proxy danted squid -include($$dirname(_QMAKE_CONF_)/tests/auto/testserver.pri) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 8627a37e12..eb956bec30 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -123,7 +123,7 @@ class tst_QNetworkReply: public QObject if (!seedCreated) { seedCreated = true; // not thread-safe, but who cares } - return QString::number(QTime(0, 0, 0).msecsTo(QTime::currentTime())) + return QString::number(QTime::currentTime().msecsSinceStartOfDay()) + QLatin1Char('-') + QString::number(QCoreApplication::applicationPid()) + QLatin1Char('-') + QString::number(QRandomGenerator::global()->generate()); } diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp index 55053842dc..8cef351554 100644 --- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp +++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp @@ -93,7 +93,7 @@ void tst_QAuthenticator::basicAuth() QCOMPARE(priv->phase, QAuthenticatorPrivate::Start); - QCOMPARE(priv->calculateResponse("GET", "/").constData(), QByteArray("Basic " + expectedReply).constData()); + QCOMPARE(priv->calculateResponse("GET", "/", "").constData(), QByteArray("Basic " + expectedReply).constData()); } void tst_QAuthenticator::ntlmAuth_data() @@ -133,9 +133,9 @@ void tst_QAuthenticator::ntlmAuth() headers << qMakePair<QByteArray, QByteArray>("WWW-Authenticate", "NTLM"); priv->parseHttpResponse(headers, /*isProxy = */ false); if (sso) - QVERIFY(priv->calculateResponse("GET", "/").startsWith("NTLM ")); + QVERIFY(priv->calculateResponse("GET", "/", "").startsWith("NTLM ")); else - QCOMPARE(priv->calculateResponse("GET", "/").constData(), "NTLM TlRMTVNTUAABAAAABYIIAAAAAAAAAAAAAAAAAAAAAAA="); + QCOMPARE(priv->calculateResponse("GET", "/", "").constData(), "NTLM TlRMTVNTUAABAAAABYIIAAAAAAAAAAAAAAAAAAAAAAA="); // NTLM phase 2: challenge headers.clear(); @@ -146,7 +146,7 @@ void tst_QAuthenticator::ntlmAuth() QEXPECT_FAIL("with-realm-sso", "NTLM authentication code doesn't extract the realm", Continue); QCOMPARE(auth.realm(), realm); - QVERIFY(priv->calculateResponse("GET", "/").startsWith("NTLM ")); + QVERIFY(priv->calculateResponse("GET", "/", "").startsWith("NTLM ")); } void tst_QAuthenticator::equalityOperators() diff --git a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro index b5d6ea6459..d170d879e6 100644 --- a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro +++ b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro @@ -4,4 +4,4 @@ SOURCES += tst_qhostaddress.cpp QT = core network-private testlib -win32:LIBS += -lws2_32 +win32: QMAKE_USE += ws2_32 diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index 3d8457dd46..d358cdf52c 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -6,6 +6,6 @@ SOURCES += tst_qhostinfo.cpp requires(qtConfig(private_tests)) QT = core-private network-private testlib -win32:LIBS += -lws2_32 +win32: QMAKE_USE += ws2_32 winrt: WINRT_MANIFEST.capabilities += internetClientServer diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 0a130d363e..da6e02210b 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -179,7 +179,6 @@ void tst_QHostInfo::staticInformation() void tst_QHostInfo::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT //start the default network netConfMan = new QNetworkConfigurationManager(this); @@ -240,8 +239,6 @@ void tst_QHostInfo::lookupIPv4_data() QTest::addColumn<QString>("addresses"); QTest::addColumn<int>("err"); - // Test server lookup - QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError); QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound); QTest::newRow("single_ip4") << "a-single" TEST_DOMAIN << "192.0.2.1" << int(QHostInfo::NoError); diff --git a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp index 5eedd1043b..cd6019090f 100644 --- a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp +++ b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp @@ -131,7 +131,7 @@ void tst_QNetworkDatagram::makeReply() QNetworkDatagram copy = dgram; copy.setData(copy.data()); { - QNetworkDatagram reply = qMove(copy).makeReply("World"); + QNetworkDatagram reply = std::move(copy).makeReply("World"); QCOMPARE(reply.data(), QByteArray("World")); QCOMPARE(reply.senderAddress(), QHostAddress(localAddress)); QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort()); diff --git a/tests/auto/network/socket/platformsocketengine/BLACKLIST b/tests/auto/network/socket/platformsocketengine/BLACKLIST index 8e1a55995e..154c5cc5b2 100644 --- a/tests/auto/network/socket/platformsocketengine/BLACKLIST +++ b/tests/auto/network/socket/platformsocketengine/BLACKLIST @@ -1 +1,8 @@ +[tcpLoopbackPerformance] +windows +[receiveUrgentData] +windows +[serverTest] +windows +[tcpLoopbackPerformance] windows diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri index 46c722deba..868439de6a 100644 --- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri +++ b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri @@ -4,7 +4,7 @@ QNETWORK_SRC = $$QT_SOURCE_TREE/src/network INCLUDEPATH += $$QNETWORK_SRC -win32:LIBS += -lws2_32 +win32: QMAKE_USE += ws2_32 unix:qtConfig(reduce_exports) { SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine_unix.cpp diff --git a/tests/auto/network/socket/qhttpsocketengine/BLACKLIST b/tests/auto/network/socket/qhttpsocketengine/BLACKLIST index 8e1a55995e..991d01dd00 100644 --- a/tests/auto/network/socket/qhttpsocketengine/BLACKLIST +++ b/tests/auto/network/socket/qhttpsocketengine/BLACKLIST @@ -1 +1,6 @@ +[passwordAuth] +windows +[downloadBigFile] +windows +[ensureEofTriggersNotification] windows diff --git a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro index 56a4fb8aee..63f41f4eb7 100644 --- a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro +++ b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro @@ -10,3 +10,8 @@ MOC_DIR=tmp requires(qtConfig(private_tests)) QT = core-private network-private testlib +# TODO: For now linux-only, because cyrus is linux-only atm ... +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = squid danted cyrus apache2 +} diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index 68f3ea059b..cdc6fef663 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -122,7 +122,14 @@ public slots: void tst_QHttpSocketEngine::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } void tst_QHttpSocketEngine::init() @@ -171,7 +178,7 @@ void tst_QHttpSocketEngine::errorTest_data() QTest::newRow("proxy-host-not-found") << "this-host-does-not-exist." << 1080 << QString() << QString() << int(QAbstractSocket::ProxyNotFoundError); - QTest::newRow("proxy-connection-refused") << QtNetworkSettings::serverName() << 2 << QString() + QTest::newRow("proxy-connection-refused") << QtNetworkSettings::socksProxyServerName() << 2 << QString() << QString() << int(QAbstractSocket::ProxyConnectionRefusedError); @@ -278,13 +285,12 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); - - QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); - QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::serverIP()); + QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::imapServerIp()); QVERIFY(!socketDevice.localAddress().isNull()); QVERIFY(socketDevice.localPort() > 0); @@ -292,10 +298,10 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.waitForRead()); // Read the greeting - qint64 available = socketDevice.bytesAvailable(); + qint64 available = int(socketDevice.bytesAvailable()); QVERIFY(available > 0); QByteArray array; - array.resize(available); + array.resize(int(available)); QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be @@ -310,9 +316,9 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() // Wait for the response QVERIFY(socketDevice.waitForRead()); - available = socketDevice.bytesAvailable(); + available = int(socketDevice.bytesAvailable()); QVERIFY(available > 0); - array.resize(available); + array.resize(int(available)); QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be @@ -321,7 +327,7 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() // Wait for the response QVERIFY(socketDevice.waitForRead()); char c; - QCOMPARE(socketDevice.read(&c, sizeof(c)), (qint64) -1); + QCOMPARE(socketDevice.read(&c, sizeof(c)), qint64(-1)); QCOMPARE(socketDevice.error(), QAbstractSocket::RemoteHostClosedError); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); } @@ -335,10 +341,10 @@ void tst_QHttpSocketEngine::simpleErrorsAndStates() // Initialize device QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::httpProxyServerName(), 3128)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverName()), 8088)); + QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::socksProxyServerName()), 8088)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); if (socketDevice.waitForWrite(30000)) { QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState || @@ -422,7 +428,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost(QtNetworkSettings::serverName(), 143); + socket.connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); @@ -479,7 +485,7 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() tcpSocketNonBlocking_socket = &socket; // Connect - socket.connectToHost(QtNetworkSettings::serverName(), 143); + socket.connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket.state() == QTcpSocket::HostLookupState || socket.state() == QTcpSocket::ConnectingState); @@ -607,13 +613,13 @@ void tst_QHttpSocketEngine::downloadBigFile() connect(tmpSocket, SIGNAL(connected()), SLOT(exitLoopSlot())); connect(tmpSocket, SIGNAL(readyRead()), SLOT(downloadBigFileSlot())); - tmpSocket->connectToHost(QtNetworkSettings::serverName(), 80); + tmpSocket->connectToHost(QtNetworkSettings::httpServerName(), 80); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); + QByteArray hostName = QtNetworkSettings::httpServerName().toLatin1(); QCOMPARE(tmpSocket->state(), QAbstractSocket::ConnectedState); QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("Host: ") > 0); @@ -664,13 +670,13 @@ void tst_QHttpSocketEngine::passwordAuth() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password")); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::httpProxyServerName(), 3128, "qsockstest", "password")); - QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); - QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::serverIP()); + QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::imapServerIp()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 45ab275510..f53c75c6a4 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -552,7 +552,7 @@ void tst_QLocalSocket::sendData() QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState); QTextStream out(serverSocket); QTextStream in(&socket); - out << testLine << endl; + out << testLine << Qt::endl; bool wrote = serverSocket->waitForBytesWritten(3000); if (!socket.canReadLine()) { @@ -877,7 +877,7 @@ public: QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); QTextStream out(serverSocket); - out << testLine << endl; + out << testLine << Qt::endl; QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState); QVERIFY2(serverSocket->waitForBytesWritten(), serverSocket->errorString().toLatin1().constData()); QCOMPARE(serverSocket->errorString(), QString("Unknown error")); diff --git a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST index 60526827bf..8af3cea8dc 100644 --- a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST +++ b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST @@ -2,6 +2,9 @@ * [passwordAuth] * +# QTBUG-74162 +[passwordAuth2] +* [serverTest] windows [downloadBigFile] diff --git a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro index 71ceafa133..243eab9480 100644 --- a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro @@ -11,3 +11,9 @@ MOC_DIR=tmp QT = core-private network-private testlib requires(qtConfig(private_tests)) + +# Only on Linux until cyrus has been added to docker-compose-for-{windows,macOS}.yml and tested +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = danted apache2 cyrus +} diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 1212ea20e5..464054f8a6 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -137,7 +137,13 @@ private slots: void tst_QSocks5SocketEngine::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } //--------------------------------------------------------------------------- @@ -293,13 +299,13 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080)); - QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); - QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::serverIP()); + QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::imapServerIp()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -347,10 +353,10 @@ void tst_QSocks5SocketEngine::simpleErrorsAndStates() // Initialize device QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - QVERIFY(!socketDevice.connectToHost(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first(), 8088)); + QVERIFY(!socketDevice.connectToHost(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().first(), 8088)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); if (socketDevice.waitForWrite(15000)) { QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState || @@ -433,7 +439,7 @@ void tst_QSocks5SocketEngine::serverTest() // Initialize a Tcp socket QVERIFY(server.initialize(QAbstractSocket::TcpSocket)); - QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080); + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080); server.setProxy(proxy); @@ -510,7 +516,7 @@ void tst_QSocks5SocketEngine::udpTest() QVERIFY(udpSocket.initialize(QAbstractSocket::UdpSocket)); QVERIFY(udpSocket.isValid()); - QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080); + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080); udpSocket.setProxy(proxy); @@ -564,7 +570,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost(QtNetworkSettings::serverName(), 143); + socket.connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); @@ -635,7 +641,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() }); // Connect - socket.connectToHost(QtNetworkSettings::serverName(), 143); + socket.connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket.state() == QTcpSocket::HostLookupState || socket.state() == QTcpSocket::ConnectingState); @@ -754,13 +760,13 @@ void tst_QSocks5SocketEngine::downloadBigFile() << " (" << stopWatch.elapsed() << "ms)"; }); - socket.connectToHost(QtNetworkSettings::serverName(), 80); + socket.connectToHost(QtNetworkSettings::httpServerName(), 80); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); + QByteArray hostName = QtNetworkSettings::httpServerName().toLatin1(); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QVERIFY(socket.write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(socket.write("HOST: ") > 0); @@ -791,13 +797,13 @@ void tst_QSocks5SocketEngine::passwordAuth() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password")); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080, "qsockstest", "password")); // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); - if (!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)) { + if (!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)) { qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); } QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); @@ -857,19 +863,19 @@ void tst_QSocks5SocketEngine::passwordAuth2() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081)); + socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1081)); socketDevice.setReceiver(this); - QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143)); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); while (socketDevice.state() == QAbstractSocket::ConnectingState) { QVERIFY(socketDevice.waitForWrite()); - socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); + socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143); } if (socketDevice.state() != QAbstractSocket::ConnectedState) qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); - QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::serverIP()); + QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::imapServerIp()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); diff --git a/tests/auto/network/socket/qtcpserver/test/test.pro b/tests/auto/network/socket/qtcpserver/test/test.pro index 4491523383..7e2e60a1e3 100644 --- a/tests/auto/network/socket/qtcpserver/test/test.pro +++ b/tests/auto/network/socket/qtcpserver/test/test.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += ../tst_qtcpserver.cpp -win32:LIBS += -lws2_32 +win32: QMAKE_USE += ws2_32 TARGET = ../tst_qtcpserver @@ -16,3 +16,9 @@ win32 { QT = core network testlib MOC_DIR=tmp + +# Only on Linux until cyrus has been added to docker-compose-for-{windows,macOS}.yml and tested +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = danted cyrus squid ftp-proxy +} diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 161d94d642..22ac9aa076 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -160,8 +160,15 @@ void tst_QTcpServer::initTestCase_data() void tst_QTcpServer::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); +#else if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); +#endif #ifndef QT_NO_BEARERMANAGEMENT QNetworkConfigurationManager man; networkSession = new QNetworkSession(man.defaultConfiguration(), this); @@ -177,7 +184,7 @@ void tst_QTcpServer::init() #ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { - QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); + QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080)); } #else // !QT_NO_NETWORKPROXY QSKIP("No proxy support"); @@ -513,7 +520,7 @@ void tst_QTcpServer::waitForConnectionTest() } QTcpSocket findLocalIpSocket; - findLocalIpSocket.connectToHost(QtNetworkSettings::serverName(), 143); + findLocalIpSocket.connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(findLocalIpSocket.waitForConnected(5000)); QTcpServer server; @@ -668,16 +675,18 @@ void tst_QTcpServer::invalidProxy_data() QTest::addColumn<int>("port"); QTest::addColumn<int>("expectedError"); - QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); - QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << fluke << 143 + const QString imapIp = QtNetworkSettings::imapServerIp().toString(); + const QString httpProxyIp = QtNetworkSettings::httpProxyServerIp().toString(); + const QString socksIp = QtNetworkSettings::socksProxyServerIp().toString(); + QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << imapIp << 143 << int(QAbstractSocket::UnsupportedSocketOperationError); - QTest::newRow("http-proxy") << int(QNetworkProxy::HttpProxy) << fluke << 3128 + QTest::newRow("http-proxy") << int(QNetworkProxy::HttpProxy) << httpProxyIp << 3128 << int(QAbstractSocket::UnsupportedSocketOperationError); QTest::newRow("no-such-host") << int(QNetworkProxy::Socks5Proxy) << "invalid.test.qt-project.org" << 1080 << int(QAbstractSocket::ProxyNotFoundError); - QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << fluke << 3128 + QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << httpProxyIp << 3128 << int(QAbstractSocket::SocketTimeoutError); } @@ -740,48 +749,48 @@ void tst_QTcpServer::proxyFactory_data() // tests that do get to listen - proxyList << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080); + proxyList << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080); QTest::newRow("socks5") << proxyList << proxyList.at(0) << false << int(QAbstractSocket::UnknownSocketError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3128) - << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080); + proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3128) + << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080); QTest::newRow("cachinghttp+socks5") << proxyList << proxyList.at(1) << false << int(QAbstractSocket::UnknownSocketError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121) - << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3128) - << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121) + << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3128) + << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080); QTest::newRow("ftp+cachinghttp+socks5") << proxyList << proxyList.at(2) << false << int(QAbstractSocket::UnknownSocketError); // tests that fail to listen proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128); + proxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::httpProxyServerName(), 3128); QTest::newRow("http") << proxyList << proxyList.at(0) << true << int(QAbstractSocket::UnsupportedSocketOperationError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3128); + proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3128); QTest::newRow("cachinghttp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121); QTest::newRow("ftp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121) - << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3128); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121) + << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3128); QTest::newRow("ftp+cachinghttp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); diff --git a/tests/auto/network/socket/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro index 337e75b372..4c07b1ec66 100644 --- a/tests/auto/network/socket/qtcpsocket/test/test.pro +++ b/tests/auto/network/socket/qtcpsocket/test/test.pro @@ -2,8 +2,8 @@ CONFIG += testcase QT = core-private network-private testlib SOURCES += ../tst_qtcpsocket.cpp -win32:LIBS += -lws2_32 +win32: QMAKE_USE += ws2_32 TARGET = tst_qtcpsocket win32 { @@ -15,3 +15,9 @@ win32 { } else { DESTDIR = ../ } + +# Only on Linux until cyrus has been added to docker-compose-for-{windows,macOS}.yml and tested +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = danted squid apache2 ftp-proxy vsftpd iptables cyrus +} diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index c473230246..abe9845213 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -317,7 +317,7 @@ tst_QTcpSocket::tst_QTcpSocket() connect(earlyConstructedSockets->endPoints[1], SIGNAL(bytesWritten(qint64)), this, SLOT(earlySocketBytesSent(qint64))); earlyConstructedSockets->endPoints[1]->write("hello work"); - firstFailInfo.setAddresses(QList<QHostAddress>() << QHostAddress("224.0.0.0") << QtNetworkSettings::serverIP()); + firstFailInfo.setAddresses(QList<QHostAddress>() << QHostAddress("224.0.0.0") << QtNetworkSettings::httpServerIp()); } void tst_QTcpSocket::initTestCase_data() @@ -326,7 +326,6 @@ void tst_QTcpSocket::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::addColumn<bool>("ssl"); - qDebug() << QtNetworkSettings::serverName(); QTest::newRow("WithoutProxy") << false << 0 << false; //QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; ### temporarily disabled, QTBUG-38385 //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; ### temporarily disabled, QTBUG-38385 @@ -352,7 +351,17 @@ void tst_QTcpSocket::initTestCase_data() void tst_QTcpSocket::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); + //QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::firewallServerName(), 1357)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpServerName(), 21)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } void tst_QTcpSocket::init() @@ -361,30 +370,33 @@ void tst_QTcpSocket::init() 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"); - QString fluke = addresses.first().toString(); + QList<QHostAddress> socks5Addresses = QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses(); + QList<QHostAddress> httpProxyAddresses = QHostInfo::fromName(QtNetworkSettings::httpProxyServerName()).addresses(); + QVERIFY2(socks5Addresses.count() > 0, "failed to get ip address for SOCKS5 proxy server"); + QVERIFY2(httpProxyAddresses.count() > 0, "failed to get ip address for HTTP proxy server"); + QString socks5Address = socks5Addresses.first().toString(); + QString httpProxyAddress = httpProxyAddresses.first().toString(); QNetworkProxy proxy; switch (proxyType) { case Socks5Proxy: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, fluke, 1080); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socks5Address, 1080); break; case Socks5Proxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, fluke, 1081); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socks5Address, 1081); break; case HttpProxy | NoAuth: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3128); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddress, 3128); break; case HttpProxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3129); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddress, 3129); break; case HttpProxy | AuthNtlm: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3130); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddress, 3130); break; } QNetworkProxy::setApplicationProxy(proxy); @@ -644,8 +656,8 @@ void tst_QTcpSocket::bind() void tst_QTcpSocket::bindThenResolveHost_data() { QTest::addColumn<QString>("hostName"); - QTest::newRow("ip-literal") << QtNetworkSettings::serverIP().toString(); - QTest::newRow("name") << QtNetworkSettings::serverName(); + QTest::newRow("ip-literal") << QtNetworkSettings::httpServerIp().toString(); + QTest::newRow("name") << QtNetworkSettings::httpServerName(); QTest::newRow("first-fail") << firstFailName; } @@ -715,7 +727,7 @@ void tst_QTcpSocket::setSocketDescriptor() #ifdef Q_OS_WIN // need the dummy to ensure winsock is started QTcpSocket *dummy = newSocket(); - dummy->connectToHost(QtNetworkSettings::serverName(), 143); + dummy->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(dummy->waitForConnected()); SOCKET sock = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -737,7 +749,7 @@ void tst_QTcpSocket::setSocketDescriptor() QCOMPARE(socket->socketDescriptor(), (qintptr)sock); qt_qhostinfo_clear_cache(); //avoid the HostLookupState being skipped due to address being in cache from previous test. - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); QCOMPARE(socket->state(), QTcpSocket::HostLookupState); QCOMPARE(socket->socketDescriptor(), (qintptr)sock); QVERIFY(socket->waitForConnected(10000)); @@ -758,7 +770,7 @@ void tst_QTcpSocket::socketDescriptor() QTcpSocket *socket = newSocket(); QCOMPARE(socket->socketDescriptor(), (qintptr)-1); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->state() == QAbstractSocket::HostLookupState || socket->state() == QAbstractSocket::ConnectingState); QVERIFY(socket->waitForConnected(10000)); @@ -775,7 +787,7 @@ void tst_QTcpSocket::blockingIMAP() QTcpSocket *socket = newSocket(); // Connect - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(10000)); QCOMPARE(socket->state(), QTcpSocket::ConnectedState); QVERIFY(socket->isValid()); @@ -852,6 +864,14 @@ void tst_QTcpSocket::hostNotFound() socket->connectToHost("nosuchserver.qt-project.org", 80); QVERIFY(!socket->waitForConnected()); QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); +#ifdef QT_TEST_SERVER + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) { + QEXPECT_FAIL("", "QTBUG-73953: The version of Squid in the docker container behaves " + "differently to the one in the network testing server, returning 503 " + "when we expect 404", Continue); + } +#endif QCOMPARE(int(socket->error()), int(QTcpSocket::HostNotFoundError)); delete socket; @@ -861,8 +881,8 @@ void tst_QTcpSocket::hostNotFound() void tst_QTcpSocket::timeoutConnect_data() { QTest::addColumn<QString>("address"); - QTest::newRow("host") << QtNetworkSettings::serverName(); - QTest::newRow("ip") << QtNetworkSettings::serverIP().toString(); + QTest::newRow("host") << QtNetworkSettings::firewallServerName(); + QTest::newRow("ip") << QtNetworkSettings::firewallServerIp().toString(); } void tst_QTcpSocket::timeoutConnect() @@ -910,7 +930,7 @@ void tst_QTcpSocket::nonBlockingIMAP() nonBlockingIMAP_socket = socket; // Connect - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->state() == QTcpSocket::HostLookupState || socket->state() == QTcpSocket::ConnectingState); @@ -1036,7 +1056,7 @@ void tst_QTcpSocket::delayedClose() connect(socket, SIGNAL(connected()), SLOT(nonBlockingIMAP_connected())); connect(socket, SIGNAL(disconnected()), SLOT(exitLoopSlot())); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); enterLoop(30); if (timeout()) @@ -1082,7 +1102,7 @@ QByteArray tst_QTcpSocket::expectedReplyIMAP() void tst_QTcpSocket::fetchExpectedReplyIMAP() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY2(socket->waitForConnected(10000), qPrintable(socket->errorString())); QVERIFY2(socket->state() == QTcpSocket::ConnectedState, qPrintable(socket->errorString())); @@ -1101,7 +1121,7 @@ void tst_QTcpSocket::fetchExpectedReplyIMAP() void tst_QTcpSocket::partialRead() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(10000)); QCOMPARE(socket->state(), QTcpSocket::ConnectedState); char buf[512]; @@ -1125,7 +1145,7 @@ void tst_QTcpSocket::partialRead() void tst_QTcpSocket::unget() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(10000)); QCOMPARE(socket->state(), QTcpSocket::ConnectedState); char buf[512]; @@ -1162,7 +1182,7 @@ void tst_QTcpSocket::readRegularFile_readyRead() void tst_QTcpSocket::readAllAfterClose() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); connect(socket, SIGNAL(readyRead()), SLOT(readRegularFile_readyRead())); enterLoop(10); if (timeout()) @@ -1202,7 +1222,7 @@ void tst_QTcpSocket::openCloseOpenClose() QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(10000)); socket->close(); } @@ -1225,7 +1245,7 @@ void tst_QTcpSocket::connectDisconnectConnectDisconnect() QCOMPARE(int(socket->peerPort()), 0); QCOMPARE(socket->peerAddress(), QHostAddress()); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForReadyRead(10000)); QCOMPARE(QString::fromLatin1(socket->read(4)), QString("* OK")); @@ -1429,7 +1449,7 @@ void tst_QTcpSocket::disconnectWhileLookingUp() // just connect and disconnect, then make sure nothing weird happened QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 21); + socket->connectToHost(QtNetworkSettings::ftpServerName(), 21); // check that connect is in progress QVERIFY(socket->state() != QAbstractSocket::UnconnectedState); @@ -1477,7 +1497,7 @@ void tst_QTcpSocket::downloadBigFile() connect(tmpSocket, SIGNAL(readyRead()), SLOT(downloadBigFileSlot())); connect(tmpSocket, SIGNAL(disconnected()), SLOT(exitLoopSlot())); - tmpSocket->connectToHost(QtNetworkSettings::serverName(), 80); + tmpSocket->connectToHost(QtNetworkSettings::httpServerName(), 80); enterLoop(30); if (timeout()) { @@ -1486,7 +1506,7 @@ void tst_QTcpSocket::downloadBigFile() QFAIL("Network operation timed out"); } - QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); + QByteArray hostName = QtNetworkSettings::httpServerName().toLatin1(); QCOMPARE(tmpSocket->state(), QAbstractSocket::ConnectedState); QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); @@ -1552,7 +1572,7 @@ void tst_QTcpSocket::downloadBigFileSlot() void tst_QTcpSocket::readLine() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(5000)); while (!socket->canReadLine()) @@ -1601,7 +1621,7 @@ void tst_QTcpSocket::readLine() void tst_QTcpSocket::readLineString() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForReadyRead(10000)); QByteArray arr = socket->readLine(); @@ -1614,7 +1634,7 @@ void tst_QTcpSocket::readLineString() void tst_QTcpSocket::readChunks() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(10000)); QVERIFY(socket->waitForReadyRead(5000)); @@ -1634,7 +1654,7 @@ void tst_QTcpSocket::readChunks() void tst_QTcpSocket::waitForBytesWritten() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); QVERIFY(socket->waitForConnected(10000)); socket->write("GET / HTTP/1.0\r\n\r\n"); @@ -1652,7 +1672,7 @@ void tst_QTcpSocket::waitForBytesWrittenMinusOne() QSKIP("QTBUG-24451 - indefinite wait may hang"); #endif QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); QVERIFY(socket->waitForConnected(10000)); socket->write("GET / HTTP/1.0\r\n\r\n"); @@ -1667,7 +1687,7 @@ void tst_QTcpSocket::waitForBytesWrittenMinusOne() void tst_QTcpSocket::waitForReadyRead() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); socket->write("GET / HTTP/1.0\r\n\r\n"); QVERIFY(socket->waitForReadyRead(5000)); delete socket; @@ -1680,7 +1700,7 @@ void tst_QTcpSocket::waitForReadyReadMinusOne() QSKIP("QTBUG-24451 - indefinite wait may hang"); #endif QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); socket->write("GET / HTTP/1.0\r\n\r\n"); QVERIFY(socket->waitForReadyRead(-1)); delete socket; @@ -1693,7 +1713,7 @@ void tst_QTcpSocket::flush() socket->flush(); connect(socket, SIGNAL(connected()), SLOT(exitLoopSlot())); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); enterLoop(60); QVERIFY(socket->isOpen()); @@ -1710,7 +1730,7 @@ void tst_QTcpSocket::flush() void tst_QTcpSocket::synchronousApi() { QTcpSocket *ftpSocket = newSocket(); - ftpSocket->connectToHost(QtNetworkSettings::serverName(), 21); + ftpSocket->connectToHost(QtNetworkSettings::ftpServerName(), 21); ftpSocket->write("QUIT\r\n"); QVERIFY(ftpSocket->waitForDisconnected(10000)); QVERIFY(ftpSocket->bytesAvailable() > 0); @@ -1757,10 +1777,10 @@ void tst_QTcpSocket::recursiveReadyRead() QSignalSpy spy(testSocket, SIGNAL(readyRead())); - testSocket->connectToHost(QtNetworkSettings::serverName(), 143); + testSocket->connectToHost(QtNetworkSettings::imapServerName(), 143); enterLoop(30); QVERIFY2(!timeout(), - "Timed out when connecting to QtNetworkSettings::serverName()."); + "Timed out when connecting to QtNetworkSettings::imapServerName()."); enterLoop(30); QVERIFY2(!timeout(), @@ -1794,7 +1814,7 @@ void tst_QTcpSocket::recursiveReadyReadSlot() void tst_QTcpSocket::atEnd() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 21); + socket->connectToHost(QtNetworkSettings::ftpServerName(), 21); QVERIFY(socket->waitForReadyRead(15000)); QTextStream stream(socket); @@ -1802,9 +1822,15 @@ void tst_QTcpSocket::atEnd() QString greeting = stream.readLine(); QVERIFY(stream.atEnd()); +#ifdef QT_TEST_SERVER + // Test server must use some vsFTPd 3.x.x version + QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 3.x.x)")-1, qPrintable(greeting)); + QVERIFY2(greeting.startsWith("220 (vsFTPd 3."), qPrintable(greeting)); +#else // Test server must use some vsFTPd 2.x.x version QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting)); QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting)); +#endif QVERIFY2(greeting.endsWith(QLatin1Char(')')), qPrintable(greeting)); delete socket; @@ -1835,7 +1861,7 @@ protected: connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), Qt::DirectConnection); - socket->connectToHost(QtNetworkSettings::serverName(), 21); + socket->connectToHost(QtNetworkSettings::ftpServerName(), 21); socket->write("QUIT\r\n"); exec(); @@ -1909,7 +1935,7 @@ void tst_QTcpSocket::waitForReadyReadInASlot() tmpSocket = socket; connect(socket, SIGNAL(connected()), this, SLOT(waitForReadyReadInASlotSlot())); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); socket->write("GET / HTTP/1.0\r\n\r\n"); enterLoop(30); @@ -2073,7 +2099,7 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot() timer.start(15000); connect(tmpSocket, SIGNAL(hostFound()), this, SLOT(hostLookupSlot())); - tmpSocket->connectToHost(QtNetworkSettings::serverName(), 143); + tmpSocket->connectToHost(QtNetworkSettings::imapServerName(), 143); // only execute the loop if not already connected if (tmpSocket->state() != QAbstractSocket::ConnectedState) @@ -2128,7 +2154,7 @@ public slots: inline void doIt() { attemptedToConnect = true; - sock->connectToHost(QtNetworkSettings::serverName(), 80); + sock->connectToHost(QtNetworkSettings::httpServerName(), 80); #if defined(Q_OS_MAC) pthread_yield_np(); @@ -2179,7 +2205,7 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() QSignalSpy readyReadSpy(socket, SIGNAL(readyRead())); // Connect - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); // Wait for the read QVERIFY(socket->waitForReadyRead(10000)); @@ -2315,7 +2341,7 @@ void tst_QTcpSocket::localAddressEmptyOnBSD() void tst_QTcpSocket::zeroAndMinusOneReturns() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 80); + socket->connectToHost(QtNetworkSettings::httpServerName(), 80); socket->write("GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n"); QVERIFY(socket->waitForReadyRead(15000)); @@ -2376,7 +2402,7 @@ void tst_QTcpSocket::connectionRefused() connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); - socket->connectToHost(QtNetworkSettings::serverName(), 144); + socket->connectToHost(QtNetworkSettings::httpServerName(), 144); enterLoop(10); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), @@ -2523,7 +2549,7 @@ void tst_QTcpSocket::moveToThread0() { // Case 1: Moved after connecting, before waiting for connection. QTcpSocket *socket = newSocket();; - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); socket->moveToThread(0); QVERIFY(socket->waitForConnected(5000)); socket->write("XXX LOGOUT\r\n"); @@ -2535,7 +2561,7 @@ void tst_QTcpSocket::moveToThread0() // Case 2: Moved before connecting QTcpSocket *socket = newSocket(); socket->moveToThread(0); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(5000)); socket->write("XXX LOGOUT\r\n"); QVERIFY(socket->waitForBytesWritten(5000)); @@ -2545,7 +2571,7 @@ void tst_QTcpSocket::moveToThread0() { // Case 3: Moved after writing, while waiting for bytes to be written. QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(5000)); socket->write("XXX LOGOUT\r\n"); socket->moveToThread(0); @@ -2556,7 +2582,7 @@ void tst_QTcpSocket::moveToThread0() { // Case 4: Moved after writing, while waiting for response. QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 143); + socket->connectToHost(QtNetworkSettings::imapServerName(), 143); QVERIFY(socket->waitForConnected(5000)); socket->write("XXX LOGOUT\r\n"); QVERIFY(socket->waitForBytesWritten(5000)); @@ -2687,7 +2713,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorWaitForConnected() // use waitForConnected, e.g. this should use a synchronous select() on the OS level QTcpSocket socket; - socket.connectToHost(QtNetworkSettings::serverName(), 12346); + socket.connectToHost(QtNetworkSettings::httpServerName(), 12346); QTime timer; timer.start(); socket.waitForConnected(10000); @@ -2707,7 +2733,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop() // This testcase uses an event loop QTcpSocket socket; connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); - socket.connectToHost(QtNetworkSettings::serverName(), 12346); + socket.connectToHost(QtNetworkSettings::httpServerName(), 12346); QTestEventLoop::instance().enterLoop(10); QVERIFY2(!QTestEventLoop::instance().timeout(), "Connection to closed port timed out instead of refusing, something is wrong"); @@ -2720,7 +2746,7 @@ void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting() { QTcpSocket *socket = newSocket(); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY(socket->waitForConnected(5*1000)); QCOMPARE(socket->error(), QAbstractSocket::UnknownSocketError); @@ -2749,10 +2775,12 @@ void tst_QTcpSocket::invalidProxy_data() QTest::addColumn<bool>("failsAtConnect"); QTest::addColumn<int>("expectedError"); - QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); - QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << fluke << 21 << true + const QString ftpAddress = QtNetworkSettings::ftpServerIp().toString(); + const QString httpProxyAddress = QtNetworkSettings::httpProxyServerIp().toString(); + const QString socksProxyAddress = QtNetworkSettings::socksProxyServerIp().toString(); + QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << ftpAddress << 21 << true << int(QAbstractSocket::UnsupportedSocketOperationError); - QTest::newRow("http-caching-proxy") << int(QNetworkProxy::HttpCachingProxy) << fluke << 3128 << true + QTest::newRow("http-caching-proxy") << int(QNetworkProxy::HttpCachingProxy) << httpProxyAddress << 3128 << true << int(QAbstractSocket::UnsupportedSocketOperationError); QTest::newRow("no-such-host-socks5") << int(QNetworkProxy::Socks5Proxy) << "this-host-will-never-exist.qt-project.org" << 1080 << false @@ -2760,9 +2788,9 @@ void tst_QTcpSocket::invalidProxy_data() QTest::newRow("no-such-host-http") << int(QNetworkProxy::HttpProxy) << "this-host-will-never-exist.qt-project.org" << 3128 << false << int(QAbstractSocket::ProxyNotFoundError); - QTest::newRow("http-on-socks5") << int(QNetworkProxy::HttpProxy) << fluke << 1080 << false + QTest::newRow("http-on-socks5") << int(QNetworkProxy::HttpProxy) << socksProxyAddress << 1080 << false << int(QAbstractSocket::ProxyConnectionClosedError); - QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << fluke << 3128 << false + QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << httpProxyAddress << 3128 << false << int(QAbstractSocket::SocketTimeoutError); } @@ -2781,7 +2809,7 @@ void tst_QTcpSocket::invalidProxy() QTcpSocket *socket = newSocket(); socket->setProxy(proxy); - socket->connectToHost(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(), 80); + socket->connectToHost(QtNetworkSettings::httpServerIp().toString(), 80); if (failsAtConnect) { QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState); @@ -2833,48 +2861,48 @@ void tst_QTcpSocket::proxyFactory_data() // tests that do connect - proxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3129); + proxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::httpProxyServerName(), 3129); QTest::newRow("http") << proxyList << proxyList.at(0) << false << int(QAbstractSocket::UnknownSocketError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081); + proxyList << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1081); QTest::newRow("socks5") << proxyList << proxyList.at(0) << false << int(QAbstractSocket::UnknownSocketError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129) - << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081); + proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3129) + << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1081); QTest::newRow("cachinghttp+socks5") << proxyList << proxyList.at(1) << false << int(QAbstractSocket::UnknownSocketError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121) - << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129) - << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121) + << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3129) + << QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1081); QTest::newRow("ftp+cachinghttp+socks5") << proxyList << proxyList.at(2) << false << int(QAbstractSocket::UnknownSocketError); // tests that fail to connect proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129); + proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3129); QTest::newRow("cachinghttp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121); QTest::newRow("ftp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); proxyList.clear(); - proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::serverName(), 2121) - << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129); + proxyList << QNetworkProxy(QNetworkProxy::FtpCachingProxy, QtNetworkSettings::ftpProxyServerName(), 2121) + << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::httpProxyServerName(), 3129); QTest::newRow("ftp+cachinghttp") << proxyList << QNetworkProxy() << true << int(QAbstractSocket::UnsupportedSocketOperationError); @@ -2895,7 +2923,7 @@ void tst_QTcpSocket::proxyFactory() QNetworkProxyFactory::setApplicationProxyFactory(factory); QTcpSocket *socket = newSocket(); - QString host = QtNetworkSettings::serverName(); + QString host = QtNetworkSettings::httpServerName(); socket->connectToHost(host, 80); // Verify that the factory was called properly diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro index e856776ddc..969e4d72cf 100644 --- a/tests/auto/network/socket/qudpsocket/test/test.pro +++ b/tests/auto/network/socket/qudpsocket/test/test.pro @@ -17,3 +17,9 @@ win32 { } TARGET = tst_qudpsocket + +# Only on Linux until 'echo' has been added to docker-compose-for-{windows,macOS}.yml and tested +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = danted echo +} diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 707c1acf48..a4b22cb000 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -235,6 +235,7 @@ void tst_QUdpSocket::initTestCase_data() // hack: we only enable the Socks5 over UDP tests on the old // test server, because they fail on the new one. See QTBUG-35490 bool newTestServer = true; +#ifndef QT_TEST_SERVER QTcpSocket socket; socket.connectToHost(QtNetworkSettings::serverName(), 22); if (socket.waitForConnected(10000)) { @@ -244,6 +245,7 @@ void tst_QUdpSocket::initTestCase_data() newTestServer = false; socket.disconnectFromHost(); } +#endif QTest::addColumn<bool>("setProxy"); QTest::addColumn<int>("proxyType"); @@ -257,8 +259,13 @@ void tst_QUdpSocket::initTestCase_data() void tst_QUdpSocket::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 7)); +#else if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); +#endif allAddresses = QNetworkInterface::allAddresses(); m_skipUnsupportedIPv6Tests = shouldSkipIpv6TestsForBrokenSetsockopt(); @@ -300,7 +307,7 @@ void tst_QUdpSocket::init() #if QT_CONFIG(socks5) QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { - QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); + QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080)); } #else QSKIP("No proxy support"); @@ -981,7 +988,7 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer_data() QTest::addColumn<bool>("bind"); QTest::addColumn<QHostAddress>("peerAddress"); QHostAddress localhost(QHostAddress::LocalHost); - QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses()); + QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses()); if (serverAddresses.isEmpty()) return; @@ -995,7 +1002,7 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer_data() void tst_QUdpSocket::writeDatagramToNonExistingPeer() { - if (QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().isEmpty()) + if (QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().isEmpty()) QFAIL("Could not find test server address"); QFETCH(bool, bind); QFETCH(QHostAddress, peerAddress); @@ -1015,7 +1022,7 @@ void tst_QUdpSocket::writeToNonExistingPeer_data() { QTest::addColumn<QHostAddress>("peerAddress"); QHostAddress localhost(QHostAddress::LocalHost); - QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses()); + QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses()); if (serverAddresses.isEmpty()) return; @@ -1028,7 +1035,7 @@ void tst_QUdpSocket::writeToNonExistingPeer_data() void tst_QUdpSocket::writeToNonExistingPeer() { QSKIP("Connected-mode UDP sockets and their behaviour are erratic"); - if (QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().isEmpty()) + if (QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().isEmpty()) QFAIL("Could not find test server address"); QFETCH(QHostAddress, peerAddress); quint16 peerPort = 34534; @@ -1551,7 +1558,7 @@ void tst_QUdpSocket::echo_data() void tst_QUdpSocket::echo() { QFETCH(bool, connect); - QHostInfo info = QHostInfo::fromName(QtNetworkSettings::serverName()); + QHostInfo info = QHostInfo::fromName(QtNetworkSettings::echoServerName()); QVERIFY(info.addresses().count()); QHostAddress remote = info.addresses().first(); diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 88be13f41d..0c8535f2de 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -814,7 +814,7 @@ void tst_QSslCertificate::task256066toPem() void tst_QSslCertificate::nulInCN() { -#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) +#if QT_CONFIG(securetransport) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList<QSslCertificate> certList = @@ -833,7 +833,7 @@ void tst_QSslCertificate::nulInCN() void tst_QSslCertificate::nulInSan() { -#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) +#if QT_CONFIG(securetransport) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList<QSslCertificate> certList = @@ -968,7 +968,7 @@ void tst_QSslCertificate::subjectAndIssuerAttributes() void tst_QSslCertificate::verify() { -#ifdef QT_SECURETRANSPORT +#if QT_CONFIG(securetransport) QSKIP("Not implemented in SecureTransport"); #endif QList<QSslError> errors; diff --git a/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes128.pem b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes128.pem new file mode 100644 index 0000000000..1a8751874e --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes128.pem @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,A2A6F6BA67CFB2A992BA4FD3A0984B59 + +L5G1mwcXwW30lFty1HaEHlswFXAGk9+qf0TdYYNAAvVrsTMgfMq/6xM5XWo3IgbN +gG4K6T57gQkAywn+upqMHobB+7qc3DRzYlrm89gb74gHOe95l/iUJp4ii+ROLcmY +fg/vNmDSB/D0eM91WfwId7ticYD29+BUbbnqSYyY2S7K7DytYLpXqg3u335GYCdT +JwOsgcgbOICytkgK6c9ZDF3IrkzvWospVuiG5IfpLQkUXlJO3YGJ/oGf1BXnRd/b +kTzUiimUVunX62muHaUXKkAmXS8FCdB0puI+52pzLJ5FHdFxCcnwSG09TmoXbwwa +KoNM+IshNHPBGM7QxflVbSDxDaF1FWLwWSb8+Fhb2fTpfEGMxRCQ8HB1ZeMV4E5W +DSiNhih8ziC0k957ZYv8iuLanoM1YYIdToHeBwjyBJA836eIcq/ElY2QtKUq5PRw ++sU1BdG+f9rf4iAPHpgWZAKFmJ42ya71bEEVAmfysAOPuc4hpn3SsDTtihm9RKc9 +l7LWJHaTnTu6yJA+vMJwAmPWg+IdG5vntbb93X4cgl5ZadBySRtv37wWyQPnQcFh +ytX8z2CJNIFJb0ik8bXc39zOxExoTu/o86IuVJ87jFdS1wz3PRek6dJdl15icx76 +yAT0YB2/ZlRcRrO9hSm0D6P+sLOh//dyhhFAlUrDxqrKngI3KF4kgIrSlva3wmx2 +t16SiUKu6FGQZk6/KYOV27Cy+8UJEqlrNJzy+wSFi26d6e6xWTIR2ItzQCxhYDmq +Tpx0Mh0ml2+bgrKRoDAL5z6UNy0Pc6bYQjvMznIeiuGvL8bAKTDUFwbmrZqNScsl +tW7yNZG9iSJnAZGMTxuOhSvJRpQkxIcLICd+lsUxWZ2YvFxtSORuRNSwaC7oxtTD +gIXV08ayoDbDmcguqTXWuCxtguxNANjhsUOetNHL8iP8QFrzAd5Ith9FgASCIBJJ +3X7vL2YGc3E6DlAJE01loqySU/cnu6/zQapLB9BIzdtoLliwdrJ7PS8FSsBDfZ2X +i6/7gb1jxYkJAS1NqrUMJw6BphRAwF8ny+FtPJ23Oaf+1vRIGiHsh8qw6XBfwFw9 +vtsUUL19r+8zMpvIB6gf34TLuM7AW7idu3c/486EWgZBDL3mOTd3fsyADKv/HCk7 +c8M2dsafxI6QkTlWsB8G5vkZ8lCGKHjrmPWjfD7NXi+CvXIrDY+gOeVN3PlQCU/2 +zF2vIxKtR0CXuxLzIjFhIgTYR5G5ZnddMmHeVkZdPRl7szGtrxOA4QGJQ6ZT4W2e +O1whVU2KB0aBYskhClimapM5ypRkcNQ97cUR6/iNgdgSLqxGHCGeMR9bEyLl7/wr +M0XeDjdVfm/Tj548oHgb0SKLsfL6nnKwqB2viKj81moK9A/wO1Ec9RNaw0jtp2j3 +VIUnPj0GqEjnkHc2jWY2yt4SD6e2AZHwLyWi1q3pixZo1CFiEgFXxwNyYwyeJ6jV +CJHPRzoNjZ8dkvgRjsXdnWwN316JBNVcH8k7CCmg/8Gq3yAojXG1z8VJZ06GHckd +meCL1t89OgwIAmIsysKu7+DrKtSlhkQclZmdG6IrQzuPKaHzTPTDgg3ef3jQ4YQO +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes192.pem b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes192.pem new file mode 100644 index 0000000000..db74877a5a --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes192.pem @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CBC,B408346ADE790F8CF0C902A4F0712B34 + +SwzPBGxmwW2JddOyug1LrWjlZn8siSp5yezjK1x/z2+J2r/vvH8OjGnA387tFtae +WVTmhT1ixQXMDI1UJuKx0gzrG2449c+BUVe2VXFPLZ2ocSgoXbBpVkfhEqtLAn91 +MSOpQMxvobQKltKhxgXGvuBJwhwfT7yK5HamohFGbxLUh4Dh+NBXwoYH4Qt+kM7C +kV8VIKvkr/QAL/SRxNoY8rVResPgYvUjdtiGSNZ6CZhNRu42Q2FqbH817cE0NDsN +il/xvWu4T/6VY1KpwMad/v6BhO45EeKz7YjbF/3Y5jj2JV9r45uf79lM9htMBw0d +L+Cc3YHeFffgU8NZo0+iUoroXcb7mjWNmgYksbkaZPbLG383YXAXwbkQS7zDMVIx +QhXn9w+78hNmEV/7PQ8mGXHEFwnfSR05phXoj8IyL5v0grRMA2dsjfxCgfQjH+kc +Miwr5pD/Flw175OpPFCb2qladdTKoIWiVShspbteoRC0EuiWHzkl5z6Tneyb/sam +yduLmSYD+RA6OBgUPY95Xm4AowlFFsuV/fxYZ53rFf4cZn9Z6VBVmvIEmapV7CtB +JzyIVclocwM0ag5u/esdEt/jndJq9chZlIsDS30y3gP6Rlqk5mj90DAs98l28FVG +WY9jP0babk8mxjYCcnAy7ikUc0D+vJVO6OTmfO3dkGjLpMBM6OlvfhN/0qeXrMDI +nU2qOshUrVna2kRe6FrcvosFTD8wvQ1/BjmCp1iWWsGdc/q1BqI3pgOlgq3TYfl6 +iUJoji3V2iexH+GPkHsrs+kii1clsO2tgIP7doIooSVkcTsRTHHxKeeHn3qL2028 +pTvieIFD/T4biLZ9Q8sX3XWiHNmXZlCx8lX8MDjTavWES8gY4H5Sr6FjRMy1qpZY +5w1aAyJ9YZ0J/jLPmFxt8mWgqHPiPlrQkryBBE3l1MSQ/hCEwlf9dP8a+ayINfd7 +3yNkHKjZ5fuoA+TZUQb/fyVM5o1zJ8ML01PaXWrMEgr3b36QL+Ivo2Rpnp9FpwuH +E405cwCEy5fNSyhHFqqatCbsPl80nkP8OpW6jdWvNy9u0Ap9PS+MbHGq/pfkaazl +fbKGOckrENzEXi6Uj/yY/0sMtbTJuC70n09X3edHyhl/RJPPUoNnwDM5W1FHfS3r +qqSOl/r3y5pEErRdBpR4wEgB7DCLBALGDPfXNAAga4ez/Z2X9Zj234+4ZbUzWoLN +1ER0QYyxLN7oz1qMA15J7nRyRIhDXNlXjyISOqy26T6/d4X0M+6RhNWfT/MHAjJ8 +6ogoGlQUITV3gPO4R6+FGZMF4R6zZXuKVtOXyzRwWnCLfo4gzBHmq+5mmCjGWRq8 +rSSkc6334bYuZOaEoR5EM5sh6ewkjSDPRrKR7EHO02YbiscyT/99TwT5pdIOPK3u +2T6/40fSmCWQyBLuWxV9CMD+rB/q8Ja5KisEseck7PgI2pMmHfiD5yQXhKR9eDrB +sRqZxjgRYxup+/0CIBshL8s1R88xelhXyIKyqFfVudM09yAZxEJLQhpDZ27g45ea +FMX2Ve+ah2NjYBgzAhwKouWg5RyWb6X99NsrCEU75fn/ek86LGs3FxRgB4Uv7Udv +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes256.pem b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes256.pem new file mode 100644 index 0000000000..3d96b3166e --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase-aes256.pem @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,0F2F4695C8FFA35F4076FA0273A3A4E3 + +GCnMcAhhGuNkJ7SSMBrgNOaDfRtG22J0mdf/0VbrMOJF40P13YBjN3Kd6LpTqBya +TCIaxQqtfjH1ffhJk8qhwG7uJFGgcY9i0dkrEYklgThzTVqHp7FsQ2jjgJs5HKpc +euuVD1bxtuc9qI2hq4miA7Z/uDe3M34n+3xcpqccWS1dLFNFZ+fIDwIazfDCu3ah +fUQHDeWLwOqYiQxhUjjrHpZkI1FE2JYZFaf4zIagIIgzI2O+33fgbrTSoeN5meRs +F7V2fhDpyEoIlchwAmp6HE6ngtKP4Ecju00yn99AO42fn097yEVwvGFClQTaIzur +aPEtuKZ4kdc/lmzL2tqNcZckq28ZxpeMq0Fgdcpeg5sDcut811scOjQLFs551On1 +j3E1WfiLoBLKgd9cgmCrZb8hMO+UjcCaV7Jv3T9vDrbvhWs/YhTTwo8UFVplh7Vx +R1h3cKfzlbtOC5WHXGNK5dBu7SnpEk0+pscY5cxTrzN0odjMbbsjZQmKDZXbmZON +USzG3Qtafm6Nw/jwQeIjeqaxSho6xGdadTteGaURw6iGio3h0c6/dHayCsxye4tk +vODa0ZdJASwVh1605qDk9n/iYUT5B46KJCYwO/iN2kUmOcUcZeBqEfV1GfRmepZJ +bwM4sipzE15hOJ5DKSkHWnSlByRMAdSrMxZWraKUczn5frEBAqEFLlBAvf/FnjWa +yZJitgryCI2Y2bww1DEMnTCX345kUQIFmmjbzTIXnM28gW+fR3Br9dCf2FAsLNKr +tru1cYXocPaCUHEqS+XZqVb6BQVQ11YAAde0+x9RknJgsBc9Y7TLobaDBvrV5/nK +T3vm8el08upum6qPTPh6Z0zBbjx4sp6DYT977N1dYeH4n+0JqcSwIeZg/VAdG0RL +GzgZVADpiRlStmy65W95KExBjbO0tRTVk/nB1U1nfLbsswp9EKxXgwtpE/ECeTOi +hzeJBSsXGZ/ZXu/y+NlIu0B/GasFbfrHKslSSrUPTjGEtaEbLNiOEu2Etu3lRcMZ +oDtMxgNR0TUgCS5nte8lLauYYfB6IuxZXpvJdcI5ushqdOJvvYgJ9Yb2ZPlY8Bt5 +C92Ga69aPcMYk24BPpe15eBbXMsFF8RF+CprVoUPCc+PcuROtxdt+rqoqjQeZPmV +WQqq+pT2bychpwD7U5jxQnu4u2m+zeBXyk80euBbwEld9BCgfk9mFj6CdBJSEiGV +qL0ivxd3mDaIKPGd5tcbrOMK2uD7duZY7FrQpAYgryoQJoUHccL7cr9fDC75akHg +AbrG1+vAYEla/y+SlOg5VTHhiuIl17ZGMViXSqh7iqnnD0dNsZ/HDvk3XouhNxQy +RQmfdqyIqLuAcfWwQxCQ2E/oMUIHjNhyYmfLVLVGsfxuevMa1eJv7rZ5vIkD2Vpe +4VveZkNDSpCCNqnvub8+bMW+UXyzbxEZbK5PLkRp7cvtKdA5CUbTlT4060IV0YZ1 +vfMtzXRw8JDD9c1F1WF14afk+y9kvZN88XOH12bSKj+Re06Xx7OzuYU8fclq/pZB +UZVtRETFnLgb8neMuz3vCoPWK/DSHDZGAAicxq7vTljyoU/QP71Dw7UJIAuYx6Mc +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index 28476fce5b..f94756ed73 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -30,6 +30,7 @@ #include <QtTest/QtTest> #include <qsslkey.h> #include <qsslsocket.h> +#include <QScopeGuard> #include <QtNetwork/qhostaddress.h> #include <QtNetwork/qnetworkproxy.h> @@ -233,15 +234,50 @@ void tst_QSslKey::constructorHandle() QByteArray passphrase; if (QByteArray(QTest::currentDataTag()).contains("-pkcs8-")) passphrase = "1234"; + BIO* bio = q_BIO_new(q_BIO_s_mem()); q_BIO_write(bio, pem.constData(), pem.length()); - QSslKey key(func(bio, nullptr, nullptr, static_cast<void *>(passphrase.data())), type); + EVP_PKEY *origin = func(bio, nullptr, nullptr, static_cast<void *>(passphrase.data())); +#if QT_CONFIG(opensslv11) + q_EVP_PKEY_up_ref(origin); +#endif + QSslKey key(origin, type); +#if !QT_CONFIG(opensslv11) + q_BIO_write(bio, pem.constData(), pem.length()); + origin = func(bio, nullptr, nullptr, static_cast<void *>(passphrase.data())); +#endif q_BIO_free(bio); + EVP_PKEY *handle = q_EVP_PKEY_new(); + switch (algorithm) { + case QSsl::Rsa: + q_EVP_PKEY_set1_RSA(handle, static_cast<RSA *>(key.handle())); + break; + case QSsl::Dsa: + q_EVP_PKEY_set1_DSA(handle, static_cast<DSA *>(key.handle())); + break; + case QSsl::Dh: + q_EVP_PKEY_set1_DH(handle, static_cast<DH *>(key.handle())); + break; +#ifndef OPENSSL_NO_EC + case QSsl::Ec: + q_EVP_PKEY_set1_EC_KEY(handle, static_cast<EC_KEY *>(key.handle())); + break; +#endif + default: + break; + } + + auto cleanup = qScopeGuard([origin, handle] { + q_EVP_PKEY_free(origin); + q_EVP_PKEY_free(handle); + }); + QVERIFY(!key.isNull()); QCOMPARE(key.algorithm(), algorithm); QCOMPARE(key.type(), type); QCOMPARE(key.length(), length); + QCOMPARE(q_EVP_PKEY_cmp(origin, handle), 1); #endif } @@ -430,15 +466,25 @@ void tst_QSslKey::toEncryptedPemOrDer() void tst_QSslKey::passphraseChecks_data() { QTest::addColumn<QString>("fileName"); - - QTest::newRow("DES") << (testDataDir + "rsa-with-passphrase-des.pem"); - QTest::newRow("3DES") << (testDataDir + "rsa-with-passphrase-3des.pem"); - QTest::newRow("RC2") << (testDataDir + "rsa-with-passphrase-rc2.pem"); + QTest::addColumn<QByteArray>("passphrase"); + + const QByteArray pass("123"); + const QByteArray aesPass("1234"); + + QTest::newRow("DES") << QString(testDataDir + "rsa-with-passphrase-des.pem") << pass; + QTest::newRow("3DES") << QString(testDataDir + "rsa-with-passphrase-3des.pem") << pass; + QTest::newRow("RC2") << QString(testDataDir + "rsa-with-passphrase-rc2.pem") << pass; +#if (!defined(QT_NO_OPENSSL) && !defined(OPENSSL_NO_AES)) || (defined(QT_NO_OPENSSL) && QT_CONFIG(ssl)) + QTest::newRow("AES128") << QString(testDataDir + "rsa-with-passphrase-aes128.pem") << aesPass; + QTest::newRow("AES192") << QString(testDataDir + "rsa-with-passphrase-aes192.pem") << aesPass; + QTest::newRow("AES256") << QString(testDataDir + "rsa-with-passphrase-aes256.pem") << aesPass; +#endif // (OpenSSL && AES) || generic backend } void tst_QSslKey::passphraseChecks() { QFETCH(QString, fileName); + QFETCH(QByteArray, passphrase); QFile keyFile(fileName); QVERIFY(keyFile.exists()); @@ -471,7 +517,7 @@ void tst_QSslKey::passphraseChecks() keyFile.open(QIODevice::ReadOnly); else keyFile.reset(); - QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, "123"); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, passphrase); QVERIFY(!key.isNull()); // correct passphrase } } @@ -516,79 +562,135 @@ void tst_QSslKey::encrypt_data() QTest::addColumn<QByteArray>("key"); QTest::addColumn<QByteArray>("plainText"); QTest::addColumn<QByteArray>("cipherText"); + QTest::addColumn<QByteArray>("iv"); + QByteArray iv("abcdefgh"); QTest::newRow("DES-CBC, length 0") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray() - << QByteArray::fromHex("956585228BAF9B1F"); + << QByteArray::fromHex("956585228BAF9B1F") + << iv; QTest::newRow("DES-CBC, length 1") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(1, 'a') - << QByteArray::fromHex("E6880AF202BA3C12"); + << QByteArray::fromHex("E6880AF202BA3C12") + << iv; QTest::newRow("DES-CBC, length 2") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(2, 'a') - << QByteArray::fromHex("A82492386EED6026"); + << QByteArray::fromHex("A82492386EED6026") + << iv; QTest::newRow("DES-CBC, length 3") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(3, 'a') - << QByteArray::fromHex("90B76D5B79519CBA"); + << QByteArray::fromHex("90B76D5B79519CBA") + << iv; QTest::newRow("DES-CBC, length 4") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(4, 'a') - << QByteArray::fromHex("63E3DD6FED87052A"); + << QByteArray::fromHex("63E3DD6FED87052A") + << iv; QTest::newRow("DES-CBC, length 5") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(5, 'a') - << QByteArray::fromHex("03ACDB0EACBDFA94"); + << QByteArray::fromHex("03ACDB0EACBDFA94") + << iv; QTest::newRow("DES-CBC, length 6") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(6, 'a') - << QByteArray::fromHex("7D95024E42A3A88A"); + << QByteArray::fromHex("7D95024E42A3A88A") + << iv; QTest::newRow("DES-CBC, length 7") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(7, 'a') - << QByteArray::fromHex("5003436B8A8E42E9"); + << QByteArray::fromHex("5003436B8A8E42E9") + << iv; QTest::newRow("DES-CBC, length 8") << QSslKeyPrivate::DesCbc << QByteArray("01234567") << QByteArray(8, 'a') - << QByteArray::fromHex("E4C1F054BF5521C0A4A0FD4A2BC6C1B1"); + << QByteArray::fromHex("E4C1F054BF5521C0A4A0FD4A2BC6C1B1") + << iv; QTest::newRow("DES-EDE3-CBC, length 0") << QSslKeyPrivate::DesEde3Cbc << QByteArray("0123456789abcdefghijklmn") << QByteArray() - << QByteArray::fromHex("3B2B4CD0B0FD495F"); + << QByteArray::fromHex("3B2B4CD0B0FD495F") + << iv; QTest::newRow("DES-EDE3-CBC, length 8") << QSslKeyPrivate::DesEde3Cbc << QByteArray("0123456789abcdefghijklmn") << QByteArray(8, 'a') - << QByteArray::fromHex("F2A5A87763C54A72A3224103D90CDB03"); + << QByteArray::fromHex("F2A5A87763C54A72A3224103D90CDB03") + << iv; QTest::newRow("RC2-40-CBC, length 0") << QSslKeyPrivate::Rc2Cbc << QByteArray("01234") << QByteArray() - << QByteArray::fromHex("6D05D52392FF6E7A"); + << QByteArray::fromHex("6D05D52392FF6E7A") + << iv; QTest::newRow("RC2-40-CBC, length 8") << QSslKeyPrivate::Rc2Cbc << QByteArray("01234") << QByteArray(8, 'a') - << QByteArray::fromHex("75768E64C5749072A5D168F3AFEB0005"); + << QByteArray::fromHex("75768E64C5749072A5D168F3AFEB0005") + << iv; QTest::newRow("RC2-64-CBC, length 0") << QSslKeyPrivate::Rc2Cbc << QByteArray("01234567") << QByteArray() - << QByteArray::fromHex("ADAE6BF70F420130"); + << QByteArray::fromHex("ADAE6BF70F420130") + << iv; QTest::newRow("RC2-64-CBC, length 8") << QSslKeyPrivate::Rc2Cbc << QByteArray("01234567") << QByteArray(8, 'a') - << QByteArray::fromHex("C7BF5C80AFBE9FBEFBBB9FD935F6D0DF"); + << QByteArray::fromHex("C7BF5C80AFBE9FBEFBBB9FD935F6D0DF") + << iv; QTest::newRow("RC2-128-CBC, length 0") << QSslKeyPrivate::Rc2Cbc << QByteArray("012345679abcdefg") << QByteArray() - << QByteArray::fromHex("1E965D483A13C8FB"); + << QByteArray::fromHex("1E965D483A13C8FB") + << iv; QTest::newRow("RC2-128-CBC, length 8") << QSslKeyPrivate::Rc2Cbc << QByteArray("012345679abcdefg") << QByteArray(8, 'a') - << QByteArray::fromHex("5AEC1A5B295660B02613454232F7DECE"); + << QByteArray::fromHex("5AEC1A5B295660B02613454232F7DECE") + << iv; + +#if (!defined(QT_NO_OPENSSL) && !defined(OPENSSL_NO_AES)) || (defined(QT_NO_OPENSSL) && QT_CONFIG(ssl)) + // AES needs a longer IV + iv = QByteArray("abcdefghijklmnop"); + QTest::newRow("AES-128-CBC, length 0") + << QSslKeyPrivate::Aes128Cbc << QByteArray("012345679abcdefg") + << QByteArray() + << QByteArray::fromHex("28DE1A9AA26601C30DD2527407121D1A") + << iv; + QTest::newRow("AES-128-CBC, length 8") + << QSslKeyPrivate::Aes128Cbc << QByteArray("012345679abcdefg") + << QByteArray(8, 'a') + << QByteArray::fromHex("08E880B1BA916F061C1E801D7F44D0EC") + << iv; + + QTest::newRow("AES-192-CBC, length 0") + << QSslKeyPrivate::Aes192Cbc << QByteArray("0123456789abcdefghijklmn") + << QByteArray() + << QByteArray::fromHex("E169E0E205CDC2BA895B7CF6097673B1") + << iv; + QTest::newRow("AES-192-CBC, length 8") + << QSslKeyPrivate::Aes192Cbc << QByteArray("0123456789abcdefghijklmn") + << QByteArray(8, 'a') + << QByteArray::fromHex("3A227D6A3A13237316D30AA17FF9B0A7") + << iv; + + QTest::newRow("AES-256-CBC, length 0") + << QSslKeyPrivate::Aes256Cbc << QByteArray("0123456789abcdefghijklmnopqrstuv") + << QByteArray() + << QByteArray::fromHex("4BAACAA0D22199C97DE206C465B7B14A") + << iv; + QTest::newRow("AES-256-CBC, length 8") + << QSslKeyPrivate::Aes256Cbc << QByteArray("0123456789abcdefghijklmnopqrstuv") + << QByteArray(8, 'a') + << QByteArray::fromHex("879C8C25EC135CDF0B14490A0A7C2F67") + << iv; +#endif // (OpenSSL && AES) || generic backend } void tst_QSslKey::encrypt() @@ -597,7 +699,7 @@ void tst_QSslKey::encrypt() QFETCH(QByteArray, key); QFETCH(QByteArray, plainText); QFETCH(QByteArray, cipherText); - QByteArray iv("abcdefgh"); + QFETCH(QByteArray, iv); #if defined(Q_OS_WINRT) || QT_CONFIG(schannel) QEXPECT_FAIL("RC2-40-CBC, length 0", "WinRT/Schannel treats RC2 as 128-bit", Abort); diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST index 555822d1e6..3ecd3d9dbb 100644 --- a/tests/auto/network/ssl/qsslsocket/BLACKLIST +++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST @@ -1,7 +1,23 @@ +[abortOnSslErrors] +windows +[deprecatedProtocols] +windows +[disabledProtocols] +windows +[protocol] +windows +[qtbug18498_peek] +windows +[setReadBufferSize] +windows +[spontaneousWrite] +windows +[sslErrors] windows [connectToHostEncrypted] osx-10.13 [setSslConfiguration] +windows osx-10.13 [connectToHostEncryptedWithVerificationPeerName] osx-10.13 diff --git a/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cert.pem b/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cert.pem new file mode 100644 index 0000000000..43c8794ce2 --- /dev/null +++ b/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIClTCCAf4CCQC2xMhNhwvATDANBgkqhkiG9w0BAQQFADCBjjELMAkGA1UEChMC +UXQxGTAXBgNVBAsTEENvcmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5v +Ym9keS5xdC5pbzENMAsGA1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UE +BhMCTk8xHDAaBgNVBAMUEyoudGVzdC1uZXQucXQubG9jYWwwHhcNMTgwNzAxMTgz +NjI3WhcNNDgwNjIzMTgzNjI3WjCBjjELMAkGA1UEChMCUXQxGTAXBgNVBAsTEENv +cmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5vYm9keS5xdC5pbzENMAsG +A1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UEBhMCTk8xHDAaBgNVBAMU +EyoudGVzdC1uZXQucXQubG9jYWwwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AM2q22/WNMmn8cC+5EEYGeICySLmp9W6Ay6eKHr0Xxp3X3epETuPfvAuxp7rOtkS +18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt93CxGBXMIChiMPAsFeYzGa/D6xzAkfcR +aJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJrgsgBfWrwHdxzAgMBAAEwDQYJKoZIhvcN +AQEEBQADgYEAZu/lQPy8PXeyyYGamOVms/FZKJ48BH1y8KC3BeBU5FYnhvgG7pz8 +Wz9JKvt2t/r45wQeAkNL6HnGUBhPJsHMjPHl5KktqN+db3D+FQygBeS2V1+zmC0X +UZNRE4aWiHvt1Lq+pTx89SOMOpfqWfh4qTQKiE5jC2V4DeCNQ3u7uI8= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro index 1260dc9410..51fcff9a8d 100644 --- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro @@ -18,3 +18,10 @@ TESTDATA += certs DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(qtConfig(private_tests)) + +# DOCKERTODO: it's 'linux' because it requires cyrus, which +# is linux-only for now ... +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = squid danted cyrus apache2 echo +} diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 1c27901844..7912063bc8 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -310,6 +310,21 @@ Q_DECLARE_METATYPE(tst_QSslSocket::PskConnectTestType) int tst_QSslSocket::loopLevel = 0; +namespace { + +QString httpServerCertChainPath() +{ + // DOCKERTODO: note how we use CA certificate on the real server. The docker container + // is using a different cert with a "special" CN. Check if it's important! +#ifdef QT_TEST_SERVER + return tst_QSslSocket::testDataDir + QStringLiteral("certs/qt-test-server-cert.pem"); +#else + return tst_QSslSocket::testDataDir + QStringLiteral("certs/qt-test-server-cacert.pem"); +#endif // QT_TEST_SERVER +} + +} // unnamed namespace + tst_QSslSocket::tst_QSslSocket() { #ifndef QT_NO_SSL @@ -363,8 +378,19 @@ void tst_QSslSocket::initTestCase() qDebug("Using SSL library %s (%ld)", qPrintable(QSslSocket::sslLibraryVersionString()), QSslSocket::sslLibraryVersionNumber()); +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 443)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 993)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 13)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); -#endif +#endif // QT_TEST_SERVER +#endif // QT_NO_SSL } void tst_QSslSocket::init() @@ -373,28 +399,29 @@ void tst_QSslSocket::init() if (setProxy) { #ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); - QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + const QString socksProxyAddr = QtNetworkSettings::socksProxyServerIp().toString(); + const QString httpProxyAddr = QtNetworkSettings::httpProxyServerIp().toString(); QNetworkProxy proxy; switch (proxyType) { case Socks5Proxy: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, fluke, 1080); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksProxyAddr, 1080); break; case Socks5Proxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, fluke, 1081); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksProxyAddr, 1081); break; case HttpProxy | NoAuth: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3128); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddr, 3128); break; case HttpProxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3129); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddr, 3129); break; case HttpProxy | AuthNtlm: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, fluke, 3130); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, httpProxyAddr, 3130); break; } QNetworkProxy::setApplicationProxy(proxy); @@ -555,7 +582,7 @@ void tst_QSslSocket::simpleConnect() connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost(QtNetworkSettings::serverName(), 993); + socket.connectToHost(QtNetworkSettings::imapServerName(), 993); QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); enterLoop(10); @@ -610,7 +637,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost(QtNetworkSettings::serverName(), 993); + socket.connectToHost(QtNetworkSettings::imapServerName(), 993); QVERIFY(socket.state() != QAbstractSocket::UnconnectedState); // something must be in progress enterLoop(10); @@ -642,7 +669,7 @@ void tst_QSslSocket::sslErrors_data() QString name = QtNetworkSettings::serverLocalName(); QTest::newRow(qPrintable(name)) << name << 993; - name = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + name = QtNetworkSettings::httpServerIp().toString(); QTest::newRow(qPrintable(name)) << name << 443; } @@ -659,7 +686,20 @@ void tst_QSslSocket::sslErrors() QSignalSpy sslErrorsSpy(socket.data(), SIGNAL(sslErrors(QList<QSslError>))); QSignalSpy peerVerifyErrorSpy(socket.data(), SIGNAL(peerVerifyError(QSslError))); - socket->connectToHostEncrypted(host, port); +#ifdef QT_TEST_SERVER + // On the old test server we had the same certificate on different services. + // The idea of this test is to fail with 'HostNameMismatch', when we're using + // either serverLocalName() or IP address directly. With Docker we connect + // to IMAP server, and we have to connect using imapServerName() and passing + // 'host' as peerVerificationName to the overload of connectToHostEncrypted(). + if (port == 993) { + socket->connectToHostEncrypted(QtNetworkSettings::imapServerName(), port, host); + } else +#endif // QT_TEST_SERVER + { + socket->connectToHostEncrypted(host, port); + } + if (!socket->waitForConnected()) QSKIP("Skipping flaky test - See QTBUG-29941"); socket->waitForEncrypted(10000); @@ -739,13 +779,13 @@ void tst_QSslSocket::connectToHostEncrypted() socket->setProtocol(QSsl::SslProtocol::TlsV1_1); #endif this->socket = socket.data(); - QVERIFY(socket->addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem")); + QVERIFY(socket->addCaCertificates(httpServerCertChainPath())); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND connect(socket.data(), SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(untrustedWorkaroundSlot(QList<QSslError>))); #endif - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); // This should pass unconditionally when using fluke's CA certificate. // or use untrusted certificate workaround @@ -758,7 +798,7 @@ void tst_QSslSocket::connectToHostEncrypted() QCOMPARE(socket->mode(), QSslSocket::SslClientMode); - socket->connectToHost(QtNetworkSettings::serverName(), 13); + socket->connectToHost(QtNetworkSettings::echoServerName(), 13); QCOMPARE(socket->mode(), QSslSocket::UnencryptedMode); @@ -776,14 +816,18 @@ void tst_QSslSocket::connectToHostEncryptedWithVerificationPeerName() #endif this->socket = socket.data(); - socket->addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem"); + socket->addCaCertificates(httpServerCertChainPath()); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND connect(socket.data(), SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(untrustedWorkaroundSlot(QList<QSslError>))); #endif - // connect to the server with its local name, but use the full name for verification. - socket->connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443, QtNetworkSettings::serverName()); +#ifdef QT_TEST_SERVER + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443, QtNetworkSettings::httpServerName()); +#else + // Connect to the server with its local name, but use the full name for verification. + socket->connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443, QtNetworkSettings::httpServerName()); +#endif // This should pass unconditionally when using fluke's CA certificate. QFETCH_GLOBAL(bool, setProxy); @@ -805,7 +849,7 @@ void tst_QSslSocket::sessionCipher() this->socket = socket.data(); connect(socket.data(), SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); QVERIFY(socket->sessionCipher().isNull()); - socket->connectToHost(QtNetworkSettings::serverName(), 443 /* https */); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443 /* https */); QVERIFY2(socket->waitForConnected(10000), qPrintable(socket->errorString())); QVERIFY(socket->sessionCipher().isNull()); socket->startClientEncryption(); @@ -840,12 +884,12 @@ void tst_QSslSocket::localCertificate() // values. This test should just run the codepath inside qsslsocket_openssl.cpp QSslSocketPtr socket = newSocket(); - QList<QSslCertificate> localCert = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> localCert = QSslCertificate::fromPath(httpServerCertChainPath()); socket->setCaCertificates(localCert); socket->setLocalCertificate(testDataDir + "certs/fluke.cert"); socket->setPrivateKey(testDataDir + "certs/fluke.key"); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH_GLOBAL(bool, setProxy); if (setProxy && !socket->waitForEncrypted(10000)) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -868,8 +912,7 @@ void tst_QSslSocket::peerCertificateChain() QSslSocketPtr socket = newSocket(); this->socket = socket.data(); - - QList<QSslCertificate> caCertificates = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> caCertificates = QSslCertificate::fromPath(httpServerCertChainPath()); QCOMPARE(caCertificates.count(), 1); socket->addCaCertificates(caCertificates); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND @@ -877,7 +920,7 @@ void tst_QSslSocket::peerCertificateChain() this, SLOT(untrustedWorkaroundSlot(QList<QSslError>))); #endif - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QCOMPARE(socket->mode(), QSslSocket::UnencryptedMode); QVERIFY(socket->peerCertificateChain().isEmpty()); QFETCH_GLOBAL(bool, setProxy); @@ -906,7 +949,7 @@ void tst_QSslSocket::peerCertificateChain() QVERIFY(socket->waitForDisconnected()); // now do it again back to the original server - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QCOMPARE(socket->mode(), QSslSocket::UnencryptedMode); QVERIFY(socket->peerCertificateChain().isEmpty()); QVERIFY2(socket->waitForConnected(10000), qPrintable(socket->errorString())); @@ -945,13 +988,13 @@ void tst_QSslSocket::privateKeyOpaque() // values. This test should just run the codepath inside qsslsocket_openssl.cpp QSslSocketPtr socket = newSocket(); - QList<QSslCertificate> localCert = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> localCert = QSslCertificate::fromPath(httpServerCertChainPath()); socket->setCaCertificates(localCert); socket->setLocalCertificate(testDataDir + "certs/fluke.cert"); socket->setPrivateKey(QSslKey(reinterpret_cast<Qt::HANDLE>(pkey))); socket->setPeerVerifyMode(QSslSocket::QueryPeer); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH_GLOBAL(bool, setProxy); if (setProxy && !socket->waitForEncrypted(10000)) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -965,7 +1008,7 @@ void tst_QSslSocket::protocol() QSslSocketPtr socket = newSocket(); this->socket = socket.data(); - QList<QSslCertificate> certs = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> certs = QSslCertificate::fromPath(httpServerCertChainPath()); socket->setCaCertificates(certs); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND @@ -979,13 +1022,13 @@ void tst_QSslSocket::protocol() // qt-test-server allows TLSV1. socket->setProtocol(QSsl::TlsV1_0); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) @@ -998,13 +1041,13 @@ void tst_QSslSocket::protocol() // qt-test-server probably doesn't allow TLSV1.1 socket->setProtocol(QSsl::TlsV1_1); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) @@ -1016,13 +1059,13 @@ void tst_QSslSocket::protocol() // qt-test-server probably doesn't allows TLSV1.2 socket->setProtocol(QSsl::TlsV1_2); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) @@ -1036,13 +1079,13 @@ void tst_QSslSocket::protocol() // qt-test-server probably doesn't allow TLSV1.3 socket->setProtocol(QSsl::TlsV1_3); QCOMPARE(socket->protocol(), QSsl::TlsV1_3); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("TLS 1.3 is not supported by the test server or the test is flaky - see QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_3); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_3); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) @@ -1055,13 +1098,13 @@ void tst_QSslSocket::protocol() // qt-test-server allows SSLV3, so it allows AnyProtocol. socket->setProtocol(QSsl::AnyProtocol); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->abort(); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) @@ -1073,13 +1116,13 @@ void tst_QSslSocket::protocol() // qt-test-server allows TlsV1, so it allows TlsV1SslV3 socket->setProtocol(QSsl::TlsV1SslV3); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); - socket->connectToHost(QtNetworkSettings::serverName(), 443); + socket->connectToHost(QtNetworkSettings::httpServerName(), 443); if (setProxy && !socket->waitForConnected()) QSKIP("Skipping flaky test - See QTBUG-29941"); socket->startClientEncryption(); @@ -1491,7 +1534,7 @@ void tst_QSslSocket::setSslConfiguration_data() QTest::newRow("empty") << QSslConfiguration() << false; QSslConfiguration conf = QSslConfiguration::defaultConfiguration(); QTest::newRow("default") << conf << false; // does not contain test server cert - QList<QSslCertificate> testServerCert = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> testServerCert = QSslCertificate::fromPath(httpServerCertChainPath()); conf.setCaCertificates(testServerCert); QTest::newRow("set-root-cert") << conf << true; conf.setProtocol(QSsl::SecureProtocols); @@ -1510,7 +1553,7 @@ void tst_QSslSocket::setSslConfiguration() socket->setProtocol(QSsl::SslProtocol::TlsV1_1); #endif this->socket = socket.data(); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH(bool, works); QFETCH_GLOBAL(bool, setProxy); if (setProxy && (socket->waitForEncrypted(10000) != works)) @@ -1530,7 +1573,7 @@ void tst_QSslSocket::waitForEncrypted() this->socket = socket.data(); connect(this->socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH_GLOBAL(bool, setProxy); if (setProxy && !socket->waitForEncrypted(10000)) @@ -1549,7 +1592,7 @@ void tst_QSslSocket::waitForEncryptedMinusOne() this->socket = socket.data(); connect(this->socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH_GLOBAL(bool, setProxy); if (setProxy && !socket->waitForEncrypted(-1)) @@ -1565,7 +1608,7 @@ void tst_QSslSocket::waitForConnectedEncryptedReadyRead() this->socket = socket.data(); connect(this->socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); + socket->connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993); QVERIFY2(socket->waitForConnected(10000), qPrintable(socket->errorString())); QFETCH_GLOBAL(bool, setProxy); @@ -1597,7 +1640,7 @@ void tst_QSslSocket::addDefaultCaCertificate() // Reset the global CA chain QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates()); - QList<QSslCertificate> flukeCerts = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> flukeCerts = QSslCertificate::fromPath(httpServerCertChainPath()); QCOMPARE(flukeCerts.size(), 1); QList<QSslCertificate> globalCerts = QSslSocket::defaultCaCertificates(); QVERIFY(!globalCerts.contains(flukeCerts.first())); @@ -1968,7 +2011,7 @@ void tst_QSslSocket::setReadBufferSize_task_250027() QSslSocketPtr socket = newSocket(); socket->setReadBufferSize(1000); // limit to 1 kb/sec socket->ignoreSslErrors(); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); socket->ignoreSslErrors(); QVERIFY2(socket->waitForConnected(10*1000), qPrintable(socket->errorString())); if (setProxy && !socket->waitForEncrypted(10*1000)) @@ -1981,7 +2024,7 @@ void tst_QSslSocket::setReadBufferSize_task_250027() // provoke a response by sending a request socket->write("GET /qtest/fluke.gif HTTP/1.0\n"); // this file is 27 KB socket->write("Host: "); - socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); + socket->write(QtNetworkSettings::httpServerName().toLocal8Bit().constData()); socket->write("\n"); socket->write("Connection: close\n"); socket->write("\n"); @@ -2096,7 +2139,7 @@ protected: // delayed reading data QTest::qSleep(100); - if (!socket->waitForReadyRead(2000)) + if (!socket->waitForReadyRead(2000) && socket->bytesAvailable() == 0) return; // error socket->readAll(); dataReadSemaphore.release(); @@ -2167,7 +2210,7 @@ void tst_QSslSocket::waitForMinusOne() socket.write("How are you doing?"); QVERIFY(socket.bytesToWrite() != 0); QVERIFY(socket.waitForBytesWritten(-1)); - QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2000)); + QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2500)); // third verification: it should wait for 100 ms: QVERIFY(socket.waitForReadyRead(-1)); @@ -2232,7 +2275,7 @@ void tst_QSslSocket::verifyMode() socket.setPeerVerifyMode(QSslSocket::VerifyPeer); QCOMPARE(socket.peerVerifyMode(), QSslSocket::VerifyPeer); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); if (socket.waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -2271,7 +2314,7 @@ void tst_QSslSocket::verifyDepth() void tst_QSslSocket::disconnectFromHostWhenConnecting() { QSslSocketPtr socket = newSocket(); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); + socket->connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993); socket->ignoreSslErrors(); socket->write("XXXX LOGOUT\r\n"); QAbstractSocket::SocketState state = socket->state(); @@ -2300,7 +2343,7 @@ void tst_QSslSocket::disconnectFromHostWhenConnecting() void tst_QSslSocket::disconnectFromHostWhenConnected() { QSslSocketPtr socket = newSocket(); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); + socket->connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993); socket->ignoreSslErrors(); if (!socket->waitForEncrypted(5000)) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -2387,13 +2430,13 @@ void tst_QSslSocket::resetProxy() // make sure the connection works, and then set a nonsense proxy, and then // make sure it does not work anymore QSslSocket socket; - socket.addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem"); + socket.addCaCertificates(httpServerCertChainPath()); socket.setProxy(goodProxy); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket.waitForConnected(10000), qPrintable(socket.errorString())); socket.abort(); socket.setProxy(badProxy); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QVERIFY(! socket.waitForConnected(10000)); // don't forget to login @@ -2406,13 +2449,13 @@ void tst_QSslSocket::resetProxy() // set the nonsense proxy and make sure the connection does not work, // and then set the right proxy and make sure it works QSslSocket socket2; - socket2.addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem"); + socket2.addCaCertificates(httpServerCertChainPath()); socket2.setProxy(badProxy); - socket2.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket2.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QVERIFY(! socket2.waitForConnected(10000)); socket2.abort(); socket2.setProxy(goodProxy); - socket2.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket2.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QVERIFY2(socket2.waitForConnected(10000), qPrintable(socket.errorString())); #endif // QT_NO_NETWORKPROXY } @@ -2425,7 +2468,7 @@ void tst_QSslSocket::ignoreSslErrorsList_data() // construct the list of errors that we will get with the SSL handshake and that we will ignore QList<QSslError> expectedSslErrors; // fromPath gives us a list of certs, but it actually only contains one - QList<QSslCertificate> certs = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + QList<QSslCertificate> certs = QSslCertificate::fromPath(httpServerCertChainPath()); QSslError rightError(FLUKE_CERTIFICATE_ERROR, certs.at(0)); QSslError wrongError(FLUKE_CERTIFICATE_ERROR); @@ -2456,7 +2499,7 @@ void tst_QSslSocket::ignoreSslErrorsList() QFETCH(int, expectedSslErrorSignalCount); QSignalSpy sslErrorsSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError))); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); bool expectEncryptionSuccess = (expectedSslErrorSignalCount == 0); if (socket.waitForEncrypted(10000) != expectEncryptionSuccess) @@ -2487,7 +2530,7 @@ void tst_QSslSocket::ignoreSslErrorsListWithSlot() this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorListSlot(QList<QSslError>))); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH(int, expectedSslErrorSignalCount); bool expectEncryptionSuccess = (expectedSslErrorSignalCount == 0); @@ -2529,14 +2572,14 @@ void tst_QSslSocket::readFromClosedSocket() socket->setProtocol(QSsl::SslProtocol::TlsV1_1); #endif socket->ignoreSslErrors(); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); socket->ignoreSslErrors(); socket->waitForConnected(); socket->waitForEncrypted(); // provoke a response by sending a request socket->write("GET /qtest/fluke.gif HTTP/1.1\n"); socket->write("Host: "); - socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); + socket->write(QtNetworkSettings::httpServerName().toLocal8Bit().constData()); socket->write("\n"); socket->write("\n"); socket->waitForBytesWritten(); @@ -2560,7 +2603,7 @@ void tst_QSslSocket::writeBigChunk() this->socket = socket.data(); connect(this->socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QByteArray data; data.resize(1024*1024*10); // 10 MB @@ -2719,7 +2762,9 @@ void tst_QSslSocket::resume_data() QTest::newRow("DoNotIgnoreErrors") << false << QList<QSslError>() << false; QTest::newRow("ignoreAllErrors") << true << QList<QSslError>() << true; - QList<QSslCertificate> certs = QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"); + // Note, httpServerCertChainPath() it's ... because we use the same certificate on + // different services. We'll be actually connecting to IMAP server. + QList<QSslCertificate> certs = QSslCertificate::fromPath(httpServerCertChainPath()); QSslError rightError(FLUKE_CERTIFICATE_ERROR, certs.at(0)); QSslError wrongError(FLUKE_CERTIFICATE_ERROR); errorsList.append(wrongError); @@ -2752,7 +2797,7 @@ void tst_QSslSocket::resume() this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); - socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 993); + socket.connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993); QTestEventLoop::instance().enterLoop(10); QFETCH_GLOBAL(bool, setProxy); if (setProxy && QTestEventLoop::instance().timeout()) @@ -3255,14 +3300,14 @@ void tst_QSslSocket::verifyClientCertificate_data() void tst_QSslSocket::verifyClientCertificate() { -#ifdef QT_SECURETRANSPORT +#if QT_CONFIG(securetransport) // We run both client and server on the same machine, // this means, client can update keychain with client's certificates, // and server later will use the same certificates from the same // keychain thus making tests fail (wrong number of certificates, // success instead of failure etc.). QSKIP("This test can not work with Secure Transport"); -#endif +#endif // QT_CONFIG(securetransport) #ifdef Q_OS_WINRT QSKIP("Server-side encryption is not implemented on WinRT."); #endif @@ -3344,7 +3389,7 @@ void tst_QSslSocket::verifyClientCertificate() void tst_QSslSocket::readBufferMaxSize() { -#if defined(QT_SECURETRANSPORT) || QT_CONFIG(schannel) +#if QT_CONFIG(securetransport) || QT_CONFIG(schannel) // QTBUG-55170: // SecureTransport back-end was ignoring read-buffer // size limit, resulting (potentially) in a constantly @@ -3401,7 +3446,7 @@ void tst_QSslSocket::readBufferMaxSize() QCOMPARE(client->bytesAvailable() + readSoFar, message.size()); #else // Not needed, QSslSocket works correctly with other back-ends. -#endif +#endif // QT_CONFIG(securetransport) || QT_CONFIG(schannel) } void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, as it has some side effects @@ -3418,7 +3463,7 @@ void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, socket = client.data(); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); QFETCH_GLOBAL(bool, setProxy); if (setProxy && socket->waitForEncrypted(4000)) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -4127,7 +4172,7 @@ void tst_QSslSocket::forwardReadChannelFinished() }); connect(&socket, &QSslSocket::readChannelFinished, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop); - socket.connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443); + socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); enterLoop(10); QVERIFY(readChannelFinishedSpy.count()); } diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro index 05755ff606..8585a3c861 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -17,3 +17,9 @@ win32 { DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(qtConfig(private_tests)) + +# DOCKERTODO: linux, docker is disabled on macOS/Windows. +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = squid danted +} diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 25c2701f69..4199c0f465 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -102,7 +102,15 @@ void tst_QSslSocket_onDemandCertificates_member::initTestCase_data() void tst_QSslSocket_onDemandCertificates_member::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif // QT_TEST_SERVER } void tst_QSslSocket_onDemandCertificates_member::init() @@ -110,28 +118,29 @@ void tst_QSslSocket_onDemandCertificates_member::init() QFETCH_GLOBAL(bool, setProxy); if (setProxy) { QFETCH_GLOBAL(int, proxyType); - QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + const auto socksAddr = QtNetworkSettings::socksProxyServerIp().toString(); + const auto squidAddr = QtNetworkSettings::httpProxyServerIp().toString(); QNetworkProxy proxy; switch (proxyType) { case Socks5Proxy: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1080); break; case Socks5Proxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1081); break; case HttpProxy | NoAuth: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3128); break; case HttpProxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3129); break; case HttpProxy | AuthNtlm: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3130); break; } QNetworkProxy::setApplicationProxy(proxy); diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro index c345d7379f..158ecbee37 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -16,3 +16,9 @@ win32 { DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(qtConfig(private_tests)) + +#DOCKERTODO Linux, docker is disabled on macOS and Windows. +linux { + CONFIG += unsupported/testserver + QT_TEST_SERVER_LIST = squid danted +} diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp index 503edc0bff..671a21b1c2 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp @@ -98,7 +98,15 @@ void tst_QSslSocket_onDemandCertificates_static::initTestCase_data() void tst_QSslSocket_onDemandCertificates_static::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129)); + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130)); +#else QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif // QT_TEST_SERVER } void tst_QSslSocket_onDemandCertificates_static::init() @@ -106,28 +114,30 @@ void tst_QSslSocket_onDemandCertificates_static::init() QFETCH_GLOBAL(bool, setProxy); if (setProxy) { QFETCH_GLOBAL(int, proxyType); - QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + const auto socksAddr = QtNetworkSettings::socksProxyServerIp().toString(); + const auto squidAddr = QtNetworkSettings::httpProxyServerIp().toString(); + QNetworkProxy proxy; switch (proxyType) { case Socks5Proxy: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1080); break; case Socks5Proxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081); + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1081); break; case HttpProxy | NoAuth: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3128); break; case HttpProxy | AuthBasic: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3129); break; case HttpProxy | AuthNtlm: - proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130); + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3130); break; } QNetworkProxy::setApplicationProxy(proxy); diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index 79bdab634a..2923502e68 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -37,6 +37,7 @@ #include <qpixmap.h> #include <qbrush.h> #include <qhash.h> +#include <qregexp.h> QT_FORWARD_DECLARE_CLASS(QPainter) #ifndef QT_NO_OPENGL diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 3587c38e76..6f3740a24f 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -11,5 +11,6 @@ win32 { !winrt { QT += windowsuiautomation_support-private } - LIBS += -luuid -loleacc -loleaut32 -lole32 + LIBS += -loleacc -loleaut32 + QMAKE_USE += ole32 uuid } diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index 0d656e223c..22782f6b09 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -378,6 +378,10 @@ public: connect(timer, &QTimer::timeout, this, &DeleteReceiverRaceReceiver::onTimeout); timer->start(1); } + ~DeleteReceiverRaceReceiver() + { + delete receiver; + } void onTimeout() { @@ -428,12 +432,12 @@ void tst_QObjectRace::disconnectRace() for (int i = 0; i < ThreadCount; ++i) { threads[i]->requestInterruption(); - QVERIFY(threads[i]->wait(300)); + QVERIFY(threads[i]->wait()); delete threads[i]; } senderThread->quit(); - QVERIFY(senderThread->wait(300)); + QVERIFY(senderThread->wait()); } QCOMPARE(countedStructObjectsCount.load(), 0u); @@ -453,11 +457,11 @@ void tst_QObjectRace::disconnectRace() QTest::qWait(TimeLimit); senderThread->requestInterruption(); - QVERIFY(senderThread->wait(300)); + QVERIFY(senderThread->wait()); for (int i = 0; i < ThreadCount; ++i) { threads[i]->quit(); - QVERIFY(threads[i]->wait(300)); + QVERIFY(threads[i]->wait()); delete threads[i]; } } diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp index f31a755f9e..8c129adaf3 100644 --- a/tests/auto/other/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -126,9 +126,9 @@ void tst_toolsupport::offsets_data() #ifdef Q_PROCESSOR_X86 // x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in // qglobal.h for more details. - data << 168 << 248; + data << 152 << 224; #else - data << 172 << 248; + data << 156 << 224; #endif } #endif diff --git a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp index 08c6039e37..be0285537e 100644 --- a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp +++ b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp @@ -46,6 +46,7 @@ private slots: void construction(); void moveOperator(); void operators(); + void qtbug_74575(); }; tst_QSqlError::tst_QSqlError() @@ -113,6 +114,7 @@ void tst_QSqlError::construction() QVERIFY(!obj4.isValid()); QCOMPARE(obj4.driverText(), QString()); QCOMPARE(obj4.databaseText(), QString()); + QCOMPARE(obj4.text(), QString()); QCOMPARE(obj4.type(), QSqlError::NoError); QCOMPARE(obj4.number(), -1); QCOMPARE(obj4.nativeErrorCode(), QString()); @@ -180,6 +182,28 @@ void tst_QSqlError::operators() QVERIFY(error1 != error3); } +void tst_QSqlError::qtbug_74575() +{ + const QString driverText(QStringLiteral("drivertext")); + const QString databaseText(QStringLiteral("databasetext")); + const QString databaseTextNewline(QStringLiteral("databasetext\n")); + + QSqlError error1(driverText, databaseText, + QSqlError::UnknownError, QStringLiteral("123")); + QCOMPARE(error1.text(), databaseText + QLatin1Char(' ') + driverText); + + QSqlError error2(QString(), databaseText, + QSqlError::UnknownError, QStringLiteral("123")); + QCOMPARE(error2.text(), databaseText); + + QSqlError error3(driverText, QString(), + QSqlError::UnknownError, QStringLiteral("123")); + QCOMPARE(error3.text(), driverText); + + QSqlError error4(driverText, databaseTextNewline, + QSqlError::UnknownError, QStringLiteral("123")); + QCOMPARE(error4.text(), databaseTextNewline + driverText); +} QTEST_MAIN(tst_QSqlError) #include "tst_qsqlerror.moc" diff --git a/tests/auto/testlib/selftests/alive/.gitignore b/tests/auto/testlib/selftests/alive/.gitignore deleted file mode 100644 index 561285c5d0..0000000000 --- a/tests/auto/testlib/selftests/alive/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_alive diff --git a/tests/auto/testlib/selftests/alive/alive.pro b/tests/auto/testlib/selftests/alive/alive.pro deleted file mode 100644 index bda0db2282..0000000000 --- a/tests/auto/testlib/selftests/alive/alive.pro +++ /dev/null @@ -1,10 +0,0 @@ -SOURCES += tst_alive.cpp -QT = core testlib - -mac:CONFIG -= app_bundle -CONFIG -= debug_and_release_target - - -TARGET = alive - -include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp deleted file mode 100644 index 0200f2a563..0000000000 --- a/tests/auto/testlib/selftests/alive/qtestalive.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <qcoreapplication.h> -#include <qcoreevent.h> -#include <qthread.h> - -class QTestAliveEvent: public QEvent -{ -public: - - enum { AliveEventType = QEvent::User + 422 }; - - explicit inline QTestAliveEvent(int aSequenceId) - : QEvent(QEvent::Type(AliveEventType)), seqId(aSequenceId) - {} - inline int sequenceId() const { return seqId; } - -private: - int seqId; -}; - -class QTestAlivePinger: public QObject -{ -public: - QTestAlivePinger(QObject *receiver, QObject *parent = 0); - bool event(QEvent *e); - -protected: - void timerEvent(QTimerEvent *event); - -private: - QObject *rec; - int timerId; - int currentSequenceId; - int lastSequenceId; -}; - -QTestAlivePinger::QTestAlivePinger(QObject *receiver, QObject *parent) - : QObject(parent), rec(receiver), currentSequenceId(0), lastSequenceId(0) -{ - if (!rec) - qFatal("Null receiver object passed to QTestAlivePinger::QTestAlivePinger()"); - timerId = startTimer(850); -} - -bool QTestAlivePinger::event(QEvent *event) -{ - // pong received - if (int(event->type()) == QTestAliveEvent::AliveEventType) { - QTestAliveEvent *e = static_cast<QTestAliveEvent *>(event); - //qDebug("PONG %d received", e->sequenceId()); - // if the events are not delivered in order, we don't care. - if (e->sequenceId() > lastSequenceId) - lastSequenceId = e->sequenceId(); - return true; - } - return QObject::event(event); -} - -void QTestAlivePinger::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != timerId) - return; - - if (lastSequenceId < currentSequenceId - 2) { - qWarning("TEST LAGS %d PINGS behind!", currentSequenceId - lastSequenceId); - } - ++currentSequenceId; - //qDebug("PING %d", currentSequenceId); - QCoreApplication::postEvent(rec, new QTestAliveEvent(currentSequenceId)); -} - -class QTestAlive: public QThread -{ -public: - QTestAlive(QObject *parent = 0); - ~QTestAlive(); - void run(); - - bool event(QEvent *e); - -private: - QTestAlivePinger *pinger; -}; - -QTestAlive::QTestAlive(QObject *parent) - : QThread(parent), pinger(0) -{ -} - -QTestAlive::~QTestAlive() -{ - quit(); - while (isRunning()); -} - -bool QTestAlive::event(QEvent *e) -{ - if (int(e->type()) == QTestAliveEvent::AliveEventType && pinger) { - // ping received, send back the pong - //qDebug("PONG %d", static_cast<QTestAliveEvent *>(e)->sequenceId()); - QCoreApplication::postEvent(pinger, - new QTestAliveEvent(static_cast<QTestAliveEvent *>(e)->sequenceId())); - return true; - } - return QThread::event(e); -} - -void QTestAlive::run() -{ - if (!QCoreApplication::instance()) - qFatal("QTestAlive::run(): Cannot start QTestAlive without a QCoreApplication instance."); - - QTestAlivePinger p(this); - pinger = &p; - exec(); - pinger = 0; -} - - diff --git a/tests/auto/testlib/selftests/alive/tst_alive.cpp b/tests/auto/testlib/selftests/alive/tst_alive.cpp deleted file mode 100644 index eeb77b18c0..0000000000 --- a/tests/auto/testlib/selftests/alive/tst_alive.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> -#include <QWidget> - -#include "qtestalive.cpp" - -class tst_Alive: public QObject -{ - Q_OBJECT - -private slots: - void alive(); - void addMouseDClick() const; -}; - -void tst_Alive::alive() -{ - QTestAlive a; - a.start(); - - sleep(5); - QCoreApplication::processEvents(); - qDebug("CUT"); - sleep(5); -} - -void tst_Alive::addMouseDClick() const -{ - class DClickListener : public QWidget - { - public: - DClickListener() : isTested(false) - { - } - - bool isTested; - protected: - virtual void mouseDoubleClickEvent(QMouseEvent * event) - { - isTested = true; - QCOMPARE(event->type(), QEvent::MouseButtonDblClick); - } - }; - - DClickListener listener; - - QTestEventList list; - list.addMouseDClick(Qt::LeftButton); - - list.simulate(&listener); - /* Check that we have been called at all. */ - QVERIFY(listener.isTested); -} - -QTEST_MAIN(tst_Alive) -#include "tst_alive.moc" diff --git a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp index 2f6d633e9d..49c08982ad 100644 --- a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp +++ b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp @@ -75,6 +75,17 @@ void tst_Blacklisted::xpass() QVERIFY2(true, "This test should BXPASS"); } +#ifndef Q_OS_WIN +#include <signal.h> +#include <setjmp.h> + +static jmp_buf state; +static void abort_handler(int signal) +{ + longjmp(state, 1); +} +#endif + void tst_Blacklisted::messages() { qWarning("This is a warning that should not appear in silent test output"); @@ -83,7 +94,15 @@ void tst_Blacklisted::messages() qCritical("This is a critical message that should not appear in silent test output"); qInfo("This is an info message that should not appear in silent test output"); QTestLog::info("This is an internal testlib info message that should not appear in silent test output", __FILE__, __LINE__); - qFatal("This is a fatal error message that should still appear in silent test output"); + +#ifndef Q_OS_WIN + // We're testing qFatal, but we don't want to actually std::abort() ! + auto prior = signal(SIGABRT, abort_handler); + if (setjmp(state)) + signal(SIGABRT, prior); + else +#endif + qFatal("This is a fatal error message that should still appear in silent test output"); } QTEST_MAIN(tst_Blacklisted) diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 8e2c7694a5..467c53088e 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -256,7 +256,7 @@ void tst_Cmptest::compare_boolfuncs() namespace { template <typename T> -T *null() Q_DECL_NOTHROW { return nullptr; } +T *null() noexcept { return nullptr; } } void tst_Cmptest::compare_to_nullptr() diff --git a/tests/auto/testlib/selftests/expected_crashes_5.txt b/tests/auto/testlib/selftests/expected_crashes_5.txt new file mode 100644 index 0000000000..088b9c5324 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_crashes_5.txt @@ -0,0 +1,5 @@ +********* Start testing of tst_Crashes ********* +Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ +PASS : tst_Crashes::initTestCase() +QFATAL : tst_Crashes::crash() Received signal 11 + Function time: ms Total time: ms diff --git a/tests/auto/testlib/selftests/expected_float.lightxml b/tests/auto/testlib/selftests/expected_float.lightxml index 458f2277e6..5f5114bb2e 100644 --- a/tests/auto/testlib/selftests/expected_float.lightxml +++ b/tests/auto/testlib/selftests/expected_float.lightxml @@ -8,15 +8,15 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="doubleComparisons"> -<Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should PASS 1]]></DataTag> -</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 1]]></DataTag> <Description><![CDATA[Compared doubles are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 1]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 2]]></DataTag> <Description><![CDATA[Compared doubles are not the same (fuzzy compare) @@ -428,21 +428,24 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="float16Comparisons"> -<Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should SUCCEED 1]]></DataTag> -</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 1]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 1]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 2]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 0.0001 Expected (operandRight): 0.0003]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 2]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 3]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) @@ -450,7 +453,187 @@ Expected (operandRight): 99]]></Description> </Incident> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should SUCCEED 2]]></DataTag> + <DataTag><![CDATA[should PASS 3]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 4]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.93e-05 + Expected (operandRight): 5.87e-05]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 4]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 5]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.94e+04 + Expected (operandRight): 5.88e+04]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: NaN == NaN]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: NaN != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != NaN]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: NaN != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != NaN]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: inf == inf]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: -inf == -inf]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != nan]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: nan != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != nan]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: nan != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != -max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: max != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -max != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != -max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): -6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: max != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -max != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): -inf]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_float.tap b/tests/auto/testlib/selftests/expected_float.tap index 277dd2b1d4..9da51b93b3 100644 --- a/tests/auto/testlib/selftests/expected_float.tap +++ b/tests/auto/testlib/selftests/expected_float.tap @@ -1,8 +1,7 @@ TAP version 13 # tst_float ok 1 - initTestCase() -ok 2 - doubleComparisons(should PASS 1) -not ok 3 - doubleComparisons(should FAIL 1) +not ok 2 - doubleComparisons(should FAIL 1) --- type: QCOMPARE message: Compared doubles are not the same (fuzzy compare) @@ -10,10 +9,11 @@ not ok 3 - doubleComparisons(should FAIL 1) found: 1 (operandLeft) expected: 3 (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... +ok 3 - doubleComparisons(should PASS 1) not ok 4 - doubleComparisons(should FAIL 2) --- type: QCOMPARE @@ -22,9 +22,9 @@ not ok 4 - doubleComparisons(should FAIL 2) found: 1e-07 (operandLeft) expected: 3e-07 (operandRight) actual: 1e-07 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... ok 5 - doubleComparisons(should PASS 2) not ok 6 - doubleComparisons(should FAIL 3) @@ -35,9 +35,9 @@ not ok 6 - doubleComparisons(should FAIL 3) found: 999999999999 (operandLeft) expected: 999999999998 (operandRight) actual: 999999999999 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... ok 7 - doubleComparisons(should PASS 3) not ok 8 - doubleComparisons(should FAIL 4) @@ -48,9 +48,9 @@ not ok 8 - doubleComparisons(should FAIL 4) found: 9.99999999999e-311 (operandLeft) expected: 9.99999999997e-311 (operandRight) actual: 9.99999999999e-311 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... ok 9 - doubleComparisons(should PASS 4) not ok 10 - doubleComparisons(should FAIL 5) @@ -61,9 +61,9 @@ not ok 10 - doubleComparisons(should FAIL 5) found: 9.99999999999e+306 (operandLeft) expected: 9.99999999997e+306 (operandRight) actual: 9.99999999999e+306 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... ok 11 - doubleComparisons(should PASS: NaN == NaN) not ok 12 - doubleComparisons(should FAIL: NaN != 0) @@ -74,9 +74,9 @@ not ok 12 - doubleComparisons(should FAIL: NaN != 0) found: nan (operandLeft) expected: 0 (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 13 - doubleComparisons(should FAIL: 0 != NaN) --- @@ -86,9 +86,9 @@ not ok 13 - doubleComparisons(should FAIL: 0 != NaN) found: 0 (operandLeft) expected: nan (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 14 - doubleComparisons(should FAIL: NaN != 1) --- @@ -98,9 +98,9 @@ not ok 14 - doubleComparisons(should FAIL: NaN != 1) found: nan (operandLeft) expected: 1 (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 15 - doubleComparisons(should FAIL: 1 != NaN) --- @@ -110,9 +110,9 @@ not ok 15 - doubleComparisons(should FAIL: 1 != NaN) found: 1 (operandLeft) expected: nan (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... ok 16 - doubleComparisons(should PASS: inf == inf) ok 17 - doubleComparisons(should PASS: -inf == -inf) @@ -124,9 +124,9 @@ not ok 18 - doubleComparisons(should FAIL: inf != -inf) found: inf (operandLeft) expected: -inf (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 19 - doubleComparisons(should FAIL: -inf != inf) --- @@ -136,9 +136,9 @@ not ok 19 - doubleComparisons(should FAIL: -inf != inf) found: -inf (operandLeft) expected: inf (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 20 - doubleComparisons(should FAIL: inf != nan) --- @@ -148,9 +148,9 @@ not ok 20 - doubleComparisons(should FAIL: inf != nan) found: inf (operandLeft) expected: nan (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 21 - doubleComparisons(should FAIL: nan != inf) --- @@ -160,9 +160,9 @@ not ok 21 - doubleComparisons(should FAIL: nan != inf) found: nan (operandLeft) expected: inf (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 22 - doubleComparisons(should FAIL: -inf != nan) --- @@ -172,9 +172,9 @@ not ok 22 - doubleComparisons(should FAIL: -inf != nan) found: -inf (operandLeft) expected: nan (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 23 - doubleComparisons(should FAIL: nan != -inf) --- @@ -184,9 +184,9 @@ not ok 23 - doubleComparisons(should FAIL: nan != -inf) found: nan (operandLeft) expected: -inf (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 24 - doubleComparisons(should FAIL: inf != 0) --- @@ -196,9 +196,9 @@ not ok 24 - doubleComparisons(should FAIL: inf != 0) found: inf (operandLeft) expected: 0 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 25 - doubleComparisons(should FAIL: 0 != inf) --- @@ -208,9 +208,9 @@ not ok 25 - doubleComparisons(should FAIL: 0 != inf) found: 0 (operandLeft) expected: inf (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 26 - doubleComparisons(should FAIL: -inf != 0) --- @@ -220,9 +220,9 @@ not ok 26 - doubleComparisons(should FAIL: -inf != 0) found: -inf (operandLeft) expected: 0 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 27 - doubleComparisons(should FAIL: 0 != -inf) --- @@ -232,9 +232,9 @@ not ok 27 - doubleComparisons(should FAIL: 0 != -inf) found: 0 (operandLeft) expected: -inf (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 28 - doubleComparisons(should FAIL: inf != 1) --- @@ -244,9 +244,9 @@ not ok 28 - doubleComparisons(should FAIL: inf != 1) found: inf (operandLeft) expected: 1 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 29 - doubleComparisons(should FAIL: 1 != inf) --- @@ -256,9 +256,9 @@ not ok 29 - doubleComparisons(should FAIL: 1 != inf) found: 1 (operandLeft) expected: inf (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 30 - doubleComparisons(should FAIL: -inf != 1) --- @@ -268,9 +268,9 @@ not ok 30 - doubleComparisons(should FAIL: -inf != 1) found: -inf (operandLeft) expected: 1 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 31 - doubleComparisons(should FAIL: 1 != -inf) --- @@ -280,9 +280,9 @@ not ok 31 - doubleComparisons(should FAIL: 1 != -inf) found: 1 (operandLeft) expected: -inf (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 32 - doubleComparisons(should FAIL: inf != max) --- @@ -292,9 +292,9 @@ not ok 32 - doubleComparisons(should FAIL: inf != max) found: inf (operandLeft) expected: 1.79769313486e+308 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 33 - doubleComparisons(should FAIL: inf != -max) --- @@ -304,9 +304,9 @@ not ok 33 - doubleComparisons(should FAIL: inf != -max) found: inf (operandLeft) expected: -1.79769313486e+308 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 34 - doubleComparisons(should FAIL: max != inf) --- @@ -316,9 +316,9 @@ not ok 34 - doubleComparisons(should FAIL: max != inf) found: 1.79769313486e+308 (operandLeft) expected: inf (operandRight) actual: 1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 35 - doubleComparisons(should FAIL: -max != inf) --- @@ -328,9 +328,9 @@ not ok 35 - doubleComparisons(should FAIL: -max != inf) found: -1.79769313486e+308 (operandLeft) expected: inf (operandRight) actual: -1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 36 - doubleComparisons(should FAIL: -inf != max) --- @@ -340,9 +340,9 @@ not ok 36 - doubleComparisons(should FAIL: -inf != max) found: -inf (operandLeft) expected: 1.79769313486e+308 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 37 - doubleComparisons(should FAIL: -inf != -max) --- @@ -352,9 +352,9 @@ not ok 37 - doubleComparisons(should FAIL: -inf != -max) found: -inf (operandLeft) expected: -1.79769313486e+308 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 38 - doubleComparisons(should FAIL: max != -inf) --- @@ -364,9 +364,9 @@ not ok 38 - doubleComparisons(should FAIL: max != -inf) found: 1.79769313486e+308 (operandLeft) expected: -inf (operandRight) actual: 1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 39 - doubleComparisons(should FAIL: -max != -inf) --- @@ -376,9 +376,9 @@ not ok 39 - doubleComparisons(should FAIL: -max != -inf) found: -1.79769313486e+308 (operandLeft) expected: -inf (operandRight) actual: -1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:103) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 54 + line: 103 ... not ok 40 - floatComparisons(should FAIL 1) --- @@ -388,9 +388,9 @@ not ok 40 - floatComparisons(should FAIL 1) found: 1 (operandLeft) expected: 3 (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 41 - floatComparisons(should PASS 1) not ok 42 - floatComparisons(should FAIL 2) @@ -401,9 +401,9 @@ not ok 42 - floatComparisons(should FAIL 2) found: 1e-07 (operandLeft) expected: 3e-07 (operandRight) actual: 1e-07 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 43 - floatComparisons(should PASS 2) not ok 44 - floatComparisons(should FAIL 3) @@ -414,9 +414,9 @@ not ok 44 - floatComparisons(should FAIL 3) found: 99999 (operandLeft) expected: 99998 (operandRight) actual: 99999 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 45 - floatComparisons(should PASS 3) not ok 46 - floatComparisons(should FAIL 4) @@ -427,9 +427,9 @@ not ok 46 - floatComparisons(should FAIL 4) found: 9.9999e-40 (operandLeft) expected: 9.99971e-40 (operandRight) actual: 9.9999e-40 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 47 - floatComparisons(should PASS 4) not ok 48 - floatComparisons(should FAIL 5) @@ -440,9 +440,9 @@ not ok 48 - floatComparisons(should FAIL 5) found: 9.9999e+37 (operandLeft) expected: 9.9997e+37 (operandRight) actual: 9.9999e+37 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 49 - floatComparisons(should PASS: NaN == NaN) not ok 50 - floatComparisons(should FAIL: NaN != 0) @@ -453,9 +453,9 @@ not ok 50 - floatComparisons(should FAIL: NaN != 0) found: nan (operandLeft) expected: 0 (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 51 - floatComparisons(should FAIL: 0 != NaN) --- @@ -465,9 +465,9 @@ not ok 51 - floatComparisons(should FAIL: 0 != NaN) found: 0 (operandLeft) expected: nan (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 52 - floatComparisons(should FAIL: NaN != 1) --- @@ -477,9 +477,9 @@ not ok 52 - floatComparisons(should FAIL: NaN != 1) found: nan (operandLeft) expected: 1 (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 53 - floatComparisons(should FAIL: 1 != NaN) --- @@ -489,9 +489,9 @@ not ok 53 - floatComparisons(should FAIL: 1 != NaN) found: 1 (operandLeft) expected: nan (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... ok 54 - floatComparisons(should PASS: inf == inf) ok 55 - floatComparisons(should PASS: -inf == -inf) @@ -503,9 +503,9 @@ not ok 56 - floatComparisons(should FAIL: inf != -inf) found: inf (operandLeft) expected: -inf (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 57 - floatComparisons(should FAIL: -inf != inf) --- @@ -515,9 +515,9 @@ not ok 57 - floatComparisons(should FAIL: -inf != inf) found: -inf (operandLeft) expected: inf (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 58 - floatComparisons(should FAIL: inf != nan) --- @@ -527,9 +527,9 @@ not ok 58 - floatComparisons(should FAIL: inf != nan) found: inf (operandLeft) expected: nan (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 59 - floatComparisons(should FAIL: nan != inf) --- @@ -539,9 +539,9 @@ not ok 59 - floatComparisons(should FAIL: nan != inf) found: nan (operandLeft) expected: inf (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 60 - floatComparisons(should FAIL: -inf != nan) --- @@ -551,9 +551,9 @@ not ok 60 - floatComparisons(should FAIL: -inf != nan) found: -inf (operandLeft) expected: nan (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 61 - floatComparisons(should FAIL: nan != -inf) --- @@ -563,9 +563,9 @@ not ok 61 - floatComparisons(should FAIL: nan != -inf) found: nan (operandLeft) expected: -inf (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 62 - floatComparisons(should FAIL: inf != 0) --- @@ -575,9 +575,9 @@ not ok 62 - floatComparisons(should FAIL: inf != 0) found: inf (operandLeft) expected: 0 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 63 - floatComparisons(should FAIL: 0 != inf) --- @@ -587,9 +587,9 @@ not ok 63 - floatComparisons(should FAIL: 0 != inf) found: 0 (operandLeft) expected: inf (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 64 - floatComparisons(should FAIL: -inf != 0) --- @@ -599,9 +599,9 @@ not ok 64 - floatComparisons(should FAIL: -inf != 0) found: -inf (operandLeft) expected: 0 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 65 - floatComparisons(should FAIL: 0 != -inf) --- @@ -611,9 +611,9 @@ not ok 65 - floatComparisons(should FAIL: 0 != -inf) found: 0 (operandLeft) expected: -inf (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 66 - floatComparisons(should FAIL: inf != 1) --- @@ -623,9 +623,9 @@ not ok 66 - floatComparisons(should FAIL: inf != 1) found: inf (operandLeft) expected: 1 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 67 - floatComparisons(should FAIL: 1 != inf) --- @@ -635,9 +635,9 @@ not ok 67 - floatComparisons(should FAIL: 1 != inf) found: 1 (operandLeft) expected: inf (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 68 - floatComparisons(should FAIL: -inf != 1) --- @@ -647,9 +647,9 @@ not ok 68 - floatComparisons(should FAIL: -inf != 1) found: -inf (operandLeft) expected: 1 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 69 - floatComparisons(should FAIL: 1 != -inf) --- @@ -659,9 +659,9 @@ not ok 69 - floatComparisons(should FAIL: 1 != -inf) found: 1 (operandLeft) expected: -inf (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 70 - floatComparisons(should FAIL: inf != max) --- @@ -671,9 +671,9 @@ not ok 70 - floatComparisons(should FAIL: inf != max) found: inf (operandLeft) expected: 3.40282e+38 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 71 - floatComparisons(should FAIL: inf != -max) --- @@ -683,9 +683,9 @@ not ok 71 - floatComparisons(should FAIL: inf != -max) found: inf (operandLeft) expected: -3.40282e+38 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 72 - floatComparisons(should FAIL: max != inf) --- @@ -695,9 +695,9 @@ not ok 72 - floatComparisons(should FAIL: max != inf) found: 3.40282e+38 (operandLeft) expected: inf (operandRight) actual: 3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 73 - floatComparisons(should FAIL: -max != inf) --- @@ -707,9 +707,9 @@ not ok 73 - floatComparisons(should FAIL: -max != inf) found: -3.40282e+38 (operandLeft) expected: inf (operandRight) actual: -3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 74 - floatComparisons(should FAIL: -inf != max) --- @@ -719,9 +719,9 @@ not ok 74 - floatComparisons(should FAIL: -inf != max) found: -inf (operandLeft) expected: 3.40282e+38 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 75 - floatComparisons(should FAIL: -inf != -max) --- @@ -731,9 +731,9 @@ not ok 75 - floatComparisons(should FAIL: -inf != -max) found: -inf (operandLeft) expected: -3.40282e+38 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 76 - floatComparisons(should FAIL: max != -inf) --- @@ -743,9 +743,9 @@ not ok 76 - floatComparisons(should FAIL: max != -inf) found: 3.40282e+38 (operandLeft) expected: -inf (operandRight) actual: 3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... not ok 77 - floatComparisons(should FAIL: -max != -inf) --- @@ -755,12 +755,11 @@ not ok 77 - floatComparisons(should FAIL: -max != -inf) found: -3.40282e+38 (operandLeft) expected: -inf (operandRight) actual: -3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:137) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 127 + line: 137 ... -ok 78 - float16Comparisons(should SUCCEED 1) -not ok 79 - float16Comparisons(should FAIL 1) +not ok 78 - float16Comparisons(should FAIL 1) --- type: QCOMPARE message: Compared qfloat16s are not the same (fuzzy compare) @@ -768,10 +767,11 @@ not ok 79 - float16Comparisons(should FAIL 1) found: 1 (operandLeft) expected: 3 (operandRight) actual: 1 (operandLeft) - at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 200 + line: 171 ... +ok 79 - float16Comparisons(should PASS 1) not ok 80 - float16Comparisons(should FAIL 2) --- type: QCOMPARE @@ -780,11 +780,12 @@ not ok 80 - float16Comparisons(should FAIL 2) found: 0.0001 (operandLeft) expected: 0.0003 (operandRight) actual: 0.0001 (operandLeft) - at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 200 + line: 171 ... -not ok 81 - float16Comparisons(should FAIL 3) +ok 81 - float16Comparisons(should PASS 2) +not ok 82 - float16Comparisons(should FAIL 3) --- type: QCOMPARE message: Compared qfloat16s are not the same (fuzzy compare) @@ -792,12 +793,352 @@ not ok 81 - float16Comparisons(should FAIL 3) found: 98 (operandLeft) expected: 99 (operandRight) actual: 98 (operandLeft) - at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 200 + line: 171 ... -ok 82 - float16Comparisons(should SUCCEED 2) -not ok 83 - compareFloatTests(1e0) +ok 83 - float16Comparisons(should PASS 3) +not ok 84 - float16Comparisons(should FAIL 4) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 5.87e-05 (operandRight) + found: 5.93e-05 (operandLeft) + expected: 5.87e-05 (operandRight) + actual: 5.93e-05 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +ok 85 - float16Comparisons(should PASS 4) +not ok 86 - float16Comparisons(should FAIL 5) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 5.88e+04 (operandRight) + found: 5.94e+04 (operandLeft) + expected: 5.88e+04 (operandRight) + actual: 5.94e+04 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +ok 87 - float16Comparisons(should PASS: NaN == NaN) +not ok 88 - float16Comparisons(should FAIL: NaN != 0) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 0 (operandRight) + found: nan (operandLeft) + expected: 0 (operandRight) + actual: nan (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 89 - float16Comparisons(should FAIL: 0 != NaN) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: nan (operandRight) + found: 0 (operandLeft) + expected: nan (operandRight) + actual: 0 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 90 - float16Comparisons(should FAIL: NaN != 1) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 1 (operandRight) + found: nan (operandLeft) + expected: 1 (operandRight) + actual: nan (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 91 - float16Comparisons(should FAIL: 1 != NaN) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: nan (operandRight) + found: 1 (operandLeft) + expected: nan (operandRight) + actual: 1 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +ok 92 - float16Comparisons(should PASS: inf == inf) +ok 93 - float16Comparisons(should PASS: -inf == -inf) +not ok 94 - float16Comparisons(should FAIL: inf != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: inf (operandLeft) + expected: -inf (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 95 - float16Comparisons(should FAIL: -inf != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: -inf (operandLeft) + expected: inf (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 96 - float16Comparisons(should FAIL: inf != nan) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: nan (operandRight) + found: inf (operandLeft) + expected: nan (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 97 - float16Comparisons(should FAIL: nan != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: nan (operandLeft) + expected: inf (operandRight) + actual: nan (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 98 - float16Comparisons(should FAIL: -inf != nan) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: nan (operandRight) + found: -inf (operandLeft) + expected: nan (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 99 - float16Comparisons(should FAIL: nan != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: nan (operandLeft) + expected: -inf (operandRight) + actual: nan (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 100 - float16Comparisons(should FAIL: inf != 0) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 0 (operandRight) + found: inf (operandLeft) + expected: 0 (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 101 - float16Comparisons(should FAIL: 0 != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: 0 (operandLeft) + expected: inf (operandRight) + actual: 0 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 102 - float16Comparisons(should FAIL: -inf != 0) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 0 (operandRight) + found: -inf (operandLeft) + expected: 0 (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 103 - float16Comparisons(should FAIL: 0 != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: 0 (operandLeft) + expected: -inf (operandRight) + actual: 0 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 104 - float16Comparisons(should FAIL: inf != 1) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 1 (operandRight) + found: inf (operandLeft) + expected: 1 (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 105 - float16Comparisons(should FAIL: 1 != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: 1 (operandLeft) + expected: inf (operandRight) + actual: 1 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 106 - float16Comparisons(should FAIL: -inf != 1) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 1 (operandRight) + found: -inf (operandLeft) + expected: 1 (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 107 - float16Comparisons(should FAIL: 1 != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: 1 (operandLeft) + expected: -inf (operandRight) + actual: 1 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 108 - float16Comparisons(should FAIL: inf != max) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 6.55e+04 (operandRight) + found: inf (operandLeft) + expected: 6.55e+04 (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 109 - float16Comparisons(should FAIL: inf != -max) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -6.55e+04 (operandRight) + found: inf (operandLeft) + expected: -6.55e+04 (operandRight) + actual: inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 110 - float16Comparisons(should FAIL: max != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: 6.55e+04 (operandLeft) + expected: inf (operandRight) + actual: 6.55e+04 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 111 - float16Comparisons(should FAIL: -max != inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: inf (operandRight) + found: -6.55e+04 (operandLeft) + expected: inf (operandRight) + actual: -6.55e+04 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 112 - float16Comparisons(should FAIL: -inf != max) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 6.55e+04 (operandRight) + found: -inf (operandLeft) + expected: 6.55e+04 (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 113 - float16Comparisons(should FAIL: -inf != -max) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -6.55e+04 (operandRight) + found: -inf (operandLeft) + expected: -6.55e+04 (operandRight) + actual: -inf (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 114 - float16Comparisons(should FAIL: max != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: 6.55e+04 (operandLeft) + expected: -inf (operandRight) + actual: 6.55e+04 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 115 - float16Comparisons(should FAIL: -max != -inf) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: -inf (operandRight) + found: -6.55e+04 (operandLeft) + expected: -inf (operandRight) + actual: -6.55e+04 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:171) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 171 + ... +not ok 116 - compareFloatTests(1e0) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -805,11 +1146,11 @@ not ok 83 - compareFloatTests(1e0) found: 1 (t1) expected: 3 (t3) actual: 1 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 245 + line: 210 ... -not ok 84 - compareFloatTests(1e-7) +not ok 117 - compareFloatTests(1e-7) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -817,11 +1158,11 @@ not ok 84 - compareFloatTests(1e-7) found: 1e-07 (t1) expected: 3e-07 (t3) actual: 1e-07 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 245 + line: 210 ... -not ok 85 - compareFloatTests(1e+7) +not ok 118 - compareFloatTests(1e+7) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -829,12 +1170,12 @@ not ok 85 - compareFloatTests(1e+7) found: 1e+07 (t1) expected: 3e+07 (t3) actual: 1e+07 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:210) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 245 + line: 210 ... -ok 86 - cleanupTestCase() -1..86 -# tests 86 -# pass 18 -# fail 68 +ok 119 - cleanupTestCase() +1..119 +# tests 119 +# pass 23 +# fail 96 diff --git a/tests/auto/testlib/selftests/expected_float.teamcity b/tests/auto/testlib/selftests/expected_float.teamcity index e23bc722b1..af81296c42 100644 --- a/tests/auto/testlib/selftests/expected_float.teamcity +++ b/tests/auto/testlib/selftests/expected_float.teamcity @@ -1,11 +1,11 @@ ##teamcity[testSuiteStarted name='tst_float' flowId='tst_float'] ##teamcity[testStarted name='initTestCase()' flowId='tst_float'] ##teamcity[testFinished name='initTestCase()' flowId='tst_float'] -##teamcity[testStarted name='doubleComparisons(should PASS 1)' flowId='tst_float'] -##teamcity[testFinished name='doubleComparisons(should PASS 1)' flowId='tst_float'] ##teamcity[testStarted name='doubleComparisons(should FAIL 1)' flowId='tst_float'] ##teamcity[testFailed name='doubleComparisons(should FAIL 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared doubles are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): 3' flowId='tst_float'] ##teamcity[testFinished name='doubleComparisons(should FAIL 1)' flowId='tst_float'] +##teamcity[testStarted name='doubleComparisons(should PASS 1)' flowId='tst_float'] +##teamcity[testFinished name='doubleComparisons(should PASS 1)' flowId='tst_float'] ##teamcity[testStarted name='doubleComparisons(should FAIL 2)' flowId='tst_float'] ##teamcity[testFailed name='doubleComparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared doubles are not the same (fuzzy compare)|n Actual (operandLeft) : 1e-07|n Expected (operandRight): 3e-07' flowId='tst_float'] ##teamcity[testFinished name='doubleComparisons(should FAIL 2)' flowId='tst_float'] @@ -215,19 +215,113 @@ ##teamcity[testStarted name='floatComparisons(should FAIL: -max != -inf)' flowId='tst_float'] ##teamcity[testFailed name='floatComparisons(should FAIL: -max != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : -3.40282e+38|n Expected (operandRight): -inf' flowId='tst_float'] ##teamcity[testFinished name='floatComparisons(should FAIL: -max != -inf)' flowId='tst_float'] -##teamcity[testStarted name='float16Comparisons(should SUCCEED 1)' flowId='tst_float'] -##teamcity[testFinished name='float16Comparisons(should SUCCEED 1)' flowId='tst_float'] ##teamcity[testStarted name='float16Comparisons(should FAIL 1)' flowId='tst_float'] ##teamcity[testFailed name='float16Comparisons(should FAIL 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): 3' flowId='tst_float'] ##teamcity[testFinished name='float16Comparisons(should FAIL 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS 1)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS 1)' flowId='tst_float'] ##teamcity[testStarted name='float16Comparisons(should FAIL 2)' flowId='tst_float'] ##teamcity[testFailed name='float16Comparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0.0001|n Expected (operandRight): 0.0003' flowId='tst_float'] ##teamcity[testFinished name='float16Comparisons(should FAIL 2)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS 2)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS 2)' flowId='tst_float'] ##teamcity[testStarted name='float16Comparisons(should FAIL 3)' flowId='tst_float'] ##teamcity[testFailed name='float16Comparisons(should FAIL 3)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 98|n Expected (operandRight): 99' flowId='tst_float'] ##teamcity[testFinished name='float16Comparisons(should FAIL 3)' flowId='tst_float'] -##teamcity[testStarted name='float16Comparisons(should SUCCEED 2)' flowId='tst_float'] -##teamcity[testFinished name='float16Comparisons(should SUCCEED 2)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS 3)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS 3)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL 4)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL 4)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 5.93e-05|n Expected (operandRight): 5.87e-05' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL 4)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS 4)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS 4)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL 5)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL 5)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 5.94e+04|n Expected (operandRight): 5.88e+04' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL 5)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS: NaN == NaN)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS: NaN == NaN)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: NaN != 0)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: NaN != 0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : nan|n Expected (operandRight): 0' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: NaN != 0)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 0 != NaN)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 0 != NaN)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0|n Expected (operandRight): nan' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 0 != NaN)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: NaN != 1)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: NaN != 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : nan|n Expected (operandRight): 1' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: NaN != 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 1 != NaN)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 1 != NaN)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): nan' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 1 != NaN)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS: inf == inf)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS: inf == inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should PASS: -inf == -inf)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should PASS: -inf == -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != nan)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != nan)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): nan' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != nan)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: nan != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: nan != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : nan|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: nan != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != nan)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != nan)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): nan' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != nan)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: nan != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: nan != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : nan|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: nan != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != 0)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != 0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): 0' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != 0)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 0 != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 0 != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 0 != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != 0)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != 0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): 0' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != 0)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 0 != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 0 != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 0 != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != 1)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): 1' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 1 != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 1 != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 1 != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != 1)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): 1' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: 1 != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: 1 != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: 1 != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != max)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != max)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): 6.55e+04' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != max)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: inf != -max)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: inf != -max)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : inf|n Expected (operandRight): -6.55e+04' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: inf != -max)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: max != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: max != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 6.55e+04|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: max != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -max != inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -max != inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -6.55e+04|n Expected (operandRight): inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -max != inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != max)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != max)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): 6.55e+04' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != max)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -inf != -max)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -inf != -max)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -inf|n Expected (operandRight): -6.55e+04' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -inf != -max)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: max != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: max != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 6.55e+04|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: max != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL: -max != -inf)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL: -max != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : -6.55e+04|n Expected (operandRight): -inf' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL: -max != -inf)' flowId='tst_float'] ##teamcity[testStarted name='compareFloatTests(1e0)' flowId='tst_float'] ##teamcity[testFailed name='compareFloatTests(1e0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1|n Expected (t3): 3' flowId='tst_float'] ##teamcity[testFinished name='compareFloatTests(1e0)' flowId='tst_float'] diff --git a/tests/auto/testlib/selftests/expected_float.txt b/tests/auto/testlib/selftests/expected_float.txt index 6419a13f86..d22a52a63d 100644 --- a/tests/auto/testlib/selftests/expected_float.txt +++ b/tests/auto/testlib/selftests/expected_float.txt @@ -1,11 +1,11 @@ ********* Start testing of tst_float ********* Config: Using QtTest library PASS : tst_float::initTestCase() -PASS : tst_float::doubleComparisons(should PASS 1) FAIL! : tst_float::doubleComparisons(should FAIL 1) Compared doubles are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::doubleComparisons(should PASS 1) FAIL! : tst_float::doubleComparisons(should FAIL 2) Compared doubles are not the same (fuzzy compare) Actual (operandLeft) : 1e-07 Expected (operandRight): 3e-07 @@ -263,20 +263,137 @@ FAIL! : tst_float::floatComparisons(should FAIL: -max != -inf) Compared floats Actual (operandLeft) : -3.40282e+38 Expected (operandRight): -inf Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] -PASS : tst_float::float16Comparisons(should SUCCEED 1) FAIL! : tst_float::float16Comparisons(should FAIL 1) Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should PASS 1) FAIL! : tst_float::float16Comparisons(should FAIL 2) Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 0.0001 Expected (operandRight): 0.0003 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should PASS 2) FAIL! : tst_float::float16Comparisons(should FAIL 3) Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 98 Expected (operandRight): 99 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] -PASS : tst_float::float16Comparisons(should SUCCEED 2) +PASS : tst_float::float16Comparisons(should PASS 3) +FAIL! : tst_float::float16Comparisons(should FAIL 4) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.93e-05 + Expected (operandRight): 5.87e-05 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should PASS 4) +FAIL! : tst_float::float16Comparisons(should FAIL 5) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.94e+04 + Expected (operandRight): 5.88e+04 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should PASS: NaN == NaN) +FAIL! : tst_float::float16Comparisons(should FAIL: NaN != 0) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 0 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 0 != NaN) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): nan + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: NaN != 1) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 1 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 1 != NaN) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): nan + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should PASS: inf == inf) +PASS : tst_float::float16Comparisons(should PASS: -inf == -inf) +FAIL! : tst_float::float16Comparisons(should FAIL: inf != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: inf != nan) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): nan + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: nan != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != nan) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): nan + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: nan != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: inf != 0) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 0 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 0 != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != 0) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 0 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 0 != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: inf != 1) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 1 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 1 != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != 1) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 1 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: 1 != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: inf != max) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 6.55e+04 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: inf != -max) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -6.55e+04 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: max != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -max != inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != max) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 6.55e+04 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -inf != -max) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): -6.55e+04 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: max != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL: -max != -inf) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): -inf + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] FAIL! : tst_float::compareFloatTests(1e0) Compared floats are not the same (fuzzy compare) Actual (t1): 1 Expected (t3): 3 @@ -290,5 +407,5 @@ FAIL! : tst_float::compareFloatTests(1e+7) Compared floats are not the same (fu Expected (t3): 3e+07 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] PASS : tst_float::cleanupTestCase() -Totals: 18 passed, 68 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 23 passed, 96 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_float ********* diff --git a/tests/auto/testlib/selftests/expected_float.xml b/tests/auto/testlib/selftests/expected_float.xml index 65d2c5ad96..247bce9577 100644 --- a/tests/auto/testlib/selftests/expected_float.xml +++ b/tests/auto/testlib/selftests/expected_float.xml @@ -10,15 +10,15 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="doubleComparisons"> -<Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should PASS 1]]></DataTag> -</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 1]]></DataTag> <Description><![CDATA[Compared doubles are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 1]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 2]]></DataTag> <Description><![CDATA[Compared doubles are not the same (fuzzy compare) @@ -430,21 +430,24 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="float16Comparisons"> -<Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should SUCCEED 1]]></DataTag> -</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 1]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 1 Expected (operandRight): 3]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 1]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 2]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 0.0001 Expected (operandRight): 0.0003]]></Description> </Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 2]]></DataTag> +</Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[should FAIL 3]]></DataTag> <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) @@ -452,7 +455,187 @@ Expected (operandRight): 99]]></Description> </Incident> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[should SUCCEED 2]]></DataTag> + <DataTag><![CDATA[should PASS 3]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 4]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.93e-05 + Expected (operandRight): 5.87e-05]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS 4]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 5]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.94e+04 + Expected (operandRight): 5.88e+04]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: NaN == NaN]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: NaN != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != NaN]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: NaN != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != NaN]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: inf == inf]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should PASS: -inf == -inf]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != nan]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: nan != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != nan]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): nan]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: nan != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != 0]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 0]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 0 != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 1]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: 1 != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: inf != -max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: max != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -max != inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -inf != -max]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): -6.55e+04]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: max != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): -inf]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL: -max != -inf]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): -inf]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_float.xunitxml b/tests/auto/testlib/selftests/expected_float.xunitxml index 9b2af9b616..602f9252a4 100644 --- a/tests/auto/testlib/selftests/expected_float.xunitxml +++ b/tests/auto/testlib/selftests/expected_float.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="0" failures="68" tests="6" name="tst_float"> +<testsuite errors="0" failures="96" tests="6" name="tst_float"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -206,6 +206,90 @@ <failure tag="should FAIL 3" message="Compared qfloat16s are not the same (fuzzy compare) Actual (operandLeft) : 98 Expected (operandRight): 99" result="fail"/> + <failure tag="should FAIL 4" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.93e-05 + Expected (operandRight): 5.87e-05" result="fail"/> + <failure tag="should FAIL 5" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 5.94e+04 + Expected (operandRight): 5.88e+04" result="fail"/> + <failure tag="should FAIL: NaN != 0" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 0" result="fail"/> + <failure tag="should FAIL: 0 != NaN" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): nan" result="fail"/> + <failure tag="should FAIL: NaN != 1" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): 1" result="fail"/> + <failure tag="should FAIL: 1 != NaN" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): nan" result="fail"/> + <failure tag="should FAIL: inf != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -inf" result="fail"/> + <failure tag="should FAIL: -inf != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: inf != nan" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): nan" result="fail"/> + <failure tag="should FAIL: nan != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: -inf != nan" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): nan" result="fail"/> + <failure tag="should FAIL: nan != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : nan + Expected (operandRight): -inf" result="fail"/> + <failure tag="should FAIL: inf != 0" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 0" result="fail"/> + <failure tag="should FAIL: 0 != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: -inf != 0" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 0" result="fail"/> + <failure tag="should FAIL: 0 != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0 + Expected (operandRight): -inf" result="fail"/> + <failure tag="should FAIL: inf != 1" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 1" result="fail"/> + <failure tag="should FAIL: 1 != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: -inf != 1" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 1" result="fail"/> + <failure tag="should FAIL: 1 != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): -inf" result="fail"/> + <failure tag="should FAIL: inf != max" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): 6.55e+04" result="fail"/> + <failure tag="should FAIL: inf != -max" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : inf + Expected (operandRight): -6.55e+04" result="fail"/> + <failure tag="should FAIL: max != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: -max != inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): inf" result="fail"/> + <failure tag="should FAIL: -inf != max" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): 6.55e+04" result="fail"/> + <failure tag="should FAIL: -inf != -max" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -inf + Expected (operandRight): -6.55e+04" result="fail"/> + <failure tag="should FAIL: max != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 6.55e+04 + Expected (operandRight): -inf" result="fail"/> + <failure tag="should FAIL: -max != -inf" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : -6.55e+04 + Expected (operandRight): -inf" result="fail"/> </testcase> <testcase result="fail" name="compareFloatTests"> <failure tag="1e0" message="Compared floats are not the same (fuzzy compare) diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml index f66c4c552d..1212e4b364 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.lightxml +++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml @@ -12,174 +12,195 @@ </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init testGlobal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init testGlobal local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init testGlobal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2]]></Description> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init testGlobal local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="skip"> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1]]></DataTag> + <DataTag><![CDATA[global=false]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Duration msecs="0"/> </TestFunction> <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init skipLocal local=false]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init skipLocal local=true]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=true]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init skipLocal local=false]]></Description> +</Message> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[skipping]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=false]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init skipLocal local=true]]></Description> +</Message> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[skipping]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=true]]></Description> </Message> <Duration msecs="0"/> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init skipSingle local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init skipSingle local=true]]></Description> </Message> -<Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true]]></Description> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[Skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=true]]></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> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init skipSingle local=false]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[skipping]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[Skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2]]></Description> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init skipSingle local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.tap b/tests/auto/testlib/selftests/expected_globaldata.tap index 580cf3a7a8..4d61b7437b 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.tap +++ b/tests/auto/testlib/selftests/expected_globaldata.tap @@ -2,51 +2,56 @@ TAP version 13 # tst_globaldata # initTestCase initTestCase (null) ok 1 - initTestCase() -# init testGlobal local 1 +# init testGlobal local=false # global: false # local: false -# cleanup testGlobal local 1 -ok 2 - testGlobal(1:local 1) -# init testGlobal local 2 +# cleanup testGlobal local=false +ok 2 - testGlobal(global=false:local=false) +# init testGlobal local=true # global: false # local: true -# cleanup testGlobal local 2 -ok 3 - testGlobal(1:local 2) -# init testGlobal local 1 +# cleanup testGlobal local=true +ok 3 - testGlobal(global=false:local=true) +# init testGlobal local=false # global: true # local: false -# cleanup testGlobal local 1 -ok 4 - testGlobal(2:local 1) -# init testGlobal local 2 +# cleanup testGlobal local=false +ok 4 - testGlobal(global=true:local=false) +# init testGlobal local=true # global: true # local: true -# cleanup testGlobal local 2 -ok 5 - testGlobal(2:local 2) -ok 6 - skip(1) # SKIP skipping -# init skipLocal local 1 -ok 7 - skipLocal(1:local 1) # SKIP skipping -# cleanup skipLocal local 1 -# init skipLocal local 2 -ok 8 - skipLocal(1:local 2) # SKIP skipping -# cleanup skipLocal local 2 -# init skipSingle local 1 +# cleanup testGlobal local=true +ok 5 - testGlobal(global=true:local=true) +ok 6 - skip(global=false) # SKIP skipping +# init skipLocal local=false +ok 7 - skipLocal(global=false:local=false) # SKIP skipping +# cleanup skipLocal local=false +# init skipLocal local=true +ok 8 - skipLocal(global=false:local=true) # SKIP skipping +# cleanup skipLocal local=true +# init skipLocal local=false +ok 9 - skipLocal(global=true:local=false) # SKIP skipping +# cleanup skipLocal local=false +# init skipLocal local=true +ok 10 - skipLocal(global=true:local=true) # SKIP skipping +# cleanup skipLocal local=true +# init skipSingle local=false # global: false local: false -# cleanup skipSingle local 1 -ok 9 - skipSingle(1:local 1) -# init skipSingle local 2 -# global: false local: true -# cleanup skipSingle local 2 -ok 10 - skipSingle(1:local 2) -# init skipSingle local 1 -ok 11 - skipSingle(2:local 1) # SKIP skipping -# cleanup skipSingle local 1 -# init skipSingle local 2 +# cleanup skipSingle local=false +ok 11 - skipSingle(global=false:local=false) +# init skipSingle local=true +ok 12 - skipSingle(global=false:local=true) # SKIP Skipping +# cleanup skipSingle local=true +# init skipSingle local=false +ok 13 - skipSingle(global=true:local=false) # SKIP Skipping +# cleanup skipSingle local=false +# init skipSingle local=true # global: true local: true -# cleanup skipSingle local 2 -ok 12 - skipSingle(2:local 2) +# cleanup skipSingle local=true +ok 14 - skipSingle(global=true:local=true) # cleanupTestCase cleanupTestCase (null) -ok 13 - cleanupTestCase() -1..13 -# tests 13 -# pass 9 +ok 15 - cleanupTestCase() +1..15 +# tests 15 +# pass 8 # fail 0 diff --git a/tests/auto/testlib/selftests/expected_globaldata.teamcity b/tests/auto/testlib/selftests/expected_globaldata.teamcity index 5d623a3285..f76f6090ba 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.teamcity +++ b/tests/auto/testlib/selftests/expected_globaldata.teamcity @@ -2,30 +2,31 @@ ##teamcity[testStarted name='initTestCase()' flowId='tst_globaldata'] ##teamcity[testStdOut name='initTestCase()' out='QDEBUG: initTestCase initTestCase (null)' flowId='tst_globaldata'] ##teamcity[testFinished name='initTestCase()' flowId='tst_globaldata'] -##teamcity[testStarted name='testGlobal(local 1)' flowId='tst_globaldata'] -##teamcity[testStdOut name='testGlobal(local 1)' out='QDEBUG: init testGlobal local 1|nQDEBUG: global: false|nQDEBUG: local: false|nQDEBUG: cleanup testGlobal local 1' flowId='tst_globaldata'] -##teamcity[testFinished name='testGlobal(local 1)' flowId='tst_globaldata'] -##teamcity[testStarted name='testGlobal(local 2)' flowId='tst_globaldata'] -##teamcity[testStdOut name='testGlobal(local 2)' out='QDEBUG: init testGlobal local 2|nQDEBUG: global: false|nQDEBUG: local: true|nQDEBUG: cleanup testGlobal local 2' flowId='tst_globaldata'] -##teamcity[testFinished name='testGlobal(local 2)' flowId='tst_globaldata'] -##teamcity[testStarted name='testGlobal(local 1)' flowId='tst_globaldata'] -##teamcity[testStdOut name='testGlobal(local 1)' out='QDEBUG: init testGlobal local 1|nQDEBUG: global: true|nQDEBUG: local: false|nQDEBUG: cleanup testGlobal local 1' flowId='tst_globaldata'] -##teamcity[testFinished name='testGlobal(local 1)' flowId='tst_globaldata'] -##teamcity[testStarted name='testGlobal(local 2)' flowId='tst_globaldata'] -##teamcity[testStdOut name='testGlobal(local 2)' out='QDEBUG: init testGlobal local 2|nQDEBUG: global: true|nQDEBUG: local: true|nQDEBUG: cleanup testGlobal local 2' flowId='tst_globaldata'] -##teamcity[testFinished name='testGlobal(local 2)' flowId='tst_globaldata'] +##teamcity[testStarted name='testGlobal(local=false)' flowId='tst_globaldata'] +##teamcity[testStdOut name='testGlobal(local=false)' out='QDEBUG: init testGlobal local=false|nQDEBUG: global: false|nQDEBUG: local: false|nQDEBUG: cleanup testGlobal local=false' flowId='tst_globaldata'] +##teamcity[testFinished name='testGlobal(local=false)' flowId='tst_globaldata'] +##teamcity[testStarted name='testGlobal(local=true)' flowId='tst_globaldata'] +##teamcity[testStdOut name='testGlobal(local=true)' out='QDEBUG: init testGlobal local=true|nQDEBUG: global: false|nQDEBUG: local: true|nQDEBUG: cleanup testGlobal local=true' flowId='tst_globaldata'] +##teamcity[testFinished name='testGlobal(local=true)' flowId='tst_globaldata'] +##teamcity[testStarted name='testGlobal(local=false)' flowId='tst_globaldata'] +##teamcity[testStdOut name='testGlobal(local=false)' out='QDEBUG: init testGlobal local=false|nQDEBUG: global: true|nQDEBUG: local: false|nQDEBUG: cleanup testGlobal local=false' flowId='tst_globaldata'] +##teamcity[testFinished name='testGlobal(local=false)' flowId='tst_globaldata'] +##teamcity[testStarted name='testGlobal(local=true)' flowId='tst_globaldata'] +##teamcity[testStdOut name='testGlobal(local=true)' out='QDEBUG: init testGlobal local=true|nQDEBUG: global: true|nQDEBUG: local: true|nQDEBUG: cleanup testGlobal local=true' flowId='tst_globaldata'] +##teamcity[testFinished name='testGlobal(local=true)' flowId='tst_globaldata'] ##teamcity[testIgnored name='skip()' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] -##teamcity[testIgnored name='skipLocal(local 1)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] -##teamcity[testIgnored name='skipLocal(local 2)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] -##teamcity[testStarted name='skipSingle(local 1)' flowId='tst_globaldata'] -##teamcity[testStdOut name='skipSingle(local 1)' out='QDEBUG: init skipLocal local 1|nQDEBUG: cleanup skipLocal local 1|nQDEBUG: init skipLocal local 2|nQDEBUG: cleanup skipLocal local 2|nQDEBUG: init skipSingle local 1|nQDEBUG: global: false local: false|nQDEBUG: cleanup skipSingle local 1' flowId='tst_globaldata'] -##teamcity[testFinished name='skipSingle(local 1)' flowId='tst_globaldata'] -##teamcity[testStarted name='skipSingle(local 2)' flowId='tst_globaldata'] -##teamcity[testStdOut name='skipSingle(local 2)' out='QDEBUG: init skipSingle local 2|nQDEBUG: global: false local: true|nQDEBUG: cleanup skipSingle local 2' flowId='tst_globaldata'] -##teamcity[testFinished name='skipSingle(local 2)' flowId='tst_globaldata'] -##teamcity[testIgnored name='skipSingle(local 1)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] -##teamcity[testStdOut name='skipSingle(local 2)' out='QDEBUG: init skipSingle local 1|nQDEBUG: cleanup skipSingle local 1|nQDEBUG: init skipSingle local 2|nQDEBUG: global: true local: true|nQDEBUG: cleanup skipSingle local 2' flowId='tst_globaldata'] -##teamcity[testFinished name='skipSingle(local 2)' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipLocal(local=false)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipLocal(local=true)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipLocal(local=false)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipLocal(local=true)' message='skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testStarted name='skipSingle(local=false)' flowId='tst_globaldata'] +##teamcity[testStdOut name='skipSingle(local=false)' out='QDEBUG: init skipLocal local=false|nQDEBUG: cleanup skipLocal local=false|nQDEBUG: init skipLocal local=true|nQDEBUG: cleanup skipLocal local=true|nQDEBUG: init skipLocal local=false|nQDEBUG: cleanup skipLocal local=false|nQDEBUG: init skipLocal local=true|nQDEBUG: cleanup skipLocal local=true|nQDEBUG: init skipSingle local=false|nQDEBUG: global: false local: false|nQDEBUG: cleanup skipSingle local=false' flowId='tst_globaldata'] +##teamcity[testFinished name='skipSingle(local=false)' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipSingle(local=true)' message='Skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testIgnored name='skipSingle(local=false)' message='Skipping |[Loc: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)|]' flowId='tst_globaldata'] +##teamcity[testStarted name='skipSingle(local=true)' flowId='tst_globaldata'] +##teamcity[testStdOut name='skipSingle(local=true)' out='QDEBUG: init skipSingle local=true|nQDEBUG: cleanup skipSingle local=true|nQDEBUG: init skipSingle local=false|nQDEBUG: cleanup skipSingle local=false|nQDEBUG: init skipSingle local=true|nQDEBUG: global: true local: true|nQDEBUG: cleanup skipSingle local=true' flowId='tst_globaldata'] +##teamcity[testFinished name='skipSingle(local=true)' flowId='tst_globaldata'] ##teamcity[testStarted name='cleanupTestCase()' flowId='tst_globaldata'] ##teamcity[testStdOut name='cleanupTestCase()' out='QDEBUG: cleanupTestCase cleanupTestCase (null)' flowId='tst_globaldata'] ##teamcity[testFinished name='cleanupTestCase()' flowId='tst_globaldata'] diff --git a/tests/auto/testlib/selftests/expected_globaldata.txt b/tests/auto/testlib/selftests/expected_globaldata.txt index b12f4a2a69..016b5e8299 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.txt +++ b/tests/auto/testlib/selftests/expected_globaldata.txt @@ -2,53 +2,61 @@ Config: Using QtTest library 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 -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 -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 -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 -PASS : tst_globaldata::testGlobal(2:local 2) -SKIP : tst_globaldata::skip(1) skipping +QDEBUG : tst_globaldata::testGlobal(global=false:local=false) init testGlobal local=false +QDEBUG : tst_globaldata::testGlobal(global=false:local=false) global: false +QDEBUG : tst_globaldata::testGlobal(global=false:local=false) local: false +QDEBUG : tst_globaldata::testGlobal(global=false:local=false) cleanup testGlobal local=false +PASS : tst_globaldata::testGlobal(global=false:local=false) +QDEBUG : tst_globaldata::testGlobal(global=false:local=true) init testGlobal local=true +QDEBUG : tst_globaldata::testGlobal(global=false:local=true) global: false +QDEBUG : tst_globaldata::testGlobal(global=false:local=true) local: true +QDEBUG : tst_globaldata::testGlobal(global=false:local=true) cleanup testGlobal local=true +PASS : tst_globaldata::testGlobal(global=false:local=true) +QDEBUG : tst_globaldata::testGlobal(global=true:local=false) init testGlobal local=false +QDEBUG : tst_globaldata::testGlobal(global=true:local=false) global: true +QDEBUG : tst_globaldata::testGlobal(global=true:local=false) local: false +QDEBUG : tst_globaldata::testGlobal(global=true:local=false) cleanup testGlobal local=false +PASS : tst_globaldata::testGlobal(global=true:local=false) +QDEBUG : tst_globaldata::testGlobal(global=true:local=true) init testGlobal local=true +QDEBUG : tst_globaldata::testGlobal(global=true:local=true) global: true +QDEBUG : tst_globaldata::testGlobal(global=true:local=true) local: true +QDEBUG : tst_globaldata::testGlobal(global=true:local=true) cleanup testGlobal local=true +PASS : tst_globaldata::testGlobal(global=true:local=true) +SKIP : tst_globaldata::skip(global=false) skipping Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] -QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 -SKIP : tst_globaldata::skipLocal(1:local 1) skipping +QDEBUG : tst_globaldata::skipLocal(global=false:local=false) init skipLocal local=false +SKIP : tst_globaldata::skipLocal(global=false:local=false) skipping Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] -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 +QDEBUG : tst_globaldata::skipLocal(global=false:local=false) cleanup skipLocal local=false +QDEBUG : tst_globaldata::skipLocal(global=false:local=true) init skipLocal local=true +SKIP : tst_globaldata::skipLocal(global=false:local=true) skipping Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] -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 -PASS : tst_globaldata::skipSingle(1:local 2) -QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 -SKIP : tst_globaldata::skipSingle(2:local 1) skipping +QDEBUG : tst_globaldata::skipLocal(global=false:local=true) cleanup skipLocal local=true +QDEBUG : tst_globaldata::skipLocal(global=true:local=false) init skipLocal local=false +SKIP : tst_globaldata::skipLocal(global=true:local=false) skipping Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] -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::skipLocal(global=true:local=false) cleanup skipLocal local=false +QDEBUG : tst_globaldata::skipLocal(global=true:local=true) init skipLocal local=true +SKIP : tst_globaldata::skipLocal(global=true:local=true) skipping + Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] +QDEBUG : tst_globaldata::skipLocal(global=true:local=true) cleanup skipLocal local=true +QDEBUG : tst_globaldata::skipSingle(global=false:local=false) init skipSingle local=false +QDEBUG : tst_globaldata::skipSingle(global=false:local=false) global: false local: false +QDEBUG : tst_globaldata::skipSingle(global=false:local=false) cleanup skipSingle local=false +PASS : tst_globaldata::skipSingle(global=false:local=false) +QDEBUG : tst_globaldata::skipSingle(global=false:local=true) init skipSingle local=true +SKIP : tst_globaldata::skipSingle(global=false:local=true) Skipping + Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] +QDEBUG : tst_globaldata::skipSingle(global=false:local=true) cleanup skipSingle local=true +QDEBUG : tst_globaldata::skipSingle(global=true:local=false) init skipSingle local=false +SKIP : tst_globaldata::skipSingle(global=true:local=false) Skipping + Loc: [qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(0)] +QDEBUG : tst_globaldata::skipSingle(global=true:local=false) cleanup skipSingle local=false +QDEBUG : tst_globaldata::skipSingle(global=true:local=true) init skipSingle local=true +QDEBUG : tst_globaldata::skipSingle(global=true:local=true) global: true local: true +QDEBUG : tst_globaldata::skipSingle(global=true:local=true) cleanup skipSingle local=true +PASS : tst_globaldata::skipSingle(global=true:local=true) QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) PASS : tst_globaldata::cleanupTestCase() -Totals: 9 passed, 0 failed, 4 skipped, 0 blacklisted, 0ms +Totals: 8 passed, 0 failed, 7 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_globaldata ********* diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml index 0f705ef352..9aa48c8f16 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xml +++ b/tests/auto/testlib/selftests/expected_globaldata.xml @@ -14,174 +14,195 @@ </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init testGlobal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init testGlobal local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init testGlobal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> + <DataTag><![CDATA[global=true:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2]]></Description> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init testGlobal local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup testGlobal local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="skip"> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1]]></DataTag> + <DataTag><![CDATA[global=false]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Duration msecs="0"/> </TestFunction> <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init skipLocal local=false]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init skipLocal local=true]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> + <DataTag><![CDATA[global=false:local=true]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=true]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init skipLocal local=false]]></Description> +</Message> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[skipping]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=false]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init skipLocal local=true]]></Description> +</Message> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[skipping]]></Description> +</Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup skipLocal local=true]]></Description> </Message> <Duration msecs="0"/> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1]]></Description> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[init skipSingle local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> <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> + <DataTag><![CDATA[global=false:local=false]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=false]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[1:local 1]]></DataTag> + <DataTag><![CDATA[global=false:local=false]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[init skipSingle local=true]]></Description> </Message> -<Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true]]></Description> +<Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[Skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2]]></Description> + <DataTag><![CDATA[global=false:local=true]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=true]]></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> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[init skipSingle local=false]]></Description> </Message> <Message type="skip" file="qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[skipping]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[Skipping]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1]]></Description> + <DataTag><![CDATA[global=true:local=false]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=false]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2]]></Description> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[init skipSingle local=true]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> <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> + <DataTag><![CDATA[global=true:local=true]]></DataTag> + <Description><![CDATA[cleanup skipSingle local=true]]></Description> </Message> <Incident type="pass" file="" line="0"> - <DataTag><![CDATA[2:local 2]]></DataTag> + <DataTag><![CDATA[global=true:local=true]]></DataTag> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml index bdd7e3f00a..de184c2fdd 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml +++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="37" failures="0" tests="6" name="tst_globaldata"> +<testsuite errors="43" failures="0" tests="6" name="tst_globaldata"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -9,88 +9,100 @@ <!-- 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="global=false:local=false" message="init testGlobal local=false" type="qdebug" --> + <!-- tag="global=false:local=false" message="global: false" type="qdebug" --> + <!-- tag="global=false:local=false" message="local: false" type="qdebug" --> + <!-- tag="global=false:local=false" message="cleanup testGlobal local=false" type="qdebug" --> + <!-- tag="global=false:local=true" message="init testGlobal local=true" type="qdebug" --> + <!-- tag="global=false:local=true" message="global: false" type="qdebug" --> + <!-- tag="global=false:local=true" message="local: true" type="qdebug" --> + <!-- tag="global=false:local=true" message="cleanup testGlobal local=true" type="qdebug" --> + <!-- tag="global=true:local=false" message="init testGlobal local=false" type="qdebug" --> + <!-- tag="global=true:local=false" message="global: true" type="qdebug" --> + <!-- tag="global=true:local=false" message="local: false" type="qdebug" --> + <!-- tag="global=true:local=false" message="cleanup testGlobal local=false" type="qdebug" --> + <!-- tag="global=true:local=true" message="init testGlobal local=true" type="qdebug" --> + <!-- tag="global=true:local=true" message="global: true" type="qdebug" --> + <!-- tag="global=true:local=true" message="local: true" type="qdebug" --> + <!-- tag="global=true:local=true" message="cleanup testGlobal local=true" type="qdebug" --> </testcase> <testcase name="skip"> - <!-- tag="1" message="skipping" type="skip" --> + <!-- tag="global=false" message="skipping" type="skip" --> </testcase> <testcase name="skipLocal"> - <!-- 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 2" message="skipping" type="skip" --> - <!-- tag="1:local 2" message="cleanup skipLocal local 2" type="qdebug" --> + <!-- tag="global=false:local=false" message="init skipLocal local=false" type="qdebug" --> + <!-- tag="global=false:local=false" message="skipping" type="skip" --> + <!-- tag="global=false:local=false" message="cleanup skipLocal local=false" type="qdebug" --> + <!-- tag="global=false:local=true" message="init skipLocal local=true" type="qdebug" --> + <!-- tag="global=false:local=true" message="skipping" type="skip" --> + <!-- tag="global=false:local=true" message="cleanup skipLocal local=true" type="qdebug" --> + <!-- tag="global=true:local=false" message="init skipLocal local=false" type="qdebug" --> + <!-- tag="global=true:local=false" message="skipping" type="skip" --> + <!-- tag="global=true:local=false" message="cleanup skipLocal local=false" type="qdebug" --> + <!-- tag="global=true:local=true" message="init skipLocal local=true" type="qdebug" --> + <!-- tag="global=true:local=true" message="skipping" type="skip" --> + <!-- tag="global=true:local=true" message="cleanup skipLocal local=true" 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="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="global=false:local=false" message="init skipSingle local=false" type="qdebug" --> + <!-- tag="global=false:local=false" message="global: false local: false" type="qdebug" --> + <!-- tag="global=false:local=false" message="cleanup skipSingle local=false" type="qdebug" --> + <!-- tag="global=false:local=true" message="init skipSingle local=true" type="qdebug" --> + <!-- tag="global=false:local=true" message="Skipping" type="skip" --> + <!-- tag="global=false:local=true" message="cleanup skipSingle local=true" type="qdebug" --> + <!-- tag="global=true:local=false" message="init skipSingle local=false" type="qdebug" --> + <!-- tag="global=true:local=false" message="Skipping" type="skip" --> + <!-- tag="global=true:local=false" message="cleanup skipSingle local=false" type="qdebug" --> + <!-- tag="global=true:local=true" message="init skipSingle local=true" type="qdebug" --> + <!-- tag="global=true:local=true" message="global: true local: true" type="qdebug" --> + <!-- tag="global=true:local=true" message="cleanup skipSingle local=true" type="qdebug" --> </testcase> <testcase result="pass" name="cleanupTestCase"> <!-- message="cleanupTestCase cleanupTestCase (null)" type="qdebug" --> </testcase> <system-err> <![CDATA[initTestCase initTestCase (null)]]> -<![CDATA[init testGlobal local 1]]> +<![CDATA[init testGlobal local=false]]> <![CDATA[global: false]]> <![CDATA[local: false]]> -<![CDATA[cleanup testGlobal local 1]]> -<![CDATA[init testGlobal local 2]]> +<![CDATA[cleanup testGlobal local=false]]> +<![CDATA[init testGlobal local=true]]> <![CDATA[global: false]]> <![CDATA[local: true]]> -<![CDATA[cleanup testGlobal local 2]]> -<![CDATA[init testGlobal local 1]]> +<![CDATA[cleanup testGlobal local=true]]> +<![CDATA[init testGlobal local=false]]> <![CDATA[global: true]]> <![CDATA[local: false]]> -<![CDATA[cleanup testGlobal local 1]]> -<![CDATA[init testGlobal local 2]]> +<![CDATA[cleanup testGlobal local=false]]> +<![CDATA[init testGlobal local=true]]> <![CDATA[global: true]]> <![CDATA[local: true]]> -<![CDATA[cleanup testGlobal local 2]]> +<![CDATA[cleanup testGlobal local=true]]> <![CDATA[skipping]]> -<![CDATA[init skipLocal local 1]]> +<![CDATA[init skipLocal local=false]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipLocal local 1]]> -<![CDATA[init skipLocal local 2]]> +<![CDATA[cleanup skipLocal local=false]]> +<![CDATA[init skipLocal local=true]]> <![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=true]]> +<![CDATA[init skipLocal local=false]]> +<![CDATA[skipping]]> +<![CDATA[cleanup skipLocal local=false]]> +<![CDATA[init skipLocal local=true]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipSingle local 1]]> -<![CDATA[init skipSingle local 2]]> +<![CDATA[cleanup skipLocal local=true]]> +<![CDATA[init skipSingle local=false]]> +<![CDATA[global: false local: false]]> +<![CDATA[cleanup skipSingle local=false]]> +<![CDATA[init skipSingle local=true]]> +<![CDATA[Skipping]]> +<![CDATA[cleanup skipSingle local=true]]> +<![CDATA[init skipSingle local=false]]> +<![CDATA[Skipping]]> +<![CDATA[cleanup skipSingle local=false]]> +<![CDATA[init skipSingle local=true]]> <![CDATA[global: true local: true]]> -<![CDATA[cleanup skipSingle local 2]]> +<![CDATA[cleanup skipSingle local=true]]> <![CDATA[cleanupTestCase cleanupTestCase (null)]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_signaldumper.lightxml b/tests/auto/testlib/selftests/expected_signaldumper.lightxml new file mode 100644 index 0000000000..f68834e1a2 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.lightxml @@ -0,0 +1,578 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: QThread(_POINTER_) started ()]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="noConnections"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="oneSlot"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="oneSlotOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="twoSlots"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="twoSlotsOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="signalForwarding"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="signalForwardingOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="slotEmittingSignal"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="slotEmittingSignalOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) emitSecondSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="variousTypes"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: QThread(_POINTER_) finished ()]]></Description> +</Message> +<Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_signaldumper.tap b/tests/auto/testlib/selftests/expected_signaldumper.tap new file mode 100644 index 0000000000..04d7d94745 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.tap @@ -0,0 +1,151 @@ +TAP version 13 +# tst_Signaldumper +# Signal: QThread(_POINTER_) started () +ok 1 - initTestCase() +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +ok 2 - noConnections() +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 3 - oneSlot(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 4 - oneSlot(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 5 - oneSlotOldSyntax(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 6 - oneSlotOldSyntax(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 7 - twoSlots(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 8 - twoSlots(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +# Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 9 - twoSlotsOldSyntax(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 10 - twoSlotsOldSyntax(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 11 - signalForwarding(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +ok 12 - signalForwarding(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Slot: SignalSlotClass(_POINTER_) nestedSignal() +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char) +# Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Slot: SignalSlotClass(_POINTER_) nestedSignal() +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 13 - signalForwardingOldSyntax(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +# Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +ok 14 - signalForwardingOldSyntax(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 15 - slotEmittingSignal(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +ok 16 - slotEmittingSignal(queued) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Slot: SignalSlotClass(_POINTER_) emitSecondSignal() +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +ok 17 - slotEmittingSignalOldSyntax(direct) +# Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +# Signal: QEventDispatcherPlatform(_POINTER_) awake () +# Signal: SignalSlotClass(_POINTER_) nestedSignal () +ok 18 - slotEmittingSignalOldSyntax(queued) +# Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string)) +# Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_) +# Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string)) +# Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray)) +# Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>()) +# Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>()) +# Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_) +# Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>()) +# Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_) +# Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal () +# Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant()) +# Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant()) +ok 19 - variousTypes() +ok 20 - cleanupTestCase() +# Signal: QThread(_POINTER_) finished () +1..20 +# tests 20 +# pass 20 +# fail 0 diff --git a/tests/auto/testlib/selftests/expected_signaldumper.teamcity b/tests/auto/testlib/selftests/expected_signaldumper.teamcity new file mode 100644 index 0000000000..3b8cf8c54f --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.teamcity @@ -0,0 +1,61 @@ +##teamcity[testSuiteStarted name='tst_Signaldumper' flowId='tst_Signaldumper'] +##teamcity[testStarted name='initTestCase()' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='initTestCase()' out='INFO: Signal: QThread(_POINTER_) started ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='initTestCase()' flowId='tst_Signaldumper'] +##teamcity[testStarted name='noConnections()' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='noConnections()' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))' flowId='tst_Signaldumper'] +##teamcity[testFinished name='noConnections()' flowId='tst_Signaldumper'] +##teamcity[testStarted name='oneSlot(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='oneSlot(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='oneSlot(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='oneSlot(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='oneSlot(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='oneSlot(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='oneSlotOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='oneSlotOldSyntax(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='oneSlotOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='oneSlotOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='oneSlotOldSyntax(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='oneSlotOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='twoSlots(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='twoSlots(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='twoSlots(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='twoSlots(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='twoSlots(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='twoSlots(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='twoSlotsOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='twoSlotsOldSyntax(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='twoSlotsOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='twoSlotsOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='twoSlotsOldSyntax(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='twoSlotsOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='signalForwarding(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='signalForwarding(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='signalForwarding(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='signalForwarding(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='signalForwarding(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='signalForwarding(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='signalForwardingOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='signalForwardingOldSyntax(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Slot: SignalSlotClass(_POINTER_) nestedSignal()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char)|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Slot: SignalSlotClass(_POINTER_) nestedSignal()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='signalForwardingOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='signalForwardingOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='signalForwardingOldSyntax(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))|nINFO: Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='signalForwardingOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='slotEmittingSignal(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='slotEmittingSignal(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='slotEmittingSignal(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='slotEmittingSignal(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='slotEmittingSignal(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='slotEmittingSignal(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='slotEmittingSignalOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='slotEmittingSignalOldSyntax(direct)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Slot: SignalSlotClass(_POINTER_) emitSecondSignal()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='slotEmittingSignalOldSyntax(direct)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='slotEmittingSignalOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='slotEmittingSignalOldSyntax(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='slotEmittingSignalOldSyntax(queued)' flowId='tst_Signaldumper'] +##teamcity[testStarted name='variousTypes()' flowId='tst_Signaldumper'] +##teamcity[testStdOut name='variousTypes()' out='INFO: Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))|nINFO: Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())' flowId='tst_Signaldumper'] +##teamcity[testFinished name='variousTypes()' flowId='tst_Signaldumper'] +##teamcity[testStarted name='cleanupTestCase()' flowId='tst_Signaldumper'] +##teamcity[testFinished name='cleanupTestCase()' flowId='tst_Signaldumper'] +##teamcity[testSuiteFinished name='tst_Signaldumper' flowId='tst_Signaldumper'] diff --git a/tests/auto/testlib/selftests/expected_signaldumper.txt b/tests/auto/testlib/selftests/expected_signaldumper.txt new file mode 100644 index 0000000000..f89c31afe5 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.txt @@ -0,0 +1,149 @@ +********* Start testing of tst_Signaldumper ********* +Config: Using QtTest library +INFO : tst_Signaldumper::initTestCase() Signal: QThread(_POINTER_) started () +PASS : tst_Signaldumper::initTestCase() +INFO : tst_Signaldumper::noConnections() Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::noConnections() Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +PASS : tst_Signaldumper::noConnections() +INFO : tst_Signaldumper::oneSlot(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::oneSlot(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlot(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlot(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlot(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlot(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::oneSlot(direct) +INFO : tst_Signaldumper::oneSlot(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::oneSlot(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlot(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlot(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlot(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlot(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::oneSlot(queued) +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::oneSlotOldSyntax(direct) +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::oneSlotOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::oneSlotOldSyntax(queued) +INFO : tst_Signaldumper::twoSlots(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::twoSlots(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlots(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlots(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlots(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlots(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::twoSlots(direct) +INFO : tst_Signaldumper::twoSlots(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::twoSlots(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlots(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlots(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlots(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlots(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::twoSlots(queued) +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char) +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) slotWithoutParameters() +INFO : tst_Signaldumper::twoSlotsOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::twoSlotsOldSyntax(direct) +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::twoSlotsOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::twoSlotsOldSyntax(queued) +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwarding(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwarding(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::signalForwarding(direct) +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::signalForwarding(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwarding(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwarding(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +PASS : tst_Signaldumper::signalForwarding(queued) +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) nestedSignal() +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char) +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) nestedSignal() +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwardingOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::signalForwardingOldSyntax(direct) +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m)) +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::signalForwardingOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +PASS : tst_Signaldumper::signalForwardingOldSyntax(queued) +INFO : tst_Signaldumper::slotEmittingSignal(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::slotEmittingSignal(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::slotEmittingSignal(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::slotEmittingSignal(direct) +INFO : tst_Signaldumper::slotEmittingSignal(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::slotEmittingSignal(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::slotEmittingSignal(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +PASS : tst_Signaldumper::slotEmittingSignal(queued) +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(direct) Slot: SignalSlotClass(_POINTER_) emitSecondSignal() +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(direct) Signal: SignalSlotClass(_POINTER_) nestedSignal () +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(direct) Signal: QEventDispatcherPlatform(_POINTER_) awake () +PASS : tst_Signaldumper::slotEmittingSignalOldSyntax(direct) +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) signalWithoutParameters () +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(queued) Signal: QEventDispatcherPlatform(_POINTER_) awake () +INFO : tst_Signaldumper::slotEmittingSignalOldSyntax(queued) Signal: SignalSlotClass(_POINTER_) nestedSignal () +PASS : tst_Signaldumper::slotEmittingSignalOldSyntax(queued) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string)) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string)) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray)) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>()) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>()) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>()) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal () +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant()) +INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant()) +PASS : tst_Signaldumper::variousTypes() +PASS : tst_Signaldumper::cleanupTestCase() +INFO : tst_Signaldumper::UnknownTestFunc() Signal: QThread(_POINTER_) finished () +Totals: 20 passed, 0 failed, 0 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_Signaldumper ********* diff --git a/tests/auto/testlib/selftests/expected_signaldumper.xml b/tests/auto/testlib/selftests/expected_signaldumper.xml new file mode 100644 index 0000000000..82959c62df --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.xml @@ -0,0 +1,581 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_Signaldumper"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: QThread(_POINTER_) started ()]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="noConnections"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="oneSlot"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="oneSlotOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="twoSlots"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="twoSlotsOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="signalForwarding"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="signalForwardingOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="slotEmittingSignal"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="slotEmittingSignalOldSyntax"> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Slot: SignalSlotClass(_POINTER_) emitSecondSignal()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[direct]]></DataTag> +</Incident> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]></Description> +</Message> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[queued]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="variousTypes"> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]></Description> +</Message> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<Message type="info" file="" line="0"> + <Description><![CDATA[Signal: QThread(_POINTER_) finished ()]]></Description> +</Message> +<Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_signaldumper.xunitxml b/tests/auto/testlib/selftests/expected_signaldumper.xunitxml new file mode 100644 index 0000000000..930dc97262 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_signaldumper.xunitxml @@ -0,0 +1,284 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="125" failures="0" tests="12" name="tst_Signaldumper"> + <properties> + <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> + <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> + </properties> + <testcase result="pass" name="initTestCase"> + <!-- message="Signal: QThread(_POINTER_) started ()" type="info" --> + </testcase> + <testcase result="pass" name="noConnections"> + <!-- message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + </testcase> + <testcase result="pass" name="oneSlot"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + </testcase> + <testcase result="pass" name="oneSlotOldSyntax"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + </testcase> + <testcase result="pass" name="twoSlots"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + </testcase> + <testcase result="pass" name="twoSlotsOldSyntax"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + </testcase> + <testcase result="pass" name="signalForwarding"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + </testcase> + <testcase result="pass" name="signalForwardingOldSyntax"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) nestedSignal()" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char)" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) nestedSignal()" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + </testcase> + <testcase result="pass" name="slotEmittingSignal"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + </testcase> + <testcase result="pass" name="slotEmittingSignalOldSyntax"> + <!-- tag="direct" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="direct" message=" Slot: SignalSlotClass(_POINTER_) emitSecondSignal()" type="info" --> + <!-- tag="direct" message=" Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + <!-- tag="direct" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()" type="info" --> + <!-- tag="queued" message="Signal: QEventDispatcherPlatform(_POINTER_) awake ()" type="info" --> + <!-- tag="queued" message="Signal: SignalSlotClass(_POINTER_) nestedSignal ()" type="info" --> + </testcase> + <testcase result="pass" name="variousTypes"> + <!-- message="Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())" type="info" --> + <!-- message="Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())" type="info" --> + </testcase> + <testcase result="pass" name="cleanupTestCase"> + <!-- message="Signal: QThread(_POINTER_) finished ()" type="info" --> + </testcase> + <system-err> +<![CDATA[Signal: QThread(_POINTER_) started ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithParameters(int,char)]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) slotWithoutParameters()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignalWithParameters(int,char)]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) nestedSignal()]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithParameters (int(242), char(m))]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[ Slot: SignalSlotClass(_POINTER_) emitSecondSignal()]]> +<![CDATA[ Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()]]> +<![CDATA[Signal: QEventDispatcherPlatform(_POINTER_) awake ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) nestedSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]> +<![CDATA[Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())]]> +<![CDATA[Signal: QThread(_POINTER_) finished ()]]> + </system-err> +</testsuite> diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp index 49d00ac0e0..cefd8a57c4 100644 --- a/tests/auto/testlib/selftests/float/tst_float.cpp +++ b/tests/auto/testlib/selftests/float/tst_float.cpp @@ -46,6 +46,55 @@ private slots: void compareFloatTests_data() const; }; +template<typename F> +static void nonFinite_data(F zero, F one) +{ + using Bounds = std::numeric_limits<F>; + + // QCOMPARE special-cases non-finite values + if (Bounds::has_quiet_NaN) { + const F nan = Bounds::quiet_NaN(); + QTest::newRow("should PASS: NaN == NaN") << nan << nan; + QTest::newRow("should FAIL: NaN != 0") << nan << zero; + QTest::newRow("should FAIL: 0 != NaN") << zero << nan; + QTest::newRow("should FAIL: NaN != 1") << nan << one; + QTest::newRow("should FAIL: 1 != NaN") << one << nan; + } + + if (Bounds::has_infinity) { + const F uge = Bounds::infinity(); + QTest::newRow("should PASS: inf == inf") << uge << uge; + QTest::newRow("should PASS: -inf == -inf") << -uge << -uge; + QTest::newRow("should FAIL: inf != -inf") << uge << -uge; + QTest::newRow("should FAIL: -inf != inf") << -uge << uge; + if (Bounds::has_quiet_NaN) { + const F nan = Bounds::quiet_NaN(); + QTest::newRow("should FAIL: inf != nan") << uge << nan; + QTest::newRow("should FAIL: nan != inf") << nan << uge; + QTest::newRow("should FAIL: -inf != nan") << -uge << nan; + QTest::newRow("should FAIL: nan != -inf") << nan << -uge; + } + QTest::newRow("should FAIL: inf != 0") << uge << zero; + QTest::newRow("should FAIL: 0 != inf") << zero << uge; + QTest::newRow("should FAIL: -inf != 0") << -uge << zero; + QTest::newRow("should FAIL: 0 != -inf") << zero << -uge; + QTest::newRow("should FAIL: inf != 1") << uge << one; + QTest::newRow("should FAIL: 1 != inf") << one << uge; + QTest::newRow("should FAIL: -inf != 1") << -uge << one; + QTest::newRow("should FAIL: 1 != -inf") << one << -uge; + + const F big = Bounds::max(); + QTest::newRow("should FAIL: inf != max") << uge << big; + QTest::newRow("should FAIL: inf != -max") << uge << -big; + QTest::newRow("should FAIL: max != inf") << big << uge; + QTest::newRow("should FAIL: -max != inf") << -big << uge; + QTest::newRow("should FAIL: -inf != max") << -uge << big; + QTest::newRow("should FAIL: -inf != -max") << -uge << -big; + QTest::newRow("should FAIL: max != -inf") << big << -uge; + QTest::newRow("should FAIL: -max != -inf") << -big << -uge; + } +} + void tst_float::doubleComparisons() const { QFETCH(double, operandLeft); @@ -58,65 +107,26 @@ void tst_float::doubleComparisons_data() const { QTest::addColumn<double>("operandLeft"); QTest::addColumn<double>("operandRight"); + double zero(0.), one(1.); - QTest::newRow("should PASS 1") << 0. << 0.; - QTest::newRow("should FAIL 1") << 1.00000 << 3.00000; - QTest::newRow("should FAIL 2") << 1.00000e-7 << 3.00000e-7; + QTest::newRow("should FAIL 1") << one << 3.; + QTest::newRow("should PASS 1") << zero << zero; + QTest::newRow("should FAIL 2") << 1.e-7 << 3.e-7; // QCOMPARE for doubles uses qFuzzyCompare(), which succeeds if the numbers // differ by no more than 1e-12 times the smaller value. Thus // QCOMPARE(1e12-2, 1e12-1) should fail, while QCOMPARE(1e12+1, 1e12+2) // should pass. - QTest::newRow("should PASS 2") << 1e12 + 1. << 1e12 + 2.; - QTest::newRow("should FAIL 3") << 1e12 - 1. << 1e12 - 2.; + QTest::newRow("should PASS 2") << 1e12 + one << 1e12 + 2.; + QTest::newRow("should FAIL 3") << 1e12 - one << 1e12 - 2.; // ... but rounding makes that a bit unrelaible when scaled close to the bounds. QTest::newRow("should PASS 3") << 1e-310 + 1e-322 << 1e-310 + 2e-322; QTest::newRow("should FAIL 4") << 1e-310 - 1e-322 << 1e-310 - 3e-322; QTest::newRow("should PASS 4") << 1e307 + 1e295 << 1e307 + 2e295; QTest::newRow("should FAIL 5") << 1e307 - 1e295 << 1e307 - 3e295; - // QCOMPARE special-cases non-finite values - if (std::numeric_limits<double>::has_quiet_NaN) { - const double nan = std::numeric_limits<double>::quiet_NaN(); - QTest::newRow("should PASS: NaN == NaN") << nan << nan; - QTest::newRow("should FAIL: NaN != 0") << nan << 0.; - QTest::newRow("should FAIL: 0 != NaN") << 0. << nan; - QTest::newRow("should FAIL: NaN != 1") << nan << 1.; - QTest::newRow("should FAIL: 1 != NaN") << 1. << nan; - } - if (std::numeric_limits<double>::has_infinity) { - const double uge = std::numeric_limits<double>::infinity(); - QTest::newRow("should PASS: inf == inf") << uge << uge; - QTest::newRow("should PASS: -inf == -inf") << -uge << -uge; - QTest::newRow("should FAIL: inf != -inf") << uge << -uge; - QTest::newRow("should FAIL: -inf != inf") << -uge << uge; - if (std::numeric_limits<double>::has_quiet_NaN) { - const double nan = std::numeric_limits<double>::quiet_NaN(); - QTest::newRow("should FAIL: inf != nan") << uge << nan; - QTest::newRow("should FAIL: nan != inf") << nan << uge; - QTest::newRow("should FAIL: -inf != nan") << -uge << nan; - QTest::newRow("should FAIL: nan != -inf") << nan << -uge; - } - QTest::newRow("should FAIL: inf != 0") << uge << 0.; - QTest::newRow("should FAIL: 0 != inf") << 0. << uge; - QTest::newRow("should FAIL: -inf != 0") << -uge << 0.; - QTest::newRow("should FAIL: 0 != -inf") << 0. << -uge; - QTest::newRow("should FAIL: inf != 1") << uge << 1.; - QTest::newRow("should FAIL: 1 != inf") << 1. << uge; - QTest::newRow("should FAIL: -inf != 1") << -uge << 1.; - QTest::newRow("should FAIL: 1 != -inf") << 1. << -uge; - - const double big = std::numeric_limits<double>::max(); - QTest::newRow("should FAIL: inf != max") << uge << big; - QTest::newRow("should FAIL: inf != -max") << uge << -big; - QTest::newRow("should FAIL: max != inf") << big << uge; - QTest::newRow("should FAIL: -max != inf") << -big << uge; - QTest::newRow("should FAIL: -inf != max") << -uge << big; - QTest::newRow("should FAIL: -inf != -max") << -uge << -big; - QTest::newRow("should FAIL: max != -inf") << big << -uge; - QTest::newRow("should FAIL: -max != -inf") << -big << -uge; - } + nonFinite_data(zero, one); } void tst_float::floatComparisons() const @@ -131,65 +141,26 @@ void tst_float::floatComparisons_data() const { QTest::addColumn<float>("operandLeft"); QTest::addColumn<float>("operandRight"); + float zero(0.f), one(1.f); - QTest::newRow("should FAIL 1") << 1.00000f << 3.00000f; - QTest::newRow("should PASS 1") << 0.f << 0.f; - QTest::newRow("should FAIL 2") << 1.00000e-7f << 3.00000e-7f; + QTest::newRow("should FAIL 1") << one << 3.f; + QTest::newRow("should PASS 1") << zero << zero; + QTest::newRow("should FAIL 2") << 1.e-7f << 3.e-7f; // QCOMPARE for floats uses qFuzzyCompare(), which succeeds if the numbers // differ by no more than 1e-5 times the smaller value. Thus // QCOMPARE(1e5-2, 1e5-1) should fail, while QCOMPARE(1e5+1, 1e5+2) // should pass. - QTest::newRow("should PASS 2") << 1e5f + 1.f << 1e5f + 2.f; - QTest::newRow("should FAIL 3") << 1e5f - 1.f << 1e5f - 2.f; + QTest::newRow("should PASS 2") << 1e5f + one << 1e5f + 2.f; + QTest::newRow("should FAIL 3") << 1e5f - one << 1e5f - 2.f; // ... but rounding makes that a bit unrelaible when scaled close to the bounds. QTest::newRow("should PASS 3") << 1e-39f + 1e-44f << 1e-39f + 2e-44f; QTest::newRow("should FAIL 4") << 1e-39f - 1e-44f << 1e-39f - 3e-44f; QTest::newRow("should PASS 4") << 1e38f + 1e33f << 1e38f + 2e33f; QTest::newRow("should FAIL 5") << 1e38f - 1e33f << 1e38f - 3e33f; - // QCOMPARE special-cases non-finite values - if (std::numeric_limits<float>::has_quiet_NaN) { - const float nan = std::numeric_limits<float>::quiet_NaN(); - QTest::newRow("should PASS: NaN == NaN") << nan << nan; - QTest::newRow("should FAIL: NaN != 0") << nan << 0.f; - QTest::newRow("should FAIL: 0 != NaN") << 0.f << nan; - QTest::newRow("should FAIL: NaN != 1") << nan << 1.f; - QTest::newRow("should FAIL: 1 != NaN") << 1.f << nan; - } - if (std::numeric_limits<float>::has_infinity) { - const float uge = std::numeric_limits<float>::infinity(); - QTest::newRow("should PASS: inf == inf") << uge << uge; - QTest::newRow("should PASS: -inf == -inf") << -uge << -uge; - QTest::newRow("should FAIL: inf != -inf") << uge << -uge; - QTest::newRow("should FAIL: -inf != inf") << -uge << uge; - if (std::numeric_limits<float>::has_quiet_NaN) { - const float nan = std::numeric_limits<float>::quiet_NaN(); - QTest::newRow("should FAIL: inf != nan") << uge << nan; - QTest::newRow("should FAIL: nan != inf") << nan << uge; - QTest::newRow("should FAIL: -inf != nan") << -uge << nan; - QTest::newRow("should FAIL: nan != -inf") << nan << -uge; - } - QTest::newRow("should FAIL: inf != 0") << uge << 0.f; - QTest::newRow("should FAIL: 0 != inf") << 0.f << uge; - QTest::newRow("should FAIL: -inf != 0") << -uge << 0.f; - QTest::newRow("should FAIL: 0 != -inf") << 0.f << -uge; - QTest::newRow("should FAIL: inf != 1") << uge << 1.f; - QTest::newRow("should FAIL: 1 != inf") << 1.f << uge; - QTest::newRow("should FAIL: -inf != 1") << -uge << 1.f; - QTest::newRow("should FAIL: 1 != -inf") << 1.f << -uge; - - const float big = std::numeric_limits<float>::max(); - QTest::newRow("should FAIL: inf != max") << uge << big; - QTest::newRow("should FAIL: inf != -max") << uge << -big; - QTest::newRow("should FAIL: max != inf") << big << uge; - QTest::newRow("should FAIL: -max != inf") << -big << uge; - QTest::newRow("should FAIL: -inf != max") << -uge << big; - QTest::newRow("should FAIL: -inf != -max") << -uge << -big; - QTest::newRow("should FAIL: max != -inf") << big << -uge; - QTest::newRow("should FAIL: -max != -inf") << -big << -uge; - } + nonFinite_data(zero, one); } void tst_float::float16Comparisons() const @@ -204,28 +175,22 @@ void tst_float::float16Comparisons_data() const { QTest::addColumn<qfloat16>("operandLeft"); QTest::addColumn<qfloat16>("operandRight"); + qfloat16 zero(0), one(1); - QTest::newRow("should SUCCEED 1") - << qfloat16(0) - << qfloat16(0); - - QTest::newRow("should FAIL 1") - << qfloat16(1.000) - << qfloat16(3.000); - - QTest::newRow("should FAIL 2") - << qfloat16(1.000e-4f) - << qfloat16(3.000e-4f); + QTest::newRow("should FAIL 1") << one << qfloat16(3); + QTest::newRow("should PASS 1") << zero << zero; + QTest::newRow("should FAIL 2") << qfloat16(1e-4f) << qfloat16(3e-4f); // QCOMPARE for qfloat16s uses qFuzzyCompare() - - QTest::newRow("should FAIL 3") - << qfloat16(98) - << qfloat16(99); - - QTest::newRow("should SUCCEED 2") - << qfloat16(1001) - << qfloat16(1002); + QTest::newRow("should PASS 2") << qfloat16(1001) << qfloat16(1002); + QTest::newRow("should FAIL 3") << qfloat16(98) << qfloat16(99); + // ... which gets a bit unreliable near to the type's bounds + QTest::newRow("should PASS 3") << qfloat16(6e-5f) + qfloat16(6e-7f) << qfloat16(6e-5f) + qfloat16(11e-7f); + QTest::newRow("should FAIL 4") << qfloat16(6e-5f) - qfloat16(7e-7f) << qfloat16(6e-5f) - qfloat16(13e-7f); + QTest::newRow("should PASS 4") << qfloat16(6e4) + qfloat16(700) << qfloat16(6e4) + qfloat16(1200); + QTest::newRow("should FAIL 5") << qfloat16(6e4) - qfloat16(600) << qfloat16(6e4) - qfloat16(1200); + + nonFinite_data(zero, one); } void tst_float::compareFloatTests() const diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 9ec87c8fc6..48ecbf0289 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -92,6 +92,17 @@ class Cleaner (object): (r'(Loc: \[[^[\]()]+)\(\d+\)', r'\1(0)'), # txt (r'(\[Loc: [^[\]()]+)\(\d+\)', r'\1(0)'), # teamcity (r'(<(?:Incident|Message)\b.*\bfile=.*\bline=)"\d+"', r'\1"0"'), # lightxml, xml + # Pointers printed by signal dumper: + (r'\(\b[a-f0-9]{8,}\b\)', r'(_POINTER_)'), + # Example/for reference: + # ((QString&)@55f5fbb8dd40) + # ((const QVector<int>*)7ffd671d4558) + (r'\((\((?:const )?\w+(?:<[^>]+>)?[*&]*\)@?)\b[a-f\d]{8,}\b\)', r'(\1_POINTER_)'), + # For xml output there is no '<', '>' or '&', so we need an alternate version for that: + # ((QVector<int>&)@5608b455e640) + (r'\((\((?:const )?\w+(?:<(?:[^&]|&(?!gt;))*>)?(?:\*|&)?\)@?)[a-z\d]+\b\)', r'(\1_POINTER_)'), + # QEventDispatcher{Glib,Win32,etc.} + (r'\bQEventDispatcher\w+\b', r'QEventDispatcherPlatform'), ), precook = re.compile): """Private implementation details of __init__().""" @@ -296,6 +307,7 @@ def generateTestData(testname, clean, "benchlibcounting": "-eventcounter", "printdatatags": "-datatags", "printdatatagswithglobaltags": "-datatags", + "signaldumper": "-vs", "silent": "-silent", "verbose1": "-v1", "verbose2": "-v2", diff --git a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp index 6c0ae1f43c..3c5c2c8f37 100644 --- a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp +++ b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp @@ -66,9 +66,10 @@ void tst_globaldata::initTestCase() void tst_globaldata::initTestCase_data() { - QTest::addColumn<bool>("booli"); - QTest::newRow("1") << false; - QTest::newRow("2") << true; + // QFETCH_GLOBAL shall iterate these, for every test: + QTest::addColumn<bool>("global"); + QTest::newRow("global=false") << false; + QTest::newRow("global=true") << true; } void tst_globaldata::cleanupTestCase() @@ -94,41 +95,42 @@ void tst_globaldata::cleanup() void tst_globaldata::testGlobal_data() { - QTest::addColumn<bool>("booll"); - QTest::newRow("local 1") << false; - QTest::newRow("local 2") << true; + QTest::addColumn<bool>("local"); + QTest::newRow("local=false") << false; + QTest::newRow("local=true") << true; } void tst_globaldata::testGlobal() { - QFETCH_GLOBAL(bool, booli); - qDebug() << "global:" << booli; - QFETCH(bool, booll); - qDebug() << "local:" << booll; + QFETCH_GLOBAL(bool, global); + qDebug() << "global:" << global; + QFETCH(bool, local); + qDebug() << "local:" << local; } void tst_globaldata::skip_data() { - QTest::addColumn<bool>("booll"); - QTest::newRow("local 1") << false; - QTest::newRow("local 2") << true; - + testGlobal_data(); QSKIP("skipping"); } void tst_globaldata::skip() { - qDebug() << "this line should never be reached"; + // A skip in _data() causes the whole test to be skipped, for all global rows. + QVERIFY(!"This line should never be reached."); } void tst_globaldata::skipSingle() { - QFETCH_GLOBAL(bool, booli); - QFETCH(bool, booll); - - if (booli && !booll) - QSKIP("skipping"); - qDebug() << "global:" << booli << "local:" << booll; + QFETCH_GLOBAL(bool, global); + QFETCH(bool, local); + + // A skip in the last run of one global row used to suppress the test in the + // next global row (where a skip in an earlier run of the first row did not). + if (global ^ local) + QSKIP("Skipping"); + qDebug() << "global:" << global << "local:" << local; + QCOMPARE(global, local); } void tst_globaldata::skipLocal() diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri index b4568dd3e1..2cad0b7e17 100644 --- a/tests/auto/testlib/selftests/selftests.pri +++ b/tests/auto/testlib/selftests/selftests.pri @@ -1,5 +1,4 @@ SUBPROGRAMS = \ - #alive \ assert \ badxml \ benchlibcallgrind \ @@ -37,6 +36,7 @@ SUBPROGRAMS = \ printdatatagswithglobaltags \ qexecstringlist \ silent \ + signaldumper \ singleskip \ skip \ skipcleanup \ diff --git a/tests/auto/testlib/selftests/signaldumper/signaldumper.pro b/tests/auto/testlib/selftests/signaldumper/signaldumper.pro new file mode 100644 index 0000000000..8780b18419 --- /dev/null +++ b/tests/auto/testlib/selftests/signaldumper/signaldumper.pro @@ -0,0 +1,9 @@ +SOURCES += tst_signaldumper.cpp +QT = core testlib-private + +macos:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = signaldumper + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp b/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp new file mode 100644 index 0000000000..f6cd0d510e --- /dev/null +++ b/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp @@ -0,0 +1,417 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QCoreApplication> +#include <QtTest/QtTest> +#include <private/qtestlog_p.h> + +class tst_Signaldumper : public QObject +{ + Q_OBJECT + + void addConnectionTypeData(); + +private slots: + void noConnections(); + void oneSlot_data(); + void oneSlot(); + void oneSlotOldSyntax_data(); + void oneSlotOldSyntax(); + void twoSlots_data(); + void twoSlots(); + void twoSlotsOldSyntax_data(); + void twoSlotsOldSyntax(); + void signalForwarding_data(); + void signalForwarding(); + void signalForwardingOldSyntax_data(); + void signalForwardingOldSyntax(); + void slotEmittingSignal_data(); + void slotEmittingSignal(); + void slotEmittingSignalOldSyntax_data(); + void slotEmittingSignalOldSyntax(); + + void variousTypes(); +}; + +void tst_Signaldumper::addConnectionTypeData() +{ + QTest::addColumn<Qt::ConnectionType>("connectionType"); + QTest::newRow("direct") << Qt::ConnectionType::DirectConnection; + QTest::newRow("queued") << Qt::ConnectionType::QueuedConnection; +} + +/* + Simple class to keep the slots and signals separate from the test +*/ +class SignalSlotClass : public QObject +{ + Q_OBJECT + +public: + SignalSlotClass(); + +public slots: + void slotWithoutParameters() {} + void slotWithParameters(int i, char c) { Q_UNUSED(i); Q_UNUSED(c); } + void emitSecondSignal() { emit nestedSignal(); } + +signals: + void signalWithoutParameters(); + void signalWithParameters(int i, char c); + + void nestedSignal(); + void nestedSignalWithParameters(int i, char c); + + // For the "variousTypes" test + void qStringSignal(QString string); + void qStringRefSignal(QString &string); + void qStringConstRefSignal(const QString &string); + void qByteArraySignal(QByteArray byteArray); + void qListSignal(QList<int> list); + void qVectorSignal(QVector<int> vector); + void qVectorRefSignal(QVector<int> &vector); + void qVectorConstRefSignal(const QVector<int> &vector); + void qVectorConstPointerSignal(const QVector<int> *vector); + void qVectorPointerConstSignal(QVector<int> *const vector); + void qVariantSignal(QVariant variant); +}; + +SignalSlotClass::SignalSlotClass() +{ + // For printing signal argument in "variousTypes" test + qRegisterMetaType<QVector<int>>(); + qRegisterMetaType<QList<int>>(); +} + +void tst_Signaldumper::noConnections() +{ + SignalSlotClass signalSlotOwner; + + emit signalSlotOwner.signalWithoutParameters(); + emit signalSlotOwner.signalWithParameters(242, 'm'); +} + +void tst_Signaldumper::oneSlot_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::oneSlot() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + // parameterless to parameterless + auto connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameters to parameters + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithParameters, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameters to no parameters + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::oneSlotOldSyntax_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::oneSlotOldSyntax() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + // parameterless to parameterless + auto connection = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameters to parameters + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithParameters(int, char)), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameters to no parameters + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::twoSlots_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::twoSlots() +{ + QFETCH(Qt::ConnectionType, connectionType); + + // Now, instead of creating two slots or two objects, we will just do the same connection twice. + // The same slot will then be invoked twice. + + SignalSlotClass signalSlotOwner; + // parameterless to parameterless + auto connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + auto connection2 = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); + + // parameters to parameters + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithParameters, connectionType); + connection2 = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithParameters, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); + + // parameters to no parameters + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + connection2 = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::slotWithoutParameters, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); +} + +void tst_Signaldumper::twoSlotsOldSyntax_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::twoSlotsOldSyntax() +{ + QFETCH(Qt::ConnectionType, connectionType); + + // Now, instead of creating two slots or two objects, we will just do the same connection twice. + // The same slot will then be invoked twice. + + SignalSlotClass signalSlotOwner; + // parameterless to parameterless + auto connection = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + auto connection2 = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); + + // parameters to parameters + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithParameters(int, char)), connectionType); + connection2 = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithParameters(int, char)), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); + + // parameters to no parameters + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + connection2 = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SLOT(slotWithoutParameters()), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + disconnect(connection2); +} + +void tst_Signaldumper::signalForwarding_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::signalForwarding() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + + // parameterless signal to parameterless signal + auto connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters, + &signalSlotOwner, &SignalSlotClass::nestedSignal, connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameter(full) signal to parameter(full) signal + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::nestedSignalWithParameters, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameter(full) signal to parameterless signal + connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithParameters, + &signalSlotOwner, &SignalSlotClass::nestedSignal, connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::signalForwardingOldSyntax_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::signalForwardingOldSyntax() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + + // parameterless signal to parameterless signal + auto connection = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()), + &signalSlotOwner, SIGNAL(nestedSignal()), connectionType); + emit signalSlotOwner.signalWithoutParameters(); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameter(full) signal to parameter(full) signal + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SIGNAL(nestedSignalWithParameters(int, char)), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); + + // parameter(full) signal to parameterless signal + connection = connect(&signalSlotOwner, SIGNAL(signalWithParameters(int, char)), + &signalSlotOwner, SIGNAL(nestedSignal()), connectionType); + emit signalSlotOwner.signalWithParameters(242, 'm'); + + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::slotEmittingSignal_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::slotEmittingSignal() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + + auto connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters, + &signalSlotOwner, &SignalSlotClass::emitSecondSignal, connectionType); + emit signalSlotOwner.signalWithoutParameters(); + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::slotEmittingSignalOldSyntax_data() +{ + addConnectionTypeData(); +} + +void tst_Signaldumper::slotEmittingSignalOldSyntax() +{ + QFETCH(Qt::ConnectionType, connectionType); + + SignalSlotClass signalSlotOwner; + + auto connection = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()), + &signalSlotOwner, SLOT(emitSecondSignal()), connectionType); + emit signalSlotOwner.signalWithoutParameters(); + QCoreApplication::processEvents(); + disconnect(connection); +} + +void tst_Signaldumper::variousTypes() +{ + SignalSlotClass signalSlotOwner; + QString string = QString::fromLatin1("Test string"); + emit signalSlotOwner.qStringSignal(string); + emit signalSlotOwner.qStringRefSignal(string); + emit signalSlotOwner.qStringConstRefSignal(string); + emit signalSlotOwner.qByteArraySignal(QByteArray("Test bytearray")); + + QList<int> list{1, 2, 3, 242}; + emit signalSlotOwner.qListSignal(list); + + QVector<int> vector{1, 2, 3, 242}; + emit signalSlotOwner.qVectorSignal(vector); + emit signalSlotOwner.qVectorRefSignal(vector); + emit signalSlotOwner.qVectorConstRefSignal(vector); + emit signalSlotOwner.qVectorConstPointerSignal(&vector); + emit signalSlotOwner.qVectorPointerConstSignal(&vector); + + QVariant variant = 24; + emit signalSlotOwner.qVariantSignal(variant); + variant = QVariant(string); + emit signalSlotOwner.qVariantSignal(variant); +} + +QTEST_MAIN(tst_Signaldumper) +#include "tst_signaldumper.moc" diff --git a/tests/auto/testlib/selftests/silent/tst_silent.cpp b/tests/auto/testlib/selftests/silent/tst_silent.cpp index 97fbbfd30a..cf3c35dec4 100644 --- a/tests/auto/testlib/selftests/silent/tst_silent.cpp +++ b/tests/auto/testlib/selftests/silent/tst_silent.cpp @@ -72,6 +72,17 @@ void tst_Silent::xpass() QVERIFY2(true, "This test should XPASS"); } +#ifndef Q_OS_WIN +#include <signal.h> +#include <setjmp.h> + +static jmp_buf state; +static void abort_handler(int signal) +{ + longjmp(state, 1); +} +#endif + void tst_Silent::messages() { qWarning("This is a warning that should not appear in silent test output"); @@ -80,7 +91,15 @@ void tst_Silent::messages() qCritical("This is a critical message that should not appear in silent test output"); qInfo("This is an info message that should not appear in silent test output"); QTestLog::info("This is an internal testlib info message that should not appear in silent test output", __FILE__, __LINE__); - qFatal("This is a fatal error message that should still appear in silent test output"); + +#ifndef Q_OS_WIN + // We're testing qFatal, but we don't want to actually std::abort() ! + auto prior = signal(SIGABRT, abort_handler); + if (setjmp(state)) + signal(SIGABRT, prior); + else +#endif + qFatal("This is a fatal error message that should still appear in silent test output"); } QTEST_MAIN(tst_Silent) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 3ef15b9261..1326b96177 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -439,7 +439,6 @@ void tst_Selftests::runSubTest_data() QTest::addColumn<bool>("crashes"); QStringList tests = QStringList() -// << "alive" // timer dependent #if !defined(Q_OS_WIN) // On windows, assert does nothing in release mode and blocks execution // with a popup window in debug mode. @@ -488,6 +487,7 @@ void tst_Selftests::runSubTest_data() << "printdatatags" << "printdatatagswithglobaltags" << "qexecstringlist" + << "signaldumper" << "silent" << "singleskip" << "skip" @@ -553,6 +553,9 @@ void tst_Selftests::runSubTest_data() else if (subtest == "printdatatagswithglobaltags") { arguments << "-datatags"; } + else if (subtest == "signaldumper") { + arguments << "-vs"; + } else if (subtest == "silent") { arguments << "-silent"; } @@ -953,6 +956,29 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir, if (actualLine.startsWith(QLatin1String("Totals:")) && expectedLine.startsWith(QLatin1String("Totals:"))) return true; + const QLatin1String pointerPlaceholder("_POINTER_"); + if (expectedLine.contains(pointerPlaceholder) + && (expectedLine.contains(QLatin1String("Signal: ")) + || expectedLine.contains(QLatin1String("Slot: ")))) { + QString actual = actualLine; + // We don't care about the pointer of the object to whom the signal belongs, so we + // replace it with _POINTER_, e.g.: + // Signal: SignalSlotClass(7ffd72245410) signalWithoutParameters () + // Signal: QThread(7ffd72245410) started () + // After this instance pointer we may have further pointers and + // references (with an @ prefix) as parameters of the signal or + // slot being invoked. + // Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@55f5fbb8dd40) + actual.replace(QRegularExpression("\\b[a-f0-9]{8,}\\b"), pointerPlaceholder); + // Also change QEventDispatcher{Glib,Win32,etc.} to QEventDispatcherPlatform + actual.replace(QRegularExpression("\\b(QEventDispatcher)\\w+\\b"), QLatin1String("\\1Platform")); + if (actual != expectedLine) { + *errorMessage = msgMismatch(actual, expectedLine); + return false; + } + return true; + } + *errorMessage = msgMismatch(actualLine, expectedLine); return false; } diff --git a/tests/auto/testserver.pri b/tests/auto/testserver.pri deleted file mode 100644 index 26e7f6ab8a..0000000000 --- a/tests/auto/testserver.pri +++ /dev/null @@ -1,216 +0,0 @@ -# Integrating docker-based test servers into Qt Test framework -# -# This file adds support for docker-based test servers built by testcase -# projects that need them. To enable this feature, any automated test can -# include testserver.pri in its project file. This instructs qmake to insert -# additional targets into the generated Makefile. The 'check' target then brings -# up test servers before running the testcase, and shuts them down afterwards. -# -# TESTSERVER_COMPOSE_FILE -# - Contains the path of docker-compose file -# This configuration file defines the services used for autotests. It tells the -# docker engine how to build up the docker images and containers. In qtbase, a -# shared docker-compose file is located in the tests folder. -# Example: TESTSERVER_COMPOSE_FILE = \ -# $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml -# -# The user must run the provisioning scripts in advance before attempting to -# build the test servers. The docker_testserver.sh script is used to build up -# the docker images into the docker-cache. It handles the immutable parts of the -# server installation that rarely need adjustment, such as downloading packages. -# Example: qt5/coin/provisioning/.../testserver/docker_testserver.sh -# -# QT_TEST_SERVER_LIST -# - A list of test servers to bring up for this testcase -# These test servers should be defined in $$TESTSERVER_COMPOSE_FILE. Each -# testcase can define the test servers it depends on. -# Example: QT_TEST_SERVER_LIST = apache2 squid vsftpd ftp-proxy danted -# -# Pre-processor defines needed for the application: -# QT_TEST_SERVER -# - A preprocessor macro used for testcase to change testing parameters at -# compile time -# This macro is predefined for docker-based test servers and is passed as a -# compiler option (-DQT_TEST_SERVER). The testcase can then check whether -# docker-based servers are in use and change the testing parameters, such as -# host name or port number, at compile time. An example can be found in -# network-settings.h. -# -# Example: -# #if defined(QT_TEST_SERVER) -# Change the testing parameters at compile time -# #endif -# -# QT_TEST_SERVER_DOMAIN -# - A preprocessor macro that holds the server domain name -# Provided for the helper functions in network-settings.h. Use function -# serverDomainName() in your application instead. -# -# Additional make targets: -# 1. check_network - A renamed target from the check target of testcase feature. -# 2. testserver_clean - Clean up server containers/images and tidy away related -# files. - -# The docker test server should only be integrated in the leaf Makefile. -# If debug_and_release option is in use, skip the meta-Makefile except for -# Makefile.Debug and Makefile.Release. -debug_and_release:!build_pass: return() - -DOCKER_ENABLED = 1 - -equals(QMAKE_HOST.os, Darwin) { - DOCKER_ENABLED = 0 - message("Not using docker network test server on macOS, see QTQAINFRA-2717 and QTQAINFRA-2750") -} - -TESTSERVER_VERSION = "" - -equals(DOCKER_ENABLED, 1) { - TESTSERVER_VERSION = $$system(docker-compose --version) -} - -isEmpty(TESTSERVER_VERSION) { - # Make check with server "qt-test-server.qt-test-net" as a fallback -} else { - # Make check with docker test servers - equals(QMAKE_HOST.os, Linux) { - # For the platform supporting docker bridge network, each container is - # assigned a unique hostname and connected to the same network domain - # to communicate with the others. - DEFINES += QT_TEST_SERVER_NAME - DNSDOMAIN = test-net.qt.local - } else { - # For the others, the containers are deployed into a virtual machine - # using the host network. All the containers share the same hostname of - # the virtual machine, and they are connected to the same network domain. - # NOTE: In Windows, Apple Bonjour only works within a single local domain. - DNSDOMAIN = local - } - - equals(QMAKE_HOST.os, Darwin) { - # There is no docker bridge on macOS. It is impossible to ping a container. - # Docker docs recommends using port mapping to connect to a container; - # but it causes a port conflict if the user is running a service that - # binds the same port on the host. An alternative solution is to deploy - # the docker environment into VirtualBox using docker-machine. - TESTSERVER_COMPOSE_FILE = \ - $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-macOS.yml - - # The connection configuration for the target machine - MACHINE_CONFIG = $(shell docker-machine config qt-test-server) - - # The environment variables passed to the docker-compose file - TEST_ENV = 'MACHINE_IP=$(shell docker-machine ip qt-test-server)' - TEST_ENV += 'TEST_DOMAIN=$$DNSDOMAIN' - TEST_CMD = env - } else:equals(QMAKE_HOST.os, Windows) { - # There is no docker bridge on Windows. It is impossible to ping a container. - # Use docker-machine to deploy the docker environment into VirtualBox. - TESTSERVER_COMPOSE_FILE = \ - $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-windows.yml - - # The connection configuration for the target machine - MACHINE_CONFIG = (docker-machine config qt-test-server) - - # The environment variables passed to the docker-compose file - TEST_ENV = '\$\$env:MACHINE_IP = docker-machine ip qt-test-server;' - TEST_ENV += '\$\$env:TEST_DOMAIN = $$shell_quote(\"$$DNSDOMAIN\");' - - # Docker-compose CLI environment variables: - # Enable path conversion from Windows-style to Unix-style in volume definitions. - TEST_ENV += '\$\$env:COMPOSE_CONVERT_WINDOWS_PATHS = $$shell_quote(\"true\");' - - TEST_CMD = 'PowerShell -noprofile' - CONFIG += PowerShell - } else { - TESTSERVER_COMPOSE_FILE = $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml - - # The environment variables passed to the docker-compose file - TEST_ENV = 'TEST_DOMAIN=$$DNSDOMAIN' - TEST_CMD = env - } - - # The domain name is relevant to https keycert (qnetworkreply/crts/qt-test-net-cacert.pem). - DEFINES += QT_TEST_SERVER QT_TEST_SERVER_DOMAIN=$$shell_quote(\"$${DNSDOMAIN}\") - - # Ensure that the docker-compose file is provided. It is a configuration - # file which is mandatory for all docker-compose commands. You can get more - # detail from the description of TESTSERVER_COMPOSE_FILE above. There is - # also an example showing how to configure it manually. - FILE_PRETEST_MSG = "Project variable 'TESTSERVER_COMPOSE_FILE' is not set" - PowerShell { - testserver_pretest.commands = echo $$TESTSERVER_VERSION && - testserver_pretest.commands += \ - $$TEST_CMD if ([String]::IsNullOrEmpty($$shell_quote(\"$$TESTSERVER_COMPOSE_FILE\"))) \ - {Write-Error $$shell_quote(\"$$FILE_PRETEST_MSG\")} && - } else { - testserver_pretest.commands = $(info "testserver:" $$TESTSERVER_VERSION) - testserver_pretest.commands += $(if $$TESTSERVER_COMPOSE_FILE,,$(error $$FILE_PRETEST_MSG)) - } - - # Make sure docker-machine is both created and running. The docker_machine - # script is used to deploy the docker environment into VirtualBox. - # Example: qt5/coin/provisioning/common/shared/testserver/docker_machine.sh - !isEmpty(MACHINE_CONFIG) { - MACHINE_LIST_CMD = docker-machine ls -q --filter "Name=^qt-test-server\$\$" - MACHINE_LIST_MSG = "Docker machine qt-test-server not found" - PowerShell { - testserver_pretest.commands += $$TEST_CMD if (!($$MACHINE_LIST_CMD)) \ - {Write-Error $$shell_quote(\"$$MACHINE_LIST_MSG\")} && - } else { - testserver_pretest.commands += \ - $(if $(shell $$MACHINE_LIST_CMD),,$(error $$MACHINE_LIST_MSG)) - } - - MACHINE_STATE_CMD = \ - docker-machine ls -q --filter "State=Running" --filter "Name=^qt-test-server\$\$" - MACHINE_START_CMD = docker-machine start qt-test-server - MACHINE_RECERT = docker-machine regenerate-certs -f qt-test-server - PowerShell { - testserver_pretest.commands += \ - $$TEST_CMD if (!($$MACHINE_STATE_CMD)) {$$MACHINE_START_CMD; $$MACHINE_RECERT} && - } else { - testserver_pretest.commands += \ - $(if $(shell $$MACHINE_STATE_CMD),,\ - $(shell $$MACHINE_START_CMD > /dev/null && $$MACHINE_RECERT > /dev/null)) - } - } - - # Before starting the test servers, it requires the user to run the setup - # script (coin/provisioning/.../testserver/docker_testserver.sh) in advance. - IMAGE_PRETEST_CMD = docker $$MACHINE_CONFIG images -aq "qt-test-server-*" - IMAGE_PRETEST_MSG = "Docker image qt-test-server-* not found" - PowerShell { - testserver_pretest.commands += $$TEST_CMD if (!($$IMAGE_PRETEST_CMD)) \ - {Write-Error $$shell_quote(\"$$IMAGE_PRETEST_MSG\")} - } else { - testserver_pretest.commands += \ - $(if $(shell $$IMAGE_PRETEST_CMD),,$(error $$IMAGE_PRETEST_MSG)) - } - - # Rename the check target of testcase feature - check.target = check_network - testserver_test.target = check - - # Pretesting test servers environment - testserver_test.depends = testserver_pretest - - # Bring up test servers and make sure the services are ready. - !isEmpty(TEST_CMD): testserver_test.commands = $$TEST_CMD $$TEST_ENV - testserver_test.commands += docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE up \ - --detach --force-recreate --timeout 1 $${QT_TEST_SERVER_LIST} && - - # Check test cases with docker-based test servers. - testserver_test.commands += $(MAKE) -f $(MAKEFILE) check_network && - - # Stop and remove test servers after testing. - !isEmpty(TEST_CMD): testserver_test.commands += $$TEST_CMD $$TEST_ENV - testserver_test.commands += docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE down \ - --timeout 1 - - # Destroy test servers and tidy away related files. - testserver_clean.commands = docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE down \ - --rmi all - - QMAKE_EXTRA_TARGETS += testserver_pretest testserver_test testserver_clean -} diff --git a/tests/auto/tools/moc/cxx-attributes.h b/tests/auto/tools/moc/cxx-attributes.h new file mode 100644 index 0000000000..eff6a3ec41 --- /dev/null +++ b/tests/auto/tools/moc/cxx-attributes.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CXXATTRIBUTE_H +#define CXXATTRIBUTE_H + +#include <QtCore/QObject> + +class CppAttribute : public QObject +{ + Q_OBJECT +signals: + [[deprecated]] void deprecatedSignal(); + +public slots: + [[deprecated]] void deprecatedSlot() {} + [[deprecated]] [[tst_moc::maybe_unused]] int deprecatedSlot2() { return 42; } + [[deprecated("reason")]] void deprecatedReason() {} + [[deprecated("reason[")]] void deprecatedReasonWithLBRACK() {} + [[deprecated("reason[[")]] void deprecatedReasonWith2LBRACK() {} + [[deprecated("reason]")]] void deprecatedReasonWithRBRACK() {} + [[deprecated("reason]]")]] void deprecatedReasonWith2RBRACK() {} + void slotWithArguments([[tst_moc::maybe_unused]] int) {} +#if !defined(_MSC_VER) || _MSC_VER >= 1912 + // On MSVC it causes: + // moc_cxx-attributes.cpp(133): fatal error C1001: An internal error has occurred in the compiler. + Q_INVOKABLE [[tst_moc::noreturn]] void noreturnSlot() { throw "unused"; } + [[tst_moc::noreturn]] Q_SCRIPTABLE void noreturnSlot2() { throw "unused"; } + [[deprecated]] int returnInt() { return 0; } + Q_SLOT [[tst_moc::noreturn]] [[deprecated]] void noreturnDeprecatedSlot() { throw "unused"; } + Q_INVOKABLE void noreturnSlot3() [[tst_moc::noreturn]] { throw "unused"; } +#endif +}; + +#ifdef Q_MOC_RUN +# define TEST_COMPILER_DEPRECATION [[deprecated]] +# define TEST_COMPILER_DEPRECATION_X(x) [[deprecated(x)]] +#else +# define TEST_COMPILER_DEPRECATION Q_DECL_ENUMERATOR_DEPRECATED +# define TEST_COMPILER_DEPRECATION_X(x) Q_DECL_ENUMERATOR_DEPRECATED_X(x) +#endif + +namespace TestQNamespaceDeprecated { + Q_NAMESPACE + enum class TestEnum1 { + Key1 = 11, + Key2 TEST_COMPILER_DEPRECATION, + Key3 TEST_COMPILER_DEPRECATION_X("reason"), + Key4 TEST_COMPILER_DEPRECATION_X("reason["), + Key5 TEST_COMPILER_DEPRECATION_X("reason[["), + Key6 TEST_COMPILER_DEPRECATION_X("reason]"), + Key7 TEST_COMPILER_DEPRECATION_X("reason]]"), + }; + Q_ENUM_NS(TestEnum1) + + // try to dizzy moc by adding a struct in between + struct TestGadget { + Q_GADGET + public: + enum class TestGEnum1 { + Key1 = 13, + Key2 TEST_COMPILER_DEPRECATION, + Key3 TEST_COMPILER_DEPRECATION_X("reason") + }; + Q_ENUM(TestGEnum1) + }; + + enum class TestFlag1 { + None = 0, + Flag1 = 1, + Flag2 TEST_COMPILER_DEPRECATION = 2, + Flag3 TEST_COMPILER_DEPRECATION_X("reason") = 3, + Any = Flag1 | Flag2 | Flag3 + }; + Q_FLAG_NS(TestFlag1) +} + +#endif // CXXATTRIBUTE_H diff --git a/tests/auto/tools/moc/cxx11-enums.h b/tests/auto/tools/moc/cxx11-enums.h index cc14c0acda..d5bd228f12 100644 --- a/tests/auto/tools/moc/cxx11-enums.h +++ b/tests/auto/tools/moc/cxx11-enums.h @@ -30,7 +30,6 @@ #define CXX11_ENUMS_H #include <QtCore/QObject> -#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_MOC_RUN) class CXX11Enums { Q_GADGET @@ -73,21 +72,4 @@ public: Q_FLAGS(ClassFlags) }; -#else -//workaround to get the moc compiled code to compile -class CXX11Enums -{ - Q_GADGET -public: - struct EnumClass { enum { A0, A1, A2, A3 }; }; - struct TypedEnumClass { enum { C0, C1, C2, C3 }; }; - enum NormalEnum { D2 = 2, D3, D0 =0 , D1 }; - enum TypedEnum { B0, B1 , B2, B3 }; -}; - -class CXX11Enums2 : public CXX11Enums -{ - Q_GADGET -}; -#endif #endif // CXX11_ENUMS_H diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index 3cbc9ebb5e..ad8c093add 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -29,7 +29,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n non-gadget-parent-class.h grand-parent-gadget-class.h \ related-metaobjects-in-gadget.h \ related-metaobjects-name-conflict.h \ - namespace.h cxx17-namespaces.h + namespace.h cxx17-namespaces.h \ + cxx-attributes.h if(*-g++*|*-icc*|*-clang*|*-llvm):!win32-*: HEADERS += os9-newlines.h win-newlines.h diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index 7b0fa29d7c..bd22b0b9af 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -51,7 +51,6 @@ #define PD_CLASSINFO Q_CLASSINFO -#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN) #define PD_VARARG(x, ...) x(__VA_ARGS__) #if defined(Q_CC_GNU) || defined(Q_MOC_RUN) @@ -61,7 +60,6 @@ #define PD_VARARGEXT(x, ...) x(__VA_ARGS__) #endif -#endif #define PD_ADD_SUFFIX(x) PD_DEFINE1(x,_SUFFIX) #define PD_DEFINE_ITSELF PD_ADD_SUFFIX(PD_DEFINE_ITSELF) @@ -100,7 +98,6 @@ public slots: PD_TEST_IDENTIFIER_ARG(void, combined6()) {} -#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN) PD_VARARG(void vararg1) {} PD_VARARG(void vararg2, int) {} PD_VARARG(void vararg3, int, int) {} @@ -108,14 +105,6 @@ public slots: PD_VARARGEXT(void vararg4) {} PD_VARARGEXT(void vararg5, int) {} PD_VARARGEXT(void vararg6, int, int) {} -#else - void vararg1() {} - void vararg2(int) {} - void vararg3(int,int) {} - void vararg4() {} - void vararg5(int) {} - void vararg6(int,int) {} -#endif #define OUTERFUNCTION(x) x #define INNERFUNCTION(x) OUTERFUNCTION(x) diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 74ddfd5620..6b7aaf7c0a 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -71,6 +71,7 @@ #include "grand-parent-gadget-class.h" #include "namespace.h" #include "cxx17-namespaces.h" +#include "cxx-attributes.h" #ifdef Q_MOC_RUN // check that moc can parse these constructs, they are being used in Windows winsock2.h header @@ -703,6 +704,7 @@ private slots: void optionsFileError(); void testQNamespace(); void cxx17Namespaces(); + void cxxAttributes(); signals: void sigWithUnsignedArg(unsigned foo); @@ -1423,6 +1425,16 @@ void tst_Moc::environmentIncludePaths() // plugin_metadata.h contains a plugin which we register here. Since we're not building this // application as a plugin, we need top copy some of the initializer code found in qplugin.h: extern "C" QObject *qt_plugin_instance(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +extern "C" QPluginMetaData qt_plugin_query_metadata(); +class StaticPluginInstance{ +public: + StaticPluginInstance() { + QStaticPlugin plugin(qt_plugin_instance, qt_plugin_query_metadata); + qRegisterStaticPluginFunction(plugin); + } +}; +#else extern "C" const char *qt_plugin_query_metadata(); class StaticPluginInstance{ public: @@ -1431,6 +1443,7 @@ public: qRegisterStaticPluginFunction(plugin); } }; +#endif static StaticPluginInstance staticInstance; void tst_Moc::specifyMetaTagsFromCmdline() { @@ -3847,6 +3860,14 @@ static void checkEnum(const QMetaEnum &enumerator, const QByteArray &name, const } } +class EnumFromNamespaceClass : public QObject +{ + Q_OBJECT + Q_PROPERTY(FooNamespace::Enum1 prop READ prop CONSTANT) +public: + FooNamespace::Enum1 prop() { return FooNamespace::Enum1::Key2; } +}; + void tst_Moc::testQNamespace() { QCOMPARE(TestQNamespace::staticMetaObject.enumeratorCount(), 4); @@ -3874,6 +3895,11 @@ void tst_Moc::testQNamespace() QCOMPARE(FooNamespace::staticMetaObject.enumeratorCount(), 1); QCOMPARE(FooNamespace::FooNestedNamespace::staticMetaObject.enumeratorCount(), 2); QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1); + + EnumFromNamespaceClass obj; + const QVariant prop = obj.property("prop"); + QCOMPARE(prop.type(), QMetaType::Int); + QCOMPARE(prop.toInt(), int(FooNamespace::Enum1::Key2)); } void tst_Moc::cxx17Namespaces() @@ -3895,6 +3921,41 @@ void tst_Moc::cxx17Namespaces() QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().value(0), 3); } +void tst_Moc::cxxAttributes() +{ + auto so = CppAttribute::staticMetaObject; + QCOMPARE(so.className(), "CppAttribute"); + QCOMPARE(so.enumeratorCount(), 0); + QVERIFY(so.indexOfSignal("deprecatedSignal") != 1); + for (auto a: {"deprecatedSlot", "deprecatedSlot2", "deprecatedReason", "deprecatedReasonWithLBRACK", + "deprecatedReasonWith2LBRACK", "deprecatedReasonWithRBRACK", "deprecatedReasonWith2RBRACK", + "slotWithArguments" +#if !defined(_MSC_VER) || _MSC_VER >= 1912 + , "noreturnSlot", "noreturnSlot2", "returnInt", "noreturnDeprecatedSlot", + "noreturnSlot3" +#endif + }) { + QVERIFY(so.indexOfSlot(a) != 1); + } + + QCOMPARE(TestQNamespaceDeprecated::staticMetaObject.enumeratorCount(), 2); + checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(0), "TestEnum1", + {{"Key1", 11}, {"Key2", 12}, {"Key3", 13}, {"Key4", 14}, {"Key5", 15}, {"Key6", 16}, + {"Key7", 17}}); + checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(1), "TestFlag1", + {{"None", 0}, {"Flag1", 1}, {"Flag2", 2}, {"Flag3", 3}, {"Any", 1 | 2 | 3}}); + + QCOMPARE(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumeratorCount(), 1); + checkEnum(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumerator(0), "TestGEnum1", + {{"Key1", 13}, {"Key2", 14}, {"Key3", 15}}); + + QMetaEnum meta = QMetaEnum::fromType<TestQNamespaceDeprecated::TestEnum1>(); + QVERIFY(meta.isValid()); + QCOMPARE(meta.name(), "TestEnum1"); + QCOMPARE(meta.enclosingMetaObject(), &TestQNamespaceDeprecated::staticMetaObject); + QCOMPARE(meta.keyCount(), 7); +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS diff --git a/tests/auto/tools/qmakelib/qmakelib.pro b/tests/auto/tools/qmakelib/qmakelib.pro index 29f17f6a14..5e9e9fe637 100644 --- a/tests/auto/tools/qmakelib/qmakelib.pro +++ b/tests/auto/tools/qmakelib/qmakelib.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qmakelib QT = core testlib -win32: LIBS += -ladvapi32 +win32: QMAKE_USE += advapi32 INCLUDEPATH += ../../../../qmake/library VPATH += ../../../../qmake/library diff --git a/tests/auto/tools/rcc/data/sizes/size-2-0-35-1_python.expected b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1_python.expected new file mode 100644 index 0000000000..9dcd131af5 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1_python.expected @@ -0,0 +1,68 @@ +# Resource object code (Python 3) +# Created by: object code +# Created by: The Resource Compiler for Qt version 5.14.0 +# WARNING! All changes made in this file will be lost! + +from PySide2 import QtCore + +qt_resource_data = b"\ +\x00\x00\x00\x02\ +0\ +1\ +\x00\x00\x00#\ +0\ +123456789 012345\ +6789 0123456789 \ +12\ +\x00\x00\x00\x01\ +@\ +\ +\x00\x00\x00\x00\ +\ +" + +qt_resource_name = b"\ +\x00\x04\ +\x00\x06\xa8\xa1\ +\x00d\ +\x00a\x00t\x00a\ +\x00\x0a\ +\x04\x08\x0a\xb4\ +\x00d\ +\x00a\x00t\x00a\x00-\x002\x00.\x00t\x00x\x00t\ +\x00\x0b\ +\x00\xb5Ot\ +\x00d\ +\x00a\x00t\x00a\x00-\x003\x005\x00.\x00t\x00x\x00t\ +\x00\x0a\ +\x04\x11\x0a\xb4\ +\x00d\ +\x00a\x00t\x00a\x00-\x001\x00.\x00t\x00x\x00t\ +\x00\x0a\ +\x04\x0e\x0a\xb4\ +\x00d\ +\x00a\x00t\x00a\x00-\x000\x00.\x00t\x00x\x00t\ +" + +qt_resource_struct = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x00\x06\ +IGNORE: (time stamp) +\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +IGNORE: (time stamp) +\x00\x00\x00^\x00\x00\x00\x00\x00\x01\x00\x00\x002\ +IGNORE: (time stamp) +\x00\x00\x00D\x00\x00\x00\x00\x00\x01\x00\x00\x00-\ +IGNORE: (time stamp) +" + +def qInitResources(): + QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index c810c6e364..24fd79cf19 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -46,6 +46,33 @@ typedef QMap<QString, QString> QStringMap; Q_DECLARE_METATYPE(QStringMap) +static QByteArray msgProcessStartFailed(const QProcess &p) +{ + const QString result = QLatin1String("Could not start \"") + + QDir::toNativeSeparators(p.program()) + QLatin1String("\": ") + + p.errorString(); + return result.toLocal8Bit(); +} + +static QByteArray msgProcessTimeout(const QProcess &p) +{ + return '"' + QDir::toNativeSeparators(p.program()).toLocal8Bit() + + "\" timed out."; +} + +static QByteArray msgProcessCrashed(QProcess &p) +{ + return '"' + QDir::toNativeSeparators(p.program()).toLocal8Bit() + + "\" crashed.\n" + p.readAllStandardError(); +} + +static QByteArray msgProcessFailed(QProcess &p) +{ + return '"' + QDir::toNativeSeparators(p.program()).toLocal8Bit() + + "\" returned " + QByteArray::number(p.exitCode()) + ":\n" + + p.readAllStandardError(); +} + class tst_rcc : public QObject { Q_OBJECT @@ -62,10 +89,13 @@ private slots: void readback_data(); void readback(); + void python(); + void cleanupTestCase(); private: QString m_rcc; + QString m_dataPath; }; void tst_rcc::initTestCase() @@ -74,20 +104,19 @@ void tst_rcc::initTestCase() // we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078 QVERIFY(qputenv("QT_RCC_TEST", "1")); m_rcc = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/rcc"); -} -QString findExpectedFile(const QString &base) -{ - QString expectedrccfile = base; + m_dataPath = QFINDTESTDATA("data"); + QVERIFY(!m_dataPath.isEmpty()); +} - // Must be updated with each minor release. - if (QFileInfo(expectedrccfile + QLatin1String(".450")).exists()) - expectedrccfile += QLatin1String(".450"); - return expectedrccfile; +static inline bool isPythonComment(const QString &line) +{ + return line.startsWith(QLatin1Char('#')); } -static QString doCompare(const QStringList &actual, const QStringList &expected) +static QString doCompare(const QStringList &actual, const QStringList &expected, + const QString &timeStampPath) { if (actual.size() != expected.size()) { return QString("Length count different: actual: %1, expected: %2") @@ -95,13 +124,21 @@ static QString doCompare(const QStringList &actual, const QStringList &expected) } QByteArray ba; + const bool isPython = isPythonComment(expected.constFirst()); for (int i = 0, n = expected.size(); i != n; ++i) { QString expectedLine = expected.at(i); if (expectedLine.startsWith("IGNORE:")) continue; + if (isPython && isPythonComment(expectedLine) && isPythonComment(actual.at(i))) + continue; if (expectedLine.startsWith("TIMESTAMP:")) { const QString relativePath = expectedLine.mid(strlen("TIMESTAMP:")); - const quint64 timeStamp = QFileInfo(relativePath).lastModified().toMSecsSinceEpoch(); + const QFileInfo fi(timeStampPath + QLatin1Char('/') + relativePath); + if (!fi.isFile()) { + ba.append("File " + fi.absoluteFilePath().toUtf8() + " does not exist!"); + break; + } + const quint64 timeStamp = quint64(fi.lastModified().toMSecsSinceEpoch()); expectedLine.clear(); for (int shift = 56; shift >= 0; shift -= 8) { expectedLine.append(QLatin1String("0x")); @@ -110,7 +147,7 @@ static QString doCompare(const QStringList &actual, const QStringList &expected) } } if (expectedLine != actual.at(i)) { - qDebug() << "LINES" << i << "DIFFER"; + qDebug() << "LINES" << (i + 1) << "DIFFER"; ba.append( "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expectedLine + "\n>>>>>> expected\n" @@ -126,49 +163,53 @@ void tst_rcc::rcc_data() QTest::addColumn<QString>("qrcfile"); QTest::addColumn<QString>("expected"); - QString dataPath = QFINDTESTDATA("data/images/"); - if (dataPath.isEmpty()) - QFAIL("data path not found"); - QTest::newRow("images") << dataPath << "images.qrc" << "images.expected"; + const QString imagesPath = m_dataPath + QLatin1String("/images"); + QTest::newRow("images") << imagesPath << "images.qrc" << "images.expected"; - QString sizesPath = QFINDTESTDATA("data/sizes/"); - if (sizesPath.isEmpty()) - QFAIL("data path not found"); + const QString sizesPath = m_dataPath + QLatin1String("/sizes"); QTest::newRow("size-0") << sizesPath << "size-0.qrc" << "size-0.expected"; QTest::newRow("size-1") << sizesPath << "size-1.qrc" << "size-1.expected"; QTest::newRow("size-2-0-35-1") << sizesPath << "size-2-0-35-1.qrc" << "size-2-0-35-1.expected"; } +static QStringList readLinesFromFile(const QString &fileName, + QString::SplitBehavior splitBehavior) +{ + QFile file(fileName); + + bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text); + if (!ok) { + QWARN(qPrintable(QString::fromLatin1("Could not open testdata file %1: %2") + .arg(fileName, file.errorString()))); + } + + return QString::fromUtf8(file.readAll()).split(QLatin1Char('\n'), splitBehavior); +} + void tst_rcc::rcc() { QFETCH(QString, directory); QFETCH(QString, qrcfile); QFETCH(QString, expected); - if (!QDir::setCurrent(directory)) { - QString message = QString::fromLatin1("Unable to cd from '%1' to '%2'").arg(QDir::currentPath(), directory); - QFAIL(qPrintable(message)); - } - // If the file expectedoutput.txt exists, compare the // console output with the content of that file - const QString expected2 = findExpectedFile(expected); - QFile expectedFile(expected2); - if (!expectedFile.exists()) { - qDebug() << "NO EXPECTATIONS? " << expected2; - return; - } // Launch; force no compression, otherwise the output would be different // depending on the compression algorithm we're using QProcess process; + process.setWorkingDirectory(directory); process.start(m_rcc, { "-no-compress", qrcfile }); + QVERIFY2(process.waitForStarted(), msgProcessStartFailed(process).constData()); if (!process.waitForFinished()) { - const QString path = QString::fromLocal8Bit(qgetenv("PATH")); - QString message = QString::fromLatin1("'%1' could not be found when run from '%2'. Path: '%3' "). - arg(m_rcc, QDir::currentPath(), path); - QFAIL(qPrintable(message)); + process.kill(); + QFAIL(msgProcessTimeout(process).constData()); } + QVERIFY2(process.exitStatus() == QProcess::NormalExit, + msgProcessCrashed(process).constData()); + QVERIFY2(process.exitCode() == 0, + msgProcessFailed(process).constData()); + const QChar cr = QLatin1Char('\r'); const QString err = QString::fromLocal8Bit(process.readAllStandardError()).remove(cr); const QString out = QString::fromLatin1(process.readAllStandardOutput()).remove(cr); @@ -181,63 +222,20 @@ void tst_rcc::rcc() const QChar nl = QLatin1Char('\n'); const QStringList actualLines = out.split(nl); - QVERIFY(expectedFile.open(QIODevice::ReadOnly|QIODevice::Text)); - const QStringList expectedLines = QString::fromLatin1(expectedFile.readAll()).split(nl); + const QStringList expectedLines = + readLinesFromFile(directory + QLatin1Char('/') + expected, QString::KeepEmptyParts); + QVERIFY(!expectedLines.isEmpty()); - const QString diff = doCompare(actualLines, expectedLines); + const QString diff = doCompare(actualLines, expectedLines, directory); if (diff.size()) QFAIL(qPrintable(diff)); } - - -static void createRccBinaryData(const QString &rcc, const QString &baseDir, - const QString &qrcFileName, const QString &rccFileName) -{ - QString currentDir = QDir::currentPath(); - QDir::setCurrent(baseDir); - - // same as above: force no compression - QProcess rccProcess; - rccProcess.start(rcc, { "-binary", "-no-compress", "-o", rccFileName, qrcFileName }); - bool ok = rccProcess.waitForFinished(); - if (!ok) { - QString errorString = QString::fromLatin1("Could not start rcc (is it in PATH?): %1").arg(rccProcess.errorString()); - QFAIL(qPrintable(errorString)); - } - - QByteArray output = rccProcess.readAllStandardOutput(); - if (!output.isEmpty()) { - QString errorMessage = QString::fromLatin1("rcc stdout: %1").arg(QString::fromLocal8Bit(output)); - QWARN(qPrintable(errorMessage)); - } - - output = rccProcess.readAllStandardError(); - if (!output.isEmpty()) { - QString errorMessage = QString::fromLatin1("rcc stderr: %1").arg(QString::fromLocal8Bit(output)); - QWARN(qPrintable(errorMessage)); - } - - QDir::setCurrent(currentDir); -} - -static QStringList readLinesFromFile(const QString &fileName) -{ - QFile file(fileName); - - bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text); - if (!ok) - QWARN(qPrintable(QString::fromLatin1("Could not open testdata file %1: %2").arg(fileName, file.errorString()))); - - QStringList lines = QString::fromUtf8(file.readAll()).split(QLatin1Char('\n'), QString::SkipEmptyParts); - return lines; -} - static QStringMap readExpectedFiles(const QString &fileName) { QStringMap expectedFiles; - QStringList lines = readLinesFromFile(fileName); + QStringList lines = readLinesFromFile(fileName, QString::SkipEmptyParts); foreach (const QString &line, lines) { QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty); QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty); @@ -268,9 +266,7 @@ void tst_rcc::binary_data() QTest::addColumn<QString>("baseDirectory"); QTest::addColumn<QStringMap>("expectedFiles"); - QString dataPath = QFINDTESTDATA("data/binary/"); - if (dataPath.isEmpty()) - QFAIL("data path not found"); + QString dataPath = m_dataPath + QLatin1String("/binary/"); QDirIterator iter(dataPath, QStringList() << QLatin1String("*.qrc")); while (iter.hasNext()) @@ -279,12 +275,33 @@ void tst_rcc::binary_data() QFileInfo qrcFileInfo = iter.fileInfo(); QString absoluteBaseName = QFileInfo(qrcFileInfo.absolutePath(), qrcFileInfo.baseName()).absoluteFilePath(); QString rccFileName = absoluteBaseName + QLatin1String(".rcc"); - createRccBinaryData(m_rcc, dataPath, qrcFileInfo.absoluteFilePath(), rccFileName); + + // same as above: force no compression + QProcess rccProcess; + rccProcess.setWorkingDirectory(dataPath); + rccProcess.start(m_rcc, { "-binary", "-no-compress", "-o", rccFileName, qrcFileInfo.absoluteFilePath() }); + QVERIFY2(rccProcess.waitForStarted(), msgProcessStartFailed(rccProcess).constData()); + if (!rccProcess.waitForFinished()) { + rccProcess.kill(); + QFAIL(msgProcessTimeout(rccProcess).constData()); + } + QVERIFY2(rccProcess.exitStatus() == QProcess::NormalExit, + msgProcessCrashed(rccProcess).constData()); + QVERIFY2(rccProcess.exitCode() == 0, + msgProcessFailed(rccProcess).constData()); + + QByteArray output = rccProcess.readAllStandardOutput(); + if (!output.isEmpty()) + qWarning("rcc stdout: %s", output.constData()); + + output = rccProcess.readAllStandardError(); + if (!output.isEmpty()) + qWarning("rcc stderr: %s", output.constData()); QString localeFileName = absoluteBaseName + QLatin1String(".locale"); QFile localeFile(localeFileName); if (localeFile.exists()) { - QStringList locales = readLinesFromFile(localeFileName); + QStringList locales = readLinesFromFile(localeFileName, QString::SkipEmptyParts); foreach (const QString &locale, locales) { QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected")); QStringMap expectedFiles = readExpectedFiles(expectedFileName); @@ -386,16 +403,12 @@ void tst_rcc::readback() QFETCH(QString, resourceName); QFETCH(QString, fileSystemName); - QString dataPath = QFINDTESTDATA("data/"); - if (dataPath.isEmpty()) - QFAIL("data path not found"); - QFile resourceFile(resourceName); QVERIFY(resourceFile.open(QIODevice::ReadOnly)); QByteArray resourceData = resourceFile.readAll(); resourceFile.close(); - QFile fileSystemFile(dataPath + fileSystemName); + QFile fileSystemFile(m_dataPath + QLatin1Char('/') + fileSystemName); QVERIFY(fileSystemFile.open(QIODevice::ReadOnly)); QByteArray fileSystemData = fileSystemFile.readAll(); fileSystemFile.close(); @@ -403,12 +416,39 @@ void tst_rcc::readback() QCOMPARE(resourceData, fileSystemData); } +void tst_rcc::python() +{ + const QString path = m_dataPath + QLatin1String("/sizes"); + const QString testFileRoot = path + QLatin1String("/size-2-0-35-1"); + const QString qrcFile = testFileRoot + QLatin1String(".qrc"); + const QString expectedFile = testFileRoot + QLatin1String("_python.expected"); + const QString actualFile = testFileRoot + QLatin1String(".rcc"); + + QProcess process; + process.setWorkingDirectory(path); + process.start(m_rcc, { "-g", "python", "-o", actualFile, qrcFile}); + QVERIFY2(process.waitForStarted(), msgProcessStartFailed(process).constData()); + if (!process.waitForFinished()) { + process.kill(); + QFAIL(msgProcessTimeout(process).constData()); + } + QVERIFY2(process.exitStatus() == QProcess::NormalExit, + msgProcessCrashed(process).constData()); + QVERIFY2(process.exitCode() == 0, + msgProcessFailed(process).constData()); + + const auto actualLines = readLinesFromFile(actualFile, QString::KeepEmptyParts); + QVERIFY(!actualLines.isEmpty()); + const auto expectedLines = readLinesFromFile(expectedFile, QString::KeepEmptyParts); + QVERIFY(!expectedLines.isEmpty()); + const QString diff = doCompare(actualLines, expectedLines, path); + if (!diff.isEmpty()) + QFAIL(qPrintable(diff)); +} + void tst_rcc::cleanupTestCase() { - QString dataPath = QFINDTESTDATA("data/binary/"); - if (dataPath.isEmpty()) - return; - QDir dataDir(dataPath); + QDir dataDir(m_dataPath + QLatin1String("/binary")); QFileInfoList entries = dataDir.entryInfoList(QStringList() << QLatin1String("*.rcc")); foreach (const QFileInfo &entry, entries) QFile::remove(entry.absoluteFilePath()); diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp index f9553028fe..5b2f1f008b 100644 --- a/tests/auto/tools/uic/tst_uic.cpp +++ b/tests/auto/tools/uic/tst_uic.cpp @@ -36,17 +36,27 @@ #include <QtCore/QTemporaryDir> #include <QtCore/QRegularExpression> #include <QtCore/QStandardPaths> +#include <QtCore/QVector> #include <cstdio> static const char keepEnvVar[] = "UIC_KEEP_GENERATED_FILES"; static const char diffToStderrEnvVar[] = "UIC_STDERR_DIFF"; +struct TestEntry +{ + QByteArray name; + QString baselineBaseName; + QString generatedFileName; +}; + class tst_uic : public QObject { Q_OBJECT public: + using TestEntries = QVector<TestEntry>; + tst_uic(); private Q_SLOTS: @@ -63,13 +73,20 @@ private Q_SLOTS: void compare(); void compare_data() const; + void python(); + void python_data() const; + void runCompare(); private: + void populateTestEntries(); + const QString m_command; QString m_baseline; QTemporaryDir m_generated; + TestEntries m_testEntries; QRegularExpression m_versionRegexp; + QString m_python; }; tst_uic::tst_uic() @@ -85,6 +102,32 @@ static QByteArray msgProcessStartFailed(const QString &command, const QString &w return result.toLocal8Bit(); } +// Locate Python and check whether PySide2 is installed +static QString locatePython(QTemporaryDir &generatedDir) +{ + QString python = QStandardPaths::findExecutable(QLatin1String("python")); + if (python.isEmpty()) { + qWarning("Cannot locate python, skipping tests"); + return QString(); + } + QFile importTestFile(generatedDir.filePath(QLatin1String("import_test.py"))); + if (!importTestFile.open(QIODevice::WriteOnly| QIODevice::Text)) + return QString(); + importTestFile.write("import PySide2.QtCore\n"); + importTestFile.close(); + QProcess process; + process.start(python, {importTestFile.fileName()}); + if (!process.waitForStarted() || !process.waitForFinished()) + return QString(); + if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) { + const QString stdErr = QString::fromLocal8Bit(process.readAllStandardError()).simplified(); + qWarning("PySide2 is not installed (%s)", qPrintable(stdErr)); + return QString(); + } + importTestFile.remove(); + return python; +} + void tst_uic::initTestCase() { QVERIFY2(m_generated.isValid(), qPrintable(m_generated.errorString())); @@ -105,7 +148,28 @@ void tst_uic::initTestCase() arg(QDir::currentPath()); if (!outLines.empty()) msg += outLines.front(); + populateTestEntries(); + QVERIFY(!m_testEntries.isEmpty()); qDebug("%s", qPrintable(msg)); + + m_python = locatePython(m_generated); +} + +void tst_uic::populateTestEntries() +{ + const QString generatedPrefix = m_generated.path() + QLatin1Char('/'); + QDir baseline(m_baseline); + const QString baseLinePrefix = baseline.path() + QLatin1Char('/'); + const QFileInfoList baselineFiles = + baseline.entryInfoList(QStringList(QString::fromLatin1("*.ui")), QDir::Files); + m_testEntries.reserve(baselineFiles.size()); + for (const QFileInfo &baselineFile : baselineFiles) { + const QString baseName = baselineFile.baseName(); + const QString baselineBaseName = baseLinePrefix + baseName; + const QString generatedFile = generatedPrefix + baselineFile.fileName() + + QLatin1String(".h"); + m_testEntries.append(TestEntry{baseName.toLocal8Bit(), baselineBaseName, generatedFile}); + } } static const char helpFormat[] = R"( @@ -171,22 +235,12 @@ void tst_uic::run_data() const QTest::addColumn<QString>("generatedFile"); QTest::addColumn<QStringList>("options"); - QDir generated(m_generated.path()); - QDir baseline(m_baseline); - const QFileInfoList baselineFiles = baseline.entryInfoList(QStringList("*.ui"), QDir::Files); - foreach (const QFileInfo &baselineFile, baselineFiles) { - const QString generatedFile = generated.absolutePath() - + QLatin1Char('/') + baselineFile.fileName() - + QLatin1String(".h"); - + for (const TestEntry &te : m_testEntries) { QStringList options; - if (baselineFile.fileName() == QLatin1String("qttrid.ui")) + if (te.name == QByteArrayLiteral("qttrid")) options << QStringList(QLatin1String("-idbased")); - - QTest::newRow(qPrintable(baselineFile.baseName())) - << baselineFile.absoluteFilePath() - << generatedFile - << options; + QTest::newRow(te.name.constData()) << (te.baselineBaseName + QLatin1String(".ui")) + << te.generatedFileName << options; } } @@ -264,15 +318,9 @@ void tst_uic::compare_data() const QTest::addColumn<QString>("originalFile"); QTest::addColumn<QString>("generatedFile"); - QDir generated(m_generated.path()); - QDir baseline(m_baseline); - const QFileInfoList baselineFiles = baseline.entryInfoList(QStringList("*.h"), QDir::Files); - foreach (const QFileInfo &baselineFile, baselineFiles) { - const QString generatedFile = generated.absolutePath() - + QLatin1Char('/') + baselineFile.fileName(); - QTest::newRow(qPrintable(baselineFile.baseName())) - << baselineFile.absoluteFilePath() - << generatedFile; + for (const TestEntry &te : m_testEntries) { + QTest::newRow(te.name.constData()) << (te.baselineBaseName + QLatin1String(".ui.h")) + << te.generatedFileName; } } @@ -280,7 +328,7 @@ void tst_uic::runTranslation() { QProcess process; - QDir baseline(m_baseline); + const QDir baseline(m_baseline); QDir generated(m_generated.path()); generated.mkdir(QLatin1String("translation")); @@ -327,5 +375,75 @@ void tst_uic::runCompare() QCOMPARE(generatedFileContents, originalFileContents); } +// Let uic generate Python code and verify that it is syntactically +// correct by compiling it into .pyc. This test is executed only +// when python with an installed Qt for Python is detected (see locatePython()). + +static inline QByteArray msgCompilePythonFailed(const QByteArray &error) +{ + // If there is a line with blanks and caret indicating an error in the line + // above, insert the cursor into the offending line and remove the caret. + QByteArrayList lines = error.trimmed().split('\n'); + for (int i = lines.size() - 1; i > 0; --i) { + const auto &line = lines.at(i); + const int caret = line.indexOf('^'); + if (caret == 0 || (caret > 0 && line.at(caret - 1) == ' ')) { + lines.removeAt(i); + lines[i - 1].insert(caret, '|'); + break; + } + } + return lines.join('\n'); +} + +void tst_uic::python_data() const +{ + QTest::addColumn<QString>("originalFile"); + QTest::addColumn<QString>("generatedFile"); + + const int size = m_python.isEmpty() + ? qMin(1, m_testEntries.size()) : m_testEntries.size(); + for (int i = 0; i < size; ++i) { + const TestEntry &te = m_testEntries.at(i); + // qprintsettingsoutput: variable named 'from' clashes with Python + if (!te.baselineBaseName.endsWith(QLatin1String("/qprintsettingsoutput"))) { + QString generatedFile = te.generatedFileName; + generatedFile.chop(1); // foo.h -> foo.py + generatedFile.append(QLatin1String("py")); + QTest::newRow(te.name.constData()) + << (te.baselineBaseName + QLatin1String(".ui")) + << generatedFile; + } + } +} + +void tst_uic::python() +{ + QFETCH(QString, originalFile); + QFETCH(QString, generatedFile); + if (m_python.isEmpty()) + QSKIP("Python was not found"); + + QStringList uicArguments{QLatin1String("-g"), QLatin1String("python"), + originalFile, QLatin1String("-o"), generatedFile}; + QProcess process; + process.setWorkingDirectory(m_generated.path()); + process.start(m_command, uicArguments); + QVERIFY2(process.waitForStarted(), msgProcessStartFailed(m_command, process.errorString())); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitStatus(), QProcess::NormalExit); + QCOMPARE(process.exitCode(), 0); + QVERIFY(QFileInfo::exists(generatedFile)); + + // Test Python code generation by compiling the file + QStringList compileArguments{QLatin1String("-m"), QLatin1String("py_compile"), generatedFile}; + process.start(m_python, compileArguments); + QVERIFY2(process.waitForStarted(), msgProcessStartFailed(m_command, process.errorString())); + QVERIFY(process.waitForFinished()); + const bool compiled = process.exitStatus() == QProcess::NormalExit + && process.exitCode() == 0; + QVERIFY2(compiled, msgCompilePythonFailed(process.readAllStandardError()).constData()); +} + QTEST_MAIN(tst_uic) #include "tst_uic.moc" diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 748c8aaa84..f7482bae45 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1421,6 +1421,16 @@ void tst_QFiledialog::clearLineEdit() QTRY_VERIFY(fd.directory().absolutePath() != workDirPath); QVERIFY(lineEdit->text().isEmpty()); + + // QTBUG-71415: When pressing back, the selection (activated + // directory) should be restored. + QToolButton *backButton = fd.findChild<QToolButton*>("backButton"); + QVERIFY(backButton); + QTreeView *treeView = fd.findChildren<QTreeView*>("treeView").value(0); + QVERIFY(treeView); + backButton->click(); + QTRY_COMPARE(treeView->selectionModel()->selectedIndexes().value(0).data().toString(), + dirName); } void tst_QFiledialog::enableChooseButton() diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 2ada4fedb6..6f527e7b6b 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -252,7 +252,7 @@ class QTestTranslator : public QTranslator { const QString m_str; public: - explicit QTestTranslator(QString str) : m_str(qMove(str)) {} + explicit QTestTranslator(QString str) : m_str(std::move(str)) {} QString translate(const char *, const char *sourceText, const char *, int) const override { return m_str + sourceText + m_str; } @@ -265,7 +265,7 @@ class QTranslatorGuard { Translator t; public: template <typename Arg> - explicit QTranslatorGuard(Arg a) : t(qMove(a)) + explicit QTranslatorGuard(Arg a) : t(std::move(a)) { qApp->installTranslator(&t); } ~QTranslatorGuard() { qApp->removeTranslator(&t); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index ae6de48195..16818a98f9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -5,4 +5,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII -win32:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index bca664c05b..0cfdecbcab 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8386,7 +8386,7 @@ void tst_QGraphicsItem::focusProxy() QString err; QTextStream stream(&err); stream << "QGraphicsItem::setFocusProxy: " - << (void*)item << " is already in the focus proxy chain" << flush; + << (void*)item << " is already in the focus proxy chain" << Qt::flush; QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); item2->setFocusProxy(item); // fails QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp index dfb2752ee0..ed79904ed8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp @@ -54,9 +54,9 @@ void tst_QGraphicsItemAnimation::construction() QCOMPARE(animation.posAt(0), QPointF()); QCOMPARE(animation.posAt(0.5), QPointF()); QCOMPARE(animation.posAt(1), QPointF()); - QCOMPARE(animation.matrixAt(0), QMatrix()); - QCOMPARE(animation.matrixAt(0.5), QMatrix()); - QCOMPARE(animation.matrixAt(1), QMatrix()); + QCOMPARE(animation.transformAt(0), QTransform()); + QCOMPARE(animation.transformAt(0.5), QTransform()); + QCOMPARE(animation.transformAt(1), QTransform()); QCOMPARE(animation.rotationAt(0), qreal(0.0)); QCOMPARE(animation.rotationAt(0.5), qreal(0.0)); QCOMPARE(animation.rotationAt(1), qreal(0.0)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 351cecd92e..2f648a2212 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:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 1b3e1e1f34..f247889d55 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -85,8 +85,8 @@ class XResetModel : public QStandardItemModel blockSignals(true); bool r = QStandardItemModel::removeRows(row, count, parent); blockSignals(false); - emit beginResetModel(); - emit endResetModel(); + beginResetModel(); + endResetModel(); return r; } virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) @@ -94,8 +94,8 @@ class XResetModel : public QStandardItemModel blockSignals(true); bool r = QStandardItemModel::insertRows(row, count, parent); blockSignals(false); - emit beginResetModel(); - emit endResetModel(); + beginResetModel(); + endResetModel(); return r; } }; diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index 10cd1dcc54..916694fd0f 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 widgets-private testlib SOURCES += tst_qitemdelegate.cpp -win32:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 75f45ab432..c3e19adc81 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 testlib-private SOURCES += tst_qlistview.cpp -win32:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index 91088aeeca..fe2ede4183 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1525,11 +1525,11 @@ void tst_QListWidget::itemData() item.setData(Qt::DisplayRole, QString("0")); QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole})); item.setData(Qt::CheckStateRole, Qt::PartiallyChecked); - QCOMPARE(widget.currentRoles, {Qt::CheckStateRole}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole}); for (int i = 0; i < 4; ++i) { item.setData(Qt::UserRole + i, QString::number(i + 1)); - QCOMPARE(widget.currentRoles, {Qt::UserRole + i}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i}); } QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0)); QCOMPARE(flags.count(), 6); diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index b1ddc6e7a2..bf87408056 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -32,6 +32,9 @@ #include <private/qtablewidget_p.h> #include <QtTest/QtTest> #include "private/qapplication_p.h" +#if QT_CONFIG(textmarkdownwriter) +#include "private/qtextmarkdownwriter_p.h" +#endif #include <algorithm> @@ -196,6 +199,10 @@ private slots: void viewOptions(); void taskQTBUG_7232_AllowUserToControlSingleStep(); + +#if QT_CONFIG(textmarkdownwriter) + void markdownWriter(); +#endif }; // Testing get/set functions @@ -4560,5 +4567,33 @@ void tst_QTableView::taskQTBUG_50171_selectRowAfterSwapColumns() } } +// This has nothing to do with QTableView, but it's convenient to reuse the QtTestTableModel +#if QT_CONFIG(textmarkdownwriter) + +// #define DEBUG_WRITE_OUTPUT + +void tst_QTableView::markdownWriter() +{ + QtTestTableModel model(2, 3); + QString md; + { + QTextStream stream(&md); + QTextMarkdownWriter writer(stream, QTextDocument::MarkdownDialectGitHub); + writer.writeTable(&model); + } + +#ifdef DEBUG_WRITE_OUTPUT + { + QFile out("/tmp/table.md"); + out.open(QFile::WriteOnly); + out.write(md.toUtf8()); + out.close(); + } +#endif + + QCOMPARE(md, QString::fromLatin1("|1 |2 |3 |\n|-------|-------|-------|\n|[0,0,0]|[0,1,0]|[0,2,0]|\n|[1,0,0]|[1,1,0]|[1,2,0]|\n")); +} +#endif + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index c2de5c2761..6184962d93 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -1383,11 +1383,11 @@ void tst_QTableWidget::itemData() item->setData(Qt::DisplayRole, QString("0")); QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole})); item->setData(Qt::CheckStateRole, Qt::PartiallyChecked); - QCOMPARE(widget.currentRoles, {Qt::CheckStateRole}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole}); for (int i = 0; i < 4; ++i) { item->setData(Qt::UserRole + i, QString::number(i + 1)); - QCOMPARE(widget.currentRoles, {Qt::UserRole + i}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i}); } QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0)); QCOMPARE(flags.count(), 6); diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 33d4f3bf91..0d97974b90 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1999,10 +1999,10 @@ void tst_QTreeWidget::itemData() item.setData(0, Qt::DisplayRole, QString("0")); QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole})); item.setData(0, Qt::CheckStateRole, Qt::PartiallyChecked); - QCOMPARE(widget.currentRoles, {Qt::CheckStateRole}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole}); for (int i = 0; i < 4; ++i) { item.setData(0, Qt::UserRole + i, QString::number(i + 1)); - QCOMPARE(widget.currentRoles, {Qt::UserRole + i}); + QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i}); } QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0)); QCOMPARE(flags.count(), 6); diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro index 73fd934502..af85a2bd13 100644 --- a/tests/auto/widgets/kernel/kernel.pro +++ b/tests/auto/widgets/kernel/kernel.pro @@ -22,5 +22,3 @@ SUBDIRS=\ darwin:SUBDIRS -= \ # Uses native recognizers qgesturerecognizer \ - -SUBDIRS -= qsound diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index e57ac77c39..af70b653ee 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -908,7 +908,9 @@ void tst_QApplication::libraryPaths() QStringList actual = QApplication::libraryPaths(); actual.sort(); - QStringList expected = QSet<QString>::fromList((QStringList() << testDir << appDirPath)).toList(); + QStringList expected; + expected << testDir << appDirPath; + expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values(); expected.sort(); QVERIFY2(isPathListIncluded(actual, expected), @@ -925,7 +927,9 @@ void tst_QApplication::libraryPaths() QStringList actual = QApplication::libraryPaths(); actual.sort(); - QStringList expected = QSet<QString>::fromList((QStringList() << installPathPlugins << appDirPath)).toList(); + QStringList expected; + expected << installPathPlugins << appDirPath; + expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values(); expected.sort(); #ifdef Q_OS_WINRT diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index b2650d1f32..8dd9d7c428 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -47,6 +47,7 @@ private slots: void sizeConstraints(); void setGeometry(); void setStyleShouldChangeSpacing(); + void widgetSurplus(); void testLayoutEngine_data(); void testLayoutEngine(); @@ -236,6 +237,69 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing() QTRY_COMPARE(spacing(), 10); } +class MarginEatingStyle : public QProxyStyle +{ +public: + MarginEatingStyle() : QProxyStyle(QStyleFactory::create("windows")) + { + } + + virtual QRect subElementRect(SubElement sr, const QStyleOption *opt, + const QWidget *widget) const + { + QRect rect = opt->rect; + switch (sr) { + case SE_GroupBoxLayoutItem: + // this is a simplifed version of what the macOS style does + rect.setTop(rect.top() + 20); + rect.setLeft(rect.left() + 20); + rect.setRight(rect.right() - 20); + rect.setBottom(rect.bottom() - 20); + break; + default: + return QProxyStyle::subElementRect(sr, opt, widget); + } + + return rect; + } +}; + +void tst_QBoxLayout::widgetSurplus() +{ + // Test case for QTBUG-67608 - a style requests space in the margin + + QDialog window; + QScopedPointer<MarginEatingStyle> marginEater(new MarginEatingStyle); + QVBoxLayout *vbox = new QVBoxLayout(&window); + vbox->setMargin(0); + vbox->setSpacing(0); + + QLabel *hiddenLabel = new QLabel(tr("Invisible label")); + hiddenLabel->setVisible(false); + + QGroupBox *groupBox = new QGroupBox(tr("Groupbox Title")); + groupBox->setStyle(marginEater.data()); + groupBox->setObjectName("Test group box"); + QPushButton *button1 = new QPushButton(tr("Button 1")); + QPushButton *button2 = new QPushButton(tr("Button 2")); + QVBoxLayout *groupLayout = new QVBoxLayout; + groupLayout->addWidget(button1); + groupLayout->addWidget(button2); + groupBox->setLayout(groupLayout); + + QLabel *label = new QLabel(tr("Visible label")); + + vbox->addWidget(hiddenLabel); + vbox->addWidget(groupBox); + vbox->addWidget(label); + window.setLayout(vbox); + + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QCOMPARE(groupBox->y(), 0); + QCOMPARE(groupBox->x(), 0); +} + void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected() { QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling."); @@ -507,6 +571,10 @@ void tst_QBoxLayout::replaceWidget() QCOMPARE(boxLayout->indexOf(replaceFrom), 1); QCOMPARE(boxLayout->indexOf(replaceTo), -1); + QCOMPARE(boxLayout->count(), 3); + boxLayout->replaceWidget(replaceFrom, replaceFrom); + QCOMPARE(boxLayout->count(), 3); + delete boxLayout->replaceWidget(replaceFrom, replaceTo); QCOMPARE(boxLayout->indexOf(replaceFrom), -1); diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index cff3dad35e..ab32643061 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -52,7 +52,7 @@ using namespace QTestPrivate; Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3); struct QFormLayoutTakeRowResultHolder { - QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) noexcept : labelItem(result.labelItem), fieldItem(result.fieldItem) { @@ -66,20 +66,20 @@ struct QFormLayoutTakeRowResultHolder { if (fieldItem) disposer.setItem(0, QFormLayout::FieldRole, fieldItem); } - QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) noexcept : labelItem(other.labelItem), fieldItem(other.fieldItem) { other.labelItem = nullptr; other.fieldItem = nullptr; } - QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) noexcept { swap(other); return *this; } - void swap(QFormLayoutTakeRowResultHolder &other) Q_DECL_NOTHROW + void swap(QFormLayoutTakeRowResultHolder &other) noexcept { qSwap(labelItem, other.labelItem); qSwap(fieldItem, other.fieldItem); diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index c1908af2a2..d3fbd6d0d9 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -16,4 +16,4 @@ mac { OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm } -win32:!winrt: LIBS += -luser32 -lgdi32 +win32:!winrt: QMAKE_USE += user32 gdi32 diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 0f9e3164c3..89da56cd0c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -2418,8 +2418,8 @@ void tst_QWidget::showMinimizedKeepsFocus() { if (m_platform == QStringLiteral("xcb")) QSKIP("QTBUG-26424"); - if (m_platform == QStringLiteral("wayland")) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported."); if (m_platform == QStringLiteral("offscreen")) QSKIP("Platform offscreen does not support showMinimized()"); @@ -2625,8 +2625,8 @@ void tst_QWidget::icon() void tst_QWidget::hideWhenFocusWidgetIsChild() { - if (m_platform == QStringLiteral("wayland")) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported."); QScopedPointer<QWidget> testWidget(new QWidget); testWidget->setWindowTitle(__FUNCTION__); @@ -5433,8 +5433,8 @@ void tst_QWidget::multipleToplevelFocusCheck() QSKIP("QTBUG-52974"); #endif - if (m_platform == QStringLiteral("wayland")) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported"); else if (m_platform == QStringLiteral("winrt")) QSKIP("Winrt: Sometimes crashes in QTextLayout. - QTBUG-68297"); TopLevelFocusCheck w1; @@ -6146,7 +6146,11 @@ public: return false; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEvent(const QByteArray &eventType, void *message, qintptr *) override +#else bool nativeEvent(const QByteArray &eventType, void *message, long *) override +#endif { if (isMapNotify(eventType, message)) gotExpectedMapNotify = true; @@ -6154,7 +6158,11 @@ public: } // QAbstractNativeEventFilter interface +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) override +#else bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override +#endif { if (isMapNotify(eventType, message)) gotExpectedGlobalEvent = true; @@ -9527,8 +9535,8 @@ void tst_QWidget::setGraphicsEffect() void tst_QWidget::activateWindow() { - if (m_platform == QStringLiteral("wayland")) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported."); // Test case for QTBUG-26711 @@ -9595,8 +9603,8 @@ void tst_QWidget::openModal_taskQTBUG_5804() void tst_QWidget::focusProxyAndInputMethods() { - if (m_platform == QStringLiteral("wayland")) - QSKIP("Wayland: This fails. Figure out why."); + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported."); QScopedPointer<QWidget> toplevel(new QWidget(0, Qt::X11BypassWindowManagerHint)); toplevel->resize(200, 200); toplevel->setAttribute(Qt::WA_InputMethodEnabled, true); diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index 007825d39c..a17a9f6c33 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -124,13 +124,19 @@ void tst_QAbstractScrollArea::scrollBarWidgets() QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList()); QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom), w2List); + auto sort = [](const QWidgetList l) { + QWidgetList list = l; + std::sort(list.begin(), list.end()); + return list; + }; + // two widgets at Bottom. area.addScrollBarWidget(w3, Qt::AlignBottom); - QCOMPARE(area.scrollBarWidgets(all).toSet(), allList.toSet()); + QCOMPARE(sort(area.scrollBarWidgets(all)), sort(allList)); QCOMPARE(area.scrollBarWidgets(Qt::AlignLeft), w1List); QCOMPARE(area.scrollBarWidgets(Qt::AlignRight), QWidgetList()); QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList()); - QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom).toSet(), (w2List + w3List).toSet()); + QCOMPARE(sort(area.scrollBarWidgets(Qt::AlignBottom)), sort(w2List + w3List)); //delete delete w1; diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index f8ce6a2c0a..625116654d 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -670,7 +670,11 @@ void tst_QDockWidget::dockLocationChanged() spy.clear(); dw.setFloating(true); - QTest::qWait(100); + QTRY_COMPARE(spy.count(), 1); + QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), + Qt::NoDockWidgetArea); + spy.clear(); + dw.setFloating(false); QTRY_COMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 95799905de..7861065de9 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -3615,6 +3615,14 @@ void tst_QLineEdit::task174640_editingFinished() le2->setFocus(); QTRY_VERIFY(le2->hasFocus()); + // editingFinished will not be emitted anew because no editing happened + QCOMPARE(editingFinishedSpy.count(), 0); + + le1->setFocus(); + QTRY_VERIFY(le1->hasFocus()); + QTest::keyPress(le1, Qt::Key_Plus); + le2->setFocus(); + QTRY_VERIFY(le2->hasFocus()); QCOMPARE(editingFinishedSpy.count(), 1); editingFinishedSpy.clear(); @@ -3632,6 +3640,8 @@ void tst_QLineEdit::task174640_editingFinished() delete testMenu1; QCOMPARE(editingFinishedSpy.count(), 0); QTRY_VERIFY(le1->hasFocus()); + // Ensure le1 has been edited + QTest::keyPress(le1, Qt::Key_Plus); QMenu *testMenu2 = new QMenu(le2); testMenu2->addAction("foo2"); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 67b79e3faf..046899ce05 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -333,6 +333,7 @@ void tst_QMdiArea::subWindowActivated() for ( i = 0; i < count; ++i ) { QWidget *widget = new QWidget(workspace, 0); widget->setAttribute(Qt::WA_DeleteOnClose); + widget->setFocus(); workspace->addSubWindow(widget)->show(); widget->show(); qApp->processEvents(); diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 803b72f36e..b9d6888263 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -206,7 +206,7 @@ private slots: void stepModifierPressAndHold_data(); void stepModifierPressAndHold(); public slots: - void valueChangedHelper(const QString &); + void textChangedHelper(const QString &); void valueChangedHelper(int); private: QStringList actualTexts; @@ -486,7 +486,7 @@ void tst_QSpinBox::setPrefixSuffix() } } -void tst_QSpinBox::valueChangedHelper(const QString &text) +void tst_QSpinBox::textChangedHelper(const QString &text) { actualTexts << text; } @@ -564,7 +564,7 @@ void tst_QSpinBox::setTracking() QSpinBox spin(0); spin.setKeyboardTracking(tracking); spin.show(); - connect(&spin, SIGNAL(valueChanged(QString)), this, SLOT(valueChangedHelper(QString))); + connect(&spin, &QSpinBox::textChanged, this, &tst_QSpinBox::textChangedHelper); keys.simulate(&spin); QCOMPARE(actualTexts, texts); diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index 6523209c32..b61cc8fa13 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:!winrt: LIBS += -luser32 +win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp index 15f10232bd..b5d9fea315 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp @@ -72,7 +72,7 @@ int main(int argc, const char *argv[]) QFile in_file(file_name); if (!in_file.open(QIODevice::ReadOnly)) { - qerr << "Could not open " << file_name << ": " << strerror(errno) << endl; + qerr << "Could not open " << file_name << ": " << strerror(errno) << Qt::endl; return 1; } @@ -87,7 +87,7 @@ int main(int argc, const char *argv[]) } else { _out_file.setFileName(out_file_name); if (!_out_file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qerr << "Could not open " << out_file_name << ": " << strerror(errno) << endl; + qerr << "Could not open " << out_file_name << ": " << strerror(errno) << Qt::endl; return 1; } _out_stream.setDevice(&_out_file); diff --git a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak deleted file mode 100644 index 2d80c8f3fb..0000000000 --- a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE doc [
-<!ENTITY e "𐀀􏿽">
-<!ELEMENT doc (#PCDATA)>
-]>
-<doc>&e;</doc>
|