Tests: Fix expectations in offset test

Change-Id: I875966409d769fe19e615763c605c527398b01dd
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-09-21 14:31:00 +02:00
parent 077a807f01
commit b64863806f

View File

@@ -157,7 +157,17 @@ void tst_offsets::offsets_data()
const int qtVersion = QT_VERSION; const int qtVersion = QT_VERSION;
const quintptr qtTypeVersion = qtHookData[6]; const quintptr qtTypeVersion = qtHookData[6];
if (qtVersion > 0x50600 && qtTypeVersion >= 17) if (qtTypeVersion >= 20)
#ifdef Q_OS_WIN
# ifdef Q_CC_MSVC
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
# else // MinGW
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
# endif
#else
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
#endif
else if (qtVersion > 0x50600 && qtTypeVersion >= 17)
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# ifdef Q_CC_MSVC # ifdef Q_CC_MSVC
OFFSET_TEST(QFilePrivate, fileName) << 164 << 224; OFFSET_TEST(QFilePrivate, fileName) << 164 << 224;
@@ -229,13 +239,16 @@ void tst_offsets::offsets_data()
OFFSET_TEST(QFileSystemEntry, m_filePath) << 0 << 0; OFFSET_TEST(QFileSystemEntry, m_filePath) << 0 << 0;
OFFSET_TEST(QFileInfoPrivate, fileEntry) << 4 << 8; OFFSET_TEST(QFileInfoPrivate, fileEntry) << 4 << 8;
QTest::newRow("sizeof(QObjectData)") << int(sizeof(QObjectData)) // Qt5: vptr + 3 ptr + 2 int + ptr
<< 28 << 48; // vptr + 3 ptr + 2 int + ptr // Qt6: vptr + objectlist + 8 unit:1 + uint:24 + int + ptr + bindingstorage + ptr
int size32 = qtVersion >= 0x60000 ? 60 : 28;
int size64 = qtVersion >= 0x60000 ? 80 : 48;
QTest::newRow("sizeof(QObjectData)") << int(sizeof(QObjectData)) << size32 << size64;
if (qtVersion >= 0x50000) if (qtVersion >= 0x50000 && qtTypeVersion < 21)
OFFSET_TEST(QObjectPrivate, extraData) << 28 << 48; // sizeof(QObjectData) OFFSET_TEST(QObjectPrivate, extraData) << size32 << size64; // sizeof(QObjectData)
else else
OFFSET_TEST(QObjectPrivate, extraData) << 32 << 56; // sizeof(QObjectData) + 1 ptr OFFSET_TEST(QObjectPrivate, extraData) << size32 + 4 << size64 + 8; // sizeof(QObjectData) + 1 ptr
#if QT_VERSION < 0x50000 #if QT_VERSION < 0x50000
OFFSET_TEST(QObjectPrivate, objectName) << 28 << 48; // sizeof(QObjectData) OFFSET_TEST(QObjectPrivate, objectName) << 28 << 48; // sizeof(QObjectData)