diff options
Diffstat (limited to 'tests/auto/corelib')
32 files changed, 224 insertions, 68 deletions
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index 8539b76dc3..e9e3ca9bb9 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -774,7 +774,6 @@ void tst_QPropertyAnimation::interpolated() } } -Q_DECLARE_METATYPE(QVariant) void tst_QPropertyAnimation::setStartEndValues_data() { @@ -1125,7 +1124,6 @@ void tst_QPropertyAnimation::restart() void tst_QPropertyAnimation::valueChanged() { - qRegisterMetaType<QVariant>("QVariant"); //we check that we receive the valueChanged signal MyErrorObject o; diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index f999f44670..3b410e1c1c 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -50,9 +50,6 @@ #include "../../../qtest-config.h" -Q_DECLARE_METATYPE(QBitArray) -Q_DECLARE_METATYPE(qint64) - class tst_QDataStream : public QObject { Q_OBJECT diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 8f76945bf5..98c12b01c1 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -56,7 +56,6 @@ # include <windows.h> # endif -Q_DECLARE_METATYPE(QList<QProcess::ExitStatus>); Q_DECLARE_METATYPE(QProcess::ExitStatus); Q_DECLARE_METATYPE(QProcess::ProcessState); #endif diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 0a4378847d..5e3801cd2b 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -61,8 +61,6 @@ private slots: void setLocale(); }; -Q_DECLARE_METATYPE(QLocale) -Q_DECLARE_METATYPE(qlonglong) void tst_QResourceEngine::initTestCase() { diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 40208f6e6d..22a7b61ea5 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -758,7 +758,6 @@ void tst_QSettings::testErrorHandling() #endif // !Q_OS_WIN } -Q_DECLARE_METATYPE(QVariant) Q_DECLARE_METATYPE(QSettings::Status) #ifdef QT_BUILD_INTERNAL @@ -804,7 +803,6 @@ void tst_QSettings::testIniParsing_data() #ifdef QT_BUILD_INTERNAL void tst_QSettings::testIniParsing() { - qRegisterMetaType<QVariant>("QVariant"); qRegisterMetaType<QSettings::Status>("QSettings::Status"); QDir dir(settingsPath()); diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index b9228cb55a..bcbd257de3 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -57,9 +57,6 @@ #include "../../../network-settings.h" -Q_DECLARE_METATYPE(qlonglong) -Q_DECLARE_METATYPE(qulonglong) -Q_DECLARE_METATYPE(QList<int>) QT_BEGIN_NAMESPACE template<> struct QMetaTypeId<QIODevice::OpenModeFlag> diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index bd4ed633cb..30beffe467 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -123,8 +123,6 @@ void tst_QAbstractProxyModel::qabstractproxymodel() model.submit(); } -Q_DECLARE_METATYPE(QVariant) -Q_DECLARE_METATYPE(QModelIndex) void tst_QAbstractProxyModel::data_data() { QTest::addColumn<QModelIndex>("proxyIndex"); diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index a58a0ad945..b906afce23 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -114,10 +114,6 @@ typedef QList<int> IntList; typedef QPair<int, int> IntPair; typedef QList<IntPair> PairList; -Q_DECLARE_METATYPE(PairList) -Q_DECLARE_METATYPE(QModelIndex) -Q_DECLARE_METATYPE(QModelIndexList) -Q_DECLARE_METATYPE(IntList) Q_DECLARE_METATYPE(QItemSelection) class QStreamHelper: public QAbstractItemModel @@ -1683,9 +1679,6 @@ void tst_QItemSelectionModel::removeColumns() typedef QList<IntList> IntListList; typedef QPair<IntPair, IntPair> IntPairPair; typedef QList<IntPairPair> IntPairPairList; -Q_DECLARE_METATYPE(IntListList) -Q_DECLARE_METATYPE(IntPairPair) -Q_DECLARE_METATYPE(IntPairPairList) void tst_QItemSelectionModel::modelLayoutChanged_data() { diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index e3dc0d3e14..576ef7747c 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -54,11 +54,6 @@ typedef QList<int> IntList; typedef QPair<int, int> IntPair; typedef QList<IntPair> IntPairList; -Q_DECLARE_METATYPE(IntList) -Q_DECLARE_METATYPE(IntPair) -Q_DECLARE_METATYPE(IntPairList) -Q_DECLARE_METATYPE(QModelIndex) - class tst_QSortFilterProxyModel : public QObject { Q_OBJECT @@ -179,7 +174,6 @@ tst_QSortFilterProxyModel::tst_QSortFilterProxyModel() void tst_QSortFilterProxyModel::initTestCase() { - qRegisterMetaType<QModelIndex>("QModelIndex"); qRegisterMetaType<IntList>("IntList"); qRegisterMetaType<IntPair>("IntPair"); qRegisterMetaType<IntPairList>("IntPairList"); diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 24649bf587..a095d1eb59 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -572,8 +572,6 @@ void tst_QEventLoop::processEventsExcludeTimers() timerReceiver.gotTimerEvent = -1; } -Q_DECLARE_METATYPE(QThread*) - namespace DeliverInDefinedOrder { enum { NbThread = 3, NbObject = 500, NbEventQueue = 5, NbEvent = 50 }; diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 46a7a5096f..56a323fcd3 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -396,7 +396,6 @@ void tst_QAlgorithms::sortedList() QCOMPARE(list.at(5), 8); } -Q_DECLARE_METATYPE(QList<int>) void tst_QAlgorithms::test_qLowerBound_data() { @@ -615,7 +614,6 @@ void tst_QAlgorithms::stableSortTest() } } -Q_DECLARE_METATYPE(QVector<int>) void tst_QAlgorithms::stableSortCorrectnessTest_data() { diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index 8097ba25c0..d21f847493 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -99,8 +99,6 @@ private slots: void resize(); }; -Q_DECLARE_METATYPE(QBitArray) - void tst_QBitArray::size_data() { //create the testtable instance and define the elements diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 1084b5a7b1..85757643ce 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -245,7 +245,6 @@ QByteArray verifyZeroTermination(const QByteArray &ba) tst_QByteArray::tst_QByteArray() { - qRegisterMetaType<qulonglong>("qulonglong"); } void tst_QByteArray::qCompress_data() @@ -1235,7 +1234,6 @@ void tst_QByteArray::toInt() QCOMPARE( number, expectednumber ); } -Q_DECLARE_METATYPE(qulonglong) void tst_QByteArray::toULong_data() { QTest::addColumn<QByteArray>("str"); diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index 9978a252bf..9cb37bbec7 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -109,7 +109,6 @@ private: QDate invalidDate() const { return QDate(); } }; -Q_DECLARE_METATYPE(QDate) Q_DECLARE_METATYPE(Qt::DateFormat) void tst_QDate::isNull_data() diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 8da5d2808b..7c26d511c6 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -147,9 +147,6 @@ private: QTime invalidTime() const { return QTime(-1, -1, -1); } }; -Q_DECLARE_METATYPE(QDateTime) -Q_DECLARE_METATYPE(QDate) -Q_DECLARE_METATYPE(QTime) Q_DECLARE_METATYPE(Qt::TimeSpec) Q_DECLARE_METATYPE(Qt::DateFormat) diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index 5f9c461c94..fc1c3c5733 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -158,8 +158,6 @@ void tst_QEasingCurve::propertyDefaults() typedef QList<int> IntList; typedef QList<qreal> RealList; -Q_DECLARE_METATYPE(IntList) -Q_DECLARE_METATYPE(RealList) void tst_QEasingCurve::valueForProgress_data() { diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index 822f2304bb..9123082fb5 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -1546,9 +1546,6 @@ void tst_QList::constSharedNullComplex() const QCOMPARE(liveCount, Complex::getLiveCount()); } -Q_DECLARE_METATYPE(QList<int>); -Q_DECLARE_METATYPE(QList<Complex>); - template <class T> void generateSetSharableData() { diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index ea65236d16..62d6c4f462 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -74,8 +74,6 @@ extern "C" DWORD GetThreadLocale(void) { # include <stdlib.h> #endif -Q_DECLARE_METATYPE(qlonglong) -Q_DECLARE_METATYPE(QDate) Q_DECLARE_METATYPE(QLocale::FormatType) class tst_QLocale : public QObject @@ -135,6 +133,8 @@ private slots: void monthName(); void standaloneMonthName(); + void defaultNumeringSystem(); + void ampm(); void currency(); void quoteString(); @@ -957,7 +957,6 @@ void tst_QLocale::formatDate() QCOMPARE(l.toString(date, format), result); } -Q_DECLARE_METATYPE(QTime) void tst_QLocale::formatTime_data() { @@ -1530,6 +1529,10 @@ void tst_QLocale::dayName() QLocale l(locale_name); QCOMPARE(l.dayName(day, format), dayName); + + QLocale ir("ga_IE"); + QCOMPARE(ir.dayName(1, QLocale::ShortFormat), QLatin1String("Luan")); + QCOMPARE(ir.dayName(7, QLocale::ShortFormat), QLatin1String("Domh")); } void tst_QLocale::standaloneDayName_data() @@ -1589,6 +1592,42 @@ a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000 QVERIFY(!ok); } +void tst_QLocale::defaultNumeringSystem() +{ + QLocale sk("sk_SK"); + QCOMPARE(sk.toString(123), QLatin1String("123")); + + QLocale ta("ta_IN"); + QCOMPARE(ta.toString(123), QLatin1String("123")); + + QLocale te("te_IN"); + QCOMPARE(te.toString(123), QLatin1String("123")); + + QLocale hi("hi_IN"); + QCOMPARE(hi.toString(123), QLatin1String("123")); + + QLocale gu("gu_IN"); + QCOMPARE(gu.toString(123), QLatin1String("123")); + + QLocale kn("kn_IN"); + QCOMPARE(kn.toString(123), QLatin1String("123")); + + QLocale pa("pa_IN"); + QCOMPARE(pa.toString(123), QLatin1String("123")); + + QLocale ne("ne_IN"); + QCOMPARE(ne.toString(123), QLatin1String("123")); + + QLocale mr("mr_IN"); + QCOMPARE(mr.toString(123), QLatin1String("123")); + + QLocale ml("ml_IN"); + QCOMPARE(ml.toString(123), QLatin1String("123")); + + QLocale kok("kok_IN"); + QCOMPARE(kok.toString(123), QLatin1String("123")); +} + void tst_QLocale::ampm() { QLocale c(QLocale::C); @@ -1610,6 +1649,10 @@ void tst_QLocale::ampm() QLocale ua("uk_UA"); QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\320\277")); QCOMPARE(ua.pmText(), QString::fromUtf8("\320\277\320\277")); + + QLocale tr("tr_TR"); + QCOMPARE(tr.amText(), QString::fromUtf8("\303\226\303\226")); + QCOMPARE(tr.pmText(), QString::fromUtf8("\303\226\123")); } void tst_QLocale::dateFormat() @@ -1676,6 +1719,10 @@ void tst_QLocale::monthName() // check that our CLDR scripts handle surrogate pairs correctly QLocale dsrt("en-Dsrt-US"); QCOMPARE(dsrt.monthName(1, QLocale::LongFormat), QString::fromUtf8("\xf0\x90\x90\x96\xf0\x90\x90\xb0\xf0\x90\x91\x8c\xf0\x90\x90\xb7\xf0\x90\x90\xad\xf0\x90\x90\xaf\xf0\x90\x91\x89\xf0\x90\x90\xa8")); + + QLocale ir("ga_IE"); + QCOMPARE(ir.monthName(1, QLocale::ShortFormat), QLatin1String("Ean")); + QCOMPARE(ir.monthName(12, QLocale::ShortFormat), QLatin1String("Noll")); } void tst_QLocale::standaloneMonthName() diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp index f832b97f84..a5f2fa73da 100644 --- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp +++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp @@ -45,10 +45,6 @@ #include <limits.h> #include <qdebug.h> -Q_DECLARE_METATYPE(QRectF) -Q_DECLARE_METATYPE(QPointF) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QPoint) class tst_QRect : public QObject { diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 8b91d1c35d..3662d32655 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -71,7 +71,6 @@ struct Match }; Q_DECLARE_METATYPE(Match) -Q_DECLARE_METATYPE(QList<Match>) bool operator==(const QRegularExpressionMatch &rem, const Match &m) { diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp new file mode 100644 index 0000000000..86f2f7a330 --- /dev/null +++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Intel Corporation. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + * This file exists because tst_qsharedpointer.cpp is compiled with + * QT_SHAREDPOINTER_TRACK_POINTERS. That changes some behavior. + * + * Note that most of these tests may yield false-positives in debug mode, but + * they should not yield false negatives. That is, they may report PASS when + * they are failing, but they should not produce FAILs. + * + * The reason for that is because of C++'s One Definition Rule: the macro + * changes some functions and, in debug mode, they will not be inlined. At link + * time, the two functions would be merged. + */ + +#include <qsharedpointer.h> +#include <QtTest> + +#include "nontracked.h" + +// We can't name our classes Data and DerivedData: those are in tst_qsharedpointer.cpp +namespace NonTracked { + +class Data +{ +public: + static int destructorCounter; + static int generationCounter; + int generation; + + Data() : generation(++generationCounter) + { } + + virtual ~Data() + { + if (generation <= 0) + qFatal("tst_qsharedpointer: Double deletion!"); + generation = 0; + ++destructorCounter; + } +}; +int Data::generationCounter = 0; +int Data::destructorCounter = 0; + +class DerivedData: public Data +{ +public: + static int derivedDestructorCounter; + int moreData; + DerivedData() : moreData(0) { } + ~DerivedData() { ++derivedDestructorCounter; } +}; +int DerivedData::derivedDestructorCounter = 0; + + +#ifndef QTEST_NO_RTTI +void dynamicCastFailureNoLeak() +{ + Data::destructorCounter = DerivedData::derivedDestructorCounter = 0; + + // see QTBUG-28924 + QSharedPointer<Data> a(new Data); + QSharedPointer<DerivedData> b = a.dynamicCast<DerivedData>(); + QVERIFY(!a.isNull()); + QVERIFY(b.isNull()); + + a.clear(); + b.clear(); + QVERIFY(a.isNull()); + + // verify that the destructors were called + QCOMPARE(Data::destructorCounter, 1); + QCOMPARE(DerivedData::derivedDestructorCounter, 0); +} + +#endif +} // namespace NonTracked diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.h b/tests/auto/corelib/tools/qsharedpointer/nontracked.h new file mode 100644 index 0000000000..501ec2b73a --- /dev/null +++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Intel Corporation. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NONTRACKED_H +#define NONTRACKED_H + +namespace NonTracked { +void dynamicCastFailureNoLeak(); +} + +#endif // NONTRACKED_H diff --git a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro index 3f7f30f474..2e8e335472 100644 --- a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro @@ -5,9 +5,11 @@ QT = core testlib SOURCES = tst_qsharedpointer.cpp \ forwarddeclared.cpp \ + nontracked.cpp \ wrapper.cpp HEADERS = forwarddeclared.h \ + nontracked.h \ wrapper.h TESTDATA += forwarddeclared.cpp forwarddeclared.h diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 8dfffebacd..086f0b49ca 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -50,6 +50,7 @@ #include "externaltests.h" #include "forwarddeclared.h" +#include "nontracked.h" #include "wrapper.h" #include <stdlib.h> @@ -88,6 +89,7 @@ private slots: void dynamicCastDifferentPointers(); void dynamicCastVirtualBase(); void dynamicCastFailure(); + void dynamicCastFailureNoLeak(); #endif void constCorrectness(); void customDeleter(); @@ -1110,6 +1112,11 @@ void tst_QSharedPointer::dynamicCastFailure() QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1); QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1); } + +void tst_QSharedPointer::dynamicCastFailureNoLeak() +{ + NonTracked::dynamicCastFailureNoLeak(); +} #endif void tst_QSharedPointer::constCorrectness() diff --git a/tests/auto/corelib/tools/qsize/tst_qsize.cpp b/tests/auto/corelib/tools/qsize/tst_qsize.cpp index b44d7d186e..22f2f0330c 100644 --- a/tests/auto/corelib/tools/qsize/tst_qsize.cpp +++ b/tests/auto/corelib/tools/qsize/tst_qsize.cpp @@ -42,7 +42,6 @@ #include <QtTest/QtTest> #include <qsize.h> -Q_DECLARE_METATYPE(QSize) class tst_QSize : public QObject { diff --git a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp index ee9c5a5778..80ef0355b2 100644 --- a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp +++ b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp @@ -42,7 +42,6 @@ #include <QtTest/QtTest> #include <qsize.h> -Q_DECLARE_METATYPE(QSizeF) class tst_QSizeF : public QObject { diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index bc6bc585f2..740581ceec 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -67,7 +67,6 @@ #include <locale.h> #include <qhash.h> -Q_DECLARE_METATYPE(qlonglong) #define CREATE_REF(string) \ const QString padded = QString::fromLatin1(" %1 ").arg(string); \ @@ -316,9 +315,6 @@ QString verifyZeroTermination(const QString &str) typedef QList<int> IntList; -Q_DECLARE_METATYPE(QList<QVariant>) -Q_DECLARE_METATYPE(IntList) - // This next bit is needed for the NAN and INF in string -> number conversion tests #include <float.h> #include <limits.h> diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index df9158da99..c56f12d650 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -46,7 +46,6 @@ #include <qlocale.h> #include <locale.h> -Q_DECLARE_METATYPE(qlonglong) class tst_QStringRef : public QObject { @@ -84,9 +83,6 @@ static QStringRef emptyRef() typedef QList<int> IntList; -Q_DECLARE_METATYPE(QList<QVariant>) -Q_DECLARE_METATYPE(IntList) - // This next bit is needed for the NAN and INF in string -> number conversion tests #include <float.h> #include <limits.h> diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index b126c62c72..9172c4115e 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -78,7 +78,6 @@ private slots: void thaiLineBreak(); }; -Q_DECLARE_METATYPE(QList<int>) QT_BEGIN_NAMESPACE namespace QTest { diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index bfb8b4c42d..46b762bac9 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -80,7 +80,6 @@ private: QTime invalidTime() { return QTime(-1, -1, -1); } }; -Q_DECLARE_METATYPE(QTime) Q_DECLARE_METATYPE(Qt::DateFormat) void tst_QTime::addSecs_data() diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 8e63556bf1..143599c989 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -130,7 +130,6 @@ void tst_QTimeLine::currentTime() { QTimeLine timeLine(2000); timeLine.setUpdateInterval((timeLine.duration()/2) / 33); - qRegisterMetaType<qreal>("qreal"); QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal))); QVERIFY(spy.isValid()); timeLine.setFrameRange(10, 20); @@ -225,7 +224,6 @@ void tst_QTimeLine::value() QVERIFY(timeLine.currentValue() == 0.0); // Default speed - qRegisterMetaType<qreal>("qreal"); QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal))); QVERIFY(spy.isValid()); timeLine.start(); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 0eda837644..ecb9d2e9e2 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -296,7 +296,6 @@ private: template<typename T> void detach() const; }; -Q_DECLARE_METATYPE(QVector<int>); template<typename T> struct SimpleValue { |