QTestLib: Add macros QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2().

Add QTRY_VERIFY2_WITH_TIMEOUT() similar to QTRY_VERIFY_WITH_TIMEOUT()
except that QTRY_VERIFY2() is used below the loop and QTRY_VERIFY2()
based on it.

Add tests to cmptest.

[ChangeLog][QtTest] Added macros QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2()
making it possible to output a message after the timeout has expired.

Change-Id: I587e24f3aeb73542dbf3ccb936a16f2e0806555f
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-07-21 10:55:17 +02:00 committed by Simon Hausmann
parent c05f2d04f2
commit 5f5db1c38b
7 changed files with 221 additions and 71 deletions

View File

@ -247,7 +247,7 @@ static void stackTrace()
\note This macro can only be used in a test function that is invoked \note This macro can only be used in a test function that is invoked
by the test framework. by the test framework.
\sa QTRY_VERIFY(), QVERIFY(), QCOMPARE(), QTRY_COMPARE() \sa QTRY_VERIFY(), QTRY_VERIFY2_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
*/ */
@ -261,7 +261,47 @@ static void stackTrace()
\note This macro can only be used in a test function that is invoked \note This macro can only be used in a test function that is invoked
by the test framework. by the test framework.
\sa QTRY_VERIFY_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE() \sa QTRY_VERIFY_WITH_TIMEOUT(), QTRY_VERIFY2(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
*/
/*! \macro QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)
\since 5.6
\relates QTest
The QTRY_VERIFY2_WITH_TIMEOUT macro is similar to QTRY_VERIFY_WITH_TIMEOUT()
except that it outputs a verbose \a message when \a condition is still false
after the specified timeout. The \a message is a plain C string.
Example:
\code
QTRY_VERIFY2_WITH_TIMEOUT(list.size() > 2, QByteArray::number(list.size()).constData(), 10000);
\endcode
\note This macro can only be used in a test function that is invoked
by the test framework.
\sa QTRY_VERIFY(), QTRY_VERIFY_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
*/
/*! \macro QTRY_VERIFY2(condition, message)
\since 5.6
\relates QTest
Checks the \a condition by invoking QTRY_VERIFY2_WITH_TIMEOUT() with a timeout
of five seconds. If \a condition is then still false, \a message is output.
The \a message is a plain C string.
Example:
\code
QTRY_VERIFY2_WITH_TIMEOUT(list.size() > 2, QByteArray::number(list.size()).constData());
\endcode
\note This macro can only be used in a test function that is invoked
by the test framework.
\sa QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
*/ */
/*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout) /*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)

View File

@ -158,6 +158,15 @@ do { \
#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000) #define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000)
// Will try to wait for the expression to become true while allowing event processing
#define QTRY_VERIFY2_WITH_TIMEOUT(__expr, __messageExpression, __timeout) \
do { \
QTRY_IMPL((__expr), __timeout);\
QVERIFY2(__expr, __messageExpression); \
} while (0)
#define QTRY_VERIFY2(__expr, __messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((__expr), (__messageExpression), 5000)
// Will try to wait for the comparison to become successful while allowing event processing // Will try to wait for the comparison to become successful while allowing event processing
#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \ #define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
do { \ do { \

View File

@ -140,6 +140,10 @@ private slots:
void compareQImages(); void compareQImages();
void compareQImages_data(); void compareQImages_data();
#endif #endif
void verify();
void verify2();
void tryVerify();
void tryVerify2();
}; };
enum MyUnregisteredEnum { MyUnregisteredEnumValue1, MyUnregisteredEnumValue2 }; enum MyUnregisteredEnum { MyUnregisteredEnumValue1, MyUnregisteredEnumValue2 };
@ -387,7 +391,36 @@ void tst_Cmptest::compareQImages()
QCOMPARE(opA, opB); QCOMPARE(opA, opB);
} }
#endif #endif // QT_GUI_LIB
static int opaqueFunc()
{
return 42;
}
void tst_Cmptest::verify()
{
QVERIFY(opaqueFunc() > 2);
QVERIFY(opaqueFunc() < 2);
}
void tst_Cmptest::verify2()
{
QVERIFY2(opaqueFunc() > 2, QByteArray::number(opaqueFunc()).constData());
QVERIFY2(opaqueFunc() < 2, QByteArray::number(opaqueFunc()).constData());
}
void tst_Cmptest::tryVerify()
{
QTRY_VERIFY(opaqueFunc() > 2);
QTRY_VERIFY_WITH_TIMEOUT(opaqueFunc() < 2, 1);
}
void tst_Cmptest::tryVerify2()
{
QTRY_VERIFY2(opaqueFunc() > 2, QByteArray::number(opaqueFunc()).constData());
QTRY_VERIFY2_WITH_TIMEOUT(opaqueFunc() < 2, QByteArray::number(opaqueFunc()).constData(), 1);
}
QTEST_MAIN(tst_Cmptest) QTEST_MAIN(tst_Cmptest)
#include "tst_cmptest.moc" #include "tst_cmptest.moc"

View File

@ -8,13 +8,13 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_unregistered_enums"> <TestFunction name="compare_unregistered_enums">
<Incident type="fail" file="tst_cmptest.cpp" line="150"> <Incident type="fail" file="tst_cmptest.cpp" line="154">
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_registered_enums"> <TestFunction name="compare_registered_enums">
<Incident type="fail" file="tst_cmptest.cpp" line="156"> <Incident type="fail" file="tst_cmptest.cpp" line="160">
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor]]></Description> Expected (Qt::BusyCursor) : BusyCursor]]></Description>
@ -30,7 +30,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_tostring"> <TestFunction name="compare_tostring">
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[int, string]]></DataTag> <DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123) Actual (actual) : QVariant(int,123)
@ -39,19 +39,19 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag> <DataTag><![CDATA[both invalid]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[null hash, invalid]]></DataTag> <DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash) Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description> Expected (expected): QVariant()]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[string, null user type]]></DataTag> <DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string) Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description> Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[both non-null user type]]></DataTag> <DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>) Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@ -66,31 +66,31 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag> <DataTag><![CDATA[equal lists]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[last item different]]></DataTag> <DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description> Expected (opB): "DIFFERS"]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[second-last item different]]></DataTag> <DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description> Expected (opB): "DIFFERS"]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[prefix]]></DataTag> <DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2 Actual (opA) size: 2
Expected (opB) size: 1]]></Description> Expected (opB) size: 1]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[short list second]]></DataTag> <DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12 Actual (opA) size: 12
Expected (opB) size: 1]]></Description> Expected (opB) size: 1]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[short list first]]></DataTag> <DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1 Actual (opA) size: 1
@ -99,7 +99,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compareQListInt"> <TestFunction name="compareQListInt">
<Incident type="fail" file="tst_cmptest.cpp" line="328"> <Incident type="fail" file="tst_cmptest.cpp" line="332">
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3 Actual (int1): 3
Expected (int2): 4]]></Description> Expected (int2): 4]]></Description>
@ -107,7 +107,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compareQListDouble"> <TestFunction name="compareQListDouble">
<Incident type="fail" file="tst_cmptest.cpp" line="335"> <Incident type="fail" file="tst_cmptest.cpp" line="339">
<Description><![CDATA[Compared lists differ at index 0. <Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5 Actual (double1): 1.5
Expected (double2): 1]]></Description> Expected (double2): 1]]></Description>
@ -118,13 +118,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag> <DataTag><![CDATA[both null]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[one null]]></DataTag> <DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ. <Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description> Expected (opB).isNull(): 0]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[other null]]></DataTag> <DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ. <Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
@ -133,13 +133,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag> <DataTag><![CDATA[equal]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[different size]]></DataTag> <DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size. <Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20]]></Description> Expected (opB): 20x20]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
@ -149,13 +149,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag> <DataTag><![CDATA[both null]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[one null]]></DataTag> <DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ. <Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description> Expected (opB).isNull(): 0]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[other null]]></DataTag> <DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ. <Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
@ -164,24 +164,48 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag> <DataTag><![CDATA[equal]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different size]]></DataTag> <DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size. <Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20]]></Description> Expected (opB): 20x20]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different format]]></DataTag> <DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format. <Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6 Actual (opA): 6
Expected (opB): 3]]></Description> Expected (opB): 3]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="verify">
<Incident type="fail" file="tst_cmptest.cpp" line="404">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
<Incident type="fail" file="tst_cmptest.cpp" line="410">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
<Incident type="fail" file="tst_cmptest.cpp" line="416">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
<Incident type="fail" file="tst_cmptest.cpp" line="422">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="cleanupTestCase"> <TestFunction name="cleanupTestCase">
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
<Duration msecs="0"/> <Duration msecs="0"/>

View File

@ -2,96 +2,104 @@
Config: Using QtTest library Config: Using QtTest library
PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::initTestCase()
FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same
Loc: [tst_cmptest.cpp(150)] Loc: [tst_cmptest.cpp(154)]
FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor Expected (Qt::BusyCursor) : BusyCursor
Loc: [tst_cmptest.cpp(156)] Loc: [tst_cmptest.cpp(160)]
PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs() PASS : tst_Cmptest::compare_pointerfuncs()
FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same
Actual (actual) : QVariant(int,123) Actual (actual) : QVariant(int,123)
Expected (expected): QVariant(QString,hi) Expected (expected): QVariant(QString,hi)
Loc: [tst_cmptest.cpp(227)] Loc: [tst_cmptest.cpp(231)]
PASS : tst_Cmptest::compare_tostring(both invalid) PASS : tst_Cmptest::compare_tostring(both invalid)
FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same
Actual (actual) : QVariant(QVariantHash) Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant() Expected (expected): QVariant()
Loc: [tst_cmptest.cpp(227)] Loc: [tst_cmptest.cpp(231)]
FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same
Actual (actual) : QVariant(QString,A simple string) Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass) Expected (expected): QVariant(PhonyClass)
Loc: [tst_cmptest.cpp(227)] Loc: [tst_cmptest.cpp(231)]
FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>) Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
Expected (expected): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>)
Loc: [tst_cmptest.cpp(227)] Loc: [tst_cmptest.cpp(231)]
PASS : tst_Cmptest::compareQStringLists(empty lists) PASS : tst_Cmptest::compareQStringLists(empty lists)
PASS : tst_Cmptest::compareQStringLists(equal lists) PASS : tst_Cmptest::compareQStringLists(equal lists)
FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2. FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS" Expected (opB): "DIFFERS"
Loc: [tst_cmptest.cpp(321)] Loc: [tst_cmptest.cpp(325)]
FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2. FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS" Expected (opB): "DIFFERS"
Loc: [tst_cmptest.cpp(321)] Loc: [tst_cmptest.cpp(325)]
FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes. FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes.
Actual (opA) size: 2 Actual (opA) size: 2
Expected (opB) size: 1 Expected (opB) size: 1
Loc: [tst_cmptest.cpp(321)] Loc: [tst_cmptest.cpp(325)]
FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes. FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes.
Actual (opA) size: 12 Actual (opA) size: 12
Expected (opB) size: 1 Expected (opB) size: 1
Loc: [tst_cmptest.cpp(321)] Loc: [tst_cmptest.cpp(325)]
FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes. FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes.
Actual (opA) size: 1 Actual (opA) size: 1
Expected (opB) size: 12 Expected (opB) size: 12
Loc: [tst_cmptest.cpp(321)] Loc: [tst_cmptest.cpp(325)]
FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2. FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2.
Actual (int1): 3 Actual (int1): 3
Expected (int2): 4 Expected (int2): 4
Loc: [tst_cmptest.cpp(328)] Loc: [tst_cmptest.cpp(332)]
FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0. FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0.
Actual (double1): 1.5 Actual (double1): 1.5
Expected (double2): 1 Expected (double2): 1
Loc: [tst_cmptest.cpp(335)] Loc: [tst_cmptest.cpp(339)]
PASS : tst_Cmptest::compareQPixmaps(both null) PASS : tst_Cmptest::compareQPixmaps(both null)
FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ. FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0 Expected (opB).isNull(): 0
Loc: [tst_cmptest.cpp(361)] Loc: [tst_cmptest.cpp(365)]
FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ. FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
Expected (opB).isNull(): 1 Expected (opB).isNull(): 1
Loc: [tst_cmptest.cpp(361)] Loc: [tst_cmptest.cpp(365)]
PASS : tst_Cmptest::compareQPixmaps(equal) PASS : tst_Cmptest::compareQPixmaps(equal)
FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size. FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20 Expected (opB): 20x20
Loc: [tst_cmptest.cpp(361)] Loc: [tst_cmptest.cpp(365)]
FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same
Loc: [tst_cmptest.cpp(361)] Loc: [tst_cmptest.cpp(365)]
PASS : tst_Cmptest::compareQImages(both null) PASS : tst_Cmptest::compareQImages(both null)
FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0 Expected (opB).isNull(): 0
Loc: [tst_cmptest.cpp(388)] Loc: [tst_cmptest.cpp(392)]
FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ. FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
Expected (opB).isNull(): 1 Expected (opB).isNull(): 1
Loc: [tst_cmptest.cpp(388)] Loc: [tst_cmptest.cpp(392)]
PASS : tst_Cmptest::compareQImages(equal) PASS : tst_Cmptest::compareQImages(equal)
FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size. FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20 Expected (opB): 20x20
Loc: [tst_cmptest.cpp(388)] Loc: [tst_cmptest.cpp(392)]
FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format. FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format.
Actual (opA): 6 Actual (opA): 6
Expected (opB): 3 Expected (opB): 3
Loc: [tst_cmptest.cpp(388)] Loc: [tst_cmptest.cpp(392)]
FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same
Loc: [tst_cmptest.cpp(388)] Loc: [tst_cmptest.cpp(392)]
FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. ()
Loc: [tst_cmptest.cpp(404)]
FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [tst_cmptest.cpp(410)]
FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. ()
Loc: [tst_cmptest.cpp(416)]
FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [tst_cmptest.cpp(422)]
PASS : tst_Cmptest::cleanupTestCase() PASS : tst_Cmptest::cleanupTestCase()
Totals: 11 passed, 22 failed, 0 skipped, 0 blacklisted Totals: 11 passed, 26 failed, 0 skipped, 0 blacklisted
********* Finished testing of tst_Cmptest ********* ********* Finished testing of tst_Cmptest *********

View File

@ -10,13 +10,13 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_unregistered_enums"> <TestFunction name="compare_unregistered_enums">
<Incident type="fail" file="tst_cmptest.cpp" line="150"> <Incident type="fail" file="tst_cmptest.cpp" line="154">
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_registered_enums"> <TestFunction name="compare_registered_enums">
<Incident type="fail" file="tst_cmptest.cpp" line="156"> <Incident type="fail" file="tst_cmptest.cpp" line="160">
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor]]></Description> Expected (Qt::BusyCursor) : BusyCursor]]></Description>
@ -32,7 +32,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compare_tostring"> <TestFunction name="compare_tostring">
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[int, string]]></DataTag> <DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123) Actual (actual) : QVariant(int,123)
@ -41,19 +41,19 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag> <DataTag><![CDATA[both invalid]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[null hash, invalid]]></DataTag> <DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash) Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description> Expected (expected): QVariant()]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[string, null user type]]></DataTag> <DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string) Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description> Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="227"> <Incident type="fail" file="tst_cmptest.cpp" line="231">
<DataTag><![CDATA[both non-null user type]]></DataTag> <DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same <Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>) Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@ -68,31 +68,31 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag> <DataTag><![CDATA[equal lists]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[last item different]]></DataTag> <DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description> Expected (opB): "DIFFERS"]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[second-last item different]]></DataTag> <DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3" Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description> Expected (opB): "DIFFERS"]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[prefix]]></DataTag> <DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2 Actual (opA) size: 2
Expected (opB) size: 1]]></Description> Expected (opB) size: 1]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[short list second]]></DataTag> <DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12 Actual (opA) size: 12
Expected (opB) size: 1]]></Description> Expected (opB) size: 1]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="321"> <Incident type="fail" file="tst_cmptest.cpp" line="325">
<DataTag><![CDATA[short list first]]></DataTag> <DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes. <Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1 Actual (opA) size: 1
@ -101,7 +101,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compareQListInt"> <TestFunction name="compareQListInt">
<Incident type="fail" file="tst_cmptest.cpp" line="328"> <Incident type="fail" file="tst_cmptest.cpp" line="332">
<Description><![CDATA[Compared lists differ at index 2. <Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3 Actual (int1): 3
Expected (int2): 4]]></Description> Expected (int2): 4]]></Description>
@ -109,7 +109,7 @@
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="compareQListDouble"> <TestFunction name="compareQListDouble">
<Incident type="fail" file="tst_cmptest.cpp" line="335"> <Incident type="fail" file="tst_cmptest.cpp" line="339">
<Description><![CDATA[Compared lists differ at index 0. <Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5 Actual (double1): 1.5
Expected (double2): 1]]></Description> Expected (double2): 1]]></Description>
@ -120,13 +120,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag> <DataTag><![CDATA[both null]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[one null]]></DataTag> <DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ. <Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description> Expected (opB).isNull(): 0]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[other null]]></DataTag> <DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ. <Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
@ -135,13 +135,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag> <DataTag><![CDATA[equal]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[different size]]></DataTag> <DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size. <Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20]]></Description> Expected (opB): 20x20]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="361"> <Incident type="fail" file="tst_cmptest.cpp" line="365">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
@ -151,13 +151,13 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag> <DataTag><![CDATA[both null]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[one null]]></DataTag> <DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ. <Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description> Expected (opB).isNull(): 0]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[other null]]></DataTag> <DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ. <Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0 Actual (opA).isNull(): 0
@ -166,24 +166,48 @@
<Incident type="pass" file="" line="0"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag> <DataTag><![CDATA[equal]]></DataTag>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different size]]></DataTag> <DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size. <Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20]]></Description> Expected (opB): 20x20]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different format]]></DataTag> <DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format. <Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6 Actual (opA): 6
Expected (opB): 3]]></Description> Expected (opB): 3]]></Description>
</Incident> </Incident>
<Incident type="fail" file="tst_cmptest.cpp" line="388"> <Incident type="fail" file="tst_cmptest.cpp" line="392">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
<TestFunction name="verify">
<Incident type="fail" file="tst_cmptest.cpp" line="404">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
<Incident type="fail" file="tst_cmptest.cpp" line="410">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
<Incident type="fail" file="tst_cmptest.cpp" line="416">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
<Incident type="fail" file="tst_cmptest.cpp" line="422">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="cleanupTestCase"> <TestFunction name="cleanupTestCase">
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
<Duration msecs="0"/> <Duration msecs="0"/>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="22" tests="12" name="tst_Cmptest"> <testsuite errors="0" failures="26" tests="16" name="tst_Cmptest">
<properties> <properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@ -84,6 +84,18 @@
Expected (opB): 3" result="fail"/> Expected (opB): 3" result="fail"/>
<failure tag="different pixels" message="Compared values are not the same" result="fail"/> <failure tag="different pixels" message="Compared values are not the same" result="fail"/>
</testcase> </testcase>
<testcase result="fail" name="verify">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. ()" result="fail"/>
</testcase>
<testcase result="fail" name="verify2">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. (42)" result="fail"/>
</testcase>
<testcase result="fail" name="tryVerify">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. ()" result="fail"/>
</testcase>
<testcase result="fail" name="tryVerify2">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. (42)" result="fail"/>
</testcase>
<testcase result="pass" name="cleanupTestCase"/> <testcase result="pass" name="cleanupTestCase"/>
<system-err/> <system-err/>
</testsuite> </testsuite>