QVariant: fix the test
8a375341cf added swap() to QJson* classes
and marked them shared-not-movable-until-qt6.
That unveiled a broken test in QVariant which was relying on QJsonDocument
being not relocatable. So fix the test by using a proper datatype for the task.
Change-Id: Ic35f09f936b00dfaeb368ccb42aecf35cc506029
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
bb10
parent
7950b6b283
commit
af211b3993
|
|
@ -3395,21 +3395,6 @@ void tst_QVariant::toIntFromDouble() const
|
|||
QCOMPARE(result, 2147483630);
|
||||
}
|
||||
|
||||
void tst_QVariant::setValue()
|
||||
{
|
||||
QJsonDocument t; //we just take a value so that we're sure that it will be shared
|
||||
QVariant v1 = QVariant::fromValue(t);
|
||||
QVERIFY( v1.isDetached() );
|
||||
QVariant v2 = v1;
|
||||
QVERIFY( !v1.isDetached() );
|
||||
QVERIFY( !v2.isDetached() );
|
||||
|
||||
v2.setValue(3); //set an integer value
|
||||
|
||||
QVERIFY( v1.isDetached() );
|
||||
QVERIFY( v2.isDetached() );
|
||||
}
|
||||
|
||||
void tst_QVariant::fpStringRoundtrip_data() const
|
||||
{
|
||||
QTest::addColumn<QVariant>("number");
|
||||
|
|
@ -3641,6 +3626,20 @@ Q_DECLARE_METATYPE(MyMovable *)
|
|||
Q_DECLARE_METATYPE(MyNotMovable *)
|
||||
Q_DECLARE_METATYPE(QSharedDataPointer<MyShared>)
|
||||
|
||||
void tst_QVariant::setValue()
|
||||
{
|
||||
MyNotMovable t; //we just take a value so that we're sure that it will be shared
|
||||
QVariant v1 = QVariant::fromValue(t);
|
||||
QVERIFY( v1.isDetached() );
|
||||
QVariant v2 = v1;
|
||||
QVERIFY( !v1.isDetached() );
|
||||
QVERIFY( !v2.isDetached() );
|
||||
|
||||
v2.setValue(3); //set an integer value
|
||||
|
||||
QVERIFY( v1.isDetached() );
|
||||
QVERIFY( v2.isDetached() );
|
||||
}
|
||||
|
||||
void tst_QVariant::moreCustomTypes()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue