From b2173b54ef9ede85d88cb0fdf025b26e732ed44a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 5 Jan 2017 15:43:21 +0100 Subject: 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 --- tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp') diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 7ffb5d0fd7..66fc578d5f 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -112,13 +112,13 @@ void tst_QGetPutEnv::intValue_data() ROW(0xffffffff, 0, false); const int bases[] = {10, 8, 16}; for (size_t i = 0; i < sizeof bases / sizeof *bases; ++i) { - QTest::newRow(qPrintable(QString::asprintf("INT_MAX, base %d", bases[i]))) + QTest::addRow("INT_MAX, base %d", bases[i]) << QByteArray::number(INT_MAX) << INT_MAX << true; - QTest::newRow(qPrintable(QString::asprintf("INT_MAX+1, base %d", bases[i]))) + QTest::addRow("INT_MAX+1, base %d", bases[i]) << QByteArray::number(qlonglong(INT_MAX) + 1) << 0 << false; - QTest::newRow(qPrintable(QString::asprintf("INT_MIN, base %d", bases[i]))) + QTest::addRow("INT_MIN, base %d", bases[i]) << QByteArray::number(INT_MIN) << INT_MIN << true; - QTest::newRow(qPrintable(QString::asprintf("INT_MIN-1, base %d", bases[i]))) + QTest::addRow("INT_MIN-1, base %d", bases[i]) << QByteArray::number(qlonglong(INT_MIN) - 1) << 0 << false; }; } -- cgit v1.2.3