Commit a9a3f0e3 authored by hjk's avatar hjk
Browse files

Debugger: Add offset test for QDateTime



Change-Id: I08d4023eee9c3af02e448f8bed41dba61d8b0989
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent e08f5044
......@@ -6,7 +6,5 @@ SUBDIRS += dumpers.pro
SUBDIRS += namedemangler.pro
SUBDIRS += simplifytypes.pro
SUBDIRS += disassembler.pro
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 1) | lessThan(QT_MAJOR_VERSION, 5) {
SUBDIRS += offsets.pro
}
SUBDIRS += offsets.pro
QTC_LIB_DEPENDS += utils
QT -= gui widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += core_private
include(../qttest.pri)
include(../../../src/private_headers.pri)
greaterThan(QT_MAJOR_VERSION, 4) {
greaterThan(QT_MINOR_VERSION, 1): QT += core_private
else: QT += core-private
}
SOURCES += tst_offsets.cpp
......@@ -33,6 +33,7 @@
#define protected public
#define private public
#include <private/qdatetime_p.h>
#include <private/qfile_p.h>
#include <private/qfileinfo_p.h>
#include <private/qobject_p.h>
......@@ -117,6 +118,41 @@ void tst_offsets::offsets_data()
data << 28 << 48; // sizeof(QObjectData)
}
#endif
{
QDateTimePrivate *p = 0;
#if QT_VERSION < 0x50000
QTest::newRow("QDateTimePrivate::date")
<< int((char *)&p->date - (char *)p) << 4 << 4;
QTest::newRow("QDateTimePrivate::time")
<< int((char *)&p->time - (char *)p) << 8 << 8;
QTest::newRow("QDateTimePrivate::spec")
<< int((char *)&p->spec - (char *)p) << 12 << 12;
QTest::newRow("QDateTimePrivate::utcOffset")
<< int((char *)&p->utcOffset - (char *)p) << 16 << 16;
#elif QT_VERSION < 0x50200
QTest::newRow("QDateTimePrivate::date")
<< int((char *)&p->date - (char *)p) << 4 << 8;
QTest::newRow("QDateTimePrivate::time")
<< int((char *)&p->time - (char *)p) << 12 << 16;
QTest::newRow("QDateTimePrivate::spec")
<< int((char *)&p->spec - (char *)p) << 16 << 20;
QTest::newRow("QDateTimePrivate::utcOffset")
<< int((char *)&p->utcOffset - (char *)p) << 20 << 24;
#else
QTest::newRow("QDateTimePrivate::m_msecs")
<< int((char *)&p->m_msecs - (char *)p) << 4 << 8;
QTest::newRow("QDateTimePrivate::m_spec")
<< int((char *)&p->m_spec - (char *)p) << 12 << 16;
QTest::newRow("QDateTimePrivate::m_offsetFromUtc")
<< int((char *)&p->m_offsetFromUtc - (char *)p) << 16 << 20;
QTest::newRow("QDateTimePrivate::m_timeZone")
<< int((char *)&p->m_timeZone - (char *)p) << 20 << 24;
QTest::newRow("QDateTimePrivate::m_status")
<< int((char *)&p->m_status - (char *)p) << 24 << 32;
#endif
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment