From d543b1c3d45766d1f88a47fae4611a9d6e2f33d0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 27 Aug 2014 23:16:13 +0200 Subject: tst_QString: refactor the op+= tests ... using the framework developed for testing QString::append. Change-Id: I29011eba6438bf9b3daad354cbec4b8e2b98ed81 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 33 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/tools/qstring/tst_qstring.cpp') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index d9f7acd6c9..43f4d3696d 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -310,6 +310,11 @@ class tst_QString : public QObject void append_impl() const { append_impl(); } void append_data(bool emptyIsNoop = false); template + void operator_pluseq_impl() const { do_apply0(MemFun(&QString::operator+=)); } + template + void operator_pluseq_impl() const { operator_pluseq_impl(); } + void operator_pluseq_data(bool emptyIsNoop = false); + template void prepend_impl() const { do_apply0(MemFun(&QString::prepend)); } template void prepend_impl() const { prepend_impl(); } @@ -403,8 +408,23 @@ private slots: void append_bytearray_special_cases_data(); void append_bytearray_special_cases(); - void operator_pluseq_bytearray_data(); - void operator_pluseq_bytearray(); + void operator_pluseq_qstring() { operator_pluseq_impl(); } + void operator_pluseq_qstring_data() { operator_pluseq_data(); } + void operator_pluseq_qstringref() { operator_pluseq_impl(); } + void operator_pluseq_qstringref_data() { operator_pluseq_data(); } + void operator_pluseq_qlatin1string() { operator_pluseq_impl(); } + void operator_pluseq_qlatin1string_data() { operator_pluseq_data(); } + void operator_pluseq_qchar() { operator_pluseq_impl(); } + void operator_pluseq_qchar_data() { operator_pluseq_data(true); } + void operator_pluseq_qbytearray() { operator_pluseq_impl(); } + void operator_pluseq_qbytearray_data() { operator_pluseq_data(); } + void operator_pluseq_char() { operator_pluseq_impl(); } + void operator_pluseq_char_data() { operator_pluseq_data(true); } + void operator_pluseq_charstar() { operator_pluseq_impl(); } + void operator_pluseq_charstar_data() { operator_pluseq_data(); } + void operator_pluseq_bytearray_special_cases_data(); + void operator_pluseq_bytearray_special_cases(); + void operator_eqeq_bytearray_data(); void operator_eqeq_bytearray(); void operator_eqeq_nullstring(); @@ -2523,12 +2543,17 @@ void tst_QString::append_bytearray_special_cases() } } -void tst_QString::operator_pluseq_bytearray_data() +void tst_QString::operator_pluseq_data(bool emptyIsNoop) +{ + append_data(emptyIsNoop); +} + +void tst_QString::operator_pluseq_bytearray_special_cases_data() { append_bytearray_special_cases_data(); } -void tst_QString::operator_pluseq_bytearray() +void tst_QString::operator_pluseq_bytearray_special_cases() { { QFETCH( QString, str ); -- cgit v1.2.3