diff options
Diffstat (limited to 'tests/auto/corelib/kernel')
11 files changed, 57 insertions, 11 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/Info.plist b/tests/auto/corelib/kernel/qcoreapplication/Info.plist new file mode 100644 index 0000000000..a2927358bc --- /dev/null +++ b/tests/auto/corelib/kernel/qcoreapplication/Info.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleVersion</key> + <string>1.2.3</string> +</dict> +</plist> diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro index d166351490..e37542be65 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro +++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro @@ -3,4 +3,7 @@ TARGET = tst_qcoreapplication QT = core testlib core-private SOURCES = tst_qcoreapplication.cpp HEADERS = tst_qcoreapplication.h +win32: VERSION = 1.2.3.4 +else: VERSION = 1.2.3 +darwin: QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,$$shell_quote($$PWD/Info.plist) requires(qtConfig(private_tests)) diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 0feffe0e96..31e76c4407 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -153,6 +153,41 @@ void tst_QCoreApplication::qAppName() QCOMPARE(QCoreApplication::applicationName(), QString()); } +void tst_QCoreApplication::qAppVersion() +{ +#if defined(Q_OS_WIN) + const char appVersion[] = "1.2.3.4"; +#elif defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) + const char appVersion[] = "1.2.3"; +#else + const char appVersion[] = ""; +#endif + + { + int argc = 0; + char *argv[] = { nullptr }; + TestApplication app(argc, argv); + QCOMPARE(QCoreApplication::applicationVersion(), QString::fromLatin1(appVersion)); + } + // The application version should still be available after destruction + QCOMPARE(QCoreApplication::applicationVersion(), QString::fromLatin1(appVersion)); + + // Setting the appversion before creating the application should work + const QString wantedAppVersion("0.0.1"); + { + int argc = 0; + char *argv[] = { nullptr }; + QCoreApplication::setApplicationVersion(wantedAppVersion); + TestApplication app(argc, argv); + QCOMPARE(QCoreApplication::applicationVersion(), wantedAppVersion); + } + QCOMPARE(QCoreApplication::applicationVersion(), wantedAppVersion); + + // Restore to initial value + QCoreApplication::setApplicationVersion(QString()); + QCOMPARE(QCoreApplication::applicationVersion(), QString()); +} + void tst_QCoreApplication::argc() { #if defined(Q_OS_WINRT) diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index 381ff5d497..b6c20a915f 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -39,6 +39,7 @@ private slots: void sendEventsOnProcessEvents(); // this must be the first test void getSetCheck(); void qAppName(); + void qAppVersion(); void argc(); void postEvent(); void removePostedEvents(); diff --git a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro index a42cd60236..9dfa29b0fc 100644 --- a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro +++ b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qmetamethod QT = core testlib SOURCES = tst_qmetamethod.cpp -mac:CONFIG -= app_bundle diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro index f3153b3fd4..4da90c1096 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qmetaobjectbuilder QT = core-private testlib SOURCES = tst_qmetaobjectbuilder.cpp -mac:CONFIG -= app_bundle diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 7d9f56ef38..f693d14029 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -377,6 +377,8 @@ void tst_QMetaType::typeName_data() QT_FOR_EACH_STATIC_TYPE(TYPENAME_DATA) QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << static_cast<const char*>(0); + QTest::newRow("QMetaType::User-1") << (int(QMetaType::User) - 1) << static_cast<const char *>(nullptr); + QTest::newRow("QMetaType::FirstWidgetsType-1") << (int(QMetaType::FirstWidgetsType) - 1) << static_cast<const char *>(nullptr); QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << QString::fromLatin1("Whity<double>"); QTest::newRow("Whity<int>") << ::qMetaTypeId<Whity<int> >() << QString::fromLatin1("Whity<int>"); @@ -404,10 +406,12 @@ void tst_QMetaType::typeName() QFETCH(int, aType); QFETCH(QString, aTypeName); - QString name = QString::fromLatin1(QMetaType::typeName(aType)); + const char *rawname = QMetaType::typeName(aType); + QString name = QString::fromLatin1(rawname); QCOMPARE(name, aTypeName); QCOMPARE(name.toLatin1(), QMetaObject::normalizedType(name.toLatin1().constData())); + QCOMPARE(rawname == nullptr, aTypeName.isNull()); } void tst_QMetaType::type_data() @@ -731,7 +735,7 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW) QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false << false; QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false << false; QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false << false; - QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << true << true << false << true; + QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << true << false << false << true; // invalid ids. QTest::newRow("-1") << -1 << false << false << false << false; diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 50f0061905..e4677c6e34 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -3403,14 +3403,12 @@ void tst_QObject::dumpObjectInfo() QObject a, b; QObject::connect(&a, SIGNAL(destroyed(QObject*)), &b, SLOT(deleteLater())); a.disconnect(&b); -#ifdef QT_DEBUG QTest::ignoreMessage(QtDebugMsg, "OBJECT QObject::unnamed"); QTest::ignoreMessage(QtDebugMsg, " SIGNALS OUT"); QTest::ignoreMessage(QtDebugMsg, " signal: destroyed(QObject*)"); QTest::ignoreMessage(QtDebugMsg, " <Disconnected receiver>"); QTest::ignoreMessage(QtDebugMsg, " SIGNALS IN"); QTest::ignoreMessage(QtDebugMsg, " <None>"); -#endif a.dumpObjectInfo(); // should not crash } diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro index fabd2cf7a3..61124c27ee 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro @@ -2,7 +2,6 @@ CONFIG += testcase QT = core-private testlib -mac:CONFIG -= app_bundle linux:LIBS += -lrt SOURCES += tst_qsharedmemory.cpp diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro index a0f63741d3..f60207eb01 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro @@ -2,7 +2,6 @@ CONFIG += testcase QT = core testlib win32: CONFIG += console -mac:CONFIG -= app_bundle SOURCES += tst_qsystemsemaphore.cpp TARGET = tst_qsystemsemaphore diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 442f7e80d1..6cb23023c7 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -80,7 +80,7 @@ public: enum MetaEnumTest_Enum1 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_ENUM(MetaEnumTest_Enum1) - enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5 }; + enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 }; Q_ENUM(MetaEnumTest_Enum3) enum MetaEnumTest_Enum4 ENUM_SIZE(quint64) { MetaEnumTest_Enum4_value = 47, MetaEnumTest_Enum4_bigValue = (Q_INT64_C(1) << 52) + 45 }; Q_ENUM(MetaEnumTest_Enum4) @@ -4682,7 +4682,7 @@ template<typename Enum> void testVariant(Enum value, bool *ok) QVERIFY(var2.convert(QMetaType::Int)); QCOMPARE(var2.value<int>(), static_cast<int>(value)); - if (static_cast<qint64>(value) <= INT_MAX) { + if ((static_cast<qint64>(value) <= INT_MAX) && (static_cast<qint64>(value) >= INT_MIN)) { int intValue = static_cast<int>(value); QVariant intVar = intValue; QVERIFY(intVar.canConvert<Enum>()); @@ -4743,7 +4743,7 @@ template<typename Enum> void testVariantMeta(Enum value, bool *ok, const char *s QVariant strVar = QString::fromLatin1(string); QVERIFY(strVar.canConvert<Enum>()); - if (value > INT_MAX) { + if ((static_cast<qint64>(value) > INT_MAX) || (static_cast<qint64>(value) < INT_MIN)) { QEXPECT_FAIL("", "QMetaEnum api uses 'int' as return type QTBUG-27451", Abort); *ok = true; } @@ -4765,6 +4765,7 @@ void tst_QVariant::metaEnums() METAENUMS_TEST(MetaEnumTest_Enum1_bigValue); METAENUMS_TEST(MetaEnumTest_Enum3_value); METAENUMS_TEST(MetaEnumTest_Enum3_bigValue); + METAENUMS_TEST(MetaEnumTest_Enum3_bigNegValue); METAENUMS_TEST(MetaEnumTest_Enum4_value); METAENUMS_TEST(MetaEnumTest_Enum4_bigValue); METAENUMS_TEST(MetaEnumTest_Enum5_value); |