diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-07-20 13:31:56 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-07-27 12:35:50 -0700 |
commit | 27b10261398304978c3dc0166aad28d80c9b359e (patch) | |
tree | 916acbad404ad7927b955bf8229167209c1b3f2b /tests/auto/corelib/kernel/qvariant | |
parent | 2e6398bd4626c054f18ca9762523dfcb49e31ab8 (diff) |
QVariant: split the warning from customConstruct()
In one of the three calls to customConstruct() -- QVariant::detach() --
we've already checked that the type is valid, so don't re-emit the
warning there.
Change-Id: I3859764fed084846bcb0fffd1703a3c7c0fb3164
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qvariant')
-rw-r--r-- | tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index f20fd0cd87..b6fc6529dc 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -5149,10 +5149,16 @@ void tst_QVariant::constructFromIncompatibleMetaType() { QFETCH(QMetaType, type); // in that case, we run into a different condition (size == 0), and do not warn - if (QTest::currentDataTag() != QLatin1String("void")) + if (type == QMetaType::fromType<NonDefaultConstructible>()) { + QTest::ignoreMessage(QtWarningMsg, + "QVariant: Cannot create type 'NonDefaultConstructible' without a " + "default constructor"); + } else if (type != QMetaType::fromType<void>()) { QTest::ignoreMessage( QtWarningMsg, - "QVariant: Provided metatype does not support destruction, copy and default construction"); + "QVariant: Provided metatype for '" + QByteArray(type.name()) + + "' does not support destruction and copy construction"); + } QVariant var(type, nullptr); QVERIFY(!var.isValid()); QVERIFY(!var.metaType().isValid()); |