diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-01-05 15:43:21 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-01-10 07:47:26 +0000 |
commit | b2173b54ef9ede85d88cb0fdf025b26e732ed44a (patch) | |
tree | 924daecbd0281944634838e2b19c6296c8fffd3d /src/testlib/qtestcase.h | |
parent | d135acfa43810b2f7a2dba12688bbaa07a2e08cc (diff) |
Long live QTest::addRow()!
This new function does the same as newRow(), except that it has a less confusing
name (in line with _add_Column()), and accepts printf-style arguments to avoid
the need to newRow(qPrintable(QString::asprintf())), a common pattern in client
code. It uses qvsnprintf() under the hoods, avoiding the need for the QString
const char* round-trip.
Port all in-tree users of newRow(qPrintable(QString::asnprintf())) to the new
function.
Change-Id: Icd5de9b7ea4f6759d98080ec30f5aecadb8bec39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 4c226830e9..058c0b3295 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -316,6 +316,7 @@ namespace QTest addColumnInternal(qMetaTypeId<T>(), name); } Q_TESTLIB_EXPORT QTestData &newRow(const char *dataTag); + Q_TESTLIB_EXPORT QTestData &addRow(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(1, 2); template <typename T> inline bool qCompare(T const &t1, T const &t2, const char *actual, const char *expected, |