summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
commit9cacde74f7de702689725882633073e60c0a2baa (patch)
tree330d22dadbd28b14a7d8896823d1c33597e9993e /tests/auto/qsharedpointer
parent006c8e22075112eff6230d8168d716e44a9e29d5 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
downloadQt-9cacde74f7de702689725882633073e60c0a2baa.zip
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.gz
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Conflicts: doc/src/examples/wheel.qdoc src/gui/util/qflickgesture.cpp src/gui/util/qflickgesture_p.h src/gui/util/qscroller.cpp src/gui/util/qscroller.h src/gui/util/qscroller_p.h src/gui/util/qscrollerproperties.cpp src/gui/util/qscrollerproperties.h tests/auto/qscroller/tst_qscroller.cpp
Diffstat (limited to 'tests/auto/qsharedpointer')
-rw-r--r--tests/auto/qsharedpointer/externaltests.cpp14
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp25
2 files changed, 23 insertions, 16 deletions
diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp
index 013fdf2..d551be3 100644
--- a/tests/auto/qsharedpointer/externaltests.cpp
+++ b/tests/auto/qsharedpointer/externaltests.cpp
@@ -50,6 +50,7 @@
#include <QtCore/QDir>
#include <QtCore/QDirIterator>
#include <QtCore/QDateTime>
+#include <QtCore/QDebug>
#ifdef Q_OS_SYMBIAN
#define DEFAULT_MAKESPEC "X:/STLsupport/mkspecs/symbian-abld/"
@@ -342,7 +343,8 @@ namespace QTest {
void QExternalTestPrivate::removeTemporaryDirectory()
{
- Q_ASSERT(!temporaryDir.isEmpty());
+ if (temporaryDir.isEmpty())
+ qWarning() << "Temporary directory is expected to be non-empty";
removeRecursive(temporaryDir);
temporaryDir.clear();
}
@@ -487,7 +489,8 @@ namespace QTest {
bool QExternalTestPrivate::createProjectFile()
{
- Q_ASSERT(!temporaryDir.isEmpty());
+ if (temporaryDir.isEmpty())
+ qWarning() << "Temporary directory is expected to be non-empty";
QFile projectFile(temporaryDir + QLatin1String("/project.pro"));
if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
@@ -599,7 +602,9 @@ namespace QTest {
bool QExternalTestPrivate::runQmake()
{
- Q_ASSERT(!temporaryDir.isEmpty());
+ if (temporaryDir.isEmpty())
+ qWarning() << "Temporary directory is expected to be non-empty";
+
if (!createProjectFile())
return false;
@@ -633,7 +638,8 @@ namespace QTest {
bool QExternalTestPrivate::runMake(Target target)
{
- Q_ASSERT(!temporaryDir.isEmpty());
+ if (temporaryDir.isEmpty())
+ qWarning() << "Temporary directory is expected to be non-empty";
QExternalProcess make;
make.setWorkingDirectory(temporaryDir);
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 8fba1db..27d2d4d 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -139,7 +139,8 @@ public:
virtual ~Data()
{
- Q_ASSERT_X(generation > 0, "tst_QSharedPointer", "Double deletion!");
+ if (generation <= 0)
+ qFatal("tst_qsharedpointer: Double deletion!");
generation = 0;
++destructorCounter;
}
@@ -283,8 +284,8 @@ void tst_QSharedPointer::operators()
QSharedPointer<char> p1;
QSharedPointer<char> p2(new char);
qptrdiff diff = p2.data() - p1.data();
- Q_ASSERT(p1.data() != p2.data());
- Q_ASSERT(diff != 0);
+ QVERIFY(p1.data() != p2.data());
+ QVERIFY(diff != 0);
// operator-
QCOMPARE(p2 - p1.data(), diff);
@@ -867,8 +868,8 @@ void tst_QSharedPointer::differentPointers()
{
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
Data *aBase = aData;
- Q_ASSERT(aData == aBase);
- Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
+ QVERIFY(aData == aBase);
+ QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
QSharedPointer<Data> baseptr = QSharedPointer<Data>(aData);
QSharedPointer<DiffPtrDerivedData> ptr = qSharedPointerCast<DiffPtrDerivedData>(baseptr);
@@ -885,8 +886,8 @@ void tst_QSharedPointer::differentPointers()
{
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
Data *aBase = aData;
- Q_ASSERT(aData == aBase);
- Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
+ QVERIFY(aData == aBase);
+ QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
QSharedPointer<DiffPtrDerivedData> ptr = QSharedPointer<DiffPtrDerivedData>(aData);
QSharedPointer<Data> baseptr = ptr;
@@ -908,8 +909,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
{
VirtualDerived *aData = new VirtualDerived;
Data *aBase = aData;
- Q_ASSERT(aData == aBase);
- Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
+ QVERIFY(aData == aBase);
+ QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr);
@@ -928,8 +929,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
{
VirtualDerived *aData = new VirtualDerived;
Data *aBase = aData;
- Q_ASSERT(aData == aBase);
- Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
+ QVERIFY(aData == aBase);
+ QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
QSharedPointer<Data> baseptr = ptr;
@@ -1605,7 +1606,7 @@ void hashAndMapTest()
QVERIFY(it != c.find(Key()));
if (Ordered) {
- Q_ASSERT(k0 < k1);
+ QVERIFY(k0 < k1);
it = c.begin();
QCOMPARE(it.key(), k0);