From: Jędrzej Nowacki Date: Thu, 8 Mar 2012 14:49:55 +0000 (+0100) Subject: Add new test cases to tst_QMetaType. X-Git-Tag: qt-v5.0.0-alpha1~223 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e497111dbd3e04380bee500364a5ee02065d193;p=profile%2Fivi%2Fqtbase.git Add new test cases to tst_QMetaType. Change-Id: I405ab5df9d9de3a0a0a71276b172a27ee01392e3 Reviewed-by: Stephen Kelly --- diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index a3959f6..d93e00e 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -629,18 +629,26 @@ FOR_EACH_CORE_METATYPE(RETURN_CREATE_COPY_FUNCTION) void tst_QMetaType::sizeOf_data() { QTest::addColumn("type"); - QTest::addColumn("size"); + QTest::addColumn("size"); #define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ - QTest::newRow(#RealType) << QMetaType::MetaTypeName << int(QTypeInfo::sizeOf); + QTest::newRow(#RealType) << QMetaType::MetaTypeName << size_t(QTypeInfo::sizeOf); FOR_EACH_CORE_METATYPE(ADD_METATYPE_TEST_ROW) #undef ADD_METATYPE_TEST_ROW + + QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << sizeof(Whity); +QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << sizeof(Whity); + QTest::newRow("Testspace::Foo") << static_cast(::qMetaTypeId()) << sizeof(TestSpace::Foo); + + QTest::newRow("-1") << QMetaType::Type(-1) << size_t(0); + QTest::newRow("-124125534") << QMetaType::Type(-124125534) << size_t(0); + QTest::newRow("124125534") << QMetaType::Type(124125534) << size_t(0); } void tst_QMetaType::sizeOf() { QFETCH(QMetaType::Type, type); - QFETCH(int, size); - QCOMPARE(QMetaType::sizeOf(type), size); + QFETCH(size_t, size); + QCOMPARE(size_t(QMetaType::sizeOf(type)), size); } void tst_QMetaType::sizeOfStaticLess_data() @@ -651,8 +659,8 @@ void tst_QMetaType::sizeOfStaticLess_data() void tst_QMetaType::sizeOfStaticLess() { QFETCH(QMetaType::Type, type); - QFETCH(int, size); - QCOMPARE(QMetaType(type).sizeOf(), size); + QFETCH(size_t, size); + QCOMPARE(size_t(QMetaType(type).sizeOf()), size); } struct CustomMovable {};