summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-15 20:47:57 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-07-15 20:47:57 +0200
commit82ea53ad24c92b345ac2b542a174887f5de5723a (patch)
tree7d326274b52bbedac481be522a20732f77457073 /src/testlib
parente46e112eb10850801218bd810ecaeb8fd29f4c34 (diff)
parent178ab885626bcd67507fde7f67f65c1872ac3be3 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: qmake/library/qmakeevaluator.cpp One side changed the iterator to use ranged-for, the other changed its body; they only conflicted because the latter had to add braces around the body, intruding on the for-line. Trivial resolution. Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtest.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 85a0d1cc0c..cf8dee4646 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -108,37 +108,57 @@ template<> inline char *toString(const QDateTime &dateTime)
template<> inline char *toString(const QChar &c)
{
+ const ushort uc = c.unicode();
+ if (uc < 128) {
+ char msg[32] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QChar: '%c' (0x%x)", char(uc), unsigned(uc));
+ return qstrdup(msg);
+ }
return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16))));
}
template<> inline char *toString(const QPoint &p)
{
- return qstrdup(QString::fromLatin1("QPoint(%1,%2)").arg(p.x()).arg(p.y()).toLatin1().constData());
+ char msg[128] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QPoint(%d,%d)", p.x(), p.y());
+ return qstrdup(msg);
}
template<> inline char *toString(const QSize &s)
{
- return qstrdup(QString::fromLatin1("QSize(%1x%2)").arg(s.width()).arg(s.height()).toLatin1().constData());
+ char msg[128] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QSize(%dx%d)", s.width(), s.height());
+ return qstrdup(msg);
}
template<> inline char *toString(const QRect &s)
{
- return qstrdup(QString::fromLatin1("QRect(%1,%2 %5x%6) (bottomright %3,%4)").arg(s.left()).arg(s.top()).arg(s.right()).arg(s.bottom()).arg(s.width()).arg(s.height()).toLatin1().constData());
+ char msg[256] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QRect(%d,%d %dx%d) (bottomright %d,%d)",
+ s.left(), s.top(), s.width(), s.height(), s.right(), s.bottom());
+ return qstrdup(msg);
}
template<> inline char *toString(const QPointF &p)
{
- return qstrdup(QString::fromLatin1("QPointF(%1,%2)").arg(p.x()).arg(p.y()).toLatin1().constData());
+ char msg[64] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QPointF(%g,%g)", p.x(), p.y());
+ return qstrdup(msg);
}
template<> inline char *toString(const QSizeF &s)
{
- return qstrdup(QString::fromLatin1("QSizeF(%1x%2)").arg(s.width()).arg(s.height()).toLatin1().constData());
+ char msg[64] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QSizeF(%gx%g)", s.width(), s.height());
+ return qstrdup(msg);
}
template<> inline char *toString(const QRectF &s)
{
- return qstrdup(QString::fromLatin1("QRectF(%1,%2 %5x%6) (bottomright %3,%4)").arg(s.left()).arg(s.top()).arg(s.right()).arg(s.bottom()).arg(s.width()).arg(s.height()).toLatin1().constData());
+ char msg[256] = {'\0'};
+ qsnprintf(msg, sizeof(msg), "QRectF(%g,%g %gx%g) (bottomright %g,%g)",
+ s.left(), s.top(), s.width(), s.height(), s.right(), s.bottom());
+ return qstrdup(msg);
}
template<> inline char *toString(const QUrl &uri)