summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:44:47 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:57:56 +1000
commit6e50394c4eac9b3e91f6df7e944181cf7f54b0fe (patch)
tree5d59d83c15f75dacad3036065603e0dd0a8e7727
parentb8af05d3e2e7914c4edac5ae1e61f55ab76100bc (diff)
Reduce usage of Q_ASSERT in autotests.
Using Q_ASSERT does nothing in release-mode builds, and in debug builds it causes tests to terminate prematurely. It is much better to use QVERIFY or QCOMPARE. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 3475168550c1a804f04f2a4edfeb30c04cd36551) Change-Id: Ic39972b685ca35a9a71d9c8d03e8dae31481fb19
-rw-r--r--tests/auto/modeltest/modeltest.cpp139
-rw-r--r--tests/auto/qbuffer/tst_qbuffer.cpp3
-rw-r--r--tests/auto/qchar/tst_qchar.cpp4
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp2
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp2
-rw-r--r--tests/auto/qdbusthreading/tst_qdbusthreading.cpp2
-rw-r--r--tests/auto/qdirmodel/tst_qdirmodel.cpp6
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/auto/qinputdialog/tst_qinputdialog.cpp18
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp4
-rw-r--r--tests/auto/qmessagebox/tst_qmessagebox.cpp49
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp4
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp2
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp22
-rw-r--r--tests/auto/qsplitter/tst_qsplitter.cpp6
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp4
-rw-r--r--tests/auto/qstring/tst_qstring.cpp30
-rw-r--r--tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp18
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp8
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp3
22 files changed, 160 insertions, 172 deletions
diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp
index 0329c3ef9c..ec1091abfa 100644
--- a/tests/auto/modeltest/modeltest.cpp
+++ b/tests/auto/modeltest/modeltest.cpp
@@ -45,8 +45,6 @@
#include "modeltest.h"
#include <QtTest/QtTest>
-#undef Q_ASSERT
-#define Q_ASSERT QVERIFY
Q_DECLARE_METATYPE ( QModelIndex )
@@ -119,15 +117,15 @@ void ModelTest::runAllTests()
*/
void ModelTest::nonDestructiveBasicTest()
{
- Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() );
+ QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() );
model->canFetchMore ( QModelIndex() );
- Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 );
- Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() );
+ QVERIFY( model->columnCount ( QModelIndex() ) >= 0 );
+ QVERIFY( model->data ( QModelIndex() ) == QVariant() );
fetchingMore = true;
model->fetchMore ( QModelIndex() );
fetchingMore = false;
Qt::ItemFlags flags = model->flags ( QModelIndex() );
- Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 );
+ QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 );
model->hasChildren ( QModelIndex() );
model->hasIndex ( 0, 0 );
model->headerData ( 0, Qt::Horizontal );
@@ -136,8 +134,8 @@ void ModelTest::nonDestructiveBasicTest()
QVariant cache;
model->match ( QModelIndex(), -1, cache );
model->mimeTypes();
- Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
- Q_ASSERT ( model->rowCount() >= 0 );
+ QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
+ QVERIFY( model->rowCount() >= 0 );
QVariant variant;
model->setData ( QModelIndex(), variant, -1 );
model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
@@ -159,17 +157,17 @@ void ModelTest::rowCount()
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
int rows = model->rowCount ( topIndex );
- Q_ASSERT ( rows >= 0 );
+ QVERIFY( rows >= 0 );
if ( rows > 0 )
- Q_ASSERT ( model->hasChildren ( topIndex ) == true );
+ QVERIFY( model->hasChildren ( topIndex ) );
QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
if ( secondLevelIndex.isValid() ) { // not the top level
// check a row count where parent is valid
rows = model->rowCount ( secondLevelIndex );
- Q_ASSERT ( rows >= 0 );
+ QVERIFY( rows >= 0 );
if ( rows > 0 )
- Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true );
+ QVERIFY( model->hasChildren ( secondLevelIndex ) );
}
// The models rowCount() is tested more extensively in checkChildren(),
@@ -183,12 +181,12 @@ void ModelTest::columnCount()
{
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- Q_ASSERT ( model->columnCount ( topIndex ) >= 0 );
+ QVERIFY( model->columnCount ( topIndex ) >= 0 );
// check a column count where parent is valid
QModelIndex childIndex = model->index ( 0, 0, topIndex );
if ( childIndex.isValid() )
- Q_ASSERT ( model->columnCount ( childIndex ) >= 0 );
+ QVERIFY( model->columnCount ( childIndex ) >= 0 );
// columnCount() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@@ -201,19 +199,19 @@ void ModelTest::hasIndex()
{
// qDebug() << "hi";
// Make sure that invalid values returns an invalid index
- Q_ASSERT ( model->hasIndex ( -2, -2 ) == false );
- Q_ASSERT ( model->hasIndex ( -2, 0 ) == false );
- Q_ASSERT ( model->hasIndex ( 0, -2 ) == false );
+ QVERIFY( !model->hasIndex ( -2, -2 ) );
+ QVERIFY( !model->hasIndex ( -2, 0 ) );
+ QVERIFY( !model->hasIndex ( 0, -2 ) );
int rows = model->rowCount();
int columns = model->columnCount();
// check out of bounds
- Q_ASSERT ( model->hasIndex ( rows, columns ) == false );
- Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false );
+ QVERIFY( !model->hasIndex ( rows, columns ) );
+ QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) );
if ( rows > 0 )
- Q_ASSERT ( model->hasIndex ( 0, 0 ) == true );
+ QVERIFY( model->hasIndex ( 0, 0 ) );
// hasIndex() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@@ -226,9 +224,9 @@ void ModelTest::index()
{
// qDebug() << "i";
// Make sure that invalid values returns an invalid index
- Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() );
- Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() );
- Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() );
+ QVERIFY( model->index ( -2, -2 ) == QModelIndex() );
+ QVERIFY( model->index ( -2, 0 ) == QModelIndex() );
+ QVERIFY( model->index ( 0, -2 ) == QModelIndex() );
int rows = model->rowCount();
int columns = model->columnCount();
@@ -237,13 +235,13 @@ void ModelTest::index()
return;
// Catch off by one errors
- Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() );
- Q_ASSERT ( model->index ( 0, 0 ).isValid() == true );
+ QVERIFY( model->index ( rows, columns ) == QModelIndex() );
+ QVERIFY( model->index ( 0, 0 ).isValid() );
// Make sure that the same index is *always* returned
QModelIndex a = model->index ( 0, 0 );
QModelIndex b = model->index ( 0, 0 );
- Q_ASSERT ( a == b );
+ QVERIFY( a == b );
// index() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@@ -257,7 +255,7 @@ void ModelTest::parent()
// qDebug() << "p";
// Make sure the model wont crash and will return an invalid QModelIndex
// when asked for the parent of an invalid index.
- Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
+ QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
if ( model->rowCount() == 0 )
return;
@@ -270,13 +268,13 @@ void ModelTest::parent()
// Common error test #1, make sure that a top level index has a parent
// that is a invalid QModelIndex.
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- Q_ASSERT ( model->parent ( topIndex ) == QModelIndex() );
+ QVERIFY( model->parent ( topIndex ) == QModelIndex() );
// Common error test #2, make sure that a second level index has a parent
// that is the first level index.
if ( model->rowCount ( topIndex ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
- Q_ASSERT ( model->parent ( childIndex ) == topIndex );
+ QVERIFY( model->parent ( childIndex ) == topIndex );
}
// Common error test #3, the second column should NOT have the same children
@@ -286,7 +284,7 @@ void ModelTest::parent()
if ( model->rowCount ( topIndex1 ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
- Q_ASSERT ( childIndex != childIndex1 );
+ QVERIFY( childIndex != childIndex1 );
}
// Full test, walk n levels deep through the model making sure that all
@@ -326,47 +324,47 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
int columns = model->columnCount ( parent );
if ( rows > 0 )
- Q_ASSERT ( model->hasChildren ( parent ) );
+ QVERIFY( model->hasChildren ( parent ) );
// Some further testing against rows(), columns(), and hasChildren()
- Q_ASSERT ( rows >= 0 );
- Q_ASSERT ( columns >= 0 );
+ QVERIFY( rows >= 0 );
+ QVERIFY( columns >= 0 );
if ( rows > 0 )
- Q_ASSERT ( model->hasChildren ( parent ) == true );
+ QVERIFY( model->hasChildren ( parent ) );
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
- Q_ASSERT ( model->hasIndex ( rows + 1, 0, parent ) == false );
+ QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) );
for ( int r = 0; r < rows; ++r ) {
if ( model->canFetchMore ( parent ) ) {
fetchingMore = true;
model->fetchMore ( parent );
fetchingMore = false;
}
- Q_ASSERT ( model->hasIndex ( r, columns + 1, parent ) == false );
+ QVERIFY( !model->hasIndex ( r, columns + 1, parent ) );
for ( int c = 0; c < columns; ++c ) {
- Q_ASSERT ( model->hasIndex ( r, c, parent ) == true );
+ QVERIFY( model->hasIndex ( r, c, parent ) );
QModelIndex index = model->index ( r, c, parent );
// rowCount() and columnCount() said that it existed...
- Q_ASSERT ( index.isValid() == true );
+ QVERIFY( index.isValid() );
// index() should always return the same index when called twice in a row
QModelIndex modifiedIndex = model->index ( r, c, parent );
- Q_ASSERT ( index == modifiedIndex );
+ QVERIFY( index == modifiedIndex );
// Make sure we get the same index if we request it twice in a row
QModelIndex a = model->index ( r, c, parent );
QModelIndex b = model->index ( r, c, parent );
- Q_ASSERT ( a == b );
+ QVERIFY( a == b );
// Some basic checking on the index that is returned
- Q_ASSERT ( index.model() == model );
- Q_ASSERT ( index.row() == r );
- Q_ASSERT ( index.column() == c );
+ QVERIFY( index.model() == model );
+ QCOMPARE( index.row(), r );
+ QCOMPARE( index.column(), c );
// While you can technically return a QVariant usually this is a sign
- // of an bug in data() Disable if this really is ok in your model.
-// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true );
+ // of a bug in data(). Disable if this really is ok in your model.
+// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
// If the next test fails here is some somewhat useful debug you play with.
@@ -381,8 +379,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
}
// Check that we can get back our real parent.
-// qDebug() << model->parent ( index ) << parent ;
- Q_ASSERT ( model->parent ( index ) == parent );
+ QCOMPARE( model->parent ( index ), parent );
// recursively go down the children
if ( model->hasChildren ( index ) && currentDepth < 10 ) {
@@ -392,7 +389,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
// make sure that after testing the children that the index doesn't change.
QModelIndex newerIndex = model->index ( r, c, parent );
- Q_ASSERT ( index == newerIndex );
+ QVERIFY( index == newerIndex );
}
}
}
@@ -403,68 +400,68 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
void ModelTest::data()
{
// Invalid index should return an invalid qvariant
- Q_ASSERT ( !model->data ( QModelIndex() ).isValid() );
+ QVERIFY( !model->data ( QModelIndex() ).isValid() );
if ( model->rowCount() == 0 )
return;
// A valid index should have a valid QVariant data
- Q_ASSERT ( model->index ( 0, 0 ).isValid() );
+ QVERIFY( model->index ( 0, 0 ).isValid() );
// shouldn't be able to set data on an invalid index
- Q_ASSERT ( model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) == false );
+ QVERIFY( !model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) );
// General Purpose roles that should return a QString
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
if ( variant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
+ QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
if ( variant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
+ QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
if ( variant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
+ QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
// General Purpose roles that should return a QSize
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
if ( variant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QSize> ( variant ) );
+ QVERIFY( qVariantCanConvert<QSize> ( variant ) );
}
// General Purpose roles that should return a QFont
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
if ( fontVariant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QFont> ( fontVariant ) );
+ QVERIFY( qVariantCanConvert<QFont> ( fontVariant ) );
}
// Check that the alignment is one we know about
QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
if ( textAlignmentVariant.isValid() ) {
int alignment = textAlignmentVariant.toInt();
- Q_ASSERT ( alignment == ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
+ QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
}
// General Purpose roles that should return a QColor
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
if ( colorVariant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
+ QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
}
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
if ( colorVariant.isValid() ) {
- Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
+ QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
}
// Check that the "check state" is one we know about.
QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
if ( checkStateVariant.isValid() ) {
int state = checkStateVariant.toInt();
- Q_ASSERT ( state == Qt::Unchecked ||
- state == Qt::PartiallyChecked ||
- state == Qt::Checked );
+ QVERIFY( state == Qt::Unchecked ||
+ state == Qt::PartiallyChecked ||
+ state == Qt::Checked );
}
}
@@ -495,7 +492,7 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
{
Changing c = insert.pop();
- Q_ASSERT ( c.parent == parent );
+ QVERIFY( c.parent == parent );
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
@@ -505,8 +502,8 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
// }
// qDebug();
- Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
- Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
+ QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
+ QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
qDebug() << start << end;
@@ -515,7 +512,7 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
}
- Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
+ QVERIFY( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
}
void ModelTest::layoutAboutToBeChanged()
@@ -528,7 +525,7 @@ void ModelTest::layoutChanged()
{
for ( int i = 0; i < changing.count(); ++i ) {
QPersistentModelIndex p = changing[i];
- Q_ASSERT ( p == model->index ( p.row(), p.column(), p.parent() ) );
+ QVERIFY( p == model->index ( p.row(), p.column(), p.parent() ) );
}
changing.clear();
}
@@ -558,10 +555,10 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
{
qDebug() << "rr" << parent << start << end;
Changing c = remove.pop();
- Q_ASSERT ( c.parent == parent );
- Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
- Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
- Q_ASSERT ( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
+ QVERIFY( c.parent == parent );
+ QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
+ QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
+ QVERIFY( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
}
diff --git a/tests/auto/qbuffer/tst_qbuffer.cpp b/tests/auto/qbuffer/tst_qbuffer.cpp
index 3e3cc739bf..5d6b84f827 100644
--- a/tests/auto/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/qbuffer/tst_qbuffer.cpp
@@ -309,8 +309,7 @@ void tst_QBuffer::seekTest()
// (see Task 184730)
{
char c;
- const int offset = 1;
- Q_ASSERT(offset > 0); // any positive integer will do
+ const int offset = 1; // any positive integer will do
const qint64 pos = buf.size() + offset;
QVERIFY(buf.seek(pos));
QCOMPARE(buf.pos(), pos);
diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp
index 45dd7ebed1..911a30cc77 100644
--- a/tests/auto/qchar/tst_qchar.cpp
+++ b/tests/auto/qchar/tst_qchar.cpp
@@ -548,14 +548,14 @@ void tst_QChar::normalization_data()
QList<QByteArray> l = line.split(';');
- Q_ASSERT(l.size() == 5);
+ QCOMPARE(l.size(), 5);
QStringList columns;
for (int i = 0; i < 5; ++i) {
columns.append(QString());
QList<QByteArray> c = l.at(i).split(' ');
- Q_ASSERT(!c.isEmpty());
+ QVERIFY(!c.isEmpty());
for (int j = 0; j < c.size(); ++j) {
bool ok;
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index 1a052d59b7..b0d40d0d22 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -1250,9 +1250,7 @@ public:
void tst_QCompleter::task189564_omitNonSelectableItems()
{
const QString prefix("a");
- Q_ASSERT(!prefix.isEmpty());
const int n = 5;
- Q_ASSERT(n > 0);
QStringList strings;
for (int i = 0; i < n; ++i)
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
index 07158d181c..f5dbea49d3 100644
--- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -2746,7 +2746,7 @@ void tst_QDateTimeEdit::setCurrentSection()
QFETCH(QList<int>, setCurrentSections);
QFETCH(QList<int>, expectedCursorPositions);
- Q_ASSERT(setCurrentSections.size() == expectedCursorPositions.size());
+ QCOMPARE(setCurrentSections.size(), expectedCursorPositions.size());
testWidget->setDisplayFormat(format);
testWidget->setDateTime(dateTime);
#ifdef Q_WS_MAC
diff --git a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp
index bfb806b33a..142b6c22be 100644
--- a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp
+++ b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp
@@ -592,7 +592,7 @@ void tst_QDBusThreading::callbackInAnotherAuxThread()
// wait for the event loop
sem1.release();
sem2.acquire();
- Q_ASSERT(loop);
+ QVERIFY(loop);
// create the second thread
new Thread;
diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp
index 38a6b8acdb..a6985a49ff 100644
--- a/tests/auto/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp
@@ -641,10 +641,10 @@ void tst_QDirModel::filter()
QDirModel model;
model.setNameFilters(QStringList() << "*.nada");
QModelIndex index = model.index(SRCDIR "test");
- Q_ASSERT(model.rowCount(index) == 0);
+ QCOMPARE(model.rowCount(index), 0);
QModelIndex index2 = model.index(SRCDIR "test/file01.tst");
- Q_ASSERT(!index2.isValid());
- Q_ASSERT(model.rowCount(index) == 0);
+ QVERIFY(!index2.isValid());
+ QCOMPARE(model.rowCount(index), 0);
}
void tst_QDirModel::task244669_remove()
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 5e9f1306c4..dc3ca5285d 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -812,7 +812,7 @@ void tst_QFileDialog2::task239706_editableFilterCombo()
break;
}
}
- Q_ASSERT(filterCombo);
+ QVERIFY(filterCombo);
filterCombo->setEditable(true);
QTest::mouseClick(filterCombo, Qt::LeftButton);
QTest::keyPress(filterCombo, Qt::Key_X);
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 73e5656b15..f8bf7a1b3c 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -10732,7 +10732,7 @@ void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations()
QTRY_VERIFY(view.repaints > 0);
QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache();
- Q_ASSERT(itemCache);
+ QVERIFY(itemCache);
QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key;
// Trigger an update and verify that the cache is unchanged.
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 9ff086c425..09275774ce 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -3594,7 +3594,7 @@ void tst_QGraphicsScene::task160653_selectionChanged()
item->flags() | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
item->setSelected(true);
}
- Q_ASSERT(scene.items().size() > 1);
+ QVERIFY(scene.items().size() > 1);
QCOMPARE(scene.items().size(), scene.selectedItems().size());
QSignalSpy spy(&scene, SIGNAL(selectionChanged()));
diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp
index 1d13eb6292..e0317df382 100644
--- a/tests/auto/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp
@@ -193,12 +193,12 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0)
void testGetText(QInputDialog *dialog)
{
QLineEdit *ledit = qFindChild<QLineEdit *>(dialog);
- Q_ASSERT(ledit);
+ QVERIFY(ledit);
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
- Q_ASSERT(bbox);
+ QVERIFY(bbox);
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
- Q_ASSERT(okButton);
+ QVERIFY(okButton);
QVERIFY(ledit->hasAcceptableInput());
QCOMPARE(ledit->selectedText(), ledit->text());
@@ -211,12 +211,12 @@ void testGetText(QInputDialog *dialog)
void testGetItem(QInputDialog *dialog)
{
QComboBox *cbox = qFindChild<QComboBox *>(dialog);
- Q_ASSERT(cbox);
+ QVERIFY(cbox);
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
- Q_ASSERT(bbox);
+ QVERIFY(bbox);
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
- Q_ASSERT(okButton);
+ QVERIFY(okButton);
QVERIFY(okButton->isEnabled());
const int origIndex = cbox->currentIndex();
@@ -249,7 +249,7 @@ void tst_QInputDialog::timerEvent(QTimerEvent *event)
{
killTimer(event->timerId());
QInputDialog *dialog = qFindChild<QInputDialog *>(parent);
- Q_ASSERT(dialog);
+ QVERIFY(dialog);
if (testFunc)
testFunc(dialog);
dialog->done(doneCode); // cause static function call to return
@@ -270,7 +270,7 @@ void tst_QInputDialog::getInteger()
{
QFETCH(int, min);
QFETCH(int, max);
- Q_ASSERT(min < max);
+ QVERIFY(min < max);
parent = new QWidget;
doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetInteger;
@@ -310,7 +310,7 @@ void tst_QInputDialog::getDouble()
QFETCH(double, min);
QFETCH(double, max);
QFETCH(int, decimals);
- Q_ASSERT(min < max && decimals >= 0 && decimals <= 13);
+ QVERIFY(min < max && decimals >= 0 && decimals <= 13);
parent = new QWidget;
doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetDouble;
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 2b7eaaefbc..2ffc9e923b 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -326,7 +326,7 @@ void tst_QLocale::ctor()
TEST_CTOR("en-GB", English, UnitedKingdom)
TEST_CTOR("en-GB@bla", English, UnitedKingdom)
- Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
+ QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal);
TEST_CTOR("no", Norwegian, Norway)
TEST_CTOR("nb", Norwegian, Norway)
TEST_CTOR("nn", NorwegianNynorsk, Norway)
@@ -431,7 +431,7 @@ void tst_QLocale::emptyCtor()
TEST_CTOR("en_GB@bla", "en_GB")
TEST_CTOR("de", "de_DE")
- Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
+ QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal);
TEST_CTOR("no", "nb_NO")
TEST_CTOR("nb", "nb_NO")
TEST_CTOR("nn", "nn_NO")
diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp
index c11e76c098..ed121cebff 100644
--- a/tests/auto/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp
@@ -609,48 +609,43 @@ void tst_QMessageBox::testSymbols()
button = QMessageBox::FlagMask;
mb1.setText("Foo");
- QString text = mb1.text();
- Q_ASSERT(text == "Foo");
+ QCOMPARE(mb1.text(), "Foo");
icon = mb1.icon();
- Q_ASSERT(icon == QMessageBox::NoIcon);
+ QVERIFY(icon == QMessageBox::NoIcon);
mb1.setIcon(QMessageBox::Question);
- Q_ASSERT(mb1.icon() == QMessageBox::Question);
+ QVERIFY(mb1.icon() == QMessageBox::Question);
QPixmap iconPixmap = mb1.iconPixmap();
mb1.setIconPixmap(iconPixmap);
- Q_ASSERT(mb1.icon() == QMessageBox::NoIcon);
+ QVERIFY(mb1.icon() == QMessageBox::NoIcon);
- QString bt0 = mb1.buttonText(QMessageBox::Ok);
- QString bt1 = mb1.buttonText(QMessageBox::Cancel);
- QString bt2 = mb1.buttonText(QMessageBox::Ok | QMessageBox::Default);
-
- Q_ASSERT(bt0 == "OK");
- Q_ASSERT(bt1.isEmpty());
- Q_ASSERT(bt2.isEmpty());
+ QCOMPARE(mb1.buttonText(QMessageBox::Ok), "OK");
+ QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString());
+ QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString());
mb2.setButtonText(QMessageBox::Cancel, "Foo");
mb2.setButtonText(QMessageBox::Ok, "Bar");
mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz");
- Q_ASSERT(mb2.buttonText(QMessageBox::Cancel).isEmpty());
- Q_ASSERT(mb2.buttonText(QMessageBox::Ok) == "Bar");
+ QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString());
+ QCOMPARE(mb2.buttonText(QMessageBox::Ok), "Bar");
- Q_ASSERT(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes"));
- Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty());
- Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty());
+ QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes"));
+ QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString());
+ QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());
mb3b.setButtonText(QMessageBox::Yes, "Blah");
mb3b.setButtonText(QMessageBox::YesAll, "Zoo");
mb3b.setButtonText(QMessageBox::Ok, "Zoo");
- Q_ASSERT(mb3b.buttonText(QMessageBox::Yes) == "Blah");
- Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty());
- Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty());
+ QCOMPARE(mb3b.buttonText(QMessageBox::Yes), "Blah");
+ QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString());
+ QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());
- Q_ASSERT(mb1.textFormat() == Qt::AutoText);
+ QCOMPARE(mb1.textFormat(), Qt::AutoText);
mb1.setTextFormat(Qt::PlainText);
- Q_ASSERT(mb1.textFormat() == Qt::PlainText);
+ QCOMPARE(mb1.textFormat(), Qt::PlainText);
CONVENIENCE_FUNC_SYMS(information);
CONVENIENCE_FUNC_SYMS_EXTRA(information);
@@ -660,7 +655,7 @@ void tst_QMessageBox::testSymbols()
CONVENIENCE_FUNC_SYMS(critical);
QSize sizeHint = mb1.sizeHint();
- Q_ASSERT(sizeHint.width() > 20 && sizeHint.height() > 20);
+ QVERIFY(sizeHint.width() > 20 && sizeHint.height() > 20);
#ifdef QT3_SUPPORT
//test QT3_SUPPORT stuff
@@ -672,8 +667,8 @@ void tst_QMessageBox::testSymbols()
QPixmap pm = QMessageBox::standardIcon(QMessageBox::Question, Qt::GUIStyle(1));
QPixmap pm2 = QMessageBox::standardIcon(QMessageBox::Question);
- Q_ASSERT(pm.toImage() == iconPixmap.toImage());
- Q_ASSERT(pm2.toImage() == iconPixmap.toImage());
+ QVERIFY(pm.toImage() == iconPixmap.toImage());
+ QVERIFY(pm2.toImage() == iconPixmap.toImage());
int ret1 = QMessageBox::message("title", "text");
int ret2 = QMessageBox::message("title", "text", "OK");
@@ -692,10 +687,10 @@ void tst_QMessageBox::testSymbols()
Q_UNUSED(ret5);
QPixmap pm3 = QMessageBox::standardIcon(QMessageBox::NoIcon);
- Q_ASSERT(pm3.isNull());
+ QVERIFY(pm3.isNull());
pm3 = QMessageBox::standardIcon(QMessageBox::Information);
- Q_ASSERT(!pm3.isNull());
+ QVERIFY(!pm3.isNull());
#endif //QT3_SUPPORT
QMessageBox::about(&mb1, "title", "text");
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 1f1ee88b23..2cd9b133ac 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1697,8 +1697,8 @@ void tst_QPixmap::fromImageReaderAnimatedGif()
QImageReader referenceReader(path);
QImageReader pixmapReader(path);
- Q_ASSERT(referenceReader.canRead());
- Q_ASSERT(referenceReader.imageCount() > 1);
+ QVERIFY(referenceReader.canRead());
+ QVERIFY(referenceReader.imageCount() > 1);
for (int i = 0; i < referenceReader.imageCount(); ++i) {
QImage refImage = referenceReader.read();
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index 2a8874eab3..3e0c3ff412 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -668,7 +668,7 @@ void tst_QProcess::exitStatus()
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
#endif
- Q_ASSERT(processList.count() == exitStatus.count());
+ QCOMPARE(exitStatus.count(), processList.count());
for (int i = 0; i < processList.count(); ++i) {
process->start(processList.at(i));
QVERIFY(process->waitForStarted(5000));
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 96d087384b..62502193b2 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -284,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);
@@ -868,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);
@@ -886,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;
@@ -909,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);
@@ -929,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;
@@ -1606,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);
diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp
index 0482661515..60be94417d 100644
--- a/tests/auto/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/qsplitter/tst_qsplitter.cpp
@@ -1340,14 +1340,14 @@ void tst_QSplitter::task187373_addAbstractScrollAreas()
QFETCH(QString, className);
QFETCH(bool, addInConstructor);
QFETCH(bool, addOutsideConstructor);
- Q_ASSERT(addInConstructor || addOutsideConstructor);
+ QVERIFY(addInConstructor || addOutsideConstructor);
QSplitter *splitter = new QSplitter;
splitter->show();
- Q_ASSERT(splitter->isVisible());
+ QVERIFY(splitter->isVisible());
QAbstractScrollArea *w = task187373_createScrollArea(splitter, className, addInConstructor);
- Q_ASSERT(w);
+ QVERIFY(w);
if (addOutsideConstructor)
splitter->addWidget(w);
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 4462659502..185e046518 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -767,7 +767,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db)
Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db);
QVERIFY_SQL(cur, select());
QSqlRecord* rec = cur.primeInsert();
- Q_ASSERT(rec);
+ QVERIFY(rec);
rec->setValue("id", pkey++);
int i = 0;
for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) {
@@ -828,7 +828,7 @@ void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase
Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db);
QVERIFY_SQL(cur, select());
QSqlRecord* rec = cur.primeInsert();
- Q_ASSERT(rec);
+ QVERIFY(rec);
rec->setValue("id", pkey++);
int i = 0;
for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) {
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index 3d80e80dd2..37a899c250 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -3429,9 +3429,9 @@ void tst_QString::fromLatin1Roundtrip()
QFETCH(QString, unicode);
// QtTest safety check:
- Q_ASSERT(latin1.isNull() == unicode.isNull());
- Q_ASSERT(latin1.isEmpty() == unicode.isEmpty());
- Q_ASSERT(latin1.length() == unicode.length());
+ QCOMPARE(latin1.isNull(), unicode.isNull());
+ QCOMPARE(latin1.isEmpty(), unicode.isEmpty());
+ QCOMPARE(latin1.length(), unicode.length());
if (!latin1.isEmpty())
while (latin1.length() < 128) {
@@ -3484,12 +3484,12 @@ void tst_QString::toLatin1Roundtrip()
QFETCH(QString, unicodedst);
// QtTest safety check:
- Q_ASSERT(latin1.isNull() == unicodesrc.isNull());
- Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty());
- Q_ASSERT(latin1.length() == unicodesrc.length());
- Q_ASSERT(latin1.isNull() == unicodedst.isNull());
- Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty());
- Q_ASSERT(latin1.length() == unicodedst.length());
+ QCOMPARE(latin1.isNull(), unicodesrc.isNull());
+ QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty());
+ QCOMPARE(latin1.length(), unicodesrc.length());
+ QCOMPARE(latin1.isNull(), unicodedst.isNull());
+ QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty());
+ QCOMPARE(latin1.length(), unicodedst.length());
if (!latin1.isEmpty())
while (latin1.length() < 128) {
@@ -3519,12 +3519,12 @@ void tst_QString::stringRef_toLatin1Roundtrip()
QFETCH(QString, unicodedst);
// QtTest safety check:
- Q_ASSERT(latin1.isNull() == unicodesrc.isNull());
- Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty());
- Q_ASSERT(latin1.length() == unicodesrc.length());
- Q_ASSERT(latin1.isNull() == unicodedst.isNull());
- Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty());
- Q_ASSERT(latin1.length() == unicodedst.length());
+ QCOMPARE(latin1.isNull(), unicodesrc.isNull());
+ QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty());
+ QCOMPARE(latin1.length(), unicodesrc.length());
+ QCOMPARE(latin1.isNull(), unicodedst.isNull());
+ QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty());
+ QCOMPARE(latin1.length(), unicodedst.length());
if (!latin1.isEmpty())
while (latin1.length() < 128) {
diff --git a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
index 8003c442b7..e885942314 100644
--- a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
+++ b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
@@ -123,14 +123,14 @@ void tst_QTextBoundaryFinder::graphemeBoundaries()
if (test.at(pos).unicode() == 0xf7)
breakPositions.append(strPos);
else
- Q_ASSERT(test.at(pos).unicode() == 0xd7);
+ QVERIFY(test.at(pos).unicode() == 0xd7);
++pos;
if (pos < test.length()) {
- Q_ASSERT(pos < test.length() - 4);
+ QVERIFY(pos < test.length() - 4);
QString hex = test.mid(pos, 4);
bool ok = true;
testString.append(QChar(hex.toInt(&ok, 16)));
- Q_ASSERT(ok);
+ QVERIFY(ok);
pos += 4;
}
++strPos;
@@ -176,14 +176,14 @@ void tst_QTextBoundaryFinder::wordBoundaries()
if (test.at(pos).unicode() == 0xf7)
breakPositions.append(strPos);
else
- Q_ASSERT(test.at(pos).unicode() == 0xd7);
+ QVERIFY(test.at(pos).unicode() == 0xd7);
++pos;
if (pos < test.length()) {
- Q_ASSERT(pos < test.length() - 4);
+ QVERIFY(pos < test.length() - 4);
QString hex = test.mid(pos, 4);
bool ok = true;
testString.append(QChar(hex.toInt(&ok, 16)));
- Q_ASSERT(ok);
+ QVERIFY(ok);
pos += 4;
}
++strPos;
@@ -228,14 +228,14 @@ void tst_QTextBoundaryFinder::sentenceBoundaries()
if (test.at(pos).unicode() == 0xf7)
breakPositions.append(strPos);
else
- Q_ASSERT(test.at(pos).unicode() == 0xd7);
+ QVERIFY(test.at(pos).unicode() == 0xd7);
++pos;
if (pos < test.length()) {
- Q_ASSERT(pos < test.length() - 4);
+ QVERIFY(pos < test.length() - 4);
QString hex = test.mid(pos, 4);
bool ok = true;
testString.append(QChar(hex.toInt(&ok, 16)));
- Q_ASSERT(ok);
+ QVERIFY(ok);
pos += 4;
}
++strPos;
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 43656c8e84..d122b0bde8 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -428,7 +428,7 @@ void tst_QTextCodec::flagCodepointFFFF() const
QString input(ch);
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
- Q_ASSERT(codec);
+ QVERIFY(codec);
const QByteArray asDecoded(codec->fromUnicode(input));
QCOMPARE(asDecoded, QByteArray("?"));
@@ -465,7 +465,7 @@ void tst_QTextCodec::flagF7808080() const
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
- Q_ASSERT(codec);
+ QVERIFY(codec);
//QVERIFY(!codec->canEncode(QChar(0x1C0000)));
@@ -482,7 +482,7 @@ void tst_QTextCodec::flagEFBFBF() const
invalidInput[2] = char(0xBF);
const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
- Q_ASSERT(codec);
+ QVERIFY(codec);
{
//QVERIFY(!codec->canEncode(QChar(0xFFFF)));
@@ -1627,7 +1627,7 @@ void tst_QTextCodec::utf8bom()
QFETCH(QString, result);
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
- Q_ASSERT(codec);
+ QVERIFY(codec);
QCOMPARE(codec->toUnicode(data.constData(), data.length(), 0), result);
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 9ce0849c4d..e9cb480b9b 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -7234,8 +7234,7 @@ void tst_QWidget::render_systemClip2()
QFETCH(bool, usePaintEvent);
QFETCH(QColor, expectedColor);
- Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO,
- "Qt::red is the reference color for the image, pick another color");
+ QVERIFY2(expectedColor != QColor(Qt::red), "Qt::red is the reference color for the image, pick another color");
class MyWidget : public QWidget
{