diff options
author | Harald Fernengel <harald.fernengel@nokia.com> | 2009-07-03 08:08:52 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2009-07-03 08:08:52 (GMT) |
commit | 8a0b05f71d2a9481a21143d1b87e2b18d427d1d5 (patch) | |
tree | 0fea01e027da6cfc60f53c0ba6faad9daee62e4b | |
parent | 17f814ce07a4d82563012a15a46dfe6acb2edcc5 (diff) | |
download | Qt-8a0b05f71d2a9481a21143d1b87e2b18d427d1d5.zip Qt-8a0b05f71d2a9481a21143d1b87e2b18d427d1d5.tar.gz Qt-8a0b05f71d2a9481a21143d1b87e2b18d427d1d5.tar.bz2 |
fix the test _and_ the class :)
-rw-r--r-- | src/corelib/tools/qstringbuilder.h | 2 | ||||
-rw-r--r-- | tests/auto/qstringbuilder/tst_qstringbuilder.cpp | 17 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 127c183..97f13ee 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -206,7 +206,7 @@ template <> struct QConcatenable<const char *> template <> struct QConcatenable<QByteArray> { typedef QByteArray type; - static int size(const QByteArray &ba) { qstrnlen(ba.constData(), ba.size()); } + static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } static inline void appendTo(const QByteArray &ba, QChar *&out) { const char *data = ba.constData(); diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp index fdbaf21..72889bc 100644 --- a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp +++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp @@ -85,28 +85,18 @@ #undef QT_NO_CAST_TO_ASCII #endif - #include <QtTest/QtTest> //TESTED_CLASS=QStringBuilder //TESTED_FILES=qstringbuilder.cpp -#include <qtest.h> - #define LITERAL "some literal" class tst_QStringBuilder : public QObject { Q_OBJECT -public: - tst_QStringBuilder() {} - ~tst_QStringBuilder() {} - -public slots: - void init() {} - void cleanup() {} - +private slots: void scenario(); }; @@ -119,6 +109,7 @@ void tst_QStringBuilder::scenario() QLatin1Char achar('c'); QString r2(QLatin1String(LITERAL LITERAL)); QString r; + QByteArray ba(LITERAL); r = l1literal P l1literal; QCOMPARE(r, r2); @@ -139,6 +130,10 @@ void tst_QStringBuilder::scenario() QCOMPARE(r, r2); r = LITERAL P string; QCOMPARE(r, r2); + r = ba P string; + QCOMPARE(r, r2); + r = string P ba; + QCOMPARE(r, r2); #endif } |