From b9b516f42e8e99b85dac0f512686a43b9be3d2bb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 12 Oct 2022 19:57:43 +0200 Subject: [PATCH] Ignore the warning for all types in tst_QCborValue's mapFromArray*() For some reason the QTest::ignoreMessage() was conditioned on the type being tested being Array; however, the warning is in fact produced for all types. So anticipate it for all and make the test log less noisy. Change-Id: I78681624252ff8a71f080204f8b031609ddac468 Reviewed-by: Thiago Macieira --- .../corelib/serialization/qcborvalue/tst_qcborvalue.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp index 82e2309680..0a36aa2084 100644 --- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp +++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp @@ -900,11 +900,6 @@ template static void mapFromArray_template(T key) if (v.isMap()) return; // already a map, nothing will happen - auto ignoreMessage = [type]() { - if (type == QCborValue::Array) - QTest::ignoreMessage(QtWarningMsg, "Using CBOR array as map forced conversion"); - }; - // verify forced conversions work // (our only Array row is an empty array, so it doesn't produce the warning) QCborValue v2 = v; @@ -918,7 +913,7 @@ template static void mapFromArray_template(T key) // non-empty array conversions QCborValue va = QCborArray{v}; v2 = va; - ignoreMessage(); + QTest::ignoreMessage(QtWarningMsg, "Using CBOR array as map forced conversion"); QVERIFY(v2[key].isUndefined()); QCOMPARE(v2.type(), QCborValue::Map); QCOMPARE(va.type(), QCborValue::Array);