tst_QMetaObject: check a few functions with QVector instead of QList
QVector instead of QList is currently still treated specially, being considered normalized even if a signature piped through normalizeSignature() would have changed. We'd like to get rid of this special treatment, so add some tests for invokeMethod() + Q_ARG, which we should continue to support. Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-135572 Change-Id: Ie09c80d2a8603a268859f395797196013efd8c0f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
a481a79a97
commit
1fa31be7ce
@ -796,6 +796,12 @@ void tst_QMetaObject::invokeMetaMember()
|
||||
Q_ARG(QList<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
QCOMPARE(obj.slotResult, QString("sl13"));
|
||||
// same, testing the QList/QVector aliasing:
|
||||
QVERIFY(QMetaObject::invokeMethod(&obj, "sl13",
|
||||
Q_RETURN_ARG(QVector<QString>, returnValue),
|
||||
Q_ARG(QVector<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
QCOMPARE(obj.slotResult, QString("sl13"));
|
||||
|
||||
// return qint64
|
||||
qint64 return64;
|
||||
@ -1583,6 +1589,12 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember()
|
||||
Q_ARG(QList<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
QCOMPARE(obj.slotResult, QString("sl13"));
|
||||
// same, testing QVector/QList aliasing:
|
||||
QVERIFY(QMetaObject::invokeMethod(&obj, "sl13", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QVector<QString>, returnValue),
|
||||
Q_ARG(QVector<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
QCOMPARE(obj.slotResult, QString("sl13"));
|
||||
|
||||
// return qint64
|
||||
qint64 return64;
|
||||
@ -2122,7 +2134,7 @@ void tst_QMetaObject::invokeQueuedAutoRegister()
|
||||
&obj, "slotWithRegistrableArgument", Qt::QueuedConnection,
|
||||
Q_ARG(QtTestObject *, shared.data()), Q_ARG(QPointer<QtTestObject>, shared.data()),
|
||||
Q_ARG(QSharedPointer<QtTestObject>, shared), Q_ARG(QWeakPointer<QtTestObject>, shared),
|
||||
Q_ARG(QList<QtTestObject *>, QList<QtTestObject *>()),
|
||||
Q_ARG(QVector<QtTestObject *>, QVector<QtTestObject *>()), // check QVector/QList aliasing
|
||||
Q_ARG(QList<QtTestObject *>, QList<QtTestObject *>())));
|
||||
QVERIFY(obj.slotResult.isEmpty());
|
||||
qApp->processEvents(QEventLoop::AllEvents);
|
||||
@ -2345,6 +2357,7 @@ void tst_QMetaObject::customPropertyType()
|
||||
prop = metaObject()->property(metaObject()->indexOfProperty("value4"));
|
||||
QCOMPARE(prop.metaType().id(), QMetaType::QVariantList);
|
||||
QCOMPARE(prop.metaType(), QMetaType::fromType<QList<QVariant>>());
|
||||
QCOMPARE(prop.metaType(), QMetaType::fromType<QVector<QVariant>>());
|
||||
|
||||
prop = metaObject()->property(metaObject()->indexOfProperty("value5"));
|
||||
QCOMPARE(prop.metaType().id(), QMetaType::QVariantList);
|
||||
@ -2635,10 +2648,10 @@ void tst_QMetaObject::metaMethod()
|
||||
argument << QString("one") << QString("two") << QString("three");
|
||||
//wrong object
|
||||
//QVERIFY(!sl13.invoke(this, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QVERIFY(!sl13.invoke(0, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QVERIFY(!sl13.invoke(0, Q_RETURN_ARG(QVector<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QVERIFY(returnValue.isEmpty());
|
||||
|
||||
QVERIFY(sl13.invoke(&obj, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QVERIFY(sl13.invoke(&obj, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QVector<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
QCOMPARE(obj.slotResult, QString("sl13"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user