Use debug stream in QTest::toString's default fallback if possible

For built-in types, this is a compile-time assert - we should not have
any types in Qt for which we have neither debug streaming nor a
QTest::toString specialization implemented. A build of most of Qt
submodules passes with this change, after minor modifications to some
tests. We cannot declare QSizeHint::Policy as a metatype after the
QMetaType has already been instantiated for it, and the QDebug stream
operator for QElaspedTimer needs to be correctly declared within the
namespace.

Add a self-test function for a custom type, and update reference files
of the self-test.

Task-number: QTBUG-104867
Change-Id: I2936db5933f4589fce45f47cf2f3224ed614d8c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 92e696b4bad52c40c6cdc1c5bf7c0c0ea8a2b283)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2022-07-09 17:01:38 +02:00 committed by Qt Cherry-pick Bot
parent e8298aea01
commit d84ee92ecf
17 changed files with 146 additions and 67 deletions

View File

@ -307,9 +307,18 @@ namespace QTest
return qstrdup(QByteArray::number(static_cast<std::underlying_type_t<T>>(e)).constData());
}
template <typename T> // Fallback
inline typename std::enable_if<!QtPrivate::IsQEnumHelper<T>::Value && !std::is_enum_v<T>, char*>::type toString(const T &)
template <typename T> // Fallback; for built-in types debug streaming must be possible
inline typename std::enable_if<!QtPrivate::IsQEnumHelper<T>::Value && !std::is_enum_v<T>, char *>::type toString(const T &t)
{
#ifndef QT_NO_DEBUG_STREAM
if constexpr (QTypeTraits::has_ostream_operator_v<QDebug, T>) {
return qstrdup(QDebug::toString(t).toUtf8().constData());
} else {
static_assert(!QMetaTypeId2<T>::IsBuiltIn,
"Built-in type must implement debug streaming operator "
"or provide QTest::toString specialization");
}
#endif
return nullptr;
}

View File

@ -9,11 +9,13 @@
static const int minResolution = 100; // the minimum resolution for the tests
QT_BEGIN_NAMESPACE
QDebug operator<<(QDebug s, const QElapsedTimer &t)
{
s.nospace() << "(" << t.msecsSinceReference() << ")";
return s.space();
}
QT_END_NAMESPACE
class tst_QElapsedTimer : public QObject
{

View File

@ -115,6 +115,7 @@ private slots:
void compare_tostring();
void compare_tostring_data();
void compare_unknown();
void compare_textFromDebug();
void compareQObjects();
void compareQStringLists();
void compareQStringLists_data();
@ -324,10 +325,36 @@ void tst_Cmptest::compare_tostring()
QCOMPARE(actual, expected);
}
struct UnknownType
{
int value;
bool operator==(const UnknownType &rhs) const { return value == rhs.value; }
};
void tst_Cmptest::compare_unknown()
{
std::string a("a");
std::string b("b");
UnknownType a{1};
UnknownType b{2};
QCOMPARE(a, b);
}
struct CustomType
{
int value;
bool operator==(const CustomType &rhs) const { return value == rhs.value; }
};
QDebug operator<<(QDebug dbg, const CustomType &val)
{
dbg << "QDebug stream: " << val.value;
return dbg;
}
void tst_Cmptest::compare_textFromDebug()
{
CustomType a{0};
CustomType b{1};
QCOMPARE(a, b);
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite name="tst_Cmptest" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="68" failures="47" errors="0" skipped="0" time="@TEST_DURATION@">
<testsuite name="tst_Cmptest" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="69" failures="48" errors="0" skipped="0" time="@TEST_DURATION@">
<properties>
<property name="QTestVersion" value="@INSERT_QT_VERSION_HERE@"/>
<property name="QtVersion" value="@INSERT_QT_VERSION_HERE@"/>
@ -84,6 +84,12 @@
Expected : b]]>
</failure>
</testcase>
<testcase name="compare_textFromDebug" classname="tst_Cmptest" time="@TEST_DURATION@">
<failure type="fail" message="Compared values are not the same">
<![CDATA[ Actual (a): QDebug stream: 0
Expected (b): QDebug stream: 1]]>
</failure>
</testcase>
<testcase name="compareQObjects" classname="tst_Cmptest" time="@TEST_DURATION@">
<failure type="fail" message="Compared QObject pointers are not the same">
<![CDATA[ Actual (&object1): QObject/"object1"

View File

@ -117,6 +117,14 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_textFromDebug">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (a): QDebug stream: 0
Expected (b): QDebug stream: 1]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQObjects">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared QObject pointers are not the same

View File

@ -148,7 +148,19 @@ not ok 19 - compare_unknown()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 20 - compareQObjects()
not ok 20 - compare_textFromDebug()
---
type: QCOMPARE
message: Compared values are not the same
wanted: QDebug stream: 1 (b)
found: QDebug stream: 0 (a)
expected: QDebug stream: 1 (b)
actual: QDebug stream: 0 (a)
at: tst_Cmptest::compare_textFromDebug() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 21 - compareQObjects()
---
type: QCOMPARE
message: Compared QObject pointers are not the same
@ -160,9 +172,9 @@ not ok 20 - compareQObjects()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 21 - compareQStringLists(empty lists)
ok 22 - compareQStringLists(equal lists)
not ok 23 - compareQStringLists(last item different)
ok 22 - compareQStringLists(empty lists)
ok 23 - compareQStringLists(equal lists)
not ok 24 - compareQStringLists(last item different)
---
type: QCOMPARE
message: Compared lists differ at index 2.
@ -174,7 +186,7 @@ not ok 23 - compareQStringLists(last item different)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 24 - compareQStringLists(second-last item different)
not ok 25 - compareQStringLists(second-last item different)
---
type: QCOMPARE
message: Compared lists differ at index 2.
@ -186,7 +198,7 @@ not ok 24 - compareQStringLists(second-last item different)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 25 - compareQStringLists(prefix)
not ok 26 - compareQStringLists(prefix)
---
# Compared lists have different sizes.
Actual (opA) size: 2
@ -195,7 +207,7 @@ not ok 25 - compareQStringLists(prefix)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 26 - compareQStringLists(short list second)
not ok 27 - compareQStringLists(short list second)
---
# Compared lists have different sizes.
Actual (opA) size: 12
@ -204,7 +216,7 @@ not ok 26 - compareQStringLists(short list second)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 27 - compareQStringLists(short list first)
not ok 28 - compareQStringLists(short list first)
---
# Compared lists have different sizes.
Actual (opA) size: 1
@ -213,8 +225,8 @@ not ok 27 - compareQStringLists(short list first)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 28 - compareQListInt(match)
not ok 29 - compareQListInt(size mismatch)
ok 29 - compareQListInt(match)
not ok 30 - compareQListInt(size mismatch)
---
# Compared lists have different sizes.
Actual (actual) size: 2
@ -223,7 +235,7 @@ not ok 29 - compareQListInt(size mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 30 - compareQListInt(value mismatch)
not ok 31 - compareQListInt(value mismatch)
---
type: QCOMPARE
message: Compared lists differ at index 2.
@ -235,8 +247,8 @@ not ok 30 - compareQListInt(value mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 31 - compareQListIntToArray(match)
not ok 32 - compareQListIntToArray(size mismatch)
ok 32 - compareQListIntToArray(match)
not ok 33 - compareQListIntToArray(size mismatch)
---
# Compared lists have different sizes.
Actual (actual) size: 2
@ -245,7 +257,7 @@ not ok 32 - compareQListIntToArray(size mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 33 - compareQListIntToArray(value mismatch)
not ok 34 - compareQListIntToArray(value mismatch)
---
type: QCOMPARE
message: Compared lists differ at index 2.
@ -257,8 +269,8 @@ not ok 33 - compareQListIntToArray(value mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 34 - compareQListIntToInitializerList(match)
not ok 35 - compareQListIntToInitializerList(size mismatch)
ok 35 - compareQListIntToInitializerList(match)
not ok 36 - compareQListIntToInitializerList(size mismatch)
---
# Compared lists have different sizes.
Actual (actual) size: 2
@ -267,7 +279,7 @@ not ok 35 - compareQListIntToInitializerList(size mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 36 - compareQListIntToInitializerList(value mismatch)
not ok 37 - compareQListIntToInitializerList(value mismatch)
---
type: QCOMPARE
message: Compared lists differ at index 2.
@ -279,7 +291,7 @@ not ok 36 - compareQListIntToInitializerList(value mismatch)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 37 - compareQListDouble()
not ok 38 - compareQListDouble()
---
type: QCOMPARE
message: Compared lists differ at index 0.
@ -291,8 +303,8 @@ not ok 37 - compareQListDouble()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 38 - compareQColor(Qt::yellow vs "yellow")
not ok 39 - compareQColor(Qt::yellow vs Qt::green)
ok 39 - compareQColor(Qt::yellow vs "yellow")
not ok 40 - compareQColor(Qt::yellow vs Qt::green)
---
type: QCOMPARE
message: Compared values are not the same
@ -304,7 +316,7 @@ not ok 39 - compareQColor(Qt::yellow vs Qt::green)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 40 - compareQColor(0x88ff0000 vs 0xffff0000)
not ok 41 - compareQColor(0x88ff0000 vs 0xffff0000)
---
type: QCOMPARE
message: Compared values are not the same
@ -316,8 +328,8 @@ not ok 40 - compareQColor(0x88ff0000 vs 0xffff0000)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 41 - compareQPixmaps(both null)
not ok 42 - compareQPixmaps(one null)
ok 42 - compareQPixmaps(both null)
not ok 43 - compareQPixmaps(one null)
---
type: QCOMPARE
message: Compared QPixmaps differ.
@ -329,7 +341,7 @@ not ok 42 - compareQPixmaps(one null)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 43 - compareQPixmaps(other null)
not ok 44 - compareQPixmaps(other null)
---
type: QCOMPARE
message: Compared QPixmaps differ.
@ -341,8 +353,8 @@ not ok 43 - compareQPixmaps(other null)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 44 - compareQPixmaps(equal)
not ok 45 - compareQPixmaps(different size)
ok 45 - compareQPixmaps(equal)
not ok 46 - compareQPixmaps(different size)
---
type: QCOMPARE
message: Compared QPixmaps differ in size.
@ -354,14 +366,14 @@ not ok 45 - compareQPixmaps(different size)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 46 - compareQPixmaps(different pixels)
not ok 47 - compareQPixmaps(different pixels)
---
# Compared values are not the same
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 47 - compareQPixmaps(different dpr)
not ok 48 - compareQPixmaps(different dpr)
---
type: QCOMPARE
message: Compared QPixmaps differ in device pixel ratio.
@ -373,8 +385,8 @@ not ok 47 - compareQPixmaps(different dpr)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 48 - compareQImages(both null)
not ok 49 - compareQImages(one null)
ok 49 - compareQImages(both null)
not ok 50 - compareQImages(one null)
---
type: QCOMPARE
message: Compared QImages differ.
@ -386,7 +398,7 @@ not ok 49 - compareQImages(one null)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 50 - compareQImages(other null)
not ok 51 - compareQImages(other null)
---
type: QCOMPARE
message: Compared QImages differ.
@ -398,8 +410,8 @@ not ok 50 - compareQImages(other null)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 51 - compareQImages(equal)
not ok 52 - compareQImages(different size)
ok 52 - compareQImages(equal)
not ok 53 - compareQImages(different size)
---
type: QCOMPARE
message: Compared QImages differ in size.
@ -411,7 +423,7 @@ not ok 52 - compareQImages(different size)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 53 - compareQImages(different format)
not ok 54 - compareQImages(different format)
---
type: QCOMPARE
message: Compared QImages differ in format.
@ -423,14 +435,14 @@ not ok 53 - compareQImages(different format)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 54 - compareQImages(different pixels)
not ok 55 - compareQImages(different pixels)
---
# Compared values are not the same
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 55 - compareQImages(different dpr)
not ok 56 - compareQImages(different dpr)
---
type: QCOMPARE
message: Compared QImages differ in device pixel ratio.
@ -442,8 +454,8 @@ not ok 55 - compareQImages(different dpr)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 56 - compareQRegion(equal-empty)
not ok 57 - compareQRegion(1-empty)
ok 57 - compareQRegion(equal-empty)
not ok 58 - compareQRegion(1-empty)
---
type: QCOMPARE
message: Compared values are not the same
@ -455,8 +467,8 @@ not ok 57 - compareQRegion(1-empty)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 58 - compareQRegion(equal)
not ok 59 - compareQRegion(different lists)
ok 59 - compareQRegion(equal)
not ok 60 - compareQRegion(different lists)
---
type: QCOMPARE
message: Compared values are not the same
@ -468,7 +480,7 @@ not ok 59 - compareQRegion(different lists)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 60 - compareQVector2D()
not ok 61 - compareQVector2D()
---
type: QCOMPARE
message: Compared values are not the same
@ -480,7 +492,7 @@ not ok 60 - compareQVector2D()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 61 - compareQVector3D()
not ok 62 - compareQVector3D()
---
type: QCOMPARE
message: Compared values are not the same
@ -492,7 +504,7 @@ not ok 61 - compareQVector3D()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 62 - compareQVector4D()
not ok 63 - compareQVector4D()
---
type: QCOMPARE
message: Compared values are not the same
@ -504,7 +516,7 @@ not ok 62 - compareQVector4D()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 63 - verify()
not ok 64 - verify()
---
type: QVERIFY
message: Verification failed
@ -516,7 +528,7 @@ not ok 63 - verify()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 64 - verify2()
not ok 65 - verify2()
---
type: QVERIFY
message: 42
@ -528,7 +540,7 @@ not ok 64 - verify2()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 65 - tryVerify()
not ok 66 - tryVerify()
---
type: QVERIFY
message: Verification failed
@ -540,7 +552,7 @@ not ok 65 - tryVerify()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
not ok 66 - tryVerify2()
not ok 67 - tryVerify2()
---
type: QVERIFY
message: 42
@ -552,9 +564,9 @@ not ok 66 - tryVerify2()
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 0
...
ok 67 - verifyExplicitOperatorBool()
ok 68 - cleanupTestCase()
1..68
# tests 68
ok 68 - verifyExplicitOperatorBool()
ok 69 - cleanupTestCase()
1..69
# tests 69
# pass 21
# fail 47
# fail 48

View File

@ -49,6 +49,9 @@
##teamcity[testStarted name='compare_unknown()' flowId='tst_Cmptest']
##teamcity[testFailed name='compare_unknown()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual : a|n Expected : b' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_unknown()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_textFromDebug()' flowId='tst_Cmptest']
##teamcity[testFailed name='compare_textFromDebug()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (a): QDebug stream: 0|n Expected (b): QDebug stream: 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_textFromDebug()' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQObjects()' flowId='tst_Cmptest']
##teamcity[testFailed name='compareQObjects()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QObject pointers are not the same|n Actual (&object1): QObject/"object1"|n Expected (&object2): QObject/"object2"' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQObjects()' flowId='tst_Cmptest']

View File

@ -55,6 +55,10 @@ FAIL! : tst_Cmptest::compare_unknown() Compared values are not the same
Actual : a
Expected : b
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compare_textFromDebug() Compared values are not the same
Actual (a): QDebug stream: 0
Expected (b): QDebug stream: 1
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQObjects() Compared QObject pointers are not the same
Actual (&object1): QObject/"object1"
Expected (&object2): QObject/"object2"
@ -197,5 +201,5 @@ FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::verifyExplicitOperatorBool()
PASS : tst_Cmptest::cleanupTestCase()
Totals: 21 passed, 47 failed, 0 skipped, 0 blacklisted, 0ms
Totals: 21 passed, 48 failed, 0 skipped, 0 blacklisted, 0ms
********* Finished testing of tst_Cmptest *********

View File

@ -119,6 +119,14 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_textFromDebug">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (a): QDebug stream: 0
Expected (b): QDebug stream: 1]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQObjects">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared QObject pointers are not the same

View File

@ -9,7 +9,7 @@
<testcase name="basics" classname="tst_TestLib" time="@TEST_DURATION@">
<failure type="fail" message="Compared QObject pointers are not the same">
<![CDATA[ Actual (QTest::testObject()): tst_TestLib/"TestObject"
Expected (nullptr) : <null>]]>
Expected (nullptr) : (nullptr)]]>
</failure>
</testcase>
<testcase name="delays" classname="tst_TestLib" time="@TEST_DURATION@"/>

View File

@ -11,7 +11,7 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0">
<Description><![CDATA[Compared QObject pointers are not the same
Actual (QTest::testObject()): tst_TestLib/"TestObject"
Expected (nullptr) : <null>]]></Description>
Expected (nullptr) : (nullptr)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>

View File

@ -5,9 +5,9 @@ not ok 2 - basics()
---
type: QCOMPARE
message: Compared QObject pointers are not the same
wanted: <null> (nullptr)
wanted: (nullptr) (nullptr)
found: tst_TestLib/"TestObject" (QTest::testObject())
expected: <null> (nullptr)
expected: (nullptr) (nullptr)
actual: tst_TestLib/"TestObject" (QTest::testObject())
at: tst_TestLib::basics() (qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp:0)
file: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp

View File

@ -2,7 +2,7 @@
##teamcity[testStarted name='initTestCase()' flowId='tst_TestLib']
##teamcity[testFinished name='initTestCase()' flowId='tst_TestLib']
##teamcity[testStarted name='basics()' flowId='tst_TestLib']
##teamcity[testFailed name='basics()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)|]' details='Compared QObject pointers are not the same|n Actual (QTest::testObject()): tst_TestLib/"TestObject"|n Expected (nullptr) : <null>' flowId='tst_TestLib']
##teamcity[testFailed name='basics()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)|]' details='Compared QObject pointers are not the same|n Actual (QTest::testObject()): tst_TestLib/"TestObject"|n Expected (nullptr) : (nullptr)' flowId='tst_TestLib']
##teamcity[testFinished name='basics()' flowId='tst_TestLib']
##teamcity[testStarted name='delays()' flowId='tst_TestLib']
##teamcity[testFinished name='delays()' flowId='tst_TestLib']

View File

@ -3,7 +3,7 @@ Config: Using QtTest library
PASS : tst_TestLib::initTestCase()
FAIL! : tst_TestLib::basics() Compared QObject pointers are not the same
Actual (QTest::testObject()): tst_TestLib/"TestObject"
Expected (nullptr) : <null>
Expected (nullptr) : (nullptr)
Loc: [qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)]
PASS : tst_TestLib::delays()
PASS : tst_TestLib::reals(zero)

View File

@ -13,7 +13,7 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0">
<Description><![CDATA[Compared QObject pointers are not the same
Actual (QTest::testObject()): tst_TestLib/"TestObject"
Expected (nullptr) : <null>]]></Description>
Expected (nullptr) : (nullptr)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>

View File

@ -3156,7 +3156,6 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning()
QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 100));
}
Q_DECLARE_METATYPE(QSizePolicy::Policy)
void tst_QGraphicsGridLayout::spanningItem2x2_data()
{
QTest::addColumn<QSizePolicy::Policy>("sizePolicy");

View File

@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qsizepolicy.h>
Q_DECLARE_METATYPE(Qt::Orientations)
@ -9,6 +8,8 @@ Q_DECLARE_METATYPE(QSizePolicy)
Q_DECLARE_METATYPE(QSizePolicy::Policy)
Q_DECLARE_METATYPE(QSizePolicy::ControlType)
#include <QTest>
class tst_QSizePolicy : public QObject
{
Q_OBJECT