void flags();
void flagsStaticLess_data();
void flagsStaticLess();
+ void flagsBinaryCompatibility5_0_data();
+ void flagsBinaryCompatibility5_0();
void construct_data();
void construct();
void constructCopy_data();
QCOMPARE(bool(flags & QMetaType::MovableType), isMovable);
}
+void tst_QMetaType::flagsBinaryCompatibility5_0_data()
+{
+ // Changing traits of a built-in type is illegal from BC point of view.
+ // Traits are saved in code of an application and in the Qt library which means
+ // that there may be a mismatch.
+ // The test is loading data generated by this code:
+ //
+ // QByteArray buffer;
+ // buffer.reserve(2 * QMetaType::User);
+ // for (quint32 i = 0; i < QMetaType::User; ++i) {
+ // if (QMetaType::isRegistered(i)) {
+ // buffer.append(i);
+ // buffer.append(quint32(QMetaType::typeFlags(i)));
+ // }
+ // }
+ // QFile file("/tmp/typeFlags.bin");
+ // file.open(QIODevice::WriteOnly);
+ // file.write(buffer);
+ // file.close();
+
+ QTest::addColumn<quint32>("id");
+ QTest::addColumn<quint32>("flags");
+
+ QFile file(QFINDTESTDATA("typeFlags.bin"));
+ file.open(QIODevice::ReadOnly);
+ QByteArray buffer = file.readAll();
+
+ for (int i = 0; i < buffer.size(); i+=2) {
+ const quint32 id = buffer.at(i);
+ const quint32 flags = buffer.at(i + 1);
+ QVERIFY2(QMetaType::isRegistered(id), "A type could not be removed in BC way");
+ QTest::newRow(QMetaType::typeName(id)) << id << flags;
+ }
+}
+
+void tst_QMetaType::flagsBinaryCompatibility5_0()
+{
+ QFETCH(quint32, id);
+ QFETCH(quint32, flags);
+
+ QCOMPARE(quint32(QMetaType::typeFlags(id)), flags);
+}
+
void tst_QMetaType::construct_data()
{
create_data();