Remove an unused enum value and document another one
Change-Id: If9fed4f20242d789c1251b8798d7378d2d6911a6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
13c1e3f434
commit
9c501b0670
@ -408,10 +408,10 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry)
|
||||
\value MovableType An instance of a type having this attribute can be safely moved by memcpy.
|
||||
\omitvalue SharedPointerToQObject
|
||||
\value IsEnumeration This type is an enumeration
|
||||
\value If the type is an Enumeration, its underlying type is unsigned
|
||||
\value PointerToQObject This type is a pointer to a derived of QObject
|
||||
\omitvalue WeakPointerToQObject
|
||||
\omitvalue TrackingPointerToQObject
|
||||
\omitvalue WasDeclaredAsMetaType
|
||||
\omitvalue IsGadget \omit This type is a Q_GADGET and it's corresponding QMetaObject can be accessed with QMetaType::metaObject Since 5.5. \endomit
|
||||
\omitvalue PointerToGadget
|
||||
*/
|
||||
|
@ -354,11 +354,10 @@ public:
|
||||
SharedPointerToQObject = 0x20,
|
||||
WeakPointerToQObject = 0x40,
|
||||
TrackingPointerToQObject = 0x80,
|
||||
WasDeclaredAsMetaType = 0x100,
|
||||
IsUnsignedEnumeration = 0x100,
|
||||
IsGadget = 0x200,
|
||||
PointerToGadget = 0x400,
|
||||
IsPointer = 0x800,
|
||||
IsUnsignedEnumeration = 0x1000
|
||||
};
|
||||
Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
|
||||
|
||||
|
@ -203,8 +203,8 @@ private slots:
|
||||
void flags();
|
||||
void flagsStaticLess_data();
|
||||
void flagsStaticLess();
|
||||
void flagsBinaryCompatibility5_0_data();
|
||||
void flagsBinaryCompatibility5_0();
|
||||
void flagsBinaryCompatibility6_0_data();
|
||||
void flagsBinaryCompatibility6_0();
|
||||
void construct_data();
|
||||
void construct();
|
||||
void typedConstruct();
|
||||
@ -411,7 +411,7 @@ void tst_QMetaType::registerGadget(const char *name, const QList<GadgetPropertyT
|
||||
auto meta = gadgetBuilder.toMetaObject();
|
||||
meta->d.static_metacall = &GadgetsStaticMetacallFunction;
|
||||
meta->d.superdata = nullptr;
|
||||
const auto flags = QMetaType::WasDeclaredAsMetaType | QMetaType::IsGadget | QMetaType::NeedsConstruction | QMetaType::NeedsDestruction;
|
||||
const auto flags = QMetaType::IsGadget | QMetaType::NeedsConstruction | QMetaType::NeedsDestruction;
|
||||
using TypeInfo = QtPrivate::QMetaTypeInterface;
|
||||
auto typeInfo = new TypeInfo {
|
||||
0, sizeof(GenericGadgetType), alignof(GenericGadgetType), uint(flags), meta, name, 0,
|
||||
@ -1133,46 +1133,47 @@ void tst_QMetaType::flagsStaticLess()
|
||||
QCOMPARE(bool(flags & QMetaType::MovableType), isMovable);
|
||||
}
|
||||
|
||||
void tst_QMetaType::flagsBinaryCompatibility5_0_data()
|
||||
void tst_QMetaType::flagsBinaryCompatibility6_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();
|
||||
// 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:
|
||||
//
|
||||
// QList<quint32> buffer;
|
||||
// buffer.reserve(2 * QMetaType::User);
|
||||
// for (quint32 i = 0; i < QMetaType::LastCoreType; ++i) {
|
||||
// if (QMetaType::isRegistered(i)) {
|
||||
// buffer.append(i);
|
||||
// buffer.append(quint32(QMetaType::typeFlags(i)));
|
||||
// }
|
||||
// }
|
||||
// QFile file("/tmp/typeFlags.bin");
|
||||
// file.open(QIODevice::WriteOnly);
|
||||
// QDataStream ds(&file);
|
||||
// ds << buffer;
|
||||
// file.close();
|
||||
|
||||
QTest::addColumn<quint32>("id");
|
||||
QTest::addColumn<quint32>("flags");
|
||||
|
||||
QFile file(QFINDTESTDATA("typeFlags.bin"));
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QByteArray buffer = file.readAll();
|
||||
QList<quint32> buffer;
|
||||
QDataStream ds(&file);
|
||||
ds >> buffer;
|
||||
|
||||
for (int i = 0; i < buffer.size(); i+=2) {
|
||||
const quint32 id = buffer.at(i);
|
||||
const quint32 flags = buffer.at(i + 1);
|
||||
if (id > QMetaType::LastCoreType)
|
||||
continue; // We do not link against QtGui, so we do longer consider such type as registered
|
||||
if (id == QMetaType::Void)
|
||||
continue; // The meaning of QMetaType::Void has changed in Qt6
|
||||
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()
|
||||
void tst_QMetaType::flagsBinaryCompatibility6_0()
|
||||
{
|
||||
QFETCH(quint32, id);
|
||||
QFETCH(quint32, flags);
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user