Fix QMetaType benchmark

The benchmark used to crash because QMetaType::typeName would return an
empty string, which is not a legal value for newRow.

Change-Id: I9e6c6c1cf153943bfa21181cd2cca596a7943ea0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Fabian Kosmale 2021-02-03 22:13:51 +01:00
parent f30a4f0be7
commit 1316af2f3e

View File

@ -248,9 +248,11 @@ void tst_QMetaType::isRegisteredNotRegistered()
void tst_QMetaType::constructInPlace_data()
{
QTest::addColumn<int>("typeId");
for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i)
if (i != QMetaType::Void)
QTest::newRow(QMetaType::typeName(i)) << i;
for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i) {
auto name = QMetaType::typeName(i);
if (name && i != QMetaType::Void)
QTest::newRow(name) << i;
}
QTest::newRow("custom") << qMetaTypeId<BigClass>();
// GUI types are tested in tst_QGuiMetaType.