diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-11 17:23:21 +0300 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-04 19:55:04 +0000 |
commit | 9c8a8e90a6514c23bcbeb14073a9d6bdd926d68b (patch) | |
tree | ee3eb949e59abd38bc2dcaad25b0847ab772a784 /tests/auto/corelib/tools/qstring/tst_qstring.cpp | |
parent | 35117590c8f4634ddfdbe75966dd43adeca69369 (diff) |
QString: fix append(const QStringRef &str)
Use QStringRef::isNull instead of QStringRef::string()
for validation. Non-NULL str.string() may yet leave us
with a useless str.unicode(), which is the actual problem here;
whereas !str.isNull() does really confirm that str.unicode()
is sensible.
Such test prevents situation like:
const QString a;
QString b;
b.append(a); // b.isNull() == true
b.append(QStringRef(&a)); // b.isNull() == false
Auto test updated: create QStringRef from QString directly, without
any condition.
Change-Id: I082cd58ef656d8a53e3c1223aca01feea82fffb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstring/tst_qstring.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qstring/tst_qstring.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index da6cdddd4f..db4c33afde 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -131,7 +131,7 @@ template <> class Arg<QStringRef> : ArgBase { QStringRef ref() const - { return this->pinned.isNull() ? QStringRef() : this->pinned.midRef(0) ; } + { return QStringRef(&pinned); } public: explicit Arg(const char *str) : ArgBase(str) {} |