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
This commit is contained in:
parent
b8af05d3e2
commit
6e50394c4e
@ -45,8 +45,6 @@
|
|||||||
#include "modeltest.h"
|
#include "modeltest.h"
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#undef Q_ASSERT
|
|
||||||
#define Q_ASSERT QVERIFY
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE ( QModelIndex )
|
Q_DECLARE_METATYPE ( QModelIndex )
|
||||||
|
|
||||||
@ -119,15 +117,15 @@ void ModelTest::runAllTests()
|
|||||||
*/
|
*/
|
||||||
void ModelTest::nonDestructiveBasicTest()
|
void ModelTest::nonDestructiveBasicTest()
|
||||||
{
|
{
|
||||||
Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() );
|
QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() );
|
||||||
model->canFetchMore ( QModelIndex() );
|
model->canFetchMore ( QModelIndex() );
|
||||||
Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 );
|
QVERIFY( model->columnCount ( QModelIndex() ) >= 0 );
|
||||||
Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() );
|
QVERIFY( model->data ( QModelIndex() ) == QVariant() );
|
||||||
fetchingMore = true;
|
fetchingMore = true;
|
||||||
model->fetchMore ( QModelIndex() );
|
model->fetchMore ( QModelIndex() );
|
||||||
fetchingMore = false;
|
fetchingMore = false;
|
||||||
Qt::ItemFlags flags = model->flags ( QModelIndex() );
|
Qt::ItemFlags flags = model->flags ( QModelIndex() );
|
||||||
Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 );
|
QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 );
|
||||||
model->hasChildren ( QModelIndex() );
|
model->hasChildren ( QModelIndex() );
|
||||||
model->hasIndex ( 0, 0 );
|
model->hasIndex ( 0, 0 );
|
||||||
model->headerData ( 0, Qt::Horizontal );
|
model->headerData ( 0, Qt::Horizontal );
|
||||||
@ -136,8 +134,8 @@ void ModelTest::nonDestructiveBasicTest()
|
|||||||
QVariant cache;
|
QVariant cache;
|
||||||
model->match ( QModelIndex(), -1, cache );
|
model->match ( QModelIndex(), -1, cache );
|
||||||
model->mimeTypes();
|
model->mimeTypes();
|
||||||
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
|
QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
|
||||||
Q_ASSERT ( model->rowCount() >= 0 );
|
QVERIFY( model->rowCount() >= 0 );
|
||||||
QVariant variant;
|
QVariant variant;
|
||||||
model->setData ( QModelIndex(), variant, -1 );
|
model->setData ( QModelIndex(), variant, -1 );
|
||||||
model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
|
model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
|
||||||
@ -159,17 +157,17 @@ void ModelTest::rowCount()
|
|||||||
// check top row
|
// check top row
|
||||||
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
|
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
|
||||||
int rows = model->rowCount ( topIndex );
|
int rows = model->rowCount ( topIndex );
|
||||||
Q_ASSERT ( rows >= 0 );
|
QVERIFY( rows >= 0 );
|
||||||
if ( rows > 0 )
|
if ( rows > 0 )
|
||||||
Q_ASSERT ( model->hasChildren ( topIndex ) == true );
|
QVERIFY( model->hasChildren ( topIndex ) );
|
||||||
|
|
||||||
QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
|
QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
|
||||||
if ( secondLevelIndex.isValid() ) { // not the top level
|
if ( secondLevelIndex.isValid() ) { // not the top level
|
||||||
// check a row count where parent is valid
|
// check a row count where parent is valid
|
||||||
rows = model->rowCount ( secondLevelIndex );
|
rows = model->rowCount ( secondLevelIndex );
|
||||||
Q_ASSERT ( rows >= 0 );
|
QVERIFY( rows >= 0 );
|
||||||
if ( rows > 0 )
|
if ( rows > 0 )
|
||||||
Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true );
|
QVERIFY( model->hasChildren ( secondLevelIndex ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// The models rowCount() is tested more extensively in checkChildren(),
|
// The models rowCount() is tested more extensively in checkChildren(),
|
||||||
@ -183,12 +181,12 @@ void ModelTest::columnCount()
|
|||||||
{
|
{
|
||||||
// check top row
|
// check top row
|
||||||
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
|
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
|
// check a column count where parent is valid
|
||||||
QModelIndex childIndex = model->index ( 0, 0, topIndex );
|
QModelIndex childIndex = model->index ( 0, 0, topIndex );
|
||||||
if ( childIndex.isValid() )
|
if ( childIndex.isValid() )
|
||||||
Q_ASSERT ( model->columnCount ( childIndex ) >= 0 );
|
QVERIFY( model->columnCount ( childIndex ) >= 0 );
|
||||||
|
|
||||||
// columnCount() is tested more extensively in checkChildren(),
|
// columnCount() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -201,19 +199,19 @@ void ModelTest::hasIndex()
|
|||||||
{
|
{
|
||||||
// qDebug() << "hi";
|
// qDebug() << "hi";
|
||||||
// Make sure that invalid values returns an invalid index
|
// Make sure that invalid values returns an invalid index
|
||||||
Q_ASSERT ( model->hasIndex ( -2, -2 ) == false );
|
QVERIFY( !model->hasIndex ( -2, -2 ) );
|
||||||
Q_ASSERT ( model->hasIndex ( -2, 0 ) == false );
|
QVERIFY( !model->hasIndex ( -2, 0 ) );
|
||||||
Q_ASSERT ( model->hasIndex ( 0, -2 ) == false );
|
QVERIFY( !model->hasIndex ( 0, -2 ) );
|
||||||
|
|
||||||
int rows = model->rowCount();
|
int rows = model->rowCount();
|
||||||
int columns = model->columnCount();
|
int columns = model->columnCount();
|
||||||
|
|
||||||
// check out of bounds
|
// check out of bounds
|
||||||
Q_ASSERT ( model->hasIndex ( rows, columns ) == false );
|
QVERIFY( !model->hasIndex ( rows, columns ) );
|
||||||
Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false );
|
QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) );
|
||||||
|
|
||||||
if ( rows > 0 )
|
if ( rows > 0 )
|
||||||
Q_ASSERT ( model->hasIndex ( 0, 0 ) == true );
|
QVERIFY( model->hasIndex ( 0, 0 ) );
|
||||||
|
|
||||||
// hasIndex() is tested more extensively in checkChildren(),
|
// hasIndex() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -226,9 +224,9 @@ void ModelTest::index()
|
|||||||
{
|
{
|
||||||
// qDebug() << "i";
|
// qDebug() << "i";
|
||||||
// Make sure that invalid values returns an invalid index
|
// Make sure that invalid values returns an invalid index
|
||||||
Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() );
|
QVERIFY( model->index ( -2, -2 ) == QModelIndex() );
|
||||||
Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() );
|
QVERIFY( model->index ( -2, 0 ) == QModelIndex() );
|
||||||
Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() );
|
QVERIFY( model->index ( 0, -2 ) == QModelIndex() );
|
||||||
|
|
||||||
int rows = model->rowCount();
|
int rows = model->rowCount();
|
||||||
int columns = model->columnCount();
|
int columns = model->columnCount();
|
||||||
@ -237,13 +235,13 @@ void ModelTest::index()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Catch off by one errors
|
// Catch off by one errors
|
||||||
Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() );
|
QVERIFY( model->index ( rows, columns ) == QModelIndex() );
|
||||||
Q_ASSERT ( model->index ( 0, 0 ).isValid() == true );
|
QVERIFY( model->index ( 0, 0 ).isValid() );
|
||||||
|
|
||||||
// Make sure that the same index is *always* returned
|
// Make sure that the same index is *always* returned
|
||||||
QModelIndex a = model->index ( 0, 0 );
|
QModelIndex a = model->index ( 0, 0 );
|
||||||
QModelIndex b = model->index ( 0, 0 );
|
QModelIndex b = model->index ( 0, 0 );
|
||||||
Q_ASSERT ( a == b );
|
QVERIFY( a == b );
|
||||||
|
|
||||||
// index() is tested more extensively in checkChildren(),
|
// index() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -257,7 +255,7 @@ void ModelTest::parent()
|
|||||||
// qDebug() << "p";
|
// qDebug() << "p";
|
||||||
// Make sure the model wont crash and will return an invalid QModelIndex
|
// Make sure the model wont crash and will return an invalid QModelIndex
|
||||||
// when asked for the parent of an invalid index.
|
// when asked for the parent of an invalid index.
|
||||||
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
|
QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
|
||||||
|
|
||||||
if ( model->rowCount() == 0 )
|
if ( model->rowCount() == 0 )
|
||||||
return;
|
return;
|
||||||
@ -270,13 +268,13 @@ void ModelTest::parent()
|
|||||||
// Common error test #1, make sure that a top level index has a parent
|
// Common error test #1, make sure that a top level index has a parent
|
||||||
// that is a invalid QModelIndex.
|
// that is a invalid QModelIndex.
|
||||||
QModelIndex topIndex = model->index ( 0, 0, 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
|
// Common error test #2, make sure that a second level index has a parent
|
||||||
// that is the first level index.
|
// that is the first level index.
|
||||||
if ( model->rowCount ( topIndex ) > 0 ) {
|
if ( model->rowCount ( topIndex ) > 0 ) {
|
||||||
QModelIndex childIndex = model->index ( 0, 0, topIndex );
|
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
|
// 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 ) {
|
if ( model->rowCount ( topIndex1 ) > 0 ) {
|
||||||
QModelIndex childIndex = model->index ( 0, 0, topIndex );
|
QModelIndex childIndex = model->index ( 0, 0, topIndex );
|
||||||
QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
|
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
|
// 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 );
|
int columns = model->columnCount ( parent );
|
||||||
|
|
||||||
if ( rows > 0 )
|
if ( rows > 0 )
|
||||||
Q_ASSERT ( model->hasChildren ( parent ) );
|
QVERIFY( model->hasChildren ( parent ) );
|
||||||
|
|
||||||
// Some further testing against rows(), columns(), and hasChildren()
|
// Some further testing against rows(), columns(), and hasChildren()
|
||||||
Q_ASSERT ( rows >= 0 );
|
QVERIFY( rows >= 0 );
|
||||||
Q_ASSERT ( columns >= 0 );
|
QVERIFY( columns >= 0 );
|
||||||
if ( rows > 0 )
|
if ( rows > 0 )
|
||||||
Q_ASSERT ( model->hasChildren ( parent ) == true );
|
QVERIFY( model->hasChildren ( parent ) );
|
||||||
|
|
||||||
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
|
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
|
||||||
// << "columns:" << columns << "parent column:" << parent.column();
|
// << "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 ) {
|
for ( int r = 0; r < rows; ++r ) {
|
||||||
if ( model->canFetchMore ( parent ) ) {
|
if ( model->canFetchMore ( parent ) ) {
|
||||||
fetchingMore = true;
|
fetchingMore = true;
|
||||||
model->fetchMore ( parent );
|
model->fetchMore ( parent );
|
||||||
fetchingMore = false;
|
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 ) {
|
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 );
|
QModelIndex index = model->index ( r, c, parent );
|
||||||
// rowCount() and columnCount() said that it existed...
|
// 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
|
// index() should always return the same index when called twice in a row
|
||||||
QModelIndex modifiedIndex = model->index ( r, c, parent );
|
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
|
// Make sure we get the same index if we request it twice in a row
|
||||||
QModelIndex a = model->index ( r, c, parent );
|
QModelIndex a = model->index ( r, c, parent );
|
||||||
QModelIndex b = 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
|
// Some basic checking on the index that is returned
|
||||||
Q_ASSERT ( index.model() == model );
|
QVERIFY( index.model() == model );
|
||||||
Q_ASSERT ( index.row() == r );
|
QCOMPARE( index.row(), r );
|
||||||
Q_ASSERT ( index.column() == c );
|
QCOMPARE( index.column(), c );
|
||||||
// While you can technically return a QVariant usually this is a sign
|
// 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.
|
// of a bug in data(). Disable if this really is ok in your model.
|
||||||
// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true );
|
// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
|
||||||
|
|
||||||
// If the next test fails here is some somewhat useful debug you play with.
|
// 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.
|
// Check that we can get back our real parent.
|
||||||
// qDebug() << model->parent ( index ) << parent ;
|
QCOMPARE( model->parent ( index ), parent );
|
||||||
Q_ASSERT ( model->parent ( index ) == parent );
|
|
||||||
|
|
||||||
// recursively go down the children
|
// recursively go down the children
|
||||||
if ( model->hasChildren ( index ) && currentDepth < 10 ) {
|
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.
|
// make sure that after testing the children that the index doesn't change.
|
||||||
QModelIndex newerIndex = model->index ( r, c, parent );
|
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()
|
void ModelTest::data()
|
||||||
{
|
{
|
||||||
// Invalid index should return an invalid qvariant
|
// Invalid index should return an invalid qvariant
|
||||||
Q_ASSERT ( !model->data ( QModelIndex() ).isValid() );
|
QVERIFY( !model->data ( QModelIndex() ).isValid() );
|
||||||
|
|
||||||
if ( model->rowCount() == 0 )
|
if ( model->rowCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// A valid index should have a valid QVariant data
|
// 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
|
// 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
|
// General Purpose roles that should return a QString
|
||||||
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
|
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
|
||||||
if ( variant.isValid() ) {
|
if ( variant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
|
QVERIFY( qVariantCanConvert<QString> ( variant ) );
|
||||||
}
|
}
|
||||||
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
|
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
|
||||||
if ( variant.isValid() ) {
|
if ( variant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
|
QVERIFY( qVariantCanConvert<QString> ( variant ) );
|
||||||
}
|
}
|
||||||
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
|
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
|
||||||
if ( variant.isValid() ) {
|
if ( variant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
|
QVERIFY( qVariantCanConvert<QString> ( variant ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// General Purpose roles that should return a QSize
|
// General Purpose roles that should return a QSize
|
||||||
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
|
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
|
||||||
if ( variant.isValid() ) {
|
if ( variant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QSize> ( variant ) );
|
QVERIFY( qVariantCanConvert<QSize> ( variant ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// General Purpose roles that should return a QFont
|
// General Purpose roles that should return a QFont
|
||||||
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
|
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
|
||||||
if ( fontVariant.isValid() ) {
|
if ( fontVariant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QFont> ( fontVariant ) );
|
QVERIFY( qVariantCanConvert<QFont> ( fontVariant ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the alignment is one we know about
|
// Check that the alignment is one we know about
|
||||||
QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
|
QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
|
||||||
if ( textAlignmentVariant.isValid() ) {
|
if ( textAlignmentVariant.isValid() ) {
|
||||||
int alignment = textAlignmentVariant.toInt();
|
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
|
// General Purpose roles that should return a QColor
|
||||||
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
|
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
|
||||||
if ( colorVariant.isValid() ) {
|
if ( colorVariant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
|
QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
|
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
|
||||||
if ( colorVariant.isValid() ) {
|
if ( colorVariant.isValid() ) {
|
||||||
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
|
QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the "check state" is one we know about.
|
// Check that the "check state" is one we know about.
|
||||||
QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
|
QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
|
||||||
if ( checkStateVariant.isValid() ) {
|
if ( checkStateVariant.isValid() ) {
|
||||||
int state = checkStateVariant.toInt();
|
int state = checkStateVariant.toInt();
|
||||||
Q_ASSERT ( state == Qt::Unchecked ||
|
QVERIFY( state == Qt::Unchecked ||
|
||||||
state == Qt::PartiallyChecked ||
|
state == Qt::PartiallyChecked ||
|
||||||
state == Qt::Checked );
|
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 )
|
void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
|
||||||
{
|
{
|
||||||
Changing c = insert.pop();
|
Changing c = insert.pop();
|
||||||
Q_ASSERT ( c.parent == parent );
|
QVERIFY( c.parent == parent );
|
||||||
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
|
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
|
||||||
// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
|
// << "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();
|
// qDebug();
|
||||||
|
|
||||||
Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
|
QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
|
||||||
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.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))) {
|
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
|
||||||
qDebug() << start << end;
|
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));
|
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()
|
void ModelTest::layoutAboutToBeChanged()
|
||||||
@ -528,7 +525,7 @@ void ModelTest::layoutChanged()
|
|||||||
{
|
{
|
||||||
for ( int i = 0; i < changing.count(); ++i ) {
|
for ( int i = 0; i < changing.count(); ++i ) {
|
||||||
QPersistentModelIndex p = changing[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();
|
changing.clear();
|
||||||
}
|
}
|
||||||
@ -558,10 +555,10 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
|
|||||||
{
|
{
|
||||||
qDebug() << "rr" << parent << start << end;
|
qDebug() << "rr" << parent << start << end;
|
||||||
Changing c = remove.pop();
|
Changing c = remove.pop();
|
||||||
Q_ASSERT ( c.parent == parent );
|
QVERIFY( c.parent == parent );
|
||||||
Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
|
QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
|
||||||
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
|
QVERIFY( 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.next == model->data ( model->index ( start, 0, c.parent ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,8 +309,7 @@ void tst_QBuffer::seekTest()
|
|||||||
// (see Task 184730)
|
// (see Task 184730)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
const int offset = 1;
|
const int offset = 1; // any positive integer will do
|
||||||
Q_ASSERT(offset > 0); // any positive integer will do
|
|
||||||
const qint64 pos = buf.size() + offset;
|
const qint64 pos = buf.size() + offset;
|
||||||
QVERIFY(buf.seek(pos));
|
QVERIFY(buf.seek(pos));
|
||||||
QCOMPARE(buf.pos(), pos);
|
QCOMPARE(buf.pos(), pos);
|
||||||
|
@ -548,14 +548,14 @@ void tst_QChar::normalization_data()
|
|||||||
|
|
||||||
QList<QByteArray> l = line.split(';');
|
QList<QByteArray> l = line.split(';');
|
||||||
|
|
||||||
Q_ASSERT(l.size() == 5);
|
QCOMPARE(l.size(), 5);
|
||||||
|
|
||||||
QStringList columns;
|
QStringList columns;
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
columns.append(QString());
|
columns.append(QString());
|
||||||
|
|
||||||
QList<QByteArray> c = l.at(i).split(' ');
|
QList<QByteArray> c = l.at(i).split(' ');
|
||||||
Q_ASSERT(!c.isEmpty());
|
QVERIFY(!c.isEmpty());
|
||||||
|
|
||||||
for (int j = 0; j < c.size(); ++j) {
|
for (int j = 0; j < c.size(); ++j) {
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -1250,9 +1250,7 @@ public:
|
|||||||
void tst_QCompleter::task189564_omitNonSelectableItems()
|
void tst_QCompleter::task189564_omitNonSelectableItems()
|
||||||
{
|
{
|
||||||
const QString prefix("a");
|
const QString prefix("a");
|
||||||
Q_ASSERT(!prefix.isEmpty());
|
|
||||||
const int n = 5;
|
const int n = 5;
|
||||||
Q_ASSERT(n > 0);
|
|
||||||
|
|
||||||
QStringList strings;
|
QStringList strings;
|
||||||
for (int i = 0; i < n; ++i)
|
for (int i = 0; i < n; ++i)
|
||||||
|
@ -2746,7 +2746,7 @@ void tst_QDateTimeEdit::setCurrentSection()
|
|||||||
QFETCH(QList<int>, setCurrentSections);
|
QFETCH(QList<int>, setCurrentSections);
|
||||||
QFETCH(QList<int>, expectedCursorPositions);
|
QFETCH(QList<int>, expectedCursorPositions);
|
||||||
|
|
||||||
Q_ASSERT(setCurrentSections.size() == expectedCursorPositions.size());
|
QCOMPARE(setCurrentSections.size(), expectedCursorPositions.size());
|
||||||
testWidget->setDisplayFormat(format);
|
testWidget->setDisplayFormat(format);
|
||||||
testWidget->setDateTime(dateTime);
|
testWidget->setDateTime(dateTime);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
|
@ -592,7 +592,7 @@ void tst_QDBusThreading::callbackInAnotherAuxThread()
|
|||||||
// wait for the event loop
|
// wait for the event loop
|
||||||
sem1.release();
|
sem1.release();
|
||||||
sem2.acquire();
|
sem2.acquire();
|
||||||
Q_ASSERT(loop);
|
QVERIFY(loop);
|
||||||
|
|
||||||
// create the second thread
|
// create the second thread
|
||||||
new Thread;
|
new Thread;
|
||||||
|
@ -641,10 +641,10 @@ void tst_QDirModel::filter()
|
|||||||
QDirModel model;
|
QDirModel model;
|
||||||
model.setNameFilters(QStringList() << "*.nada");
|
model.setNameFilters(QStringList() << "*.nada");
|
||||||
QModelIndex index = model.index(SRCDIR "test");
|
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");
|
QModelIndex index2 = model.index(SRCDIR "test/file01.tst");
|
||||||
Q_ASSERT(!index2.isValid());
|
QVERIFY(!index2.isValid());
|
||||||
Q_ASSERT(model.rowCount(index) == 0);
|
QCOMPARE(model.rowCount(index), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDirModel::task244669_remove()
|
void tst_QDirModel::task244669_remove()
|
||||||
|
@ -812,7 +812,7 @@ void tst_QFileDialog2::task239706_editableFilterCombo()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Q_ASSERT(filterCombo);
|
QVERIFY(filterCombo);
|
||||||
filterCombo->setEditable(true);
|
filterCombo->setEditable(true);
|
||||||
QTest::mouseClick(filterCombo, Qt::LeftButton);
|
QTest::mouseClick(filterCombo, Qt::LeftButton);
|
||||||
QTest::keyPress(filterCombo, Qt::Key_X);
|
QTest::keyPress(filterCombo, Qt::Key_X);
|
||||||
|
@ -10732,7 +10732,7 @@ void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations()
|
|||||||
QTRY_VERIFY(view.repaints > 0);
|
QTRY_VERIFY(view.repaints > 0);
|
||||||
|
|
||||||
QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache();
|
QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache();
|
||||||
Q_ASSERT(itemCache);
|
QVERIFY(itemCache);
|
||||||
QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key;
|
QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key;
|
||||||
|
|
||||||
// Trigger an update and verify that the cache is unchanged.
|
// Trigger an update and verify that the cache is unchanged.
|
||||||
|
@ -3594,7 +3594,7 @@ void tst_QGraphicsScene::task160653_selectionChanged()
|
|||||||
item->flags() | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
item->flags() | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||||
item->setSelected(true);
|
item->setSelected(true);
|
||||||
}
|
}
|
||||||
Q_ASSERT(scene.items().size() > 1);
|
QVERIFY(scene.items().size() > 1);
|
||||||
QCOMPARE(scene.items().size(), scene.selectedItems().size());
|
QCOMPARE(scene.items().size(), scene.selectedItems().size());
|
||||||
|
|
||||||
QSignalSpy spy(&scene, SIGNAL(selectionChanged()));
|
QSignalSpy spy(&scene, SIGNAL(selectionChanged()));
|
||||||
|
@ -193,12 +193,12 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0)
|
|||||||
void testGetText(QInputDialog *dialog)
|
void testGetText(QInputDialog *dialog)
|
||||||
{
|
{
|
||||||
QLineEdit *ledit = qFindChild<QLineEdit *>(dialog);
|
QLineEdit *ledit = qFindChild<QLineEdit *>(dialog);
|
||||||
Q_ASSERT(ledit);
|
QVERIFY(ledit);
|
||||||
|
|
||||||
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
||||||
Q_ASSERT(bbox);
|
QVERIFY(bbox);
|
||||||
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
||||||
Q_ASSERT(okButton);
|
QVERIFY(okButton);
|
||||||
|
|
||||||
QVERIFY(ledit->hasAcceptableInput());
|
QVERIFY(ledit->hasAcceptableInput());
|
||||||
QCOMPARE(ledit->selectedText(), ledit->text());
|
QCOMPARE(ledit->selectedText(), ledit->text());
|
||||||
@ -211,12 +211,12 @@ void testGetText(QInputDialog *dialog)
|
|||||||
void testGetItem(QInputDialog *dialog)
|
void testGetItem(QInputDialog *dialog)
|
||||||
{
|
{
|
||||||
QComboBox *cbox = qFindChild<QComboBox *>(dialog);
|
QComboBox *cbox = qFindChild<QComboBox *>(dialog);
|
||||||
Q_ASSERT(cbox);
|
QVERIFY(cbox);
|
||||||
|
|
||||||
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
||||||
Q_ASSERT(bbox);
|
QVERIFY(bbox);
|
||||||
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
||||||
Q_ASSERT(okButton);
|
QVERIFY(okButton);
|
||||||
|
|
||||||
QVERIFY(okButton->isEnabled());
|
QVERIFY(okButton->isEnabled());
|
||||||
const int origIndex = cbox->currentIndex();
|
const int origIndex = cbox->currentIndex();
|
||||||
@ -249,7 +249,7 @@ void tst_QInputDialog::timerEvent(QTimerEvent *event)
|
|||||||
{
|
{
|
||||||
killTimer(event->timerId());
|
killTimer(event->timerId());
|
||||||
QInputDialog *dialog = qFindChild<QInputDialog *>(parent);
|
QInputDialog *dialog = qFindChild<QInputDialog *>(parent);
|
||||||
Q_ASSERT(dialog);
|
QVERIFY(dialog);
|
||||||
if (testFunc)
|
if (testFunc)
|
||||||
testFunc(dialog);
|
testFunc(dialog);
|
||||||
dialog->done(doneCode); // cause static function call to return
|
dialog->done(doneCode); // cause static function call to return
|
||||||
@ -270,7 +270,7 @@ void tst_QInputDialog::getInteger()
|
|||||||
{
|
{
|
||||||
QFETCH(int, min);
|
QFETCH(int, min);
|
||||||
QFETCH(int, max);
|
QFETCH(int, max);
|
||||||
Q_ASSERT(min < max);
|
QVERIFY(min < max);
|
||||||
parent = new QWidget;
|
parent = new QWidget;
|
||||||
doneCode = QDialog::Accepted;
|
doneCode = QDialog::Accepted;
|
||||||
testFunc = &tst_QInputDialog::testFuncGetInteger;
|
testFunc = &tst_QInputDialog::testFuncGetInteger;
|
||||||
@ -310,7 +310,7 @@ void tst_QInputDialog::getDouble()
|
|||||||
QFETCH(double, min);
|
QFETCH(double, min);
|
||||||
QFETCH(double, max);
|
QFETCH(double, max);
|
||||||
QFETCH(int, decimals);
|
QFETCH(int, decimals);
|
||||||
Q_ASSERT(min < max && decimals >= 0 && decimals <= 13);
|
QVERIFY(min < max && decimals >= 0 && decimals <= 13);
|
||||||
parent = new QWidget;
|
parent = new QWidget;
|
||||||
doneCode = QDialog::Accepted;
|
doneCode = QDialog::Accepted;
|
||||||
testFunc = &tst_QInputDialog::testFuncGetDouble;
|
testFunc = &tst_QInputDialog::testFuncGetDouble;
|
||||||
|
@ -326,7 +326,7 @@ void tst_QLocale::ctor()
|
|||||||
TEST_CTOR("en-GB", English, UnitedKingdom)
|
TEST_CTOR("en-GB", English, UnitedKingdom)
|
||||||
TEST_CTOR("en-GB@bla", 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("no", Norwegian, Norway)
|
||||||
TEST_CTOR("nb", Norwegian, Norway)
|
TEST_CTOR("nb", Norwegian, Norway)
|
||||||
TEST_CTOR("nn", NorwegianNynorsk, Norway)
|
TEST_CTOR("nn", NorwegianNynorsk, Norway)
|
||||||
@ -431,7 +431,7 @@ void tst_QLocale::emptyCtor()
|
|||||||
TEST_CTOR("en_GB@bla", "en_GB")
|
TEST_CTOR("en_GB@bla", "en_GB")
|
||||||
TEST_CTOR("de", "de_DE")
|
TEST_CTOR("de", "de_DE")
|
||||||
|
|
||||||
Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
|
QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal);
|
||||||
TEST_CTOR("no", "nb_NO")
|
TEST_CTOR("no", "nb_NO")
|
||||||
TEST_CTOR("nb", "nb_NO")
|
TEST_CTOR("nb", "nb_NO")
|
||||||
TEST_CTOR("nn", "nn_NO")
|
TEST_CTOR("nn", "nn_NO")
|
||||||
|
@ -609,48 +609,43 @@ void tst_QMessageBox::testSymbols()
|
|||||||
button = QMessageBox::FlagMask;
|
button = QMessageBox::FlagMask;
|
||||||
|
|
||||||
mb1.setText("Foo");
|
mb1.setText("Foo");
|
||||||
QString text = mb1.text();
|
QCOMPARE(mb1.text(), "Foo");
|
||||||
Q_ASSERT(text == "Foo");
|
|
||||||
|
|
||||||
icon = mb1.icon();
|
icon = mb1.icon();
|
||||||
Q_ASSERT(icon == QMessageBox::NoIcon);
|
QVERIFY(icon == QMessageBox::NoIcon);
|
||||||
mb1.setIcon(QMessageBox::Question);
|
mb1.setIcon(QMessageBox::Question);
|
||||||
Q_ASSERT(mb1.icon() == QMessageBox::Question);
|
QVERIFY(mb1.icon() == QMessageBox::Question);
|
||||||
|
|
||||||
QPixmap iconPixmap = mb1.iconPixmap();
|
QPixmap iconPixmap = mb1.iconPixmap();
|
||||||
mb1.setIconPixmap(iconPixmap);
|
mb1.setIconPixmap(iconPixmap);
|
||||||
Q_ASSERT(mb1.icon() == QMessageBox::NoIcon);
|
QVERIFY(mb1.icon() == QMessageBox::NoIcon);
|
||||||
|
|
||||||
QString bt0 = mb1.buttonText(QMessageBox::Ok);
|
QCOMPARE(mb1.buttonText(QMessageBox::Ok), "OK");
|
||||||
QString bt1 = mb1.buttonText(QMessageBox::Cancel);
|
QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString());
|
||||||
QString bt2 = mb1.buttonText(QMessageBox::Ok | QMessageBox::Default);
|
QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString());
|
||||||
|
|
||||||
Q_ASSERT(bt0 == "OK");
|
|
||||||
Q_ASSERT(bt1.isEmpty());
|
|
||||||
Q_ASSERT(bt2.isEmpty());
|
|
||||||
|
|
||||||
mb2.setButtonText(QMessageBox::Cancel, "Foo");
|
mb2.setButtonText(QMessageBox::Cancel, "Foo");
|
||||||
mb2.setButtonText(QMessageBox::Ok, "Bar");
|
mb2.setButtonText(QMessageBox::Ok, "Bar");
|
||||||
mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz");
|
mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz");
|
||||||
|
|
||||||
Q_ASSERT(mb2.buttonText(QMessageBox::Cancel).isEmpty());
|
QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString());
|
||||||
Q_ASSERT(mb2.buttonText(QMessageBox::Ok) == "Bar");
|
QCOMPARE(mb2.buttonText(QMessageBox::Ok), "Bar");
|
||||||
|
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes"));
|
QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes"));
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty());
|
QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString());
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty());
|
QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());
|
||||||
|
|
||||||
mb3b.setButtonText(QMessageBox::Yes, "Blah");
|
mb3b.setButtonText(QMessageBox::Yes, "Blah");
|
||||||
mb3b.setButtonText(QMessageBox::YesAll, "Zoo");
|
mb3b.setButtonText(QMessageBox::YesAll, "Zoo");
|
||||||
mb3b.setButtonText(QMessageBox::Ok, "Zoo");
|
mb3b.setButtonText(QMessageBox::Ok, "Zoo");
|
||||||
|
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::Yes) == "Blah");
|
QCOMPARE(mb3b.buttonText(QMessageBox::Yes), "Blah");
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty());
|
QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString());
|
||||||
Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty());
|
QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());
|
||||||
|
|
||||||
Q_ASSERT(mb1.textFormat() == Qt::AutoText);
|
QCOMPARE(mb1.textFormat(), Qt::AutoText);
|
||||||
mb1.setTextFormat(Qt::PlainText);
|
mb1.setTextFormat(Qt::PlainText);
|
||||||
Q_ASSERT(mb1.textFormat() == Qt::PlainText);
|
QCOMPARE(mb1.textFormat(), Qt::PlainText);
|
||||||
|
|
||||||
CONVENIENCE_FUNC_SYMS(information);
|
CONVENIENCE_FUNC_SYMS(information);
|
||||||
CONVENIENCE_FUNC_SYMS_EXTRA(information);
|
CONVENIENCE_FUNC_SYMS_EXTRA(information);
|
||||||
@ -660,7 +655,7 @@ void tst_QMessageBox::testSymbols()
|
|||||||
CONVENIENCE_FUNC_SYMS(critical);
|
CONVENIENCE_FUNC_SYMS(critical);
|
||||||
|
|
||||||
QSize sizeHint = mb1.sizeHint();
|
QSize sizeHint = mb1.sizeHint();
|
||||||
Q_ASSERT(sizeHint.width() > 20 && sizeHint.height() > 20);
|
QVERIFY(sizeHint.width() > 20 && sizeHint.height() > 20);
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
#ifdef QT3_SUPPORT
|
||||||
//test QT3_SUPPORT stuff
|
//test QT3_SUPPORT stuff
|
||||||
@ -672,8 +667,8 @@ void tst_QMessageBox::testSymbols()
|
|||||||
QPixmap pm = QMessageBox::standardIcon(QMessageBox::Question, Qt::GUIStyle(1));
|
QPixmap pm = QMessageBox::standardIcon(QMessageBox::Question, Qt::GUIStyle(1));
|
||||||
QPixmap pm2 = QMessageBox::standardIcon(QMessageBox::Question);
|
QPixmap pm2 = QMessageBox::standardIcon(QMessageBox::Question);
|
||||||
|
|
||||||
Q_ASSERT(pm.toImage() == iconPixmap.toImage());
|
QVERIFY(pm.toImage() == iconPixmap.toImage());
|
||||||
Q_ASSERT(pm2.toImage() == iconPixmap.toImage());
|
QVERIFY(pm2.toImage() == iconPixmap.toImage());
|
||||||
|
|
||||||
int ret1 = QMessageBox::message("title", "text");
|
int ret1 = QMessageBox::message("title", "text");
|
||||||
int ret2 = QMessageBox::message("title", "text", "OK");
|
int ret2 = QMessageBox::message("title", "text", "OK");
|
||||||
@ -692,10 +687,10 @@ void tst_QMessageBox::testSymbols()
|
|||||||
Q_UNUSED(ret5);
|
Q_UNUSED(ret5);
|
||||||
|
|
||||||
QPixmap pm3 = QMessageBox::standardIcon(QMessageBox::NoIcon);
|
QPixmap pm3 = QMessageBox::standardIcon(QMessageBox::NoIcon);
|
||||||
Q_ASSERT(pm3.isNull());
|
QVERIFY(pm3.isNull());
|
||||||
|
|
||||||
pm3 = QMessageBox::standardIcon(QMessageBox::Information);
|
pm3 = QMessageBox::standardIcon(QMessageBox::Information);
|
||||||
Q_ASSERT(!pm3.isNull());
|
QVERIFY(!pm3.isNull());
|
||||||
#endif //QT3_SUPPORT
|
#endif //QT3_SUPPORT
|
||||||
|
|
||||||
QMessageBox::about(&mb1, "title", "text");
|
QMessageBox::about(&mb1, "title", "text");
|
||||||
|
@ -1697,8 +1697,8 @@ void tst_QPixmap::fromImageReaderAnimatedGif()
|
|||||||
QImageReader referenceReader(path);
|
QImageReader referenceReader(path);
|
||||||
QImageReader pixmapReader(path);
|
QImageReader pixmapReader(path);
|
||||||
|
|
||||||
Q_ASSERT(referenceReader.canRead());
|
QVERIFY(referenceReader.canRead());
|
||||||
Q_ASSERT(referenceReader.imageCount() > 1);
|
QVERIFY(referenceReader.imageCount() > 1);
|
||||||
|
|
||||||
for (int i = 0; i < referenceReader.imageCount(); ++i) {
|
for (int i = 0; i < referenceReader.imageCount(); ++i) {
|
||||||
QImage refImage = referenceReader.read();
|
QImage refImage = referenceReader.read();
|
||||||
|
@ -668,7 +668,7 @@ void tst_QProcess::exitStatus()
|
|||||||
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
|
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_ASSERT(processList.count() == exitStatus.count());
|
QCOMPARE(exitStatus.count(), processList.count());
|
||||||
for (int i = 0; i < processList.count(); ++i) {
|
for (int i = 0; i < processList.count(); ++i) {
|
||||||
process->start(processList.at(i));
|
process->start(processList.at(i));
|
||||||
QVERIFY(process->waitForStarted(5000));
|
QVERIFY(process->waitForStarted(5000));
|
||||||
|
@ -284,8 +284,8 @@ void tst_QSharedPointer::operators()
|
|||||||
QSharedPointer<char> p1;
|
QSharedPointer<char> p1;
|
||||||
QSharedPointer<char> p2(new char);
|
QSharedPointer<char> p2(new char);
|
||||||
qptrdiff diff = p2.data() - p1.data();
|
qptrdiff diff = p2.data() - p1.data();
|
||||||
Q_ASSERT(p1.data() != p2.data());
|
QVERIFY(p1.data() != p2.data());
|
||||||
Q_ASSERT(diff != 0);
|
QVERIFY(diff != 0);
|
||||||
|
|
||||||
// operator-
|
// operator-
|
||||||
QCOMPARE(p2 - p1.data(), diff);
|
QCOMPARE(p2 - p1.data(), diff);
|
||||||
@ -868,8 +868,8 @@ void tst_QSharedPointer::differentPointers()
|
|||||||
{
|
{
|
||||||
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
|
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
|
||||||
Data *aBase = aData;
|
Data *aBase = aData;
|
||||||
Q_ASSERT(aData == aBase);
|
QVERIFY(aData == aBase);
|
||||||
Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
||||||
|
|
||||||
QSharedPointer<Data> baseptr = QSharedPointer<Data>(aData);
|
QSharedPointer<Data> baseptr = QSharedPointer<Data>(aData);
|
||||||
QSharedPointer<DiffPtrDerivedData> ptr = qSharedPointerCast<DiffPtrDerivedData>(baseptr);
|
QSharedPointer<DiffPtrDerivedData> ptr = qSharedPointerCast<DiffPtrDerivedData>(baseptr);
|
||||||
@ -886,8 +886,8 @@ void tst_QSharedPointer::differentPointers()
|
|||||||
{
|
{
|
||||||
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
|
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
|
||||||
Data *aBase = aData;
|
Data *aBase = aData;
|
||||||
Q_ASSERT(aData == aBase);
|
QVERIFY(aData == aBase);
|
||||||
Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
||||||
|
|
||||||
QSharedPointer<DiffPtrDerivedData> ptr = QSharedPointer<DiffPtrDerivedData>(aData);
|
QSharedPointer<DiffPtrDerivedData> ptr = QSharedPointer<DiffPtrDerivedData>(aData);
|
||||||
QSharedPointer<Data> baseptr = ptr;
|
QSharedPointer<Data> baseptr = ptr;
|
||||||
@ -909,8 +909,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
|
|||||||
{
|
{
|
||||||
VirtualDerived *aData = new VirtualDerived;
|
VirtualDerived *aData = new VirtualDerived;
|
||||||
Data *aBase = aData;
|
Data *aBase = aData;
|
||||||
Q_ASSERT(aData == aBase);
|
QVERIFY(aData == aBase);
|
||||||
Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
||||||
|
|
||||||
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
|
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
|
||||||
QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr);
|
QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr);
|
||||||
@ -929,8 +929,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
|
|||||||
{
|
{
|
||||||
VirtualDerived *aData = new VirtualDerived;
|
VirtualDerived *aData = new VirtualDerived;
|
||||||
Data *aBase = aData;
|
Data *aBase = aData;
|
||||||
Q_ASSERT(aData == aBase);
|
QVERIFY(aData == aBase);
|
||||||
Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
QVERIFY(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
|
||||||
|
|
||||||
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
|
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
|
||||||
QSharedPointer<Data> baseptr = ptr;
|
QSharedPointer<Data> baseptr = ptr;
|
||||||
@ -1606,7 +1606,7 @@ void hashAndMapTest()
|
|||||||
QVERIFY(it != c.find(Key()));
|
QVERIFY(it != c.find(Key()));
|
||||||
|
|
||||||
if (Ordered) {
|
if (Ordered) {
|
||||||
Q_ASSERT(k0 < k1);
|
QVERIFY(k0 < k1);
|
||||||
|
|
||||||
it = c.begin();
|
it = c.begin();
|
||||||
QCOMPARE(it.key(), k0);
|
QCOMPARE(it.key(), k0);
|
||||||
|
@ -1340,14 +1340,14 @@ void tst_QSplitter::task187373_addAbstractScrollAreas()
|
|||||||
QFETCH(QString, className);
|
QFETCH(QString, className);
|
||||||
QFETCH(bool, addInConstructor);
|
QFETCH(bool, addInConstructor);
|
||||||
QFETCH(bool, addOutsideConstructor);
|
QFETCH(bool, addOutsideConstructor);
|
||||||
Q_ASSERT(addInConstructor || addOutsideConstructor);
|
QVERIFY(addInConstructor || addOutsideConstructor);
|
||||||
|
|
||||||
QSplitter *splitter = new QSplitter;
|
QSplitter *splitter = new QSplitter;
|
||||||
splitter->show();
|
splitter->show();
|
||||||
Q_ASSERT(splitter->isVisible());
|
QVERIFY(splitter->isVisible());
|
||||||
|
|
||||||
QAbstractScrollArea *w = task187373_createScrollArea(splitter, className, addInConstructor);
|
QAbstractScrollArea *w = task187373_createScrollArea(splitter, className, addInConstructor);
|
||||||
Q_ASSERT(w);
|
QVERIFY(w);
|
||||||
if (addOutsideConstructor)
|
if (addOutsideConstructor)
|
||||||
splitter->addWidget(w);
|
splitter->addWidget(w);
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db)
|
|||||||
Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db);
|
Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db);
|
||||||
QVERIFY_SQL(cur, select());
|
QVERIFY_SQL(cur, select());
|
||||||
QSqlRecord* rec = cur.primeInsert();
|
QSqlRecord* rec = cur.primeInsert();
|
||||||
Q_ASSERT(rec);
|
QVERIFY(rec);
|
||||||
rec->setValue("id", pkey++);
|
rec->setValue("id", pkey++);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) {
|
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);
|
Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db);
|
||||||
QVERIFY_SQL(cur, select());
|
QVERIFY_SQL(cur, select());
|
||||||
QSqlRecord* rec = cur.primeInsert();
|
QSqlRecord* rec = cur.primeInsert();
|
||||||
Q_ASSERT(rec);
|
QVERIFY(rec);
|
||||||
rec->setValue("id", pkey++);
|
rec->setValue("id", pkey++);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) {
|
for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) {
|
||||||
|
@ -3429,9 +3429,9 @@ void tst_QString::fromLatin1Roundtrip()
|
|||||||
QFETCH(QString, unicode);
|
QFETCH(QString, unicode);
|
||||||
|
|
||||||
// QtTest safety check:
|
// QtTest safety check:
|
||||||
Q_ASSERT(latin1.isNull() == unicode.isNull());
|
QCOMPARE(latin1.isNull(), unicode.isNull());
|
||||||
Q_ASSERT(latin1.isEmpty() == unicode.isEmpty());
|
QCOMPARE(latin1.isEmpty(), unicode.isEmpty());
|
||||||
Q_ASSERT(latin1.length() == unicode.length());
|
QCOMPARE(latin1.length(), unicode.length());
|
||||||
|
|
||||||
if (!latin1.isEmpty())
|
if (!latin1.isEmpty())
|
||||||
while (latin1.length() < 128) {
|
while (latin1.length() < 128) {
|
||||||
@ -3484,12 +3484,12 @@ void tst_QString::toLatin1Roundtrip()
|
|||||||
QFETCH(QString, unicodedst);
|
QFETCH(QString, unicodedst);
|
||||||
|
|
||||||
// QtTest safety check:
|
// QtTest safety check:
|
||||||
Q_ASSERT(latin1.isNull() == unicodesrc.isNull());
|
QCOMPARE(latin1.isNull(), unicodesrc.isNull());
|
||||||
Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty());
|
QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty());
|
||||||
Q_ASSERT(latin1.length() == unicodesrc.length());
|
QCOMPARE(latin1.length(), unicodesrc.length());
|
||||||
Q_ASSERT(latin1.isNull() == unicodedst.isNull());
|
QCOMPARE(latin1.isNull(), unicodedst.isNull());
|
||||||
Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty());
|
QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty());
|
||||||
Q_ASSERT(latin1.length() == unicodedst.length());
|
QCOMPARE(latin1.length(), unicodedst.length());
|
||||||
|
|
||||||
if (!latin1.isEmpty())
|
if (!latin1.isEmpty())
|
||||||
while (latin1.length() < 128) {
|
while (latin1.length() < 128) {
|
||||||
@ -3519,12 +3519,12 @@ void tst_QString::stringRef_toLatin1Roundtrip()
|
|||||||
QFETCH(QString, unicodedst);
|
QFETCH(QString, unicodedst);
|
||||||
|
|
||||||
// QtTest safety check:
|
// QtTest safety check:
|
||||||
Q_ASSERT(latin1.isNull() == unicodesrc.isNull());
|
QCOMPARE(latin1.isNull(), unicodesrc.isNull());
|
||||||
Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty());
|
QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty());
|
||||||
Q_ASSERT(latin1.length() == unicodesrc.length());
|
QCOMPARE(latin1.length(), unicodesrc.length());
|
||||||
Q_ASSERT(latin1.isNull() == unicodedst.isNull());
|
QCOMPARE(latin1.isNull(), unicodedst.isNull());
|
||||||
Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty());
|
QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty());
|
||||||
Q_ASSERT(latin1.length() == unicodedst.length());
|
QCOMPARE(latin1.length(), unicodedst.length());
|
||||||
|
|
||||||
if (!latin1.isEmpty())
|
if (!latin1.isEmpty())
|
||||||
while (latin1.length() < 128) {
|
while (latin1.length() < 128) {
|
||||||
|
@ -123,14 +123,14 @@ void tst_QTextBoundaryFinder::graphemeBoundaries()
|
|||||||
if (test.at(pos).unicode() == 0xf7)
|
if (test.at(pos).unicode() == 0xf7)
|
||||||
breakPositions.append(strPos);
|
breakPositions.append(strPos);
|
||||||
else
|
else
|
||||||
Q_ASSERT(test.at(pos).unicode() == 0xd7);
|
QVERIFY(test.at(pos).unicode() == 0xd7);
|
||||||
++pos;
|
++pos;
|
||||||
if (pos < test.length()) {
|
if (pos < test.length()) {
|
||||||
Q_ASSERT(pos < test.length() - 4);
|
QVERIFY(pos < test.length() - 4);
|
||||||
QString hex = test.mid(pos, 4);
|
QString hex = test.mid(pos, 4);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
testString.append(QChar(hex.toInt(&ok, 16)));
|
testString.append(QChar(hex.toInt(&ok, 16)));
|
||||||
Q_ASSERT(ok);
|
QVERIFY(ok);
|
||||||
pos += 4;
|
pos += 4;
|
||||||
}
|
}
|
||||||
++strPos;
|
++strPos;
|
||||||
@ -176,14 +176,14 @@ void tst_QTextBoundaryFinder::wordBoundaries()
|
|||||||
if (test.at(pos).unicode() == 0xf7)
|
if (test.at(pos).unicode() == 0xf7)
|
||||||
breakPositions.append(strPos);
|
breakPositions.append(strPos);
|
||||||
else
|
else
|
||||||
Q_ASSERT(test.at(pos).unicode() == 0xd7);
|
QVERIFY(test.at(pos).unicode() == 0xd7);
|
||||||
++pos;
|
++pos;
|
||||||
if (pos < test.length()) {
|
if (pos < test.length()) {
|
||||||
Q_ASSERT(pos < test.length() - 4);
|
QVERIFY(pos < test.length() - 4);
|
||||||
QString hex = test.mid(pos, 4);
|
QString hex = test.mid(pos, 4);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
testString.append(QChar(hex.toInt(&ok, 16)));
|
testString.append(QChar(hex.toInt(&ok, 16)));
|
||||||
Q_ASSERT(ok);
|
QVERIFY(ok);
|
||||||
pos += 4;
|
pos += 4;
|
||||||
}
|
}
|
||||||
++strPos;
|
++strPos;
|
||||||
@ -228,14 +228,14 @@ void tst_QTextBoundaryFinder::sentenceBoundaries()
|
|||||||
if (test.at(pos).unicode() == 0xf7)
|
if (test.at(pos).unicode() == 0xf7)
|
||||||
breakPositions.append(strPos);
|
breakPositions.append(strPos);
|
||||||
else
|
else
|
||||||
Q_ASSERT(test.at(pos).unicode() == 0xd7);
|
QVERIFY(test.at(pos).unicode() == 0xd7);
|
||||||
++pos;
|
++pos;
|
||||||
if (pos < test.length()) {
|
if (pos < test.length()) {
|
||||||
Q_ASSERT(pos < test.length() - 4);
|
QVERIFY(pos < test.length() - 4);
|
||||||
QString hex = test.mid(pos, 4);
|
QString hex = test.mid(pos, 4);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
testString.append(QChar(hex.toInt(&ok, 16)));
|
testString.append(QChar(hex.toInt(&ok, 16)));
|
||||||
Q_ASSERT(ok);
|
QVERIFY(ok);
|
||||||
pos += 4;
|
pos += 4;
|
||||||
}
|
}
|
||||||
++strPos;
|
++strPos;
|
||||||
|
@ -428,7 +428,7 @@ void tst_QTextCodec::flagCodepointFFFF() const
|
|||||||
QString input(ch);
|
QString input(ch);
|
||||||
|
|
||||||
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
||||||
Q_ASSERT(codec);
|
QVERIFY(codec);
|
||||||
|
|
||||||
const QByteArray asDecoded(codec->fromUnicode(input));
|
const QByteArray asDecoded(codec->fromUnicode(input));
|
||||||
QCOMPARE(asDecoded, QByteArray("?"));
|
QCOMPARE(asDecoded, QByteArray("?"));
|
||||||
@ -465,7 +465,7 @@ void tst_QTextCodec::flagF7808080() const
|
|||||||
|
|
||||||
|
|
||||||
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
||||||
Q_ASSERT(codec);
|
QVERIFY(codec);
|
||||||
|
|
||||||
//QVERIFY(!codec->canEncode(QChar(0x1C0000)));
|
//QVERIFY(!codec->canEncode(QChar(0x1C0000)));
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ void tst_QTextCodec::flagEFBFBF() const
|
|||||||
invalidInput[2] = char(0xBF);
|
invalidInput[2] = char(0xBF);
|
||||||
|
|
||||||
const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
||||||
Q_ASSERT(codec);
|
QVERIFY(codec);
|
||||||
|
|
||||||
{
|
{
|
||||||
//QVERIFY(!codec->canEncode(QChar(0xFFFF)));
|
//QVERIFY(!codec->canEncode(QChar(0xFFFF)));
|
||||||
@ -1627,7 +1627,7 @@ void tst_QTextCodec::utf8bom()
|
|||||||
QFETCH(QString, result);
|
QFETCH(QString, result);
|
||||||
|
|
||||||
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
|
||||||
Q_ASSERT(codec);
|
QVERIFY(codec);
|
||||||
|
|
||||||
QCOMPARE(codec->toUnicode(data.constData(), data.length(), 0), result);
|
QCOMPARE(codec->toUnicode(data.constData(), data.length(), 0), result);
|
||||||
|
|
||||||
|
@ -7234,8 +7234,7 @@ void tst_QWidget::render_systemClip2()
|
|||||||
QFETCH(bool, usePaintEvent);
|
QFETCH(bool, usePaintEvent);
|
||||||
QFETCH(QColor, expectedColor);
|
QFETCH(QColor, expectedColor);
|
||||||
|
|
||||||
Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO,
|
QVERIFY2(expectedColor != QColor(Qt::red), "Qt::red is the reference color for the image, pick another color");
|
||||||
"Qt::red is the reference color for the image, pick another color");
|
|
||||||
|
|
||||||
class MyWidget : public QWidget
|
class MyWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user