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 <thiago.macieira@intel.com>
bb10
Edward Welbourne 2022-10-12 19:57:43 +02:00
parent d39f1da6e3
commit b9b516f42e
1 changed files with 1 additions and 6 deletions

View File

@ -900,11 +900,6 @@ template <typename T> 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 <typename T> 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);