summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qvariant
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-06-27 15:48:30 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-07-05 11:25:46 +0200
commit9b3e8b32f2657948591f6bdffea9d48291b8a69b (patch)
treed6fbb8a21930dbf9ccf9d8271f18a8ca132fe88a /tests/auto/corelib/kernel/qvariant
parent6061e6820b97c45100d2e761a9bb302c71ce3e62 (diff)
Remove usages of deprecated APIs of corelib
- Replaced the usages of deprecated APIs of corelib by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Task-number: QTBUG-76491 Task-number: QTBUG-76539 Task-number: QTBUG-76541 Change-Id: I62ed4a5b530a965ec3f6502c6480808f938921aa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qvariant')
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index c75e4ef035..5d06f6e8c8 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -402,6 +402,8 @@ QT_WARNING_POP
QVERIFY( var6.isNull() );
QVariant varLL( (qlonglong)0 );
QVERIFY( !varLL.isNull() );
+
+#if QT_DEPRECATED_SINCE(5, 9)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QVariant var7(QString::null);
@@ -412,6 +414,7 @@ QT_WARNING_DISABLE_DEPRECATED
var7 = QVariant::fromValue<QString>(QString::null);
QT_WARNING_POP
QVERIFY(var7.isNull());
+#endif
QVariant var8(QMetaType::Nullptr, nullptr);
QVERIFY(var8.isNull());
@@ -433,6 +436,9 @@ QT_WARNING_POP
QVERIFY(var11.isNull());
QVERIFY(QVariant::fromValue<int*>(nullptr).isNull());
+
+ QVariant var12(QVariant::fromValue<QString>(QString()));
+ QVERIFY(var12.isNull());
}
void tst_QVariant::swap()
@@ -2871,6 +2877,7 @@ void tst_QVariant::qvariant_cast_QObject_wrapper()
QVERIFY(spVar.canConvert<QObject*>());
QCOMPARE(f, spVar.value<QObject*>());
}
+#if QT_DEPRECATED_SINCE(5, 0)
{
QFile *f = new QFile(this);
QT_WARNING_PUSH
@@ -2881,6 +2888,15 @@ QT_WARNING_POP
QVERIFY(spVar.canConvert<QObject*>());
QCOMPARE(f, spVar.value<QObject*>());
}
+#endif
+ {
+ QFile *f = new QFile(this);
+ QSharedPointer<QObject> sp(f);
+ QWeakPointer<QObject> wp = sp;
+ QVariant wpVar = QVariant::fromValue(wp);
+ QVERIFY(wpVar.canConvert<QObject*>());
+ QCOMPARE(f, wpVar.value<QObject*>());
+ }
{
QFile *f = new QFile(this);
QSharedPointer<QFile> sp(f);