diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-03 10:23:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-03 10:23:56 +0200 |
commit | e2f66f921594b7be4af4a058c959557489e86879 (patch) | |
tree | cc44931708b57bd5a761906797c7dee0360d1d6b /tests/auto/corelib/kernel | |
parent | 933bf178aab88ab5df8a68cbf02611d6d8744b1b (diff) | |
parent | 754efa57d89c62d1796e01b407e9222e67450f52 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/corelib/global/qnamespace.qdoc
src/corelib/io/qwindowspipereader.cpp
src/corelib/io/qwindowspipereader_p.h
src/corelib/statemachine/qstatemachine.cpp
src/corelib/statemachine/qstatemachine_p.h
src/plugins/platforms/xcb/qxcbconnection.h
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/tools/qmake/tst_qmake.cpp
tests/manual/touch/main.cpp
Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
Diffstat (limited to 'tests/auto/corelib/kernel')
4 files changed, 56 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index ff4963a960..924db17c04 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -112,6 +112,22 @@ void tst_QCoreApplication::qAppName() // The application name should still be available after destruction; // global statics often rely on this. QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1(appName)); + + // Setting the appname before creating the application should work (QTBUG-45283) + const QString wantedAppName("my app name"); + { + int argc = 1; + char *argv[] = { const_cast<char*>(appName) }; + QCoreApplication::setApplicationName(wantedAppName); + TestApplication app(argc, argv); + QCOMPARE(::qAppName(), QString::fromLatin1(appName)); + QCOMPARE(QCoreApplication::applicationName(), wantedAppName); + } + QCOMPARE(QCoreApplication::applicationName(), wantedAppName); + + // Restore to initial value + QCoreApplication::setApplicationName(QString()); + QCOMPARE(QCoreApplication::applicationName(), QString()); } void tst_QCoreApplication::argc() diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp index 17b00ebf63..5a10cf51e6 100644 --- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp +++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp @@ -91,5 +91,13 @@ void tst_QMetaEnum::valuesToKeys() QCOMPARE(me.valueToKeys(windowFlags), expected); } +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<tst_QMetaEnum::SuperEnum>::Value); +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::WindowFlags>::Value); +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::Orientation>::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<int>::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject>::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject*>::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<void>::Value); + QTEST_MAIN(tst_QMetaEnum) #include "tst_qmetaenum.moc" diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index b3333c6d68..9cdb1f47f8 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -142,8 +142,14 @@ public: class CustomGadget { Q_GADGET }; +class CustomGadget_NonDefaultConstructible { + Q_GADGET +public: + CustomGadget_NonDefaultConstructible(int) {}; +}; class CustomNonQObject {}; +class GadgetDerived : public CustomGadget {}; void tst_QMetaType::defined() { @@ -153,11 +159,12 @@ void tst_QMetaType::defined() QCOMPARE(int(QMetaTypeId2<int*>::Defined), 0); QCOMPARE(int(QMetaTypeId2<CustomQObject::CustomQEnum>::Defined), 1); QCOMPARE(int(QMetaTypeId2<CustomGadget>::Defined), 1); + QVERIFY(!QMetaTypeId2<GadgetDerived>::Defined); QVERIFY(int(QMetaTypeId2<CustomQObject*>::Defined)); QVERIFY(!QMetaTypeId2<CustomQObject>::Defined); QVERIFY(!QMetaTypeId2<CustomNonQObject>::Defined); QVERIFY(!QMetaTypeId2<CustomNonQObject*>::Defined); - QVERIFY(!QMetaTypeId2<CustomGadget*>::Defined); + QVERIFY(!QMetaTypeId2<CustomGadget_NonDefaultConstructible>::Defined); } struct Bar diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 263cc5a07a..3ec84b5198 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -128,6 +128,7 @@ private slots: void connectWithReference(); void connectManyArguments(); void connectForwardDeclare(); + void connectNoDefaultConstructorArg(); void returnValue_data(); void returnValue(); void returnValue2_data(); @@ -5227,6 +5228,29 @@ void tst_QObject::connectForwardDeclare() QVERIFY(connect(&ob, &ForwardDeclareArguments::mySignal, &ob, &ForwardDeclareArguments::mySlot, Qt::QueuedConnection)); } +class NoDefaultConstructor +{ + Q_GADGET +public: + NoDefaultConstructor(int) {} +}; + +class NoDefaultContructorArguments : public QObject +{ + Q_OBJECT +signals: + void mySignal(const NoDefaultConstructor&); +public slots: + void mySlot(const NoDefaultConstructor&) {} +}; + +void tst_QObject::connectNoDefaultConstructorArg() +{ + NoDefaultContructorArguments ob; + // it should compile + QVERIFY(connect(&ob, &NoDefaultContructorArguments::mySignal, &ob, &NoDefaultContructorArguments::mySlot, Qt::QueuedConnection)); +} + class ReturnValue : public QObject { friend class tst_QObject; Q_OBJECT |