From af32768f18f8fed1ce3d06a6bad5fd65d0574a3a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Jun 2023 14:52:43 +0200 Subject: QDebug: add getter/setter for noQuotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were setters (quote(), noquote()), but, unlike space()/nospace(), there was no getter. Add the getter, and, for symmetry, a parametrized setter, too. [ChangeLog][QtCore][QDebug] Added setQuoteStrings()/quoteStrings() to access and manipulate the quote()/noquote() state. Change-Id: I1b73138819b4d02726a6ef862c190206431ccebc Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib/io/qdebug') diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 37bb6aa65a..6c976e4a63 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -318,11 +318,17 @@ void tst_QDebug::debugNoQuotes() const MessageHandlerSetter mhs(myMessageHandler); { QDebug d = qDebug(); + QVERIFY(d.quoteStrings()); d << QStringLiteral("Hello"); + QVERIFY(d.quoteStrings()); d.noquote(); + QVERIFY(!d.quoteStrings()); d << QStringLiteral("Hello"); + QVERIFY(!d.quoteStrings()); d.quote(); + QVERIFY(d.quoteStrings()); d << QStringLiteral("Hello"); + QVERIFY(d.quoteStrings()); } QCOMPARE(s_msg, QString::fromLatin1("\"Hello\" Hello \"Hello\"")); @@ -331,7 +337,7 @@ void tst_QDebug::debugNoQuotes() const d << QChar('H'); d << QLatin1String("Hello"); d << QByteArray("Hello"); - d.noquote(); + d.setQuoteStrings(false); d << QChar('H'); d << QLatin1String("Hello"); d << QByteArray("Hello"); -- cgit v1.2.3