summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtest_gui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtest_gui.h')
-rw-r--r--src/testlib/qtest_gui.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index d4b2de2214..a4f217ae1f 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -62,10 +62,7 @@
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
-
-#ifdef QT_WIDGETS_LIB
#include <QtGui/qicon.h>
-#endif
#if 0
// inform syncqt
@@ -78,9 +75,6 @@ QT_BEGIN_NAMESPACE
namespace QTest
{
-/*!
- \internal
- */
template<> inline char *toString(const QColor &color)
{
return qstrdup(color.name(QColor::HexArgb).toLocal8Bit().constData());
@@ -94,8 +88,8 @@ template<> inline char *toString(const QRegion &region)
} else if (region.isEmpty()) {
result += "empty";
} else {
- const QVector<QRect> &rects = region.rects();
- const int rectCount = rects.size();
+ const auto rects = region.begin();
+ const int rectCount = region.rectCount();
if (rectCount > 1) {
result += QByteArray::number(rectCount);
result += " rectangles, ";
@@ -103,7 +97,7 @@ template<> inline char *toString(const QRegion &region)
for (int i = 0; i < rectCount; ++i) {
if (i)
result += ", ";
- const QRect &r = rects.at(i);
+ const QRect &r = rects[i];
result += QByteArray::number(r.width());
result += 'x';
result += QByteArray::number(r.height());
@@ -164,24 +158,24 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
qsnprintf(msg, 1024, "Compared QImages differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
" Actual (%s): %dx%d\n"
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1.format() != t2.format()) {
qsnprintf(msg, 1024, "Compared QImages differ in format.\n"
" Actual (%s): %d\n"
" Expected (%s): %d",
actual, t1.format(), expected, t2.format());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
return compare_helper(t1 == t2, "Compared values are not the same",
toString(t1), toString(t2), actual, expected, file, line);
@@ -198,17 +192,17 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
qsnprintf(msg, 1024, "Compared QPixmaps differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
" Actual (%s): %dx%d\n"
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
return qCompare(t1.toImage(), t2.toImage(), actual, expected, file, line);
}