From 882bf3475c8926abe62ed71e6719458b024caac0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 13 Jan 2014 15:48:44 +0100 Subject: expand tabs and related whitespace fixes in *.{cpp,h,qdoc} the diff -w for this commit is empty. Started-by: Thiago Macieira Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira --- tests/auto/gui/image/qimage/tst_qimage.cpp | 18 +- .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 2 +- .../gui/kernel/qkeysequence/tst_qkeysequence.cpp | 26 +- .../gui/kernel/qmouseevent/tst_qmouseevent.cpp | 24 +- .../qmouseevent_modal/tst_qmouseevent_modal.cpp | 8 +- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 52 +- .../painting/qpainter/utils/createImages/main.cpp | 100 +- tests/auto/gui/painting/qpen/tst_qpen.cpp | 24 +- tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp | 10 +- tests/auto/gui/painting/qregion/tst_qregion.cpp | 186 +-- tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp | 218 +-- tests/auto/gui/text/qfont/tst_qfont.cpp | 158 +- .../gui/text/qfontdatabase/tst_qfontdatabase.cpp | 10 +- .../gui/text/qfontmetrics/tst_qfontmetrics.cpp | 2 +- tests/auto/gui/text/qtextdocument/common.h | 10 +- .../tst_qtextdocumentfragment.cpp | 198 +-- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 110 +- tests/auto/gui/text/qtextlist/tst_qtextlist.cpp | 2 +- .../text/qtextpiecetable/tst_qtextpiecetable.cpp | 180 +-- .../qnetworksession/test/tst_qnetworksession.cpp | 12 +- .../network/socket/qtcpsocket/stressTest/Test.h | 2 +- tests/auto/other/atwrapper/atWrapperAutotest.cpp | 2 +- tests/auto/other/collections/tst_collections.cpp | 1628 ++++++++++---------- tests/auto/other/qcomplextext/tst_qcomplextext.cpp | 58 +- tests/auto/other/qfocusevent/tst_qfocusevent.cpp | 4 +- .../sql/kernel/qsqldatabase/tst_qsqldatabase.cpp | 224 +-- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 2 +- .../auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp | 98 +- .../models/qsqlquerymodel/tst_qsqlquerymodel.cpp | 16 +- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 2 +- .../dialogs/qfiledialog2/tst_qfiledialog2.cpp | 4 +- .../qfilesystemmodel/tst_qfilesystemmodel.cpp | 10 +- .../dialogs/qfontdialog/tst_qfontdialog.cpp | 10 +- .../dialogs/qinputdialog/tst_qinputdialog.cpp | 4 +- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 2 +- .../tst_qgraphicsgridlayout.cpp | 2 +- .../tst_qgraphicslinearlayout.cpp | 4 +- .../tst_qgraphicsproxywidget.cpp | 36 +- .../qabstractitemview/tst_qabstractitemview.cpp | 8 +- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 28 +- .../itemviews/qtableview/tst_qtableview.cpp | 22 +- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 26 +- .../kernel/qapplication/tst_qapplication.cpp | 90 +- .../widgets/kernel/qformlayout/tst_qformlayout.cpp | 2 +- .../widgets/kernel/qgridlayout/tst_qgridlayout.cpp | 4 +- .../widgets/kernel/qshortcut/tst_qshortcut.cpp | 318 ++-- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 42 +- .../qabstractbutton/tst_qabstractbutton.cpp | 2 +- .../qcalendarwidget/tst_qcalendarwidget.cpp | 2 +- .../widgets/qdockwidget/tst_qdockwidget.cpp | 18 +- .../widgets/qdoublespinbox/tst_qdoublespinbox.cpp | 2 +- tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp | 4 +- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 2 +- .../widgets/qmainwindow/tst_qmainwindow.cpp | 6 +- .../auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 56 +- .../widgets/qpushbutton/tst_qpushbutton.cpp | 6 +- .../auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp | 6 +- .../xml/sax/qxmlsimplereader/parser/parser.cpp | 284 ++-- .../auto/xml/sax/qxmlsimplereader/parser/parser.h | 16 +- .../sax/qxmlsimplereader/tst_qxmlsimplereader.cpp | 82 +- 60 files changed, 2242 insertions(+), 2242 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 5016abff4f..254428958e 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -194,9 +194,9 @@ void tst_QImage::create() #if !defined(Q_OS_WINCE) QT_TRY { #endif - //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); - QImage image(7000000, 7000000, QImage::Format_Indexed8); - image.setColorCount(256); + //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); + QImage image(7000000, 7000000, QImage::Format_Indexed8); + image.setColorCount(256); cr = !image.isNull(); #if !defined(Q_OS_WINCE) } QT_CATCH (...) { @@ -309,16 +309,16 @@ void tst_QImage::formatHandlersInput() bool formatSupported = false; for (QList::Iterator it = formats.begin(); it != formats.end(); ++it) { if (*it == testFormat.toLower()) { - formatSupported = true; - break; - } + formatSupported = true; + break; + } } if (formatSupported) { // qDebug(QImage::imageFormat(testFile)); - QCOMPARE(testFormat.toLatin1().toLower(), QImageReader::imageFormat(testFile)); + QCOMPARE(testFormat.toLatin1().toLower(), QImageReader::imageFormat(testFile)); } else { - QString msg = "Format not supported : "; - QSKIP(QString(msg + testFormat).toLatin1()); + QString msg = "Format not supported : "; + QSKIP(QString(msg + testFormat).toLatin1()); } } diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index 085dfd0461..761f6371db 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1468,7 +1468,7 @@ static QModelIndex indexFromText(QStandardItemModel *model, const QString &text) struct FriendlyTreeView : public QTreeView { friend class tst_QStandardItemModel; - Q_DECLARE_PRIVATE(QTreeView) + Q_DECLARE_PRIVATE(QTreeView) }; #endif diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index bd7bd3a464..161a1692ca 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -528,7 +528,7 @@ void tst_QKeySequence::toStringFromKeycode() void tst_QKeySequence::streamOperators_data() { - operatorQString_data(); + operatorQString_data(); } void tst_QKeySequence::streamOperators() @@ -536,21 +536,21 @@ void tst_QKeySequence::streamOperators() QFETCH( int, modifiers ); QFETCH( int, keycode ); - QByteArray data; - QKeySequence refK( modifiers | keycode ); - QKeySequence orgK( "Ctrl+A" ); - QKeySequence copyOrgK = orgK; - QVERIFY( copyOrgK == orgK ); + QByteArray data; + QKeySequence refK( modifiers | keycode ); + QKeySequence orgK( "Ctrl+A" ); + QKeySequence copyOrgK = orgK; + QVERIFY( copyOrgK == orgK ); - QDataStream in(&data, QIODevice::WriteOnly); - in << refK; - QDataStream out(&data, QIODevice::ReadOnly); - out >> orgK; + QDataStream in(&data, QIODevice::WriteOnly); + in << refK; + QDataStream out(&data, QIODevice::ReadOnly); + out >> orgK; - QVERIFY( orgK == refK ); + QVERIFY( orgK == refK ); - // check if detached - QVERIFY( orgK != copyOrgK ); + // check if detached + QVERIFY( orgK != copyOrgK ); } diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index 424b5fea3a..828c1fc41f 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -61,21 +61,21 @@ public: protected: void mousePressEvent(QMouseEvent *e) { - QWindow::mousePressEvent(e); - mousePressButton = e->button(); - mousePressButtons = e->buttons(); - mousePressModifiers = e->modifiers(); - mousePressEventRecieved = true; - e->accept(); + QWindow::mousePressEvent(e); + mousePressButton = e->button(); + mousePressButtons = e->buttons(); + mousePressModifiers = e->modifiers(); + mousePressEventRecieved = true; + e->accept(); } void mouseReleaseEvent(QMouseEvent *e) { - QWindow::mouseReleaseEvent(e); - mouseReleaseButton = e->button(); - mouseReleaseButtons = e->buttons(); - mouseReleaseModifiers = e->modifiers(); - mouseReleaseEventRecieved = true; - e->accept(); + QWindow::mouseReleaseEvent(e); + mouseReleaseButton = e->button(); + mouseReleaseButtons = e->buttons(); + mouseReleaseModifiers = e->modifiers(); + mouseReleaseEventRecieved = true; + e->accept(); } }; diff --git a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp index ef800bd995..48f079a24e 100644 --- a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp +++ b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp @@ -183,9 +183,9 @@ TstWidget::TstWidget() connect( pb, SIGNAL(pressed()), this, SLOT(buttonPressed()) ); -// QScrollBar *sb = new QScrollBar( Qt::Horizontal, this ); +// QScrollBar *sb = new QScrollBar( Qt::Horizontal, this ); -// sb->setGeometry( 5, pb->geometry().bottom() + 5, 100, sb->sizeHint().height() ); +// sb->setGeometry( 5, pb->geometry().bottom() + 5, 100, sb->sizeHint().height() ); d = new TstDialog( pb, this , 0 ); } @@ -218,8 +218,8 @@ void TstDialog::releaseMouse() void TstDialog::closeDialog() { if ( isVisible() ) { - c++; - accept(); + c++; + accept(); } } diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 27c0f6e66a..d288665c44 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -511,7 +511,7 @@ void tst_QPainter::drawPixmap_comp() bool different = false; for (int y=0; y off) || (qAbs(qAlpha(pix) - qAlpha(expected)) > off); } - if (diff && !different) - qDebug( "Different at %d,%d pixel [%d,%d,%d,%d] expected [%d,%d,%d,%d]", x, y, + if (diff && !different) + qDebug( "Different at %d,%d pixel [%d,%d,%d,%d] expected [%d,%d,%d,%d]", x, y, qRed(result.pixel(x, y)), qGreen(result.pixel(x, y)), qBlue(result.pixel(x, y)), qAlpha(result.pixel(x, y)), qRed(expected), qGreen(expected), qBlue(expected), qAlpha(expected)); - different |= diff; + different |= diff; } QVERIFY(!different); @@ -560,24 +560,24 @@ void tst_QPainter::saveAndRestore_data() QRect viewport = p.viewport(); QTest::newRow("Original") << font << pen << brush << backgroundColor << int(backgroundMode) - << brushOrigin << clipRegion << window << viewport; + << brushOrigin << clipRegion << window << viewport; QFont font2 = font; font2.setPointSize( 24 ); QTest::newRow("Modified font.pointSize, brush, backgroundColor, backgroundMode") << font2 << pen << QBrush(Qt::red) << QColor(Qt::blue) << int(Qt::TransparentMode) - << brushOrigin << clipRegion << window << viewport; + << brushOrigin << clipRegion << window << viewport; font2 = font; font2.setPixelSize( 20 ); QTest::newRow("Modified font.pixelSize, brushOrigin, pos") << font2 << pen << brush << backgroundColor << int(backgroundMode) - << QPoint( 50, 32 ) << clipRegion << window << viewport; + << QPoint( 50, 32 ) << clipRegion << window << viewport; QTest::newRow("Modified clipRegion, window, viewport") << font << pen << brush << backgroundColor << int(backgroundMode) - << brushOrigin << clipRegion.subtracted(QRect(10,10,50,30)) - << QRect(-500, -500, 500, 500 ) << QRect( 0, 0, 50, 50 ); + << brushOrigin << clipRegion.subtracted(QRect(10,10,50,30)) + << QRect(-500, -500, 500, 500 ) << QRect( 0, 0, 50, 50 ); } void tst_QPainter::saveAndRestore() @@ -662,13 +662,13 @@ QBitmap tst_QPainter::getBitmap( const QString &dir, const QString &filename, bo return QBitmap(); } if ( mask ) { - QBitmap mask; - QString maskFilename = dir + QString( "/%1-mask.xbm" ).arg( filename ); - if ( !mask.load( maskFilename ) ) { - QWARN(QString("Could not load mask '%1'").arg(maskFilename).toLatin1()); - return QBitmap(); - } - bm.setMask( mask ); + QBitmap mask; + QString maskFilename = dir + QString( "/%1-mask.xbm" ).arg( filename ); + if (!mask.load(maskFilename)) { + QWARN(QString("Could not load mask '%1'").arg(maskFilename).toLatin1()); + return QBitmap(); + } + bm.setMask( mask ); } return bm; } @@ -698,17 +698,17 @@ static QRect getPaintedSize(const QImage &image, const QColor &background) uint color = background.rgba(); for ( int y = 0; y < image.height(); ++y ) { - for ( int x = 0; x < image.width(); ++x ) { + for (int x = 0; x < image.width(); ++x) { QRgb pixel = image.pixel( x, y ); - if ( pixel != color && x < xmin ) - xmin = x; - if ( pixel != color && x > xmax ) - xmax = x; - if ( pixel != color && y < ymin ) - ymin = y; - if ( pixel != color && y > ymax ) - ymax = y; - } + if (pixel != color && x < xmin) + xmin = x; + if (pixel != color && x > xmax) + xmax = x; + if (pixel != color && y < ymin) + ymin = y; + if (pixel != color && y > ymax) + ymax = y; + } } return QRect(xmin, ymin, xmax - xmin + 1, ymax - ymin + 1); diff --git a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp index 11ce8b947b..a6bf4eca8b 100644 --- a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp +++ b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp @@ -61,15 +61,15 @@ static QPixmap createDestPixmap() QPainter painter; painter.begin( &pm ); for ( int i=0; i 0 ) { - QBitmap mask( totalSize, totalSize, true ); - QPainter painter; - painter.begin( &mask ); - painter.setPen( QPen( Qt::color1, 1 ) ); - painter.setBrush( Qt::color1 ); - painter.drawRect( border, border, size, size ); - painter.end(); - bm.setMask( mask ); + QBitmap mask(totalSize, totalSize, true); + QPainter painter; + painter.begin(&mask); + painter.setPen(QPen(Qt::color1, 1)); + painter.setBrush(Qt::color1); + painter.drawRect(border, border, size, size); + painter.end(); + bm.setMask(mask); } return bm; } @@ -146,49 +146,49 @@ int main( int argc, char **argv ) // input for tst_QPainter::drawLine_rop_bitmap() { - QBitmap dst = createDestBitmap(); - dst.save( "../../drawLine_rop_bitmap/dst.xbm", "XBM" ); + QBitmap dst = createDestBitmap(); + dst.save("../../drawLine_rop_bitmap/dst.xbm", "XBM"); } // input for tst_QPainter::drawPixmap_rop_bitmap() { - QBitmap dst = createDestBitmap(); - QBitmap src1 = createSrcBitmap( 4, 2 ); - QBitmap src2 = createSrcBitmap( 4, 0 ); - dst.save( "../../drawPixmap_rop_bitmap/dst.xbm", "XBM" ); - src1.save( "../../drawPixmap_rop_bitmap/src1.xbm", "XBM" ); - src1.mask()->save( "../../drawPixmap_rop_bitmap/src1-mask.xbm", "XBM" ); - src2.save( "../../drawPixmap_rop_bitmap/src2.xbm", "XBM" ); + QBitmap dst = createDestBitmap(); + QBitmap src1 = createSrcBitmap(4, 2); + QBitmap src2 = createSrcBitmap(4, 0); + dst.save("../../drawPixmap_rop_bitmap/dst.xbm", "XBM"); + src1.save("../../drawPixmap_rop_bitmap/src1.xbm", "XBM"); + src1.mask()->save("../../drawPixmap_rop_bitmap/src1-mask.xbm", "XBM"); + src2.save("../../drawPixmap_rop_bitmap/src2.xbm", "XBM"); } // input for tst_QPainter::drawPixmap_rop() { - QPixmap dst1 = createDestPixmap(); - QPixmap dst2 = createDestPixmap(); - dst2.resize( 32, 32 ); - QBitmap src1 = createSrcBitmap( 32, 0 ); + QPixmap dst1 = createDestPixmap(); + QPixmap dst2 = createDestPixmap(); + dst2.resize(32, 32); + QBitmap src1 = createSrcBitmap(32, 0); - QBitmap src_tmp = createSrcBitmap( 32, 0 ).xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); - src_tmp.resize( 32, 48 ); - QBitmap src2 = src_tmp.xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); - QBitmap mask( 32, 48, true ); - { - QPainter painter; - painter.begin( &mask ); - painter.setPen( QPen( Qt::color1, 1 ) ); - painter.setBrush( Qt::color1 ); - painter.drawRect( 0, 16, 32, 32 ); - painter.end(); - } - src2.setMask( mask ); + QBitmap src_tmp = createSrcBitmap(32, 0).xForm(QWMatrix(1, 0, 0, -1, 0, 0)); + src_tmp.resize(32, 48); + QBitmap src2 = src_tmp.xForm(QWMatrix(1, 0, 0, -1, 0, 0)); + QBitmap mask(32, 48, true); + { + QPainter painter; + painter.begin(&mask); + painter.setPen(QPen(Qt::color1, 1)); + painter.setBrush(Qt::color1); + painter.drawRect(0, 16, 32, 32); + painter.end(); + } + src2.setMask(mask); - QBitmap src3 = createSrcBitmap( 32, 0 ).xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); + QBitmap src3 = createSrcBitmap(32, 0).xForm(QWMatrix(1, 0, 0, -1, 0, 0)); - dst1.save( "../../drawPixmap_rop/dst1.png", "PNG" ); - dst2.save( "../../drawPixmap_rop/dst2.png", "PNG" ); - src1.save( "../../drawPixmap_rop/src1.xbm", "XBM" ); - src2.save( "../../drawPixmap_rop/src2.xbm", "XBM" ); - src2.mask()->save( "../../drawPixmap_rop/src2-mask.xbm", "XBM" ); - src3.save( "../../drawPixmap_rop/src3.xbm", "XBM" ); + dst1.save("../../drawPixmap_rop/dst1.png", "PNG"); + dst2.save("../../drawPixmap_rop/dst2.png", "PNG"); + src1.save("../../drawPixmap_rop/src1.xbm", "XBM"); + src2.save("../../drawPixmap_rop/src2.xbm", "XBM"); + src2.mask()->save("../../drawPixmap_rop/src2-mask.xbm", "XBM"); + src3.save("../../drawPixmap_rop/src3.xbm", "XBM"); } } diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index 1444c4fc16..07c996d026 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -114,23 +114,23 @@ void tst_QPen::operator_eq_eq_data() QTest::addColumn("isEqual"); QTest::newRow("differentColor") << QPen(Qt::red) - << QPen(Qt::blue) - << false; + << QPen(Qt::blue) + << false; QTest::newRow("differentWidth") << QPen(Qt::red, 2) - << QPen(Qt::red, 3) - << false; + << QPen(Qt::red, 3) + << false; QTest::newRow("differentPenStyle") << QPen(Qt::red, 2, Qt::DashLine) - << QPen(Qt::red, 2, Qt::DotLine) - << false; + << QPen(Qt::red, 2, Qt::DotLine) + << false; QTest::newRow("differentCapStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << QPen(Qt::red, 2, Qt::DashLine, Qt::SquareCap, Qt::BevelJoin) - << false; + << QPen(Qt::red, 2, Qt::DashLine, Qt::SquareCap, Qt::BevelJoin) + << false; QTest::newRow("differentJoinStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin) - << false; + << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin) + << false; QTest::newRow("same") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << true; + << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) + << true; } diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp index 4a659a3159..07670b2ae2 100644 --- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp +++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp @@ -77,11 +77,11 @@ void tst_QPolygon::makeEllipse() // make sure that all points are R+-1 away from the center bool err = false; for (i = 1; i < pa.size(); i++) { - QPoint p = pa.at( i ); - double r = sqrt( pow( double(p.x() - R), 2.0 ) + pow( double(p.y() - R), 2.0 ) ); - // ### too strict ? at least from visual inspection it looks - // quite odd around the main axes. 2.0 passes easily. - err |= ( qAbs( r - double(R) ) > 2.0 ); + QPoint p = pa.at(i); + double r = sqrt(pow(double(p.x() - R), 2.0) + pow(double(p.y() - R), 2.0)); + // ### too strict ? at least from visual inspection it looks + // quite odd around the main axes. 2.0 passes easily. + err |= (qAbs(r - double(R)) > 2.0); } QVERIFY( !err ); } diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index c099611755..121d98e653 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -109,19 +109,19 @@ tst_QRegion::tst_QRegion() void tst_QRegion::boundingRect() { { - QRect rect; - QRegion region( rect ); - QCOMPARE( region.boundingRect(), rect ); + QRect rect; + QRegion region(rect); + QCOMPARE(region.boundingRect(), rect); } { - QRect rect( 10, -20, 30, 40 ); - QRegion region( rect ); - QCOMPARE( region.boundingRect(), rect ); + QRect rect(10, -20, 30, 40); + QRegion region(rect); + QCOMPARE(region.boundingRect(), rect); } { - QRect rect(15,25,10,10); - QRegion region( rect ); - QCOMPARE( region.boundingRect(), rect ); + QRect rect(15,25,10,10); + QRegion region(rect); + QCOMPARE(region.boundingRect(), rect); } } @@ -129,75 +129,75 @@ void tst_QRegion::boundingRect() void tst_QRegion::rects() { { - QRect rect; - QRegion region( rect ); - QVERIFY( region.isEmpty() ); - QVERIFY( region.rects().isEmpty() ); + QRect rect; + QRegion region(rect); + QVERIFY(region.isEmpty()); + QVERIFY(region.rects().isEmpty()); } { - QRect rect( 10, -20, 30, 40 ); - QRegion region( rect ); - QCOMPARE( region.rects().count(), 1 ); - QCOMPARE( region.rects()[0], rect ); + QRect rect(10, -20, 30, 40); + QRegion region(rect); + QCOMPARE(region.rects().count(), 1); + QCOMPARE(region.rects()[0], rect); } { - QRect r( QPoint(10, 10), QPoint(40, 40) ); - QRegion region( r ); - QVERIFY( region.contains( QPoint(10,10) ) ); - QVERIFY( region.contains( QPoint(20,40) ) ); - QVERIFY( region.contains( QPoint(40,20) ) ); - QVERIFY( !region.contains( QPoint(20,41) ) ); - QVERIFY( !region.contains( QPoint(41,20) ) ); + QRect r(QPoint(10, 10), QPoint(40, 40)); + QRegion region(r); + QVERIFY(region.contains(QPoint(10,10))); + QVERIFY(region.contains(QPoint(20,40))); + QVERIFY(region.contains(QPoint(40,20))); + QVERIFY(!region.contains(QPoint(20,41))); + QVERIFY(!region.contains(QPoint(41,20))); } { - QRect r( 10, 10, 30, 30 ); - QRegion region( r ); - QVERIFY( region.contains( QPoint(10,10) ) ); - QVERIFY( region.contains( QPoint(20,39) ) ); - QVERIFY( region.contains( QPoint(39,20) ) ); - QVERIFY( !region.contains( QPoint(20,40) ) ); - QVERIFY( !region.contains( QPoint(40,20) ) ); + QRect r(10, 10, 30, 30); + QRegion region(r); + QVERIFY(region.contains(QPoint(10,10))); + QVERIFY(region.contains(QPoint(20,39))); + QVERIFY(region.contains(QPoint(39,20))); + QVERIFY(!region.contains(QPoint(20,40))); + QVERIFY(!region.contains(QPoint(40,20))); } } void tst_QRegion::swap() { - QRegion r1(QRect( 0, 0,10,10)); + QRegion r1(QRect(0, 0,10,10)); QRegion r2(QRect(10,10,10,10)); r1.swap(r2); QCOMPARE(r1.rects().front(), QRect(10,10,10,10)); - QCOMPARE(r2.rects().front(), QRect( 0, 0,10,10)); + QCOMPARE(r2.rects().front(), QRect(0, 0,10,10)); } void tst_QRegion::setRects() { { - QRegion region; - region.setRects( 0, 0 ); - QVERIFY( region.rects().isEmpty() ); + QRegion region; + region.setRects(0, 0); + QVERIFY(region.rects().isEmpty()); } { - QRegion region; - QRect rect; - region.setRects( &rect, 0 ); + QRegion region; + QRect rect; + region.setRects(&rect, 0); QVERIFY(region.isEmpty()); QVERIFY(region == QRegion()); - QVERIFY(!region.boundingRect().isValid()); - QVERIFY(region.rects().isEmpty()); + QVERIFY(!region.boundingRect().isValid()); + QVERIFY(region.rects().isEmpty()); } { - QRegion region; - QRect rect; - region.setRects( &rect, 1 ); - QVERIFY( !region.boundingRect().isValid() ); - QVERIFY( region.rects().isEmpty() ); + QRegion region; + QRect rect; + region.setRects(&rect, 1); + QVERIFY(!region.boundingRect().isValid()); + QVERIFY(region.rects().isEmpty()); } { - QRegion region; - QRect rect( 10, -20, 30, 40 ); - region.setRects( &rect, 1 ); - QCOMPARE( region.rects().count(), 1 ); - QCOMPARE( region.rects()[0], rect ); + QRegion region; + QRect rect(10, -20, 30, 40); + region.setRects(&rect, 1); + QCOMPARE(region.rects().count(), 1); + QCOMPARE(region.rects()[0], rect); } } @@ -242,30 +242,30 @@ void tst_QRegion::polygonRegion() { QPolygon pa; { - QRegion region ( pa ); - QVERIFY( region.isEmpty() ); + QRegion region (pa); + QVERIFY(region.isEmpty()); } { - pa.setPoints( 8, 10, 10, // a____________b - 40, 10, // | | - 40, 20, // |___ ___| - 30, 20, // | | - 30, 40, // | | - 20, 40, // | | - 20, 20, // |____c - 10, 20 ); + pa.setPoints(8, 10, 10, // a____________b + 40, 10, // | | + 40, 20, // |___ ___| + 30, 20, // | | + 30, 40, // | | + 20, 40, // | | + 20, 20, // |____c + 10, 20); - QRegion region ( pa ); - QVERIFY( !region.isEmpty() ); + QRegion region (pa); + QVERIFY(!region.isEmpty()); - // These should not be inside the circle - QVERIFY( !region.contains( QPoint( 9, 9 ) ) ); - QVERIFY( !region.contains( QPoint( 30, 41 ) ) ); - QVERIFY( !region.contains( QPoint( 41, 10 ) ) ); - QVERIFY( !region.contains( QPoint( 31, 21 ) ) ); + // These should not be inside the circle + QVERIFY(!region.contains(QPoint( 9, 9))); + QVERIFY(!region.contains(QPoint(30, 41))); + QVERIFY(!region.contains(QPoint(41, 10))); + QVERIFY(!region.contains(QPoint(31, 21))); - // These should be inside - QVERIFY( region.contains( QPoint( 10, 10 ) ) ); // Upper-left (a) + // These should be inside + QVERIFY(region.contains(QPoint(10, 10))); // Upper-left (a) } } @@ -317,8 +317,8 @@ void tst_QRegion::emptyPolygonRegion() static const char *circle_xpm[] = { "20 20 2 1", - " c #FFFFFF", - ". c #000000", + " c #FFFFFF", + ". c #000000", " ...... ", " .......... ", " .............. ", @@ -345,29 +345,29 @@ void tst_QRegion::bitmapRegion() { QBitmap circle; { - QRegion region( circle ); - QVERIFY( region.isEmpty() ); + QRegion region(circle); + QVERIFY(region.isEmpty()); } { - circle = QPixmap( circle_xpm ); - QRegion region( circle ); - - //// These should not be inside the circe - QVERIFY( !region.contains( QPoint( 2, 2 ) ) ); - QVERIFY( !region.contains( QPoint( 2, 17 ) ) ); - QVERIFY( !region.contains( QPoint( 17, 2 ) ) ); - QVERIFY( !region.contains( QPoint( 17, 17 ) ) ); - - //// These should be inside - QVERIFY( region.contains( QPoint( 3, 3 ) ) ); - QVERIFY( region.contains( QPoint( 3, 16 ) ) ); - QVERIFY( region.contains( QPoint( 16, 3 ) ) ); - QVERIFY( region.contains( QPoint( 16, 16 ) ) ); - - QVERIFY( region.contains( QPoint( 0, 10 ) ) ); // Mid-left - QVERIFY( region.contains( QPoint( 10, 0 ) ) ); // Mid-top - QVERIFY( region.contains( QPoint( 19, 10 ) ) ); // Mid-right - QVERIFY( region.contains( QPoint( 10, 19 ) ) ); // Mid-bottom + circle = QPixmap(circle_xpm); + QRegion region(circle); + + //// These should not be inside the circe + QVERIFY(!region.contains(QPoint(2, 2))); + QVERIFY(!region.contains(QPoint(2, 17))); + QVERIFY(!region.contains(QPoint(17, 2))); + QVERIFY(!region.contains(QPoint(17, 17))); + + //// These should be inside + QVERIFY(region.contains(QPoint(3, 3))); + QVERIFY(region.contains(QPoint(3, 16))); + QVERIFY(region.contains(QPoint(16, 3))); + QVERIFY(region.contains(QPoint(16, 16))); + + QVERIFY(region.contains(QPoint(0, 10))); // Mid-left + QVERIFY(region.contains(QPoint(10, 0))); // Mid-top + QVERIFY(region.contains(QPoint(19, 10))); // Mid-right + QVERIFY(region.contains(QPoint(10, 19))); // Mid-bottom } } diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index 4c73676329..c62ca3fa38 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -112,47 +112,47 @@ void tst_QWMatrix::mapping_data() //next we fill it with data // identity - QTest::newRow( "identity" ) << QMatrix( 1, 0, 0, 1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 10, 20, 30, 40 ) ); + QTest::newRow( "identity" ) << QMatrix( 1, 0, 0, 1, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 10, 20, 30, 40 ) ); // scaling QTest::newRow( "scale 0" ) << QMatrix( 2, 0, 0, 2, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 20, 40, 60, 80 ) ); + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 20, 40, 60, 80 ) ); QTest::newRow( "scale 1" ) << QMatrix( 10, 0, 0, 10, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 100, 200, 300, 400 ) ); + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 100, 200, 300, 400 ) ); // mirroring - QTest::newRow( "mirror 0" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -40, 20, 30, 40 ) ); - QTest::newRow( "mirror 1" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 10, -60, 30, 40 ) ); - QTest::newRow( "mirror 2" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -40, -60, 30, 40 ) ); - QTest::newRow( "mirror 3" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -80, -120, 60, 80 ) ); - QTest::newRow( "mirror 4" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -400, -600, 300, 400 ) ); - QTest::newRow( "mirror 5" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -30, 0, 30, 40 ) ); - QTest::newRow( "mirror 6" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -40, 30, 40 ) ); - QTest::newRow( "mirror 7" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -30, -40, 30, 40 ) ); - QTest::newRow( "mirror 8" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -60, -80, 60, 80 ) ); - QTest::newRow( "mirror 9" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -300, -400, 300, 400 ) ); + QTest::newRow( "mirror 0" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -40, 20, 30, 40 ) ); + QTest::newRow( "mirror 1" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 10, -60, 30, 40 ) ); + QTest::newRow( "mirror 2" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -40, -60, 30, 40 ) ); + QTest::newRow( "mirror 3" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -80, -120, 60, 80 ) ); + QTest::newRow( "mirror 4" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -400, -600, 300, 400 ) ); + QTest::newRow( "mirror 5" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -30, 0, 30, 40 ) ); + QTest::newRow( "mirror 6" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( 0, -40, 30, 40 ) ); + QTest::newRow( "mirror 7" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -30, -40, 30, 40 ) ); + QTest::newRow( "mirror 8" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -60, -80, 60, 80 ) ); + QTest::newRow( "mirror 9" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -300, -400, 300, 400 ) ); #if (defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(M_PI) #define M_PI 3.14159265897932384626433832795f @@ -161,126 +161,126 @@ void tst_QWMatrix::mapping_data() // rotations float deg = 0.; QTest::newRow( "rot 0 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon ( QRect( 0, 0, 30, 40 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon ( QRect( 0, 0, 30, 40 ) ); deg = 0.00001f; QTest::newRow( "rot 0 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon ( QRect( 0, 0, 30, 40 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon ( QRect( 0, 0, 30, 40 ) ); deg = 0.; QTest::newRow( "rot 0 c" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon ( QRect( 10, 20, 30, 40 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon ( QRect( 10, 20, 30, 40 ) ); deg = 0.00001f; QTest::newRow( "rot 0 d" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon ( QRect( 10, 20, 30, 40 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon ( QRect( 10, 20, 30, 40 ) ); #if 0 // rotations deg = 90.; QTest::newRow( "rotscale 90 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -299, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( 0, -299, 400, 300 ) ); deg = 90.00001; QTest::newRow( "rotscale 90 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -299, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( 0, -299, 400, 300 ) ); deg = 90.; QTest::newRow( "rotscale 90 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 200, -399, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 200, -399, 400, 300 ) ); deg = 90.00001; QTest::newRow( "rotscale 90 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 200, -399, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 200, -399, 400, 300 ) ); deg = 180.; QTest::newRow( "rotscale 180 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -299, -399, 300, 400 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -299, -399, 300, 400 ) ); deg = 180.000001; QTest::newRow( "rotscale 180 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -299, -399, 300, 400 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -299, -399, 300, 400 ) ); deg = 180.; QTest::newRow( "rotscale 180 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -399, -599, 300, 400 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -399, -599, 300, 400 ) ); deg = 180.000001; QTest::newRow( "rotscale 180 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -399, -599, 300, 400 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -399, -599, 300, 400 ) ); deg = 270.; QTest::newRow( "rotscale 270 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -399, 00, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -399, 00, 400, 300 ) ); deg = 270.0000001; QTest::newRow( "rotscale 270 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -399, 00, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 30, 40 ) + << QPolygon( QRect( -399, 00, 400, 300 ) ); deg = 270.; QTest::newRow( "rotscale 270 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -599, 100, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -599, 100, 400, 300 ) ); deg = 270.000001; QTest::newRow( "rotscale 270 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -599, 100, 400, 300 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -599, 100, 400, 300 ) ); // rotations that are not multiples of 90 degrees. mapRect returns the bounding rect here. deg = 45; QTest::newRow( "rot 45 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( 0, -7, 14, 14 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 10, 10 ) + << QPolygon( QRect( 0, -7, 14, 14 ) ); QTest::newRow( "rot 45 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 21, -14, 49, 49 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 21, -14, 49, 49 ) ); QTest::newRow( "rot 45 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( 0, -70, 141, 141 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 10, 10 ) + << QPolygon( QRect( 0, -70, 141, 141 ) ); QTest::newRow( "rot 45 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 212, -141, 495, 495 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( 212, -141, 495, 495 ) ); deg = -45; QTest::newRow( "rot -45 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( -7, 0, 14, 14 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 10, 10 ) + << QPolygon( QRect( -7, 0, 14, 14 ) ); QTest::newRow( "rot -45 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -35, 21, 49, 49 ) ); + sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -35, 21, 49, 49 ) ); QTest::newRow( "rot -45 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( -70, 0, 141, 141 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 0, 0, 10, 10 ) + << QPolygon( QRect( -70, 0, 141, 141 ) ); QTest::newRow( "rot -45 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -353, 212, 495, 495 ) ); + 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + << QRect( 10, 20, 30, 40 ) + << QPolygon( QRect( -353, 212, 495, 495 ) ); #endif } diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index aa5fa10a33..a7248869ed 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -316,25 +316,25 @@ void tst_QFont::italicOblique() QStringList::ConstIterator f_it, f_end = families.end(); for (f_it = families.begin(); f_it != f_end; ++f_it) { - QString family = *f_it; - QStringList styles = fdb.styles(family); - QVERIFY(!styles.isEmpty()); - QStringList::ConstIterator s_it, s_end = styles.end(); - for (s_it = styles.begin(); s_it != s_end; ++s_it) { - QString style = *s_it; - - if (fdb.isSmoothlyScalable(family, style)) { - if (style.contains("Oblique")) { - style.replace("Oblique", "Italic"); - } else if (style.contains("Italic")) { - style.replace("Italic", "Oblique"); - } else { - continue; - } - QFont f = fdb.font(family, style, 12); - QVERIFY(f.italic()); - } - } + QString family = *f_it; + QStringList styles = fdb.styles(family); + QVERIFY(!styles.isEmpty()); + QStringList::ConstIterator s_it, s_end = styles.end(); + for (s_it = styles.begin(); s_it != s_end; ++s_it) { + QString style = *s_it; + + if (fdb.isSmoothlyScalable(family, style)) { + if (style.contains("Oblique")) { + style.replace("Oblique", "Italic"); + } else if (style.contains("Italic")) { + style.replace("Italic", "Oblique"); + } else { + continue; + } + QFont f = fdb.font(family, style, 12); + QVERIFY(f.italic()); + } + } } } @@ -342,16 +342,16 @@ void tst_QFont::compare() { QFont font; { - QFont font2 = font; - font2.setPointSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPointSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - font2.setPixelSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPixelSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } font.setPointSize(12); @@ -361,69 +361,69 @@ void tst_QFont::compare() font.setStrikeOut(false); font.setOverline(false); { - QFont font2 = font; - font2.setPointSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPointSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - font2.setPixelSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPixelSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - - font2.setItalic(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font2.setItalic(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font2.setWeight(QFont::Bold); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font2.setWeight(QFont::Normal); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setUnderline(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setUnderline(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setStrikeOut(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setStrikeOut(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setOverline(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setOverline(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); + QFont font2 = font; + + font2.setItalic(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font2.setItalic(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font2.setWeight(QFont::Bold); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font2.setWeight(QFont::Normal); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setUnderline(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setUnderline(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setStrikeOut(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setStrikeOut(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setOverline(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setOverline(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); font.setCapitalization(QFont::SmallCaps); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); font.setCapitalization(QFont::MixedCase); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); } #if defined(Q_WS_X11) { - QFont font1, font2; - font1.setRawName("-Adobe-Helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1"); - font2.setRawName("-Adobe-Helvetica-medium-r-normal--24-240-75-75-p-130-iso8859-1"); - QVERIFY(font1 != font2); + QFont font1, font2; + font1.setRawName("-Adobe-Helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1"); + font2.setRawName("-Adobe-Helvetica-medium-r-normal--24-240-75-75-p-130-iso8859-1"); + QVERIFY(font1 != font2); } #endif } diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 104d3465f2..fa5c81a2f0 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -124,11 +124,11 @@ void tst_QFontDatabase::styles() QStringList styles = fdb.styles( font ); QStringList::Iterator it = styles.begin(); while ( it != styles.end() ) { - QString style = *it; - QString trimmed = style.trimmed(); - ++it; + QString style = *it; + QString trimmed = style.trimmed(); + ++it; - QCOMPARE( style, trimmed ); + QCOMPARE(style, trimmed); } } @@ -160,7 +160,7 @@ void tst_QFontDatabase::fixedPitch() QFontDatabase fdb; if (!fdb.families().contains(font)) - QSKIP( "Font not installed"); + QSKIP("Font not installed"); QCOMPARE(fdb.isFixedPitch(font), fixedPitch); diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp index cddec5b6e7..7adaac9fac 100644 --- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp @@ -163,7 +163,7 @@ void tst_QFontMetrics::metrics() fontmetrics.lineSpacing()); } } - } + } } } diff --git a/tests/auto/gui/text/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h index 8fb5fe2499..184b2f7ec7 100644 --- a/tests/auto/gui/text/qtextdocument/common.h +++ b/tests/auto/gui/text/qtextdocument/common.h @@ -79,11 +79,11 @@ public: int l; void expect(int from, int oldLength, int length) { - f = from; - o = oldLength; - l = length; - error = false; - called = false; + f = from; + o = oldLength; + l = length; + error = false; + called = false; } bool error; bool called; diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 9f9b6acb02..009b536d7e 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -360,8 +360,8 @@ void tst_QTextDocumentFragment::listCopying2() cursor.movePosition(QTextCursor::Start); int listItemCount = 0; do { - if (cursor.currentList()) - listItemCount++; + if (cursor.currentList()) + listItemCount++; } while (cursor.movePosition(QTextCursor::NextBlock)); QCOMPARE(listItemCount, 4); @@ -378,35 +378,35 @@ void tst_QTextDocumentFragment::tableCopying() // as the pasiveness of the tablemanager. QTextDocumentFragment fragment; { - QTextDocument doc; - QTextCursor cursor(&doc); + QTextDocument doc; + QTextCursor cursor(&doc); - QTextTableFormat fmt; - QTextTable *table = cursor.insertTable(2, 2, fmt); + QTextTableFormat fmt; + QTextTable *table = cursor.insertTable(2, 2, fmt); - table->cellAt(0, 0).firstCursorPosition().insertText("First Cell"); - table->cellAt(0, 1).firstCursorPosition().insertText("Second Cell"); - table->cellAt(1, 0).firstCursorPosition().insertText("Third Cell"); - table->cellAt(1, 1).firstCursorPosition().insertText("Fourth Cell"); + table->cellAt(0, 0).firstCursorPosition().insertText("First Cell"); + table->cellAt(0, 1).firstCursorPosition().insertText("Second Cell"); + table->cellAt(1, 0).firstCursorPosition().insertText("Third Cell"); + table->cellAt(1, 1).firstCursorPosition().insertText("Fourth Cell"); - fragment = QTextDocumentFragment(&doc); + fragment = QTextDocumentFragment(&doc); } { - QTextDocument doc; - QTextCursor cursor(&doc); + QTextDocument doc; + QTextCursor cursor(&doc); - cursor.insertText("FooBar"); - cursor.insertBlock(); - cursor.movePosition(QTextCursor::Left); + cursor.insertText("FooBar"); + cursor.insertBlock(); + cursor.movePosition(QTextCursor::Left); - cursor.insertFragment(fragment); - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); + cursor.insertFragment(fragment); + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->rows(), 2); - QCOMPARE(table->columns(), 2); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->rows(), 2); + QCOMPARE(table->columns(), 2); } } @@ -488,91 +488,91 @@ void tst_QTextDocumentFragment::tableImport() void tst_QTextDocumentFragment::tableImport2() { { - const char html[] = "" - "" - "" - "" - "
First CellSecond Cell
Third CellFourth Cell
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char html[] = "" + "" + "" + "" + "
First CellSecond Cell
Third CellFourth Cell
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } { - const char html[] = "" - "" - "" - "" - "
First CellSecond Cell
Third Cell" - " " - " " - " " - " " - "
First Nested CellSecond Nested Cell
Third Nested CellFourth Nested Cell
Fifth Nested CellSixth Nested Cell
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char html[] = "" + "" + "" + "" + "
First CellSecond Cell
Third Cell" + " " + " " + " " + " " + "
First Nested CellSecond Nested Cell
Third Nested CellFourth Nested Cell
Fifth Nested CellSixth Nested Cell
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); /* - QTextCursor fourthCell = table->cellAt(1, 1).firstCursorPosition(); - fourthCell.movePosition(QTextCursor::NextBlock); - table = fourthCell.currentTable(); - QVERIFY(table); - QVERIFY(table != cursor.currentTable()); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 3); + QTextCursor fourthCell = table->cellAt(1, 1).firstCursorPosition(); + fourthCell.movePosition(QTextCursor::NextBlock); + table = fourthCell.currentTable(); + QVERIFY(table); + QVERIFY(table != cursor.currentTable()); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 3); */ } { - const char buggyHtml[] = "" - "" - "
First CellSecond Cell" - "
Third CellFourth Cell" - "
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char buggyHtml[] = "" + "" + "
First CellSecond Cell" + "
Third CellFourth Cell" + "
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } { - const char buggyHtml[] = "" - "" - "
First CellSecond Cell" - "
Third CellFourth Cell" - "
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char buggyHtml[] = "" + "" + "
First CellSecond Cell" + "
Third CellFourth Cell" + "
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } } diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 90137079f3..56d6711dc6 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -212,63 +212,63 @@ void tst_QTextLayout::lineBreaking() { #if 0 struct Breaks { - const char *utf8; - uchar breaks[32]; + const char *utf8; + uchar breaks[32]; }; Breaks brks[] = { - { "11", { false, 0xff } }, - { "aa", { false, 0xff } }, - { "++", { false, 0xff } }, - { "--", { false, 0xff } }, - { "((", { false, 0xff } }, - { "))", { false, 0xff } }, - { "..", { false, 0xff } }, - { "\"\"", { false, 0xff } }, - { "$$", { false, 0xff } }, - { "!!", { false, 0xff } }, - { "??", { false, 0xff } }, - { ",,", { false, 0xff } }, - - { ")()", { true, false, 0xff } }, - { "?!?", { false, false, 0xff } }, - { ".,.", { false, false, 0xff } }, - { "+-+", { false, false, 0xff } }, - { "+=+", { false, false, 0xff } }, - { "+(+", { false, false, 0xff } }, - { "+)+", { false, false, 0xff } }, - - { "a b", { false, true, 0xff } }, - { "a(b", { false, false, 0xff } }, - { "a)b", { false, false, 0xff } }, - { "a-b", { false, true, 0xff } }, - { "a.b", { false, false, 0xff } }, - { "a+b", { false, false, 0xff } }, - { "a?b", { false, false, 0xff } }, - { "a!b", { false, false, 0xff } }, - { "a$b", { false, false, 0xff } }, - { "a,b", { false, false, 0xff } }, - { "a/b", { false, false, 0xff } }, - { "1/2", { false, false, 0xff } }, - { "./.", { false, false, 0xff } }, - { ",/,", { false, false, 0xff } }, - { "!/!", { false, false, 0xff } }, - { "\\/\\", { false, false, 0xff } }, - { "1 2", { false, true, 0xff } }, - { "1(2", { false, false, 0xff } }, - { "1)2", { false, false, 0xff } }, - { "1-2", { false, false, 0xff } }, - { "1.2", { false, false, 0xff } }, - { "1+2", { false, false, 0xff } }, - { "1?2", { false, true, 0xff } }, - { "1!2", { false, true, 0xff } }, - { "1$2", { false, false, 0xff } }, - { "1,2", { false, false, 0xff } }, - { "1/2", { false, false, 0xff } }, - { "\330\260\331\216\331\204\331\220\331\203\331\216", { false, false, false, false, false, 0xff } }, - { "\330\247\331\204\331\205 \330\247\331\204\331\205", { false, false, false, true, false, false, 0xff } }, - { "1#2", { false, false, 0xff } }, - { "!#!", { false, false, 0xff } }, - { 0, {} } + { "11", { false, 0xff } }, + { "aa", { false, 0xff } }, + { "++", { false, 0xff } }, + { "--", { false, 0xff } }, + { "((", { false, 0xff } }, + { "))", { false, 0xff } }, + { "..", { false, 0xff } }, + { "\"\"", { false, 0xff } }, + { "$$", { false, 0xff } }, + { "!!", { false, 0xff } }, + { "??", { false, 0xff } }, + { ",,", { false, 0xff } }, + + { ")()", { true, false, 0xff } }, + { "?!?", { false, false, 0xff } }, + { ".,.", { false, false, 0xff } }, + { "+-+", { false, false, 0xff } }, + { "+=+", { false, false, 0xff } }, + { "+(+", { false, false, 0xff } }, + { "+)+", { false, false, 0xff } }, + + { "a b", { false, true, 0xff } }, + { "a(b", { false, false, 0xff } }, + { "a)b", { false, false, 0xff } }, + { "a-b", { false, true, 0xff } }, + { "a.b", { false, false, 0xff } }, + { "a+b", { false, false, 0xff } }, + { "a?b", { false, false, 0xff } }, + { "a!b", { false, false, 0xff } }, + { "a$b", { false, false, 0xff } }, + { "a,b", { false, false, 0xff } }, + { "a/b", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "./.", { false, false, 0xff } }, + { ",/,", { false, false, 0xff } }, + { "!/!", { false, false, 0xff } }, + { "\\/\\", { false, false, 0xff } }, + { "1 2", { false, true, 0xff } }, + { "1(2", { false, false, 0xff } }, + { "1)2", { false, false, 0xff } }, + { "1-2", { false, false, 0xff } }, + { "1.2", { false, false, 0xff } }, + { "1+2", { false, false, 0xff } }, + { "1?2", { false, true, 0xff } }, + { "1!2", { false, true, 0xff } }, + { "1$2", { false, false, 0xff } }, + { "1,2", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "\330\260\331\216\331\204\331\220\331\203\331\216", { false, false, false, false, false, 0xff } }, + { "\330\247\331\204\331\205 \330\247\331\204\331\205", { false, false, false, true, false, false, 0xff } }, + { "1#2", { false, false, 0xff } }, + { "!#!", { false, false, 0xff } }, + { 0, {} } }; Breaks *b = brks; while (b->utf8) { diff --git a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp index 10a25ba437..0628cc66d1 100644 --- a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp @@ -119,7 +119,7 @@ void tst_QTextList::autoNumbering() QVERIFY(list); for (int i = 0; i < 27; ++i) - cursor.insertBlock(); + cursor.insertBlock(); QVERIFY(list->count() == 28); diff --git a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp index 3359cc8d32..5efb532233 100644 --- a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp @@ -158,12 +158,12 @@ void tst_QTextPieceTable::insertion3() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)(i & 0xff) + 1); - QString str; - str += c; - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); + int pos = rand() % (i+1); + QChar c((unsigned short)(i & 0xff) + 1); + QString str; + str += c; + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); } QVERIFY(table->plainText() == compare); } @@ -172,17 +172,17 @@ void tst_QTextPieceTable::insertion4() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); - // if (table->text() != compare) { - // qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); - // exit(12); - // } + int pos = rand() % (i+1); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); +// if (table->text() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -191,23 +191,23 @@ void tst_QTextPieceTable::insertion5() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (c == 'a') { - table->insertBlock(pos, blockFormatIndex, charFormatIndex); - str = QChar(QChar::ParagraphSeparator); - } else { - table->insert(pos, str, charFormatIndex); - } - compare.insert(pos, str); + int pos = rand() % (i+1); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (c == 'a') { + table->insertBlock(pos, blockFormatIndex, charFormatIndex); + str = QChar(QChar::ParagraphSeparator); + } else { + table->insert(pos, str, charFormatIndex); + } + compare.insert(pos, str); } QVERIFY(table->plainText() == compare); for (QTextBlock it = table->blocksBegin(); it != table->blocksEnd(); it = it.next()) { - QTextDocumentPrivate::FragmentIterator fit = table->find(it.position()); - QVERIFY(fit.position() == it.position()); + QTextDocumentPrivate::FragmentIterator fit = table->find(it.position()); + QVERIFY(fit.position() == it.position()); } } @@ -249,24 +249,24 @@ void tst_QTextPieceTable::removal3() QString compare; int l = 0; for (int i = 0; i < 20000; ++i) { - bool remove = l && (rand() % 2); - int pos = rand() % (remove ? l : (l+1)); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (remove && pos < table->length()) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - compare.insert(pos, str); - table->insert(pos, str, charFormatIndex); - } - l += remove ? -1 : 2; - // if (table->text() != compare) { - // qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); - // exit(12); - // } + bool remove = l && (rand() % 2); + int pos = rand() % (remove ? l : (l+1)); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (remove && pos < table->length()) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + compare.insert(pos, str); + table->insert(pos, str, charFormatIndex); + } + l += remove ? -1 : 2; +// if (table->text() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -276,31 +276,31 @@ void tst_QTextPieceTable::removal4() QString compare; int l = 0; for (int i = 0; i < 20000; ++i) { - bool remove = l && (rand() % 2); - int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - if (c != 'a') { - str += c; - str += c; - } else { - str = QChar(QChar::ParagraphSeparator); - } - if (remove && pos < table->length() - 1) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - if (str[0] == QChar(QChar::ParagraphSeparator)) - table->insertBlock(pos, blockFormatIndex, charFormatIndex); - else - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); - } - l += remove ? -1 : 2; -// if (table->plainText() != compare) { -// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->plainText().latin1()); -// exit(12); -// } + bool remove = l && (rand() % 2); + int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + if (c != 'a') { + str += c; + str += c; + } else { + str = QChar(QChar::ParagraphSeparator); + } + if (remove && pos < table->length() - 1) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + if (str[0] == QChar(QChar::ParagraphSeparator)) + table->insertBlock(pos, blockFormatIndex, charFormatIndex); + else + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); + } + l += remove ? -1 : 2; +// if (table->plainText() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->plainText().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -490,27 +490,27 @@ void tst_QTextPieceTable::undoRedo11() QString compare; int l = 0; for (int i = 0; i < loops; ++i) { - bool remove = l && (rand() % 2); - int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (remove) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - compare.insert(pos, str); - table->insert(pos, str, charFormatIndex); - } - l += remove ? -1 : 2; + bool remove = l && (rand() % 2); + int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (remove) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + compare.insert(pos, str); + table->insert(pos, str, charFormatIndex); + } + l += remove ? -1 : 2; } QVERIFY(table->plainText() == compare); for (int i = 0; i < loops; ++i) - table->undo(); + table->undo(); QVERIFY(table->plainText() == QString("")); for (int i = 0; i < loops; ++i) - table->redo(); + table->redo(); QVERIFY(table->plainText() == compare); } diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp index 5dede11e5b..8d222965eb 100644 --- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp @@ -749,7 +749,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() } else if (state == QNetworkSession::Disconnected) { QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), TestTimeOut); QTRY_VERIFY_WITH_TIMEOUT(session2.state() == QNetworkSession::Disconnected, TestTimeOut); - } else if (state == QNetworkSession::Connected) { + } else if (state == QNetworkSession::Connected) { QTRY_VERIFY_WITH_TIMEOUT(errorSpy.isEmpty(),TestTimeOut); if (stateChangedSpy.count() > 1) { @@ -1121,13 +1121,13 @@ bool openSession(QNetworkSession *session) { } if (session->configuration().state() != QNetworkConfiguration::Active) { qDebug("tst_QNetworkSession::openSession() failure: session's configuration is not in 'Active' -state."); - qDebug() << "tst_QNetworkSession::openSession() state is: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::openSession() state is: " << session->configuration().state(); result = false; } if (result == false) { - qDebug() << "tst_QNetworkSession::openSession() opening session failed."; + qDebug() << "tst_QNetworkSession::openSession() opening session failed."; } else { - qDebug() << "tst_QNetworkSession::openSession() opening session succeeded."; + qDebug() << "tst_QNetworkSession::openSession() opening session succeeded."; } qDebug() << "tst_QNetworkSession::openSession() name of the configuration is: " << session->configuration().name(); qDebug() << "tst_QNetworkSession::openSession() configuration state is: " << session->configuration().state(); @@ -1196,9 +1196,9 @@ bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { result = false; } if (result == false) { - qDebug() << "tst_QNetworkSession::closeSession() closing session failed."; + qDebug() << "tst_QNetworkSession::closeSession() closing session failed."; } else { - qDebug() << "tst_QNetworkSession::closeSession() closing session succeeded."; + qDebug() << "tst_QNetworkSession::closeSession() closing session succeeded."; } qDebug() << "tst_QNetworkSession::closeSession() name of the configuration is: " << session->configuration().name(); qDebug() << "tst_QNetworkSession::closeSession() configuration state is: " << session->configuration().state(); diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h index 1982244c1e..20ccf0d0cd 100644 --- a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h +++ b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h @@ -92,4 +92,4 @@ public: }; //------------------------------------------------------------------------------ -#endif // TEST_H +#endif // TEST_H diff --git a/tests/auto/other/atwrapper/atWrapperAutotest.cpp b/tests/auto/other/atwrapper/atWrapperAutotest.cpp index 7ece62806c..63116574b5 100644 --- a/tests/auto/other/atwrapper/atWrapperAutotest.cpp +++ b/tests/auto/other/atwrapper/atWrapperAutotest.cpp @@ -70,7 +70,7 @@ void atWrapperAutotest::runTest() atWrapper wrapper; if (!wrapper.runAutoTests()) - QSKIP("Arthur not tested on this machine"); + QSKIP("Arthur not tested on this machine"); QVERIFY(true); } diff --git a/tests/auto/other/collections/tst_collections.cpp b/tests/auto/other/collections/tst_collections.cpp index df622602c3..17ed9c8a45 100644 --- a/tests/auto/other/collections/tst_collections.cpp +++ b/tests/auto/other/collections/tst_collections.cpp @@ -210,231 +210,231 @@ void tst_Collections::typeinfo() void tst_Collections::list() { { - QList list; - QVERIFY(list.isEmpty()); - list.append(1); - QVERIFY(list.size() == 1); + QList list; + QVERIFY(list.isEmpty()); + list.append(1); + QVERIFY(list.size() == 1); - QVERIFY(*list.begin() == 1); + QVERIFY(*list.begin() == 1); - list.push_back(2); - list += (3); - list << 4 << 5 << 6; - QVERIFY(!list.isEmpty()); - QVERIFY(list.size() == 6); - QVERIFY(list.end() - list.begin() == list.size()); + list.push_back(2); + list += (3); + list << 4 << 5 << 6; + QVERIFY(!list.isEmpty()); + QVERIFY(list.size() == 6); + QVERIFY(list.end() - list.begin() == list.size()); #if !defined(Q_CC_MSVC) && !defined(Q_CC_SUN) - QVERIFY(std::binary_search(list.begin(), list.end(), 2) == true); - QVERIFY(std::binary_search(list.begin(), list.end(), 9) == false); + QVERIFY(std::binary_search(list.begin(), list.end(), 2) == true); + QVERIFY(std::binary_search(list.begin(), list.end(), 9) == false); #endif - QVERIFY(qBinaryFind(list.begin(), list.end(), 2) == list.begin() + 1); - QVERIFY(qLowerBound(list.begin(), list.end(), 2) == list.begin() + 1); + QVERIFY(qBinaryFind(list.begin(), list.end(), 2) == list.begin() + 1); + QVERIFY(qLowerBound(list.begin(), list.end(), 2) == list.begin() + 1); QVERIFY(qUpperBound(list.begin(), list.end(), 2) == list.begin() + 2); - QVERIFY(qBinaryFind(list.begin(), list.end(), 9) == list.end()); - QVERIFY(qLowerBound(list.begin(), list.end(), 9) == list.end()); + QVERIFY(qBinaryFind(list.begin(), list.end(), 9) == list.end()); + QVERIFY(qLowerBound(list.begin(), list.end(), 9) == list.end()); QVERIFY(qUpperBound(list.begin(), list.end(), 9) == list.end()); - { - int sum = 0; - QListIterator i(list); - while (i.hasNext()) - sum += i.next(); - QVERIFY(sum == 21); - } - - { - QList list1; + { + int sum = 0; + QListIterator i(list); + while (i.hasNext()) + sum += i.next(); + QVERIFY(sum == 21); + } + + { + QList list1; list1 << 1 << 2 << 3 << 5 << 7 << 8 << 9; - QList list2 = list1; + QList list2 = list1; - QMutableListIterator i1(list1); + QMutableListIterator i1(list1); while (i1.hasNext()) { - if (i1.next() % 2 != 0) - i1.remove(); - } + if (i1.next() % 2 != 0) + i1.remove(); + } - QMutableListIterator i2(list2); + QMutableListIterator i2(list2); i2.toBack(); while (i2.hasPrevious()) { - if (i2.previous() % 2 != 0) - i2.remove(); + if (i2.previous() % 2 != 0) + i2.remove(); } QVERIFY(list1.size() == 2); QVERIFY(list2.size() == 2); QVERIFY(list1 == list2); } - { - int sum = 0; - for (int i = 0; i < list.size(); ++i) - sum += list[i]; - QVERIFY(sum == 21); - } - { - int sum = 0; - QList::const_iterator i = list.begin(); - while (i != list.end()) - sum += *i++; - QVERIFY(sum == 21); - } - { - int sum = 0; - QList::ConstIterator i = list.begin(); - while (i != list.end()) - sum += *i++; - QVERIFY(sum == 21); - } - { - QList::Iterator i = list.begin(); + { + int sum = 0; + for (int i = 0; i < list.size(); ++i) + sum += list[i]; + QVERIFY(sum == 21); + } + { + int sum = 0; + QList::const_iterator i = list.begin(); + while (i != list.end()) + sum += *i++; + QVERIFY(sum == 21); + } + { + int sum = 0; + QList::ConstIterator i = list.begin(); + while (i != list.end()) + sum += *i++; + QVERIFY(sum == 21); + } + { + QList::Iterator i = list.begin(); i += 2; QCOMPARE(*i, 3); i -= 1; QCOMPARE(*i, 2); - } - { - QList::ConstIterator i = list.begin(); + } + { + QList::ConstIterator i = list.begin(); i += 2; QCOMPARE(*i, 3); i -= 1; QCOMPARE(*i, 2); - } - { - int sum = 0; - int i; - for (i = 0; i < list.size(); ++i) - list[i] = list[i] +1; - for (i = 0; i < list.size(); ++i) - sum += list[i]; - QVERIFY(sum == 21 + list.size()); - } - { - int sum = 0; - int i; - for (i = 0; i < list.size(); ++i) - --list[i]; - for (i = 0; i < list.size(); ++i) - sum += list[i]; - QVERIFY(sum == 21); - } - { - QMutableListIterator i(list); - while (i.hasNext()) - i.setValue(2*i.next()); - } - { - int sum = 0; - QListIterator i(list); - i.toBack(); - while (i.hasPrevious()) - sum += i.previous(); - QVERIFY(sum == 2*21); - } - { - QMutableListIterator i(list); - i.toBack(); - while (i.hasPrevious()) - i.setValue(2*i.previous()); - } - { - int sum = 0; - QListIterator i(list); - i.toBack(); - while (i.hasPrevious()) - sum += i.previous(); - QVERIFY(sum == 2*2*21); - } - { - QMutableListIterator i(list); - while (i.hasNext()) { - int a = i.next(); - i.insert(a); - } - } - { - int sum = 0; - QList::iterator i = list.begin(); - while (i != list.end()) - sum += *i++; - QVERIFY(sum == 2*2*2*21); - } - { - int duplicates = 0; - QListIterator i(list); - while (i.hasNext()) { - int a = i.next(); - if (i.hasNext() && a == i.peekNext()) - duplicates++; - } - QVERIFY(duplicates == 6); - } - { - int duplicates = 0; - QListIterator i(list); - i.toBack(); - while (i.hasPrevious()) { - int a = i.previous(); - if (i.hasPrevious() && a == i.peekPrevious()) - duplicates++; - } - QVERIFY(duplicates == 6); - } - { - QMutableListIterator i(list); - while (i.hasNext()) { - int a = i.next(); - if (i.hasNext() && - i.peekNext() == a) - i.remove(); - } - } - { - int duplicates = 0; - QMutableListIterator i = list; - i.toBack(); - while (i.hasPrevious()) { - int a = i.previous(); - if (i.hasPrevious() && a == i.peekPrevious()) - duplicates++; - } - QVERIFY(duplicates == 0); - } - { - QVERIFY(list.size() == 6); - QMutableListIterator i = list; - while (i.hasNext()) { - int a = i.peekNext(); - i.insert(42); - QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a); - i.next(); - } - QVERIFY(list.size() == 12); - i.toFront(); - while (i.findNext(42)) - i.remove(); - } - { - QList l; - l << 4 << 8 << 12 << 16 << 20 << 24; - QVERIFY(l == list); - QList copy = list; - list += list; - QVERIFY(l != list && l.size() == list.size()/2 && l == copy); - l += copy; - QVERIFY(l == list); - list = copy; - } - { - QList copy = list; - list << 8; - QVERIFY(list.indexOf(8) == 1); - QVERIFY(list.indexOf(8, list.indexOf(8)+1) == 6); - int a = list.indexOf(8); - QVERIFY(list.count(8) == 2); - int r = list.removeAll(8); - QVERIFY(r == 2); - list.insert(a, 8); - QVERIFY(list == copy); - } + } + { + int sum = 0; + int i; + for (i = 0; i < list.size(); ++i) + list[i] = list[i] +1; + for (i = 0; i < list.size(); ++i) + sum += list[i]; + QVERIFY(sum == 21 + list.size()); + } + { + int sum = 0; + int i; + for (i = 0; i < list.size(); ++i) + --list[i]; + for (i = 0; i < list.size(); ++i) + sum += list[i]; + QVERIFY(sum == 21); + } + { + QMutableListIterator i(list); + while (i.hasNext()) + i.setValue(2*i.next()); + } + { + int sum = 0; + QListIterator i(list); + i.toBack(); + while (i.hasPrevious()) + sum += i.previous(); + QVERIFY(sum == 2*21); + } + { + QMutableListIterator i(list); + i.toBack(); + while (i.hasPrevious()) + i.setValue(2*i.previous()); + } + { + int sum = 0; + QListIterator i(list); + i.toBack(); + while (i.hasPrevious()) + sum += i.previous(); + QVERIFY(sum == 2*2*21); + } + { + QMutableListIterator i(list); + while (i.hasNext()) { + int a = i.next(); + i.insert(a); + } + } + { + int sum = 0; + QList::iterator i = list.begin(); + while (i != list.end()) + sum += *i++; + QVERIFY(sum == 2*2*2*21); + } + { + int duplicates = 0; + QListIterator i(list); + while (i.hasNext()) { + int a = i.next(); + if (i.hasNext() && a == i.peekNext()) + duplicates++; + } + QVERIFY(duplicates == 6); + } + { + int duplicates = 0; + QListIterator i(list); + i.toBack(); + while (i.hasPrevious()) { + int a = i.previous(); + if (i.hasPrevious() && a == i.peekPrevious()) + duplicates++; + } + QVERIFY(duplicates == 6); + } + { + QMutableListIterator i(list); + while (i.hasNext()) { + int a = i.next(); + if (i.hasNext() && + i.peekNext() == a) + i.remove(); + } + } + { + int duplicates = 0; + QMutableListIterator i = list; + i.toBack(); + while (i.hasPrevious()) { + int a = i.previous(); + if (i.hasPrevious() && a == i.peekPrevious()) + duplicates++; + } + QVERIFY(duplicates == 0); + } + { + QVERIFY(list.size() == 6); + QMutableListIterator i = list; + while (i.hasNext()) { + int a = i.peekNext(); + i.insert(42); + QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a); + i.next(); + } + QVERIFY(list.size() == 12); + i.toFront(); + while (i.findNext(42)) + i.remove(); + } + { + QList l; + l << 4 << 8 << 12 << 16 << 20 << 24; + QVERIFY(l == list); + QList copy = list; + list += list; + QVERIFY(l != list && l.size() == list.size()/2 && l == copy); + l += copy; + QVERIFY(l == list); + list = copy; + } + { + QList copy = list; + list << 8; + QVERIFY(list.indexOf(8) == 1); + QVERIFY(list.indexOf(8, list.indexOf(8)+1) == 6); + int a = list.indexOf(8); + QVERIFY(list.count(8) == 2); + int r = list.removeAll(8); + QVERIFY(r == 2); + list.insert(a, 8); + QVERIFY(list == copy); + } { QList list; list << "one" << "two" << "three" << "four" << "five" << "six"; @@ -458,73 +458,73 @@ void tst_Collections::list() QVERIFY(!list.removeOne("one")); QVERIFY(list.isEmpty()); } - { - QList copy = list; - list << 8; - QVERIFY(list.lastIndexOf(8) == 6); - QVERIFY(list.lastIndexOf(8, list.lastIndexOf(8)-1) == 1); - list = copy; - } - { - QList copy = list; - list.insert(3, 999); - QVERIFY(list[3] == 999); - list.replace(3, 222); - QVERIFY(list[3] == 222); - QVERIFY(list.contains(222) && ! list.contains(999)); - list.removeAt(3); - list = copy; - QVERIFY(list == copy); - } - { - list.clear(); - QVERIFY(list.isEmpty()); - QVERIFY(list.begin() == list.end()); - QListIterator i(list); - QVERIFY(!i.hasNext() && !i.hasPrevious()); - } - { - QList l1; - QList l2; - l1 << 1 << 2 << 3; - l2 << 4 << 5 << 6; - QList l3 = l1 + l2; - l1 += l2; - QVERIFY(l3 == l1); - } - { - QList list; - QVERIFY(list.isEmpty()); - list.append(1); - QList list2; - list2 = list; - list2.clear(); - QVERIFY(list2.size() == 0); - QVERIFY(list.size() == 1); - } - { - QList list; - list.append(1); - list = list; - QVERIFY(list.size() == 1); - } + { + QList copy = list; + list << 8; + QVERIFY(list.lastIndexOf(8) == 6); + QVERIFY(list.lastIndexOf(8, list.lastIndexOf(8)-1) == 1); + list = copy; + } + { + QList copy = list; + list.insert(3, 999); + QVERIFY(list[3] == 999); + list.replace(3, 222); + QVERIFY(list[3] == 222); + QVERIFY(list.contains(222) && ! list.contains(999)); + list.removeAt(3); + list = copy; + QVERIFY(list == copy); + } + { + list.clear(); + QVERIFY(list.isEmpty()); + QVERIFY(list.begin() == list.end()); + QListIterator i(list); + QVERIFY(!i.hasNext() && !i.hasPrevious()); + } + { + QList l1; + QList l2; + l1 << 1 << 2 << 3; + l2 << 4 << 5 << 6; + QList l3 = l1 + l2; + l1 += l2; + QVERIFY(l3 == l1); + } + { + QList list; + QVERIFY(list.isEmpty()); + list.append(1); + QList list2; + list2 = list; + list2.clear(); + QVERIFY(list2.size() == 0); + QVERIFY(list.size() == 1); + } + { + QList list; + list.append(1); + list = list; + QVERIFY(list.size() == 1); + } } { - QList list; - list.append(0); - list.append((void*)42); - QCOMPARE(list.size(), 2); - QCOMPARE(list.at(0), (void*)0); - QCOMPARE(list.at(1), (void*)42); + QList list; + list.append(0); + list.append((void*)42); + QCOMPARE(list.size(), 2); + QCOMPARE(list.at(0), (void*)0); + QCOMPARE(list.at(1), (void*)42); } { - QVector vector(5); + QVector vector(5); vector[0] = "99"; vector[4] ="100"; QList list = vector.toList(); - QVERIFY(list.size() == 5); + QVERIFY(list.size() == 5); QVERIFY(list.at(0) == "99"); QVERIFY(list.at(4) == "100"); list[0] = "10"; @@ -783,145 +783,145 @@ void tst_Collections::list() void tst_Collections::linkedList() { { - QLinkedList list; - QVERIFY(list.isEmpty()); - list.append(1); - list.push_back(2); - list += (3); - list << 4 << 5 << 6; - QVERIFY(!list.isEmpty()); - QVERIFY(list.size() == 6); - { - int sum = 0; - QLinkedListIterator i = list; - while (i.hasNext()) { - sum += i.next(); - } - QVERIFY(sum == 21); - } - { - int sum = 0; - QLinkedList::const_iterator i = list.begin(); - while (i != list.end()) - sum += *i++; - QVERIFY(sum == 21); - } - { - QMutableLinkedListIterator i = list; - while (i.hasNext()) - i.setValue(2*i.next()); - } - { - int sum = 0; - QLinkedListIterator i = list; - i.toBack(); - while (i.hasPrevious()) - sum += i.previous(); - QVERIFY(sum == 2*21); - } - { - QMutableLinkedListIterator i = list; - i.toBack(); - while (i.hasPrevious()) - i.setValue(2*i.previous()); - } - { - int sum = 0; - QLinkedListIterator i = list; - i.toBack(); - while (i.hasPrevious()) - sum += i.previous(); - QVERIFY(sum == 2*2*21); - } - { - QMutableLinkedListIterator i = list; - while (i.hasNext()) { - int a = i.next(); - i.insert(a); - } - } - { - int sum = 0; - QLinkedList::iterator i = list.begin(); - while (i != list.end()) - sum += *i++; - QVERIFY(sum == 2*2*2*21); - } - { - int duplicates = 0; - QLinkedListIterator i = list; - while (i.hasNext()) { - int a = i.next(); - if (i.hasNext() && a == i.peekNext()) - duplicates++; - } - QVERIFY(duplicates == 6); - } - { - int duplicates = 0; - QLinkedListIterator i = list; - i.toBack(); - while (i.hasPrevious()) { - int a = i.previous(); - if (i.hasPrevious() && a == i.peekPrevious()) - duplicates++; - } - QVERIFY(duplicates == 6); - } - { - QMutableLinkedListIterator i = list; - while (i.hasNext()) { - int a = i.next(); - if (i.hasNext() && - i.peekNext() == a) - i.remove(); - } - } - { - int duplicates = 0; - QMutableLinkedListIterator i = list; - i.toBack(); - while (i.hasPrevious()) { - int a = i.previous(); - if (i.hasPrevious() && a == i.peekPrevious()) - duplicates++; - } - QVERIFY(duplicates == 0); - } - { - QVERIFY(list.size() == 6); - QMutableLinkedListIterator i = list; - while (i.hasNext()) { - int a = i.peekNext(); - i.insert(42); - QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a); - i.next(); - } - QVERIFY(list.size() == 12); - i.toFront(); - while (i.findNext(42)) - i.remove(); - } - { - QLinkedList l; - l << 4 << 8 << 12 << 16 << 20 << 24; - QVERIFY(l == list); - QLinkedList copy = list; - list += list; - QVERIFY(l != list && l.size() == list.size()/2 && l == copy); - l += copy; - QVERIFY(l == list); - list = copy; - } - { - QLinkedList copy = list; - list.prepend(999); - list.append(999); - QVERIFY(list.contains(999)); - QVERIFY(list.count(999) == 2); - list.removeAll(999); - QVERIFY(list == copy); - } + QLinkedList list; + QVERIFY(list.isEmpty()); + list.append(1); + list.push_back(2); + list += (3); + list << 4 << 5 << 6; + QVERIFY(!list.isEmpty()); + QVERIFY(list.size() == 6); + { + int sum = 0; + QLinkedListIterator i = list; + while (i.hasNext()) { + sum += i.next(); + } + QVERIFY(sum == 21); + } + { + int sum = 0; + QLinkedList::const_iterator i = list.begin(); + while (i != list.end()) + sum += *i++; + QVERIFY(sum == 21); + } + { + QMutableLinkedListIterator i = list; + while (i.hasNext()) + i.setValue(2*i.next()); + } + { + int sum = 0; + QLinkedListIterator i = list; + i.toBack(); + while (i.hasPrevious()) + sum += i.previous(); + QVERIFY(sum == 2*21); + } + { + QMutableLinkedListIterator i = list; + i.toBack(); + while (i.hasPrevious()) + i.setValue(2*i.previous()); + } + { + int sum = 0; + QLinkedListIterator i = list; + i.toBack(); + while (i.hasPrevious()) + sum += i.previous(); + QVERIFY(sum == 2*2*21); + } + { + QMutableLinkedListIterator i = list; + while (i.hasNext()) { + int a = i.next(); + i.insert(a); + } + } + { + int sum = 0; + QLinkedList::iterator i = list.begin(); + while (i != list.end()) + sum += *i++; + QVERIFY(sum == 2*2*2*21); + } + { + int duplicates = 0; + QLinkedListIterator i = list; + while (i.hasNext()) { + int a = i.next(); + if (i.hasNext() && a == i.peekNext()) + duplicates++; + } + QVERIFY(duplicates == 6); + } + { + int duplicates = 0; + QLinkedListIterator i = list; + i.toBack(); + while (i.hasPrevious()) { + int a = i.previous(); + if (i.hasPrevious() && a == i.peekPrevious()) + duplicates++; + } + QVERIFY(duplicates == 6); + } + { + QMutableLinkedListIterator i = list; + while (i.hasNext()) { + int a = i.next(); + if (i.hasNext() && + i.peekNext() == a) + i.remove(); + } + } + { + int duplicates = 0; + QMutableLinkedListIterator i = list; + i.toBack(); + while (i.hasPrevious()) { + int a = i.previous(); + if (i.hasPrevious() && a == i.peekPrevious()) + duplicates++; + } + QVERIFY(duplicates == 0); + } + { + QVERIFY(list.size() == 6); + QMutableLinkedListIterator i = list; + while (i.hasNext()) { + int a = i.peekNext(); + i.insert(42); + QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a); + i.next(); + } + QVERIFY(list.size() == 12); + i.toFront(); + while (i.findNext(42)) + i.remove(); + } + { + QLinkedList l; + l << 4 << 8 << 12 << 16 << 20 << 24; + QVERIFY(l == list); + QLinkedList copy = list; + list += list; + QVERIFY(l != list && l.size() == list.size()/2 && l == copy); + l += copy; + QVERIFY(l == list); + list = copy; + } + { + QLinkedList copy = list; + list.prepend(999); + list.append(999); + QVERIFY(list.contains(999)); + QVERIFY(list.count(999) == 2); + list.removeAll(999); + QVERIFY(list == copy); + } { QLinkedList list; list << "one" << "two" << "three" << "four" << "five" << "six"; @@ -946,12 +946,12 @@ void tst_Collections::linkedList() QVERIFY(list.isEmpty()); } { - list.clear(); - QVERIFY(list.isEmpty()); - QVERIFY(list.begin() == list.end()); - QLinkedListIterator i(list); - QVERIFY(!i.hasNext() && !i.hasPrevious()); - } + list.clear(); + QVERIFY(list.isEmpty()); + QVERIFY(list.begin() == list.end()); + QLinkedListIterator i(list); + QVERIFY(!i.hasNext() && !i.hasPrevious()); + } } { @@ -1102,7 +1102,7 @@ void tst_Collections::vector() dummy = new LargeStatic; vector.append(LargeStatic()); } - delete dummy; + delete dummy; } QVERIFY(LargeStatic::count == originalLargeStaticCount); @@ -1364,11 +1364,11 @@ void tst_Collections::byteArray() ba1 += ba1; QCOMPARE(ba1, QByteArray("yyyyyy")); - ba1.remove(1, -1); // do nothing - QCOMPARE(ba1, QByteArray("yyyyyy")); + ba1.remove(1, -1); // do nothing + QCOMPARE(ba1, QByteArray("yyyyyy")); - ba1.replace(0, -1, "ZZZ"); - QCOMPARE(ba1, QByteArray("ZZZyyyyyy")); + ba1.replace(0, -1, "ZZZ"); + QCOMPARE(ba1, QByteArray("ZZZyyyyyy")); } }; @@ -1382,16 +1382,16 @@ void tst_Collections::stack() i.toBack(); int sum = 0; while (i.hasPrevious()) - sum += i.previous(); + sum += i.previous(); QVERIFY(sum == 6); sum = 0; for (QStack::iterator i = stack.begin(); i != stack.end(); ++i) - sum += *i; + sum += *i; QVERIFY(sum == 6); while (!stack.isEmpty()) - sum -= stack.pop(); + sum -= stack.pop(); QVERIFY(sum == 0); } @@ -1403,194 +1403,194 @@ void tst_Collections::hash() const char *monde = "monde"; { - typedef QHash Hash; - Hash hash; - QString key; - for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; - for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; - hash.insert(key, "V" + key); - } - } - - for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; - for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; - hash.remove(key); - } - } + typedef QHash Hash; + Hash hash; + QString key; + for (int i = 0; i < 10; ++i) { + key[0] = i + '0'; + for (int j = 0; j < 10; ++j) { + key[1] = j + '0'; + hash.insert(key, "V" + key); + } + } + + for (int i = 0; i < 10; ++i) { + key[0] = i + '0'; + for (int j = 0; j < 10; ++j) { + key[1] = j + '0'; + hash.remove(key); + } + } } { - typedef QHash Hash; - Hash hash; - hash.insert(1, hello); - hash.insert(2, world); - - QVERIFY(hash.size() == 2); - QVERIFY(!hash.isEmpty()); - - { - Hash hash2 = hash; - hash2 = hash; - hash = hash2; - hash2 = hash2; - hash = hash; - hash2.clear(); - hash2 = hash2; - QVERIFY(hash2.size() == 0); - QVERIFY(hash2.isEmpty()); - } - QVERIFY(hash.size() == 2); - - { - Hash hash2 = hash; - hash2[1] = allo; - hash2[2] = monde; - - QVERIFY(hash2[1] == allo); - QVERIFY(hash2[2] == monde); - QVERIFY(hash[1] == hello); - QVERIFY(hash[2] == world); - - hash2[1] = hash[1]; - hash2[2] = hash[2]; - - QVERIFY(hash2[1] == hello); - QVERIFY(hash2[2] == world); - - hash[1] = hash[1]; - QVERIFY(hash[1] == hello); - } - - { - Hash hash2 = hash; - hash2.detach(); - hash2.remove(1); - QVERIFY(hash2.size() == 1); - hash2.remove(1); - QVERIFY(hash2.size() == 1); - hash2.remove(0); - QVERIFY(hash2.size() == 1); - hash2.remove(2); - QVERIFY(hash2.size() == 0); - QVERIFY(hash.size() == 2); - } - - hash.detach(); - - { - Hash::iterator it1 = hash.find(1); - QVERIFY(it1 != hash.end()); - - Hash::iterator it2 = hash.find(0); - QVERIFY(it2 != hash.begin()); - QVERIFY(it2 == hash.end()); - - *it1 = monde; - QVERIFY(*it1 == monde); - QVERIFY(hash[1] == monde); - - *it1 = hello; - QVERIFY(*it1 == hello); - QVERIFY(hash[1] == hello); - - hash[1] = monde; - QVERIFY(it1.key() == 1); - QVERIFY(it1.value() == monde); - QVERIFY(*it1 == monde); - QVERIFY(hash[1] == monde); - - hash[1] = hello; - QVERIFY(*it1 == hello); - QVERIFY(hash[1] == hello); - } - - { - const Hash hash2 = hash; - - Hash::const_iterator it1 = hash2.find(1); - QVERIFY(it1 != hash2.end()); - QVERIFY(it1.key() == 1); - QVERIFY(it1.value() == hello); - QVERIFY(*it1 == hello); - - Hash::const_iterator it2 = hash2.find(2); - QVERIFY(it1 != it2); - QVERIFY(it1 != hash2.end()); - QVERIFY(it2 != hash2.end()); - - int count = 0; - it1 = hash2.begin(); - while (it1 != hash2.end()) { - count++; - ++it1; - } - QVERIFY(count == 2); - - count = 0; - it1 = hash.begin(); - while (it1 != hash.end()) { - count++; - ++it1; - } - QVERIFY(count == 2); - } - - { - QVERIFY(hash.contains(1)); - QVERIFY(hash.contains(2)); - QVERIFY(!hash.contains(0)); - QVERIFY(!hash.contains(3)); - } - - { - QVERIFY(hash.value(1) == hello); - QVERIFY(hash.value(2) == world); - QVERIFY(hash.value(3) == 0); - QVERIFY(hash.value(1, allo) == hello); - QVERIFY(hash.value(2, allo) == world); - QVERIFY(hash.value(3, allo) == allo); - QVERIFY(hash.value(0, monde) == monde); - } - - { - QHash hash; - for (int i = 0; i < 10; i++) - hash.insert(i, LargeStatic()); - QVERIFY(LargeStatic::count == 10); - hash.remove(7); - QVERIFY(LargeStatic::count == 9); - - } - QVERIFY(LargeStatic::count == 0); - { - QHash hash; - QVERIFY(((const QHash*) &hash)->operator[](7) == 0); - } - - { - /* + typedef QHash Hash; + Hash hash; + hash.insert(1, hello); + hash.insert(2, world); + + QVERIFY(hash.size() == 2); + QVERIFY(!hash.isEmpty()); + + { + Hash hash2 = hash; + hash2 = hash; + hash = hash2; + hash2 = hash2; + hash = hash; + hash2.clear(); + hash2 = hash2; + QVERIFY(hash2.size() == 0); + QVERIFY(hash2.isEmpty()); + } + QVERIFY(hash.size() == 2); + + { + Hash hash2 = hash; + hash2[1] = allo; + hash2[2] = monde; + + QVERIFY(hash2[1] == allo); + QVERIFY(hash2[2] == monde); + QVERIFY(hash[1] == hello); + QVERIFY(hash[2] == world); + + hash2[1] = hash[1]; + hash2[2] = hash[2]; + + QVERIFY(hash2[1] == hello); + QVERIFY(hash2[2] == world); + + hash[1] = hash[1]; + QVERIFY(hash[1] == hello); + } + + { + Hash hash2 = hash; + hash2.detach(); + hash2.remove(1); + QVERIFY(hash2.size() == 1); + hash2.remove(1); + QVERIFY(hash2.size() == 1); + hash2.remove(0); + QVERIFY(hash2.size() == 1); + hash2.remove(2); + QVERIFY(hash2.size() == 0); + QVERIFY(hash.size() == 2); + } + + hash.detach(); + + { + Hash::iterator it1 = hash.find(1); + QVERIFY(it1 != hash.end()); + + Hash::iterator it2 = hash.find(0); + QVERIFY(it2 != hash.begin()); + QVERIFY(it2 == hash.end()); + + *it1 = monde; + QVERIFY(*it1 == monde); + QVERIFY(hash[1] == monde); + + *it1 = hello; + QVERIFY(*it1 == hello); + QVERIFY(hash[1] == hello); + + hash[1] = monde; + QVERIFY(it1.key() == 1); + QVERIFY(it1.value() == monde); + QVERIFY(*it1 == monde); + QVERIFY(hash[1] == monde); + + hash[1] = hello; + QVERIFY(*it1 == hello); + QVERIFY(hash[1] == hello); + } + + { + const Hash hash2 = hash; + + Hash::const_iterator it1 = hash2.find(1); + QVERIFY(it1 != hash2.end()); + QVERIFY(it1.key() == 1); + QVERIFY(it1.value() == hello); + QVERIFY(*it1 == hello); + + Hash::const_iterator it2 = hash2.find(2); + QVERIFY(it1 != it2); + QVERIFY(it1 != hash2.end()); + QVERIFY(it2 != hash2.end()); + + int count = 0; + it1 = hash2.begin(); + while (it1 != hash2.end()) { + count++; + ++it1; + } + QVERIFY(count == 2); + + count = 0; + it1 = hash.begin(); + while (it1 != hash.end()) { + count++; + ++it1; + } + QVERIFY(count == 2); + } + + { + QVERIFY(hash.contains(1)); + QVERIFY(hash.contains(2)); + QVERIFY(!hash.contains(0)); + QVERIFY(!hash.contains(3)); + } + + { + QVERIFY(hash.value(1) == hello); + QVERIFY(hash.value(2) == world); + QVERIFY(hash.value(3) == 0); + QVERIFY(hash.value(1, allo) == hello); + QVERIFY(hash.value(2, allo) == world); + QVERIFY(hash.value(3, allo) == allo); + QVERIFY(hash.value(0, monde) == monde); + } + + { + QHash hash; + for (int i = 0; i < 10; i++) + hash.insert(i, LargeStatic()); + QVERIFY(LargeStatic::count == 10); + hash.remove(7); + QVERIFY(LargeStatic::count == 9); + + } + QVERIFY(LargeStatic::count == 0); + { + QHash hash; + QVERIFY(((const QHash*) &hash)->operator[](7) == 0); + } + + { + /* This test relies on a certain implementation of QHash. If you change the way QHash works internally, change this test as well. */ - QHash hash; + QHash hash; for (int i = 0; i < 1000; ++i) - hash.insert(i, i); - QVERIFY(hash.capacity() == 1031); + hash.insert(i, i); + QVERIFY(hash.capacity() == 1031); hash.squeeze(); QVERIFY(hash.capacity() == 521); - hash.insert(12345, 12345); + hash.insert(12345, 12345); QVERIFY(hash.capacity() == 1031); - for (int j = 0; j < 900; ++j) - hash.remove(j); + for (int j = 0; j < 900; ++j) + hash.remove(j); QVERIFY(hash.capacity() == 257); - hash.squeeze(); + hash.squeeze(); QVERIFY(hash.capacity() == 67); hash.reserve(0); } @@ -1643,211 +1643,211 @@ void tst_Collections::map() const char *monde = "monde"; { - typedef QMap Map; - Map map; - map.insert(1, hello); - map.insert(2, world); - - QVERIFY(*map.begin() == hello); - - QVERIFY(map.size() == 2); - QVERIFY(!map.isEmpty()); - - { - Map map2 = map; - map2 = map; - map = map2; - map2 = map2; - map = map; - map2.clear(); - map2 = map2; - QVERIFY(map2.size() == 0); - QVERIFY(map2.isEmpty()); - } - QVERIFY(map.size() == 2); - - { - Map map2 = map; - map2[1] = allo; - map2[2] = monde; - - QVERIFY(map2[1] == allo); - QVERIFY(map2[2] == monde); - QVERIFY(map[1] == hello); - QVERIFY(map[2] == world); - - map2[1] = map[1]; - map2[2] = map[2]; - - QVERIFY(map2[1] == hello); - QVERIFY(map2[2] == world); - - map[1] = map[1]; - QVERIFY(map[1] == hello); - } - - { - Map map2 = map; - map2.detach(); - map2.remove(1); - QVERIFY(map2.size() == 1); - map2.remove(1); - QVERIFY(map2.size() == 1); - map2.remove(0); - QVERIFY(map2.size() == 1); - map2.remove(2); - QVERIFY(map2.size() == 0); - QVERIFY(map.size() == 2); - } - - map.detach(); - - { - Map::iterator it1 = map.find(1); - QVERIFY(it1 == map.begin()); - QVERIFY(it1 != map.end()); - - Map::iterator it2 = map.find(0); - QVERIFY(it2 != map.begin()); - QVERIFY(it2 == map.end()); - - *it1 = monde; - QVERIFY(*it1 == monde); - QVERIFY(map[1] == monde); - - *it1 = hello; - QVERIFY(*it1 == hello); - QVERIFY(map[1] == hello); - - map[1] = monde; - QVERIFY(it1.key() == 1); - QVERIFY(it1.value() == monde); - QVERIFY(*it1 == monde); - QVERIFY(map[1] == monde); - - map[1] = hello; - QVERIFY(*it1 == hello); - QVERIFY(map[1] == hello); - - *++it1 = allo; - QVERIFY(*it1 == allo); - QVERIFY(map[2] == allo); - *it1 = world; - - ++it1; - QVERIFY(it1 == map.end()); - - int count = 0; - it1 = map.begin(); - while (it1 != map.end()) { - count++; - ++it1; - } - QVERIFY(count == 2); - } - - { - const Map map2 = map; - - Map::const_iterator it1 = map2.find(1); - QVERIFY(it1 != map2.end()); - QVERIFY(it1.key() == 1); - QVERIFY(it1.value() == hello); - QVERIFY(*it1 == hello); - ++it1; - - Map::const_iterator it2 = map2.find(2); - QVERIFY(it1 == it2); - ++it1; - QVERIFY(it1 == map2.end()); - QVERIFY(it2 != map2.end()); - QVERIFY(it1 != it2); - - int count = 0; - it1 = map2.begin(); - while (it1 != map2.end()) { - count++; - ++it1; - } - QVERIFY(count == 2); - - count = 0; - it1 = map.begin(); - while (it1 != map.end()) { - count++; - ++it1; - } - QVERIFY(count == 2); - } - - { - QVERIFY(map.contains(1)); - QVERIFY(map.contains(2)); - QVERIFY(!map.contains(0)); - QVERIFY(!map.contains(3)); - } - - { - QVERIFY(map.value(1) == hello); - QVERIFY(map.value(2) == world); - QVERIFY(map.value(3) == 0); - QVERIFY(map.value(1, allo) == hello); - QVERIFY(map.value(2, allo) == world); - QVERIFY(map.value(3, allo) == allo); - QVERIFY(map.value(0, monde) == monde); - } - int originalLargeStaticCount = LargeStatic::count; - { - QMap map; - for (int i = 0; i < 10; i++) - map.insert(i, LargeStatic()); + typedef QMap Map; + Map map; + map.insert(1, hello); + map.insert(2, world); + + QVERIFY(*map.begin() == hello); + + QVERIFY(map.size() == 2); + QVERIFY(!map.isEmpty()); + + { + Map map2 = map; + map2 = map; + map = map2; + map2 = map2; + map = map; + map2.clear(); + map2 = map2; + QVERIFY(map2.size() == 0); + QVERIFY(map2.isEmpty()); + } + QVERIFY(map.size() == 2); + + { + Map map2 = map; + map2[1] = allo; + map2[2] = monde; + + QVERIFY(map2[1] == allo); + QVERIFY(map2[2] == monde); + QVERIFY(map[1] == hello); + QVERIFY(map[2] == world); + + map2[1] = map[1]; + map2[2] = map[2]; + + QVERIFY(map2[1] == hello); + QVERIFY(map2[2] == world); + + map[1] = map[1]; + QVERIFY(map[1] == hello); + } + + { + Map map2 = map; + map2.detach(); + map2.remove(1); + QVERIFY(map2.size() == 1); + map2.remove(1); + QVERIFY(map2.size() == 1); + map2.remove(0); + QVERIFY(map2.size() == 1); + map2.remove(2); + QVERIFY(map2.size() == 0); + QVERIFY(map.size() == 2); + } + + map.detach(); + + { + Map::iterator it1 = map.find(1); + QVERIFY(it1 == map.begin()); + QVERIFY(it1 != map.end()); + + Map::iterator it2 = map.find(0); + QVERIFY(it2 != map.begin()); + QVERIFY(it2 == map.end()); + + *it1 = monde; + QVERIFY(*it1 == monde); + QVERIFY(map[1] == monde); + + *it1 = hello; + QVERIFY(*it1 == hello); + QVERIFY(map[1] == hello); + + map[1] = monde; + QVERIFY(it1.key() == 1); + QVERIFY(it1.value() == monde); + QVERIFY(*it1 == monde); + QVERIFY(map[1] == monde); + + map[1] = hello; + QVERIFY(*it1 == hello); + QVERIFY(map[1] == hello); + + *++it1 = allo; + QVERIFY(*it1 == allo); + QVERIFY(map[2] == allo); + *it1 = world; + + ++it1; + QVERIFY(it1 == map.end()); + + int count = 0; + it1 = map.begin(); + while (it1 != map.end()) { + count++; + ++it1; + } + QVERIFY(count == 2); + } + + { + const Map map2 = map; + + Map::const_iterator it1 = map2.find(1); + QVERIFY(it1 != map2.end()); + QVERIFY(it1.key() == 1); + QVERIFY(it1.value() == hello); + QVERIFY(*it1 == hello); + ++it1; + + Map::const_iterator it2 = map2.find(2); + QVERIFY(it1 == it2); + ++it1; + QVERIFY(it1 == map2.end()); + QVERIFY(it2 != map2.end()); + QVERIFY(it1 != it2); + + int count = 0; + it1 = map2.begin(); + while (it1 != map2.end()) { + count++; + ++it1; + } + QVERIFY(count == 2); + + count = 0; + it1 = map.begin(); + while (it1 != map.end()) { + count++; + ++it1; + } + QVERIFY(count == 2); + } + + { + QVERIFY(map.contains(1)); + QVERIFY(map.contains(2)); + QVERIFY(!map.contains(0)); + QVERIFY(!map.contains(3)); + } + + { + QVERIFY(map.value(1) == hello); + QVERIFY(map.value(2) == world); + QVERIFY(map.value(3) == 0); + QVERIFY(map.value(1, allo) == hello); + QVERIFY(map.value(2, allo) == world); + QVERIFY(map.value(3, allo) == allo); + QVERIFY(map.value(0, monde) == monde); + } + int originalLargeStaticCount = LargeStatic::count; + { + QMap map; + for (int i = 0; i < 10; i++) + map.insert(i, LargeStatic()); QVERIFY(LargeStatic::count == (originalLargeStaticCount + 10)); - map.remove(7); - QVERIFY(LargeStatic::count == (originalLargeStaticCount + 9)); - - } - QVERIFY(LargeStatic::count == originalLargeStaticCount); - { - QMap map; - QVERIFY(((const QMap*) &map)->operator[](7) == 0); - } - - { - QMap map; - map[0] = 1; - map[1] = 2; - map[2] = 4; - map[3] = 8; - int sum = 0; - int sumkey = 0; - QMapIterator i = map; - while (i.hasNext()) { - sum += i.next().value(); - sumkey += i.key(); - } - QVERIFY(sum == 15); - QVERIFY(sumkey == 6); - } - { - QMap map; - map[0] = 1; - map[1] = 2; - map[2] = 4; - map[3] = 8; - int sum = 0; - QMutableMapIterator i = map; - while(i.hasNext()) - if (i.next().key() == 2) - i.remove(); - i.toFront(); - while(i.hasNext()) { - sum += i.next().value(); + map.remove(7); + QVERIFY(LargeStatic::count == (originalLargeStaticCount + 9)); + + } + QVERIFY(LargeStatic::count == originalLargeStaticCount); + { + QMap map; + QVERIFY(((const QMap*) &map)->operator[](7) == 0); + } + + { + QMap map; + map[0] = 1; + map[1] = 2; + map[2] = 4; + map[3] = 8; + int sum = 0; + int sumkey = 0; + QMapIterator i = map; + while (i.hasNext()) { + sum += i.next().value(); + sumkey += i.key(); + } + QVERIFY(sum == 15); + QVERIFY(sumkey == 6); + } + { + QMap map; + map[0] = 1; + map[1] = 2; + map[2] = 4; + map[3] = 8; + int sum = 0; + QMutableMapIterator i = map; + while (i.hasNext()) + if (i.next().key() == 2) + i.remove(); + i.toFront(); + while (i.hasNext()) { + sum += i.next().value(); i.setValue(10); i.value() += 22; QVERIFY(i.value() == 32); } - QVERIFY(sum == 11); - } + QVERIFY(sum == 11); + } { QMap map; map[0] = 1; @@ -2177,14 +2177,14 @@ void tst_Collections::qstring() QVERIFY(s == "stl rocks"); { - QString str("Bananas"); - QVERIFY(str.startsWith("Ban")); - QVERIFY(false == str.startsWith("Car")); + QString str("Bananas"); + QVERIFY(str.startsWith("Ban")); + QVERIFY(false == str.startsWith("Car")); } { - QString str("Bananas"); - QVERIFY(str.endsWith("anas")); - QVERIFY(false == str.endsWith("pple")); + QString str("Bananas"); + QVERIFY(str.endsWith("anas")); + QVERIFY(false == str.endsWith("pple")); } @@ -2257,7 +2257,7 @@ void tst_Collections::bitArray() QVERIFY(ba[4]); int sum = 0; for(int i = 0; i < 20; i++) - sum += ba.testBit(i) ? 1 : 0; + sum += ba.testBit(i) ? 1 : 0; QVERIFY(sum == 2); ba = QBitArray(7, true); @@ -2288,36 +2288,36 @@ int CacheFoo::counter = 0; void tst_Collections::cache() { { - QCache cache(120); - int i; - for (i = 0; i < 30; i++) { + QCache cache(120); + int i; + for (i = 0; i < 30; i++) { cache.object(10); - cache.insert(i, new CacheFoo(i), i); - } + cache.insert(i, new CacheFoo(i), i); + } - QVERIFY(cache.contains(10)); - QVERIFY(!cache.contains(1)); - QVERIFY(!cache.contains(2)); - delete cache.take(10); + QVERIFY(cache.contains(10)); + QVERIFY(!cache.contains(1)); + QVERIFY(!cache.contains(2)); + delete cache.take(10); } { - QCache cache(120); - int i; - QString two; - for (i = 0; i < 30; i++) { - QString s = QString::number(i); - cache.insert(i, new QString(s), i); - if (i == 2) - two = s; - } - QVERIFY(!cache.contains(3)); - QVERIFY(!cache.contains(2)); + QCache cache(120); + int i; + QString two; + for (i = 0; i < 30; i++) { + QString s = QString::number(i); + cache.insert(i, new QString(s), i); + if (i == 2) + two = s; + } + QVERIFY(!cache.contains(3)); + QVERIFY(!cache.contains(2)); } { - QCache cache(100); - cache.insert(2, new int(2)); - *cache[2] = 3; - QVERIFY(*cache.object(2) == 3); + QCache cache(100); + cache.insert(2, new int(2)); + *cache[2] = 3; + QVERIFY(*cache.object(2) == 3); } QVERIFY(CacheFoo::counter == 0); diff --git a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp index ff440948a2..7eb8479372 100644 --- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp +++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp @@ -102,12 +102,12 @@ void tst_QComplexText::bidiReorderString_data() const LV *data = logical_visual; while ( data->name ) { - //next we fill it with data - QTest::newRow( data->name ) - << QString::fromUtf8( data->logical ) - << QString::fromUtf8( data->visual ) - << (int) data->basicDir; - data++; + //next we fill it with data + QTest::newRow( data->name ) + << QString::fromUtf8( data->logical ) + << QString::fromUtf8( data->visual ) + << (int) data->basicDir; + data++; } } @@ -127,34 +127,34 @@ void tst_QComplexText::bidiReorderString() int nitems = e.layoutData->items.size(); int i; for (i = 0; i < nitems; ++i) { - //qDebug("item %d bidiLevel=%d", i, e.items[i].analysis.bidiLevel); - levels[i] = e.layoutData->items[i].analysis.bidiLevel; + //qDebug("item %d bidiLevel=%d", i, e.items[i].analysis.bidiLevel); + levels[i] = e.layoutData->items[i].analysis.bidiLevel; } e.bidiReorder(nitems, levels, visualOrder); QString visual; for (i = 0; i < nitems; ++i) { - QScriptItem &si = e.layoutData->items[visualOrder[i]]; - QString sub = logical.mid(si.position, e.length(visualOrder[i])); - if (si.analysis.bidiLevel % 2) { - // reverse sub - QChar *a = (QChar *)sub.unicode(); - QChar *b = a + sub.length() - 1; - while (a < b) { - QChar tmp = *a; - *a = *b; - *b = tmp; - ++a; - --b; - } - a = (QChar *)sub.unicode(); - b = a + sub.length(); - while (amirroredChar(); - ++a; - } - } - visual += sub; + QScriptItem &si = e.layoutData->items[visualOrder[i]]; + QString sub = logical.mid(si.position, e.length(visualOrder[i])); + if (si.analysis.bidiLevel % 2) { + // reverse sub + QChar *a = (QChar *)sub.unicode(); + QChar *b = a + sub.length() - 1; + while (a < b) { + QChar tmp = *a; + *a = *b; + *b = tmp; + ++a; + --b; + } + a = (QChar *)sub.unicode(); + b = a + sub.length(); + while (amirroredChar(); + ++a; + } + } + visual += sub; } // replace Unicode newline back with \n to compare. visual.replace(QChar(0x2028), QChar('\n')); diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index b194d08a65..df26407fe6 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -72,14 +72,14 @@ protected: { QLineEdit::focusInEvent( e ); focusInEventReason = e->reason(); - focusInEventGotFocus = e->gotFocus(); + focusInEventGotFocus = e->gotFocus(); focusInEventRecieved = true; } void focusOutEvent( QFocusEvent* e ) { QLineEdit::focusOutEvent( e ); focusOutEventReason = e->reason(); - focusOutEventLostFocus = !e->gotFocus(); + focusOutEventLostFocus = !e->gotFocus(); focusOutEventRecieved = true; } }; diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 91ed7360c3..6e199d5a71 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -668,7 +668,7 @@ void tst_QSqlDatabase::testRecord(const FieldDef fieldDefs[], const QSqlRecord& } QVERIFY(!inf.field(i+1).isAutoValue()); -// qDebug(QString(" field: %1 type: %2 variant type: %3").arg(fieldDefs[ i ].fieldName()).arg(QVariant::typeToName(inf.field(i+1)->type())).arg(QVariant::typeToName(inf.field(i+1)->value().type()))); +// qDebug(QString(" field: %1 type: %2 variant type: %3").arg(fieldDefs[ i ].fieldName()).arg(QVariant::typeToName(inf.field(i+1)->type())).arg(QVariant::typeToName(inf.field(i+1)->value().type()))); } } @@ -692,28 +692,28 @@ void tst_QSqlDatabase::recordTDS() CHECK_DATABASE(db); static const FieldDef fieldDefs[] = { - FieldDef("tinyint", QVariant::Int, 255), - FieldDef("smallint", QVariant::Int, 32767), - FieldDef("int", QVariant::Int, 2147483647), - FieldDef("numeric(10,9)", QVariant::Double, 1.23456789), - FieldDef("decimal(10,9)", QVariant::Double, 1.23456789), - FieldDef("float(4)", QVariant::Double, 1.23456789), - FieldDef("double precision", QVariant::Double, 1.23456789), - FieldDef("real", QVariant::Double, 1.23456789), - FieldDef("smallmoney", QVariant::Double, 100.42), - FieldDef("money", QVariant::Double, 200.42), - // accuracy is that of a minute - FieldDef("smalldatetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 0, 0))), - // accuracy is that of a second - FieldDef("datetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 3, 0))), - FieldDef("char(20)", QVariant::String, "blah1"), - FieldDef("varchar(20)", QVariant::String, "blah2"), - FieldDef("nchar(20)", QVariant::String, "blah3"), - FieldDef("nvarchar(20)", QVariant::String, "blah4"), - FieldDef("text", QVariant::String, "blah5"), - FieldDef("bit", QVariant::Int, 1, false), + FieldDef("tinyint", QVariant::Int, 255), + FieldDef("smallint", QVariant::Int, 32767), + FieldDef("int", QVariant::Int, 2147483647), + FieldDef("numeric(10,9)", QVariant::Double, 1.23456789), + FieldDef("decimal(10,9)", QVariant::Double, 1.23456789), + FieldDef("float(4)", QVariant::Double, 1.23456789), + FieldDef("double precision", QVariant::Double, 1.23456789), + FieldDef("real", QVariant::Double, 1.23456789), + FieldDef("smallmoney", QVariant::Double, 100.42), + FieldDef("money", QVariant::Double, 200.42), + // accuracy is that of a minute + FieldDef("smalldatetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 0, 0))), + // accuracy is that of a second + FieldDef("datetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 3, 0))), + FieldDef("char(20)", QVariant::String, "blah1"), + FieldDef("varchar(20)", QVariant::String, "blah2"), + FieldDef("nchar(20)", QVariant::String, "blah3"), + FieldDef("nvarchar(20)", QVariant::String, "blah4"), + FieldDef("text", QVariant::String, "blah5"), + FieldDef("bit", QVariant::Int, 1, false), - FieldDef() + FieldDef() }; const int fieldCount = createFieldTable(fieldDefs, db); @@ -800,40 +800,40 @@ void tst_QSqlDatabase::recordPSQL() if (db.driver()->hasFeature(QSqlDriver::BLOB)) byteadef = FieldDef("bytea", QVariant::ByteArray, QByteArray("bl\\ah")); static FieldDef fieldDefs[] = { - FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), - FieldDef("bigserial", QVariant::LongLong, 100, false), - FieldDef("bit", QVariant::String, "1"), // a bit in postgres is a bit-string - FieldDef("box", QVariant::String, "(5,6),(1,2)"), - FieldDef("char(20)", QVariant::String, "blah5678901234567890"), - FieldDef("varchar(20)", QVariant::String, "blah5678901234567890"), - FieldDef("cidr", QVariant::String, "12.123.0.0/24"), - FieldDef("circle", QVariant::String, "<(1,2),3>"), - FieldDef("date", QVariant::Date, QDate::currentDate()), - FieldDef("float8", QVariant::Double, 1.12345678912), - FieldDef("inet", QVariant::String, "12.123.12.23"), - FieldDef("integer", QVariant::Int, 2147483647), - FieldDef("interval", QVariant::String, "1 day 12:59:10"), -// LOL... you can create a "line" datatype in PostgreSQL <= 7.2.x but -// as soon as you want to insert data you get a "not implemented yet" error -// FieldDef("line", QVariant::Polygon, QPolygon(QRect(1, 2, 3, 4))), - FieldDef("lseg", QVariant::String, "[(1,1),(2,2)]"), - FieldDef("macaddr", QVariant::String, "08:00:2b:01:02:03"), - FieldDef("money", QVariant::String, "$12.23"), - FieldDef("numeric", QVariant::Double, 1.2345678912), - FieldDef("path", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"), - FieldDef("point", QVariant::String, "(1,2)"), - FieldDef("polygon", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"), - FieldDef("real", QVariant::Double, 1.1234), - FieldDef("smallint", QVariant::Int, 32767), - FieldDef("serial", QVariant::Int, 100, false), - FieldDef("text", QVariant::String, "blah"), - FieldDef("time(6)", QVariant::Time, QTime(1, 2, 3)), - FieldDef("timetz", QVariant::Time, QTime(1, 2, 3)), - FieldDef("timestamp(6)", QVariant::DateTime, QDateTime::currentDateTime()), - FieldDef("timestamptz", QVariant::DateTime, QDateTime::currentDateTime()), - byteadef, + FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), + FieldDef("bigserial", QVariant::LongLong, 100, false), + FieldDef("bit", QVariant::String, "1"), // a bit in postgres is a bit-string + FieldDef("box", QVariant::String, "(5,6),(1,2)"), + FieldDef("char(20)", QVariant::String, "blah5678901234567890"), + FieldDef("varchar(20)", QVariant::String, "blah5678901234567890"), + FieldDef("cidr", QVariant::String, "12.123.0.0/24"), + FieldDef("circle", QVariant::String, "<(1,2),3>"), + FieldDef("date", QVariant::Date, QDate::currentDate()), + FieldDef("float8", QVariant::Double, 1.12345678912), + FieldDef("inet", QVariant::String, "12.123.12.23"), + FieldDef("integer", QVariant::Int, 2147483647), + FieldDef("interval", QVariant::String, "1 day 12:59:10"), +// LOL... you can create a "line" datatype in PostgreSQL <= 7.2.x but +// as soon as you want to insert data you get a "not implemented yet" error +// FieldDef("line", QVariant::Polygon, QPolygon(QRect(1, 2, 3, 4))), + FieldDef("lseg", QVariant::String, "[(1,1),(2,2)]"), + FieldDef("macaddr", QVariant::String, "08:00:2b:01:02:03"), + FieldDef("money", QVariant::String, "$12.23"), + FieldDef("numeric", QVariant::Double, 1.2345678912), + FieldDef("path", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"), + FieldDef("point", QVariant::String, "(1,2)"), + FieldDef("polygon", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"), + FieldDef("real", QVariant::Double, 1.1234), + FieldDef("smallint", QVariant::Int, 32767), + FieldDef("serial", QVariant::Int, 100, false), + FieldDef("text", QVariant::String, "blah"), + FieldDef("time(6)", QVariant::Time, QTime(1, 2, 3)), + FieldDef("timetz", QVariant::Time, QTime(1, 2, 3)), + FieldDef("timestamp(6)", QVariant::DateTime, QDateTime::currentDateTime()), + FieldDef("timestamptz", QVariant::DateTime, QDateTime::currentDateTime()), + byteadef, - FieldDef() + FieldDef() }; QSqlQuery q(db); @@ -853,17 +853,17 @@ void tst_QSqlDatabase::recordPSQL() commonFieldTest(fieldDefs, db, fieldCount); for (int i = 0; i < ITERATION_COUNT; ++i) { - // increase serial values - for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) { - if (fieldDefs[ i2 ].typeName == "serial" || - fieldDefs[ i2 ].typeName == "bigserial") { - - FieldDef def = fieldDefs[ i2 ]; - def.val = def.val.toInt() + 1; - fieldDefs[ i2 ] = def; + // increase serial values + for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) { + if (fieldDefs[ i2 ].typeName == "serial" || + fieldDefs[ i2 ].typeName == "bigserial") { + + FieldDef def = fieldDefs[ i2 ]; + def.val = def.val.toInt() + 1; + fieldDefs[ i2 ] = def; + } } } - } } void tst_QSqlDatabase::recordMySQL() @@ -890,34 +890,34 @@ void tst_QSqlDatabase::recordMySQL() static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0)); static const FieldDef fieldDefs[] = { - FieldDef("tinyint", QVariant::Int, 127), - FieldDef("tinyint unsigned", QVariant::UInt, 255), - FieldDef("smallint", QVariant::Int, 32767), - FieldDef("smallint unsigned", QVariant::UInt, 65535), - FieldDef("mediumint", QVariant::Int, 8388607), - FieldDef("mediumint unsigned", QVariant::UInt, 16777215), - FieldDef("integer", QVariant::Int, 2147483647), - FieldDef("integer unsigned", QVariant::UInt, 4294967295u), - FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), - FieldDef("bigint unsigned", QVariant::ULongLong, Q_UINT64_C(18446744073709551615)), - FieldDef("float", QVariant::Double, 1.12345), - FieldDef("double", QVariant::Double, 1.123456789), - FieldDef("decimal(10, 9)", QVariant::Double,1.123456789), - FieldDef("numeric(5, 2)", QVariant::Double, 123.67), - FieldDef("date", QVariant::Date, QDate::currentDate()), - FieldDef("datetime", QVariant::DateTime, dt), - FieldDef("timestamp", QVariant::DateTime, dt, false), - FieldDef("time", QVariant::Time, dt.time()), - FieldDef("year", QVariant::Int, 2003), - FieldDef("char(20)", QVariant::String, "Blah"), - FieldDef("varchar(20)", QVariant::String, "BlahBlah"), - FieldDef("tinytext", QVariant::String, QString("blah5")), - FieldDef("text", QVariant::String, QString("blah6")), - FieldDef("mediumtext", QVariant::String, QString("blah7")), - FieldDef("longtext", QVariant::String, QString("blah8")), - // SET OF? + FieldDef("tinyint", QVariant::Int, 127), + FieldDef("tinyint unsigned", QVariant::UInt, 255), + FieldDef("smallint", QVariant::Int, 32767), + FieldDef("smallint unsigned", QVariant::UInt, 65535), + FieldDef("mediumint", QVariant::Int, 8388607), + FieldDef("mediumint unsigned", QVariant::UInt, 16777215), + FieldDef("integer", QVariant::Int, 2147483647), + FieldDef("integer unsigned", QVariant::UInt, 4294967295u), + FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), + FieldDef("bigint unsigned", QVariant::ULongLong, Q_UINT64_C(18446744073709551615)), + FieldDef("float", QVariant::Double, 1.12345), + FieldDef("double", QVariant::Double, 1.123456789), + FieldDef("decimal(10, 9)", QVariant::Double, 1.123456789), + FieldDef("numeric(5, 2)", QVariant::Double, 123.67), + FieldDef("date", QVariant::Date, QDate::currentDate()), + FieldDef("datetime", QVariant::DateTime, dt), + FieldDef("timestamp", QVariant::DateTime, dt, false), + FieldDef("time", QVariant::Time, dt.time()), + FieldDef("year", QVariant::Int, 2003), + FieldDef("char(20)", QVariant::String, "Blah"), + FieldDef("varchar(20)", QVariant::String, "BlahBlah"), + FieldDef("tinytext", QVariant::String, QString("blah5")), + FieldDef("text", QVariant::String, QString("blah6")), + FieldDef("mediumtext", QVariant::String, QString("blah7")), + FieldDef("longtext", QVariant::String, QString("blah8")), + // SET OF? - FieldDef() + FieldDef() }; const int fieldCount = createFieldTable(fieldDefs, db); @@ -938,27 +938,27 @@ void tst_QSqlDatabase::recordDB2() CHECK_DATABASE(db); static const FieldDef fieldDefs[] = { - FieldDef("char(20)", QVariant::String, QString("Blah1")), - FieldDef("varchar(20)", QVariant::String, QString("Blah2")), - FieldDef("long varchar", QVariant::String, QString("Blah3")), - // using BOOLEAN results in "SQL0486N The BOOLEAN data type is currently only supported internally." -//X FieldDef("boolean" , QVariant::Bool, QVariant(true, 1)), - FieldDef("smallint", QVariant::Int, 32767), - FieldDef("integer", QVariant::Int, 2147483647), - FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), - FieldDef("real", QVariant::Double, 1.12345), - FieldDef("double", QVariant::Double, 1.23456789), - FieldDef("float", QVariant::Double, 1.23456789), - FieldDef("decimal(10,9)", QVariant::Double, 1.234567891), - FieldDef("numeric(10,9)", QVariant::Double, 1.234567891), - FieldDef("date", QVariant::Date, QDate::currentDate()), - FieldDef("time", QVariant::Time, QTime(1, 2, 3)), - FieldDef("timestamp", QVariant::DateTime, QDateTime::currentDateTime()), -// FieldDef("graphic(20)", QVariant::String, QString("Blah4")), -// FieldDef("vargraphic(20)", QVariant::String, QString("Blah5")), -// FieldDef("long vargraphic", QVariant::String, QString("Blah6")), - //X FieldDef("datalink", QVariant::String, QString("DLVALUE('Blah10')")), - FieldDef() + FieldDef("char(20)", QVariant::String, QString("Blah1")), + FieldDef("varchar(20)", QVariant::String, QString("Blah2")), + FieldDef("long varchar", QVariant::String, QString("Blah3")), + // using BOOLEAN results in "SQL0486N The BOOLEAN data type is currently only supported internally." +//X FieldDef("boolean" , QVariant::Bool, QVariant(true, 1)), + FieldDef("smallint", QVariant::Int, 32767), + FieldDef("integer", QVariant::Int, 2147483647), + FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), + FieldDef("real", QVariant::Double, 1.12345), + FieldDef("double", QVariant::Double, 1.23456789), + FieldDef("float", QVariant::Double, 1.23456789), + FieldDef("decimal(10,9)", QVariant::Double, 1.234567891), + FieldDef("numeric(10,9)", QVariant::Double, 1.234567891), + FieldDef("date", QVariant::Date, QDate::currentDate()), + FieldDef("time", QVariant::Time, QTime(1, 2, 3)), + FieldDef("timestamp", QVariant::DateTime, QDateTime::currentDateTime()), +// FieldDef("graphic(20)", QVariant::String, QString("Blah4")), +// FieldDef("vargraphic(20)", QVariant::String, QString("Blah5")), +// FieldDef("long vargraphic", QVariant::String, QString("Blah6")), + //X FieldDef("datalink", QVariant::String, QString("DLVALUE('Blah10')")), + FieldDef() }; const int fieldCount = createFieldTable(fieldDefs, db); diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index b74e02bcc4..38f561dbaa 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -2857,7 +2857,7 @@ void tst_QSqlQuery::task_250026() QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toString().length(), data258.length() ); QVERIFY_SQL( q, next() ); - QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); + QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); } void tst_QSqlQuery::task_205701() diff --git a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp index b251e54cca..a76ecec84d 100644 --- a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp +++ b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp @@ -114,8 +114,8 @@ void tst_QSqlRecord::cleanup() { delete rec; for ( int i = 0; i < NUM_FIELDS; ++i ) { - delete fields[ i ]; - fields[ i ] = 0; + delete fields[ i ]; + fields[ i ] = 0; } rec = 0; } @@ -129,7 +129,7 @@ void tst_QSqlRecord::createTestRecord() fields[ 2 ] = new QSqlField( "double", QVariant::Double ); fields[ 3 ] = new QSqlField( "bool", QVariant::Bool ); for ( int i = 0; i < NUM_FIELDS; ++i ) - rec->append( *(fields[ i ] ) ); + rec->append( *(fields[ i ] ) ); } @@ -237,7 +237,7 @@ void tst_QSqlRecord::contains() { createTestRecord(); for ( int i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->contains( fields[ i ]->name() ) ); + QVERIFY( rec->contains( fields[ i ]->name() ) ); QVERIFY( !rec->contains( "__Harry__" ) ); } @@ -258,10 +258,10 @@ void tst_QSqlRecord::field() int i; for ( i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->field( i ) == *fields[ i ] ); + QVERIFY( rec->field( i ) == *fields[ i ] ); for ( i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) ); + QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) ); QVERIFY( rec->indexOf( "_This should give a warning!_" ) == -1 ); } @@ -270,7 +270,7 @@ void tst_QSqlRecord::fieldName() createTestRecord(); for ( int i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) ); + QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) ); QVERIFY( rec->fieldName( NUM_FIELDS ).isNull() ); } @@ -279,10 +279,10 @@ void tst_QSqlRecord::insert() QSqlRecord iRec; int i; for ( i = 0; i <= 100; ++i ) { - iRec.insert( i, QSqlField( QString::number( i ), QVariant::Int ) ); + iRec.insert( i, QSqlField( QString::number( i ), QVariant::Int ) ); } for ( i = 0; i <= 100; ++i ) { - QCOMPARE( iRec.fieldName( i ), QString::number( i ) ); + QCOMPARE( iRec.fieldName( i ), QString::number( i ) ); } // iRec.insert( 505, QSqlField( "Harry", QVariant::Double ) ); // QCOMPARE( iRec.fieldName( 505 ), (QString)"Harry" ); @@ -313,30 +313,30 @@ void tst_QSqlRecord::isGenerated() int i; for ( i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->isGenerated( i ) ); + QVERIFY( rec->isGenerated( i ) ); for ( i = 0; i < NUM_FIELDS; ++i ) - QVERIFY( rec->isGenerated( fields[ i ]->name() ) ); + QVERIFY( rec->isGenerated( fields[ i ]->name() ) ); for ( i = 0; i < NUM_FIELDS; ++i ) { - if ( i % 2 ) - rec->setGenerated( i, false ); + if ( i % 2 ) + rec->setGenerated( i, false ); } rec->setGenerated( NUM_FIELDS * 2, false ); // nothing should happen here for ( i = 0; i < NUM_FIELDS; ++i ) { - if ( i % 2 ) { - QVERIFY( !rec->isGenerated( i ) ); - } else { - QVERIFY( rec->isGenerated( i ) ); + if ( i % 2 ) { + QVERIFY( !rec->isGenerated( i ) ); + } else { + QVERIFY( rec->isGenerated( i ) ); } } for ( i = 0; i < NUM_FIELDS; ++i ) - if ( i % 2 ) { - QVERIFY( !rec->isGenerated( fields[ i ]->name() ) ); - } else { - QVERIFY( rec->isGenerated( fields[ i ]->name() ) ); + if ( i % 2 ) { + QVERIFY( !rec->isGenerated( fields[ i ]->name() ) ); + } else { + QVERIFY( rec->isGenerated( fields[ i ]->name() ) ); } rec->setGenerated( "_This should give a warning!_", false ); // nothing should happen here @@ -348,31 +348,31 @@ void tst_QSqlRecord::isNull() int i; for ( i = 0; i < NUM_FIELDS; ++i ) { - QVERIFY( rec->isNull( i ) ); - QVERIFY( rec->isNull( fields[ i ]->name() ) ); + QVERIFY( rec->isNull( i ) ); + QVERIFY( rec->isNull( fields[ i ]->name() ) ); } for ( i = 0; i < NUM_FIELDS; ++i ) { - if ( i % 2 ) - rec->setNull( i ); + if ( i % 2 ) + rec->setNull( i ); } rec->setNull( NUM_FIELDS ); // nothing should happen here for ( i = 0; i < NUM_FIELDS; ++i ) { - if ( i % 2 ) { - QVERIFY( rec->isNull( i ) ); - QVERIFY( rec->isNull( fields[ i ]->name() ) ); + if ( i % 2 ) { + QVERIFY( rec->isNull( i ) ); + QVERIFY( rec->isNull( fields[ i ]->name() ) ); } } for ( i = 0; i < NUM_FIELDS; ++i ) { - rec->setNull( fields[ i ]->name() ); + rec->setNull( fields[ i ]->name() ); } rec->setNull( "_This should give a warning!_" ); // nothing should happen here for ( i = 0; i < NUM_FIELDS; ++i ) { - QVERIFY( rec->isNull( i ) ); - QVERIFY( rec->isNull( fields[ i ]->name() ) ); + QVERIFY( rec->isNull( i ) ); + QVERIFY( rec->isNull( fields[ i ]->name() ) ); } } @@ -385,19 +385,19 @@ void tst_QSqlRecord::operator_Assign() buf3 = *rec; buf4 = *rec; for ( i = 0; i < NUM_FIELDS; ++i ) { - QVERIFY( buf2.field( i ) == *fields[ i ] ); - QVERIFY( buf3.field( i ) == *( fields[ i ] ) ); - QVERIFY( buf4.field( i ) == *( fields[ i ] ) ); + QVERIFY( buf2.field( i ) == *fields[ i ] ); + QVERIFY( buf3.field( i ) == *( fields[ i ] ) ); + QVERIFY( buf4.field( i ) == *( fields[ i ] ) ); } for ( i = 0; i < NUM_FIELDS; ++i ) - buf3.setNull( i ); + buf3.setNull( i ); buf3.remove( NUM_FIELDS - 1 ); QSqlRecord buf5 = buf3; for ( i = 0; i < NUM_FIELDS - 1; ++i ) { - QSqlField fi ( fields[ i ]->name(), fields[ i ]->type() ); - fi.clear(); - QVERIFY( buf5.field( i ) == fi ); - QVERIFY( buf5.isGenerated( i ) ); + QSqlField fi ( fields[ i ]->name(), fields[ i ]->type() ); + fi.clear(); + QVERIFY( buf5.field( i ) == fi ); + QVERIFY( buf5.isGenerated( i ) ); } } @@ -406,7 +406,7 @@ void tst_QSqlRecord::position() createTestRecord(); int i; for ( i = 0; i < NUM_FIELDS; ++i ) { - QCOMPARE( rec->indexOf( fields[ i ]->name() ), i ); + QCOMPARE( rec->indexOf( fields[ i ]->name() ), i ); } } @@ -415,15 +415,15 @@ void tst_QSqlRecord::remove() createTestRecord(); int i; for ( i = 0; i < NUM_FIELDS; ++i ) { - rec->setGenerated( i, false ); - QCOMPARE( (int)rec->count(), NUM_FIELDS - i ); - rec->remove( 0 ); - QCOMPARE( (int)rec->count(), NUM_FIELDS - i - 1 ); + rec->setGenerated( i, false ); + QCOMPARE( (int)rec->count(), NUM_FIELDS - i ); + rec->remove( 0 ); + QCOMPARE( (int)rec->count(), NUM_FIELDS - i - 1 ); } rec->remove( NUM_FIELDS * 2 ); // nothing should happen for ( i = 0; i < NUM_FIELDS; ++i ) { - rec->insert( i, QSqlField( fields[ i ]->name(), fields[ i ]->type() ) ); - QVERIFY( rec->isGenerated( i ) ); + rec->insert( i, QSqlField( fields[ i ]->name(), fields[ i ]->type() ) ); + QVERIFY( rec->isGenerated( i ) ); } } @@ -472,7 +472,7 @@ void tst_QSqlRecord::setValue() QFETCH( int, bval ); for ( i = 0; i < 4; ++i ) - rec->setNull( i ); + rec->setNull( i ); rec->setValue( 0, sval ); rec->setValue( 1, ival ); @@ -483,7 +483,7 @@ void tst_QSqlRecord::setValue() QVERIFY( rec->value( 2 ) == dval ); QVERIFY( rec->value( 3 ) == QVariant(bval) ); for ( i = 0; i < 4; ++i ) - QVERIFY( !rec->isNull( i ) ); + QVERIFY( !rec->isNull( i ) ); QSqlRecord rec2 = *rec; QVERIFY( rec2.value( 0 ) == sval ); @@ -495,7 +495,7 @@ void tst_QSqlRecord::setValue() QVERIFY( rec2.value( 0 ) == "__Harry__" ); for ( i = 0; i < 4; ++i ) - QVERIFY( !rec2.isNull( i ) ); + QVERIFY( !rec2.isNull( i ) ); QCOMPARE( rec->value( 0 ).toString(), sval ); QCOMPARE( rec->value( 1 ).toInt(), ival ); diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index c5eafb37fb..fe0f6abd9d 100644 --- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -126,20 +126,20 @@ void tst_QSqlQueryModel::initTestCase() { dbs.open(); for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) { - QSqlDatabase db = QSqlDatabase::database((*it)); - CHECK_DATABASE(db); - dropTestTables(db); //in case of leftovers - createTestTables(db); - populateTestTables(db); + QSqlDatabase db = QSqlDatabase::database((*it)); + CHECK_DATABASE(db); + dropTestTables(db); //in case of leftovers + createTestTables(db); + populateTestTables(db); } } void tst_QSqlQueryModel::cleanupTestCase() { for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) { - QSqlDatabase db = QSqlDatabase::database((*it)); - CHECK_DATABASE(db); - dropTestTables(db); + QSqlDatabase db = QSqlDatabase::database((*it)); + CHECK_DATABASE(db); + dropTestTables(db); } dbs.close(); } diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 1aab794e1b..d8833e232d 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -200,7 +200,7 @@ void tst_QDialog::showExtension() // show ((DummyDialog*)testWidget)->showExtension( true ); // while ( testWidget->size() == dlgSize ) -// qApp->processEvents(); +// qApp->processEvents(); QTEST( testWidget->size(), "result" ); diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index b9e6c82d84..217fb4c30b 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -310,10 +310,10 @@ void tst_QFileDialog2::unc() void tst_QFileDialog2::emptyUncPath() { QNonNativeFileDialog fd; - fd.show(); + fd.show(); QLineEdit *lineEdit = fd.findChild("fileNameEdit"); QVERIFY(lineEdit); - // press 'keys' for the input + // press 'keys' for the input for (int i = 0; i < 3 ; ++i) QTest::keyPress(lineEdit, Qt::Key_Backslash); QFileSystemModel *model = fd.findChild("qt_filesystem_model"); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 3a1f650351..b29bf44307 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -164,12 +164,12 @@ void tst_QFileSystemModel::cleanup() for (int i = 0; i < list.count(); ++i) { QFileInfo fi(dir.path() + '/' + list.at(i)); if (fi.exists() && fi.isFile()) { - QFile p(fi.absoluteFilePath()); + QFile p(fi.absoluteFilePath()); p.setPermissions(QFile::ReadUser | QFile::ReadOwner | QFile::ExeOwner | QFile::ExeUser | QFile::WriteUser | QFile::WriteOwner | QFile::WriteOther); - QFile dead(dir.path() + '/' + list.at(i)); - dead.remove(); - } - if (fi.exists() && fi.isDir()) + QFile dead(dir.path() + '/' + list.at(i)); + dead.remove(); + } + if (fi.exists() && fi.isDir()) QVERIFY(dir.rmdir(list.at(i))); } list = dir.entryList(QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot); diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 1762e40a9d..6eb36115cb 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -108,11 +108,11 @@ void tst_QFontDialog::cleanup() void tst_QFontDialog::postKeyReturn() { QWidgetList list = QApplication::topLevelWidgets(); for (int i=0; i(list[i]); - if (dialog) { - QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier ); - return; - } + QFontDialog *dialog = qobject_cast(list[i]); + if (dialog) { + QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier ); + return; + } } } diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index 7d8077d77d..abd120db86 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -110,7 +110,7 @@ void testTypingValue( sbox->selectAll(); for (int i = 0; i < value.size(); ++i) { const QChar valChar = value[i]; - _keyClick(static_cast(sbox), valChar.toLatin1()); // ### always guaranteed to work? + _keyClick(static_cast(sbox), valChar.toLatin1()); // ### always guaranteed to work? if (sbox->hasAcceptableInput()) QVERIFY(okButton->isEnabled()); else @@ -123,7 +123,7 @@ void testTypingValue(QLineEdit *ledit, QPushButton *okButton, const QString &val ledit->selectAll(); for (int i = 0; i < value.size(); ++i) { const QChar valChar = value[i]; - _keyClick(ledit, valChar.toLatin1()); // ### always guaranteed to work? + _keyClick(ledit, valChar.toLatin1()); // ### always guaranteed to work? QVERIFY(ledit->hasAcceptableInput()); QVERIFY(okButton->isEnabled()); } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 25a82050e3..4c07b48c00 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -1812,7 +1812,7 @@ public: QWizardPage *page_to_delete = page(id); removePage(id); delete page_to_delete; - } + } } void applyOperations(const QList &operations) diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 1ffb5c3b5c..78ab8027d8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -2974,7 +2974,7 @@ void tst_QGraphicsGridLayout::geometries() void tst_QGraphicsGridLayout::avoidRecursionInInsertItem() { QGraphicsWidget window(0, Qt::Window); - QGraphicsGridLayout *layout = new QGraphicsGridLayout(&window); + QGraphicsGridLayout *layout = new QGraphicsGridLayout(&window); QCOMPARE(layout->count(), 0); QTest::ignoreMessage(QtWarningMsg, "QGraphicsGridLayout::addItem: cannot insert itself"); layout->addItem(layout, 0, 0); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 8f7a3a3255..6a3e69d0a8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -774,7 +774,7 @@ void tst_QGraphicsLinearLayout::orientation() layout.setOrientation(orientation); QCOMPARE(layout.orientation(), orientation); - // important to resize to preferredsize when orientation is switched + // important to resize to preferredsize when orientation is switched widget->resize(widget->effectiveSizeHint(Qt::PreferredSize)); qApp->processEvents(); for (i = 0; i < positions.count(); ++i) { @@ -1561,7 +1561,7 @@ void tst_QGraphicsLinearLayout::removeLayout() void tst_QGraphicsLinearLayout::avoidRecursionInInsertItem() { QGraphicsWidget window(0, Qt::Window); - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window); + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window); QCOMPARE(layout->count(), 0); QTest::ignoreMessage(QtWarningMsg, "QGraphicsLinearLayout::insertItem: cannot insert itself"); layout->insertItem(0, layout); diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 92de2c6733..d3f6c2db00 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1230,17 +1230,17 @@ void tst_QGraphicsProxyWidget::mousePressReleaseEvent() view.resize(100, 100); if (hasWidget) { proxy->setWidget(widget); - proxy->show(); + proxy->show(); } proxy->setPos(50, 0); scene.addItem(proxy); proxy->setFocus(); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, - view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); + view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); QTRY_COMPARE(spy.count(), 0); QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, - view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); + view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); QTRY_COMPARE(spy.count(), (hasWidget) ? 1 : 0); if (!hasWidget) @@ -1439,16 +1439,16 @@ class View : public QGraphicsView { public: View(QGraphicsScene *scene, QWidget *parent = 0) - : QGraphicsView(scene, parent), npaints(0) + : QGraphicsView(scene, parent), npaints(0) { } QRegion paintEventRegion; int npaints; protected: void paintEvent(QPaintEvent *event) { - ++npaints; - paintEventRegion += event->region(); - QGraphicsView::paintEvent(event); + ++npaints; + paintEventRegion += event->region(); + QGraphicsView::paintEvent(event); } }; @@ -1458,7 +1458,7 @@ class ScrollWidget : public QWidget public: ScrollWidget() : npaints(0) { - resize(200, 200); + resize(200, 200); } QRegion paintEventRegion; int npaints; @@ -1466,17 +1466,17 @@ public: public slots: void updateScroll() { - update(0, 0, 200, 10); - scroll(0, 10, QRect(0, 0, 100, 20)); + update(0, 0, 200, 10); + scroll(0, 10, QRect(0, 0, 100, 20)); } protected: void paintEvent(QPaintEvent *event) { - ++npaints; - paintEventRegion += event->region(); - QPainter painter(this); - painter.fillRect(event->rect(), Qt::blue); + ++npaints; + paintEventRegion += event->region(); + QPainter painter(this); + painter.fillRect(event->rect(), Qt::blue); } }; @@ -1502,7 +1502,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() // QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2), // intersected with the above update. QCOMPARE(view.paintEventRegion.rects(), - QVector() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10)); + QVector() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10)); QCOMPARE(widget->npaints, 2); QCOMPARE(widget->paintEventRegion.rects(), QVector() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10)); @@ -2458,7 +2458,7 @@ void tst_QGraphicsProxyWidget::popup_basic() QComboBox *box = new QComboBox; box->setGeometry(0, 0, 320, 40); box->addItems(QStringList() << "monday" << "tuesday" << "wednesday" - << "thursday" << "saturday" << "sunday"); + << "thursday" << "saturday" << "sunday"); QCOMPARE(proxy->childItems().count(), 0); proxy->setWidget(box); proxy->show(); @@ -2472,7 +2472,7 @@ void tst_QGraphicsProxyWidget::popup_basic() QApplication::processEvents(); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, - view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); + view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); QTRY_COMPARE(box->pos(), QPoint()); @@ -2511,7 +2511,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget() QComboBox *box = new QComboBox; box->addItems(QStringList() << "monday" << "tuesday" << "wednesday" - << "thursday" << "saturday" << "sunday"); + << "thursday" << "saturday" << "sunday"); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(new QLineEdit("QLineEdit")); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 97ea7d7d32..e4167aacad 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -216,10 +216,10 @@ private slots: void persistentEditorFocus(); void setItemDelegate(); void setItemDelegate_data(); - // The dragAndDrop() test doesn't work, and is thus disabled on Mac and Windows - // for the following reasons: - // Mac: use of GetCurrentEventButtonState() in QDragManager::drag() - // Win: unknown reason + // The dragAndDrop() test doesn't work, and is thus disabled on Mac and Windows + // for the following reasons: + // Mac: use of GetCurrentEventButtonState() in QDragManager::drag() + // Win: unknown reason #if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) #if 0 void dragAndDrop(); diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index 42975cfb5e..153144db63 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1646,29 +1646,29 @@ void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() class ItemDelegate : public QItemDelegate { public: - ItemDelegate(QObject *parent = 0) : QItemDelegate(parent) - {} - virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const - { - QLineEdit *lineEdit = new QLineEdit(parent); - lineEdit->setFrame(false); - QCompleter *completer = new QCompleter(QStringList() << "completer", lineEdit); - completer->setCompletionMode(QCompleter::InlineCompletion); - lineEdit->setCompleter(completer); - return lineEdit; - } + ItemDelegate(QObject *parent = 0) : QItemDelegate(parent) + {} + virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const + { + QLineEdit *lineEdit = new QLineEdit(parent); + lineEdit->setFrame(false); + QCompleter *completer = new QCompleter(QStringList() << "completer", lineEdit); + completer->setCompletionMode(QCompleter::InlineCompletion); + lineEdit->setCompleter(completer); + return lineEdit; + } }; void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers() { - QListWidget listWidget; - listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed); + QListWidget listWidget; + listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed); listWidget.setItemDelegate(new ItemDelegate); QListWidgetItem *item = new QListWidgetItem(QLatin1String("select an item (don't start editing)"), &listWidget); item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable); new QListWidgetItem(QLatin1String("try to type the letter 'c'"), &listWidget); new QListWidgetItem(QLatin1String("completer"), &listWidget); - listWidget.show(); + listWidget.show(); listWidget.setCurrentItem(item); qApp->setActiveWindow(&listWidget); QVERIFY(QTest::qWaitForWindowActive(&listWidget)); diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 76ac6bcf19..f7613a59f3 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -1643,7 +1643,7 @@ void tst_QTableView::selection() view.setColumnWidth(c, columnWidth); view.setSelection(QRect(x, y, width, height), - QItemSelectionModel::SelectionFlags(command)); + QItemSelectionModel::SelectionFlags(command)); QCOMPARE(view.selectedIndexes().count(), selectedCount); } @@ -2950,7 +2950,7 @@ void tst_QTableView::span() if (hiddenRow > -1) { QModelIndex hidden = model.index(hiddenRow, columnCount - 1); - QVERIFY(view.isIndexHidden(hidden)); + QVERIFY(view.isIndexHidden(hidden)); } if (hiddenColumn > -1) { @@ -3597,7 +3597,7 @@ void tst_QTableView::task173773_updateVerticalHeader() void tst_QTableView::task227953_setRootIndex() { - QTableView tableView; + QTableView tableView; //model = tree with two items with tables as children QStandardItemModel model; @@ -3619,16 +3619,16 @@ void tst_QTableView::task227953_setRootIndex() //show the first 10 rows of the first table QModelIndex root = model.indexFromItem(&item1); - tableView.setRootIndex(root); - for (int i = 10; i != 40; ++i) { - tableView.setRowHidden(i, true); - } + tableView.setRootIndex(root); + for (int i = 10; i != 40; ++i) { + tableView.setRowHidden(i, true); + } QCOMPARE(tableView.verticalHeader()->count(), 40); QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 30); - //show the first 10 rows of the second table - tableView.setRootIndex(model.indexFromItem(&item2)); + //show the first 10 rows of the second table + tableView.setRootIndex(model.indexFromItem(&item2)); QCOMPARE(tableView.verticalHeader()->count(), 10); QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 0); @@ -3670,8 +3670,8 @@ void tst_QTableView::task248688_autoScrollNavigation() QTableView view; view.setModel(&model); - view.hideColumn(8); - view.hideRow(8); + view.hideColumn(8); + view.hideRow(8); view.show(); for (int r = 0; r < model.rowCount(); ++r) { if (view.isRowHidden(r)) diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index d2625c400a..dfa7592813 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1467,14 +1467,14 @@ void tst_QTreeWidget::keyboardNavigation() QVector keymoves; keymoves << Qt::Key_Down << Qt::Key_Right << Qt::Key_Left - << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down - << Qt::Key_Right - << Qt::Key_Up << Qt::Key_Left << Qt::Key_Left - << Qt::Key_Up << Qt::Key_Down << Qt::Key_Up << Qt::Key_Up - << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up + << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down + << Qt::Key_Right + << Qt::Key_Up << Qt::Key_Left << Qt::Key_Left + << Qt::Key_Up << Qt::Key_Down << Qt::Key_Up << Qt::Key_Up + << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Down << Qt::Key_Right << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Right << Qt::Key_Down << Qt::Key_Down - << Qt::Key_Left << Qt::Key_Left << Qt::Key_Up << Qt::Key_Down + << Qt::Key_Left << Qt::Key_Left << Qt::Key_Up << Qt::Key_Down << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Left << Qt::Key_Down << Qt::Key_Right << Qt::Key_Right << Qt::Key_Right << Qt::Key_Left << Qt::Key_Left << Qt::Key_Right << Qt::Key_Left; @@ -1499,16 +1499,16 @@ void tst_QTreeWidget::keyboardNavigation() switch (key) { case Qt::Key_Up: - if (row > 0) { + if (row > 0) { if (item->parent()) item = item->parent()->child(row - 1); else item = testWidget->topLevelItem(row - 1); - row -= 1; - } else if (item->parent()) { - item = item->parent(); - row = item->parent() ? item->parent()->indexOfChild(item) : testWidget->indexOfTopLevelItem(item); - } + row -= 1; + } else if (item->parent()) { + item = item->parent(); + row = item->parent() ? item->parent()->indexOfChild(item) : testWidget->indexOfTopLevelItem(item); + } break; case Qt::Key_Down: if (testWidget->isItemExpanded(item)) { @@ -1537,7 +1537,7 @@ void tst_QTreeWidget::keyboardNavigation() case Qt::Key_Right: if (checkScroll) QCOMPARE(scrollBar->value(), valueBeforeClick + scrollBar->singleStep()); - // windows style right will walk to the first child + // windows style right will walk to the first child if (testWidget->currentItem() != item) { QCOMPARE(testWidget->currentItem()->parent(), item); row = item->indexOfChild(testWidget->currentItem()); diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index e13dfe836f..9d7d3d1f34 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -288,7 +288,7 @@ public: TestApplication( int &argc, char **argv ) : QApplication( argc, argv) { - startTimer( 150 ); + startTimer( 150 ); } void timerEvent( QTimerEvent * ) @@ -338,24 +338,24 @@ void tst_QApplication::multiple() int i = 0; int argc = 0; - while ( i++ < 5 ) { - TestApplication app( argc, 0 ); - - if ( features.contains( "QFont" ) ) { - // create font and force loading - QFont font( "Arial", 12 ); - QFontInfo finfo( font ); - finfo.exactMatch(); - } - if ( features.contains( "QPixmap" ) ) { - QPixmap pix( 100, 100 ); - pix.fill( Qt::black ); - } - if ( features.contains( "QWidget" ) ) { - QWidget widget; - } - - QVERIFY(!app.exec()); + while (i++ < 5) { + TestApplication app(argc, 0); + + if (features.contains("QFont")) { + // create font and force loading + QFont font("Arial", 12); + QFontInfo finfo(font); + finfo.exactMatch(); + } + if (features.contains("QPixmap")) { + QPixmap pix(100, 100); + pix.fill(Qt::black); + } + if (features.contains("QWidget")) { + QWidget widget; + } + + QVERIFY(!app.exec()); } } @@ -384,29 +384,29 @@ void tst_QApplication::setFont_data() QFontDatabase fdb; QStringList families = fdb.families(); for (QStringList::const_iterator itr = families.begin(); - itr != families.end(); - ++itr) { - if (cnt < 3) { - QString family = *itr; - QStringList styles = fdb.styles(family); - if (styles.size() > 0) { - QString style = styles.first(); - QList sizes = fdb.pointSizes(family, style); - if (!sizes.size()) - sizes = fdb.standardSizes(); - if (sizes.size() > 0) { - QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData()) - << family - << sizes.first() + itr != families.end(); + ++itr) { + if (cnt < 3) { + QString family = *itr; + QStringList styles = fdb.styles(family); + if (styles.size() > 0) { + QString style = styles.first(); + QList sizes = fdb.pointSizes(family, style); + if (!sizes.size()) + sizes = fdb.standardSizes(); + if (sizes.size() > 0) { + QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData()) + << family + << sizes.first() << false; - QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData()) - << family - << sizes.first() + QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData()) + << family + << sizes.first() << true; } - } - } - ++cnt; + } + } + ++cnt; } QTest::newRow("nonexistingfont after") << "nosuchfont_probably_quiteunlikely" @@ -452,7 +452,7 @@ void tst_QApplication::args_data() QTest::newRow( "No arguments" ) << 0 << QString() << 0 << QString(); QTest::newRow( "App name, style" ) << 3 << "/usr/bin/appname -style windows" << 1 << "/usr/bin/appname"; QTest::newRow( "App name, style, arbitrary, reverse" ) << 5 << "/usr/bin/appname -style windows -arbitrary -reverse" - << 2 << "/usr/bin/appname -arbitrary"; + << 2 << "/usr/bin/appname -arbitrary"; } void tst_QApplication::task109149() @@ -491,14 +491,14 @@ static QString cstrings2QString( char **args ) { QString string; if ( !args ) - return string; + return string; int i = 0; while ( args[i] ) { - string += args[i]; - if ( args[i+1] ) - string += " "; - ++i; + string += args[i]; + if ( args[i+1] ) + string += " "; + ++i; } return string; } diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index d04b812878..9df7e1662d 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -263,7 +263,7 @@ void tst_QFormLayout::wrapping() { QWidget *w = new QWidget; QFormLayout *fl = new QFormLayout(w); - fl->setRowWrapPolicy(QFormLayout::WrapLongRows); + fl->setRowWrapPolicy(QFormLayout::WrapLongRows); QLineEdit *le = new QLineEdit; QLabel *lbl = new QLabel("A long label"); diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index e067b071e7..1003a9fb1f 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -974,8 +974,8 @@ QRect CustomLayoutStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_GroupBoxLayoutItem: rect = opt->rect.adjusted(0, +10, 0, 0); break; - default: - break; + default: + break; } } if (rect.isNull()) diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 962fd3a8ab..306b049467 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -160,7 +160,7 @@ class TestEdit : public QTextEdit Q_OBJECT public: TestEdit(QWidget *parent, const char *name) - : QTextEdit(parent) + : QTextEdit(parent) { setObjectName(name); } @@ -231,13 +231,13 @@ Qt::KeyboardModifiers tst_QShortcut::toButtons( int key ) { Qt::KeyboardModifiers result = Qt::NoModifier; if ( key & Qt::SHIFT ) - result |= Qt::ShiftModifier; + result |= Qt::ShiftModifier; if ( key & Qt::CTRL ) - result |= Qt::ControlModifier; - if ( key & Qt::META ) - result |= Qt::MetaModifier; - if ( key & Qt::ALT ) - result |= Qt::AltModifier; + result |= Qt::ControlModifier; + if ( key & Qt::META ) + result |= Qt::MetaModifier; + if ( key & Qt::ALT ) + result |= Qt::AltModifier; return result; } @@ -291,15 +291,15 @@ void tst_QShortcut::number_data() Shift + Qt::Key_Plus on Qt::Key_Pluss Qt::Key_Plus on Qt::Key_Pluss */ - QTest::newRow("N001 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N001 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("N001:Shift + M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N001 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + //QTest::newRow("N001:Shift + M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N001 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_M on Shift + Qt::Key_M @@ -307,32 +307,32 @@ void tst_QShortcut::number_data() Shift + Qt::Key_Plus on Shift + Qt::Key_Pluss Qt::Key_Plus on Shift + Qt::Key_Pluss */ - QTest::newRow("N002 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N002 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Qt::Key_F1 Qt::Key_F1 on Qt::Key_F1 */ - QTest::newRow("N003 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N003 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Shift + Qt::Key_F1 Qt::Key_F1 on Shift + Qt::Key_F1 */ - QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Qt::Key_Tab @@ -340,14 +340,14 @@ void tst_QShortcut::number_data() Qt::Key_Backtab on Qt::Key_Tab Shift + Qt::Key_Backtab on Qt::Key_Tab */ - QTest::newRow("N005a - slot1") << SetupAccel << TriggerSlot1 << QString("")<< int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005a:Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N005a - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005a:Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("N005a:Shift+Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + //QTest::newRow("N005a:Shift+Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; // (Shift+)BackTab != Tab, but Shift+BackTab == Shift+Tab - QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Shift + Qt::Key_Tab @@ -355,12 +355,12 @@ void tst_QShortcut::number_data() Qt::Key_Backtab on Shift + Qt::Key_Tab Shift + Qt::Key_Backtab on Shift + Qt::Key_Tab */ - QTest::newRow("N005b - slot1") << SetupAccel << TriggerSlot1 << QString("")<< int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005b:Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N005b - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005b:Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Qt::Key_Backtab @@ -368,15 +368,15 @@ void tst_QShortcut::number_data() Qt::Key_Backtab on Qt::Key_Backtab Shift + Qt::Key_Backtab on Qt::Key_Backtab */ - QTest::newRow("N006a - slot1") << SetupAccel << TriggerSlot1 << QString("")<< int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N006a:Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N006a - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N006a:Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // This should work, since platform dependent code will transform the // Shift+Tab into a Shift+BackTab, which should trigger the shortcut - QTest::newRow("N006a:Shift+Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL - QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N006a:Shift+Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL + QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Shift + Qt::Key_Backtab @@ -384,12 +384,12 @@ void tst_QShortcut::number_data() Qt::Key_Backtab on Shift + Qt::Key_Backtab Shift + Qt::Key_Backtab on Shift + Qt::Key_Backtab */ - QTest::newRow("N006b - slot1") << SetupAccel << TriggerSlot1 << QString("")<< int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N006b:Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL - QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N006b - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N006b:Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL + QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all //=========================================== // [Shift + key] and [key] on shortcuts with @@ -400,11 +400,11 @@ void tst_QShortcut::number_data() Qt::Key_F1 Shift + Qt::Key_F1 */ - QTest::newRow("N007 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N007 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_M @@ -412,51 +412,51 @@ void tst_QShortcut::number_data() Ctrl + Qt::Key_M Alt + Qt::Key_M */ - QTest::newRow("N01 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N02 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N03 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N04 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N:Shift+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N:Ctrl+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N:Alt+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N01 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N02 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N03 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N04 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N:Shift+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N:Ctrl+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N:Alt+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; /* Testing Single Sequence Ambiguity Qt::Key_M on shortcut2 */ - QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; - QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; + QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Specialkeys Qt::Key_aring Qt::Key_Aring Qt::UNICODE_ACCEL + Qt::Key_K */ - QTest::newRow("N06 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N07 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N06 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N07 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Multiple Sequences Qt::Key_M Qt::Key_I, Qt::Key_M Shift+Qt::Key_I, Qt::Key_M */ - QTest::newRow("N10 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N11 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N12 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult; - - QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("N10 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N11 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("N12 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult; + + QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all } // ------------------------------------------------------------------ @@ -478,15 +478,15 @@ void tst_QShortcut::text_data() Shift + Qt::Key_Plus on Qt::Key_Pluss Qt::Key_Plus on Qt::Key_Pluss */ - QTest::newRow("T001 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T001 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("T001:Shift+M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T001 - slot2") << SetupAccel << TriggerSlot2 << QString("+") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + //QTest::newRow("T001:Shift+M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T001 - slot2") << SetupAccel << TriggerSlot2 << QString("+") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_M on Shift + Qt::Key_M @@ -496,44 +496,44 @@ void tst_QShortcut::text_data() Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Pluss Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Pluss */ - QTest::newRow("T002 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T002 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus - Qt::Key_Plus on Ctrl + Qt::Key_Plus + Qt::Key_Plus on Ctrl + Qt::Key_Plus */ - QTest::newRow("T002b - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002b - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Qt::Key_F1 Qt::Key_F1 on Qt::Key_F1 */ - QTest::newRow("T003 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T003 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; //commented out because the behaviour changed, those tests should be updated - //QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + //QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Shift + Qt::Key_F1 Qt::Key_F1 on Shift + Qt::Key_F1 */ - QTest::newRow("T004 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T004 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all //=========================================== // [Shift + key] and [key] on shortcuts with @@ -544,11 +544,11 @@ void tst_QShortcut::text_data() Qt::Key_F1 Shift + Qt::Key_F1 */ - QTest::newRow("T007 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T007 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T007 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T007 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_M @@ -556,22 +556,22 @@ void tst_QShortcut::text_data() Ctrl + Qt::Key_M Alt + Qt::Key_M */ - QTest::newRow("T01 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T02 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T03 - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T04 - slot2") << SetupAccel << TriggerSlot2 << QString("Alt+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T01 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T02 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T03 - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T04 - slot2") << SetupAccel << TriggerSlot2 << QString("Alt+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T:Shift + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T:Ctrl + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T:Alt + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T:Shift + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T:Ctrl + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T:Alt + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; /* Testing Single Sequence Ambiguity Qt::Key_M on shortcut2 */ - QTest::newRow("T05 - slot2") << SetupAccel << TriggerSlot2 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; - QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T05 - slot2") << SetupAccel << TriggerSlot2 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; + QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Specialkeys Qt::Key_aring @@ -581,26 +581,26 @@ void tst_QShortcut::text_data() /* see comments above on the #ifdef'ery */ QTest::newRow("T06 - slot1") << SetupAccel << TriggerSlot1 << QString::fromLatin1("\x0C5")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("T07 - slot2") << SetupAccel << TriggerSlot2 << QString::fromLatin1("Shift+\x0C5")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T08 - slot2") << SetupAccel << TriggerSlot1 << QString("K") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T08 - slot2") << SetupAccel << TriggerSlot1 << QString("K") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Multiple Sequences Qt::Key_M Qt::Key_I, Qt::Key_M Shift+Qt::Key_I, Qt::Key_M */ - QTest::newRow("T10 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T11 - slot2") << SetupAccel << TriggerSlot2 << QString("I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T12 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all + QTest::newRow("T10 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T11 - slot2") << SetupAccel << TriggerSlot2 << QString("I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T12 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; + QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; + QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; + QTest::newRow("T13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all } // ------------------------------------------------------------------ @@ -624,7 +624,7 @@ void tst_QShortcut::disabledItems() QPushButton pb2(mainW); pb1.setObjectName("pushbutton-1"); pb2.setObjectName("pushbutton-2"); - pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger + pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger pb2.show(); QShortcut *cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M"); @@ -700,21 +700,21 @@ void tst_QShortcut::disabledItems() sendKeyEvents( Qt::CTRL+Qt::Key_Q, 0 ); QCOMPARE( currentResult, NoResult ); if (over_330) - QCOMPARE( sbText, QString("Ctrl+K, Ctrl+Q not defined") ); + QCOMPARE( sbText, QString("Ctrl+K, Ctrl+Q not defined") ); currentResult = NoResult; sendKeyEvents( Qt::CTRL+Qt::Key_K, 0 ); sendKeyEvents( Qt::CTRL+Qt::Key_M, 0 ); QCOMPARE( currentResult, NoResult ); if (over_330) - QCOMPARE( sbText, QString::null ); + QCOMPARE( sbText, QString::null ); currentResult = NoResult; sendKeyEvents( Qt::CTRL+Qt::Key_K, 0 ); sendKeyEvents( Qt::CTRL+Qt::Key_L, 0 ); QCOMPARE( currentResult, Slot1Triggered ); if (over_330) - QCOMPARE( sbText, QString::null ); + QCOMPARE( sbText, QString::null ); #endif clearAllShortcuts(); cut1 = 0; @@ -876,7 +876,7 @@ void tst_QShortcut::ambiguousItems() QPushButton pb2(mainW); pb1.setObjectName("pushbutton-1"); pb2.setObjectName("pushbutton-2"); - pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger + pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger pb2.show(); setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M"); @@ -915,7 +915,7 @@ void tst_QShortcut::unicodeCompare() QPushButton pb2(mainW); pb1.setObjectName("pushbutton-1"); pb2.setObjectName("pushbutton-2"); - pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger + pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger pb2.show(); QKeySequence ks1("Ctrl+M"); // Unicode @@ -1190,25 +1190,25 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2 if (k1 || c1.toLatin1()) { QString c(c1.unicode() == QChar::Null ? QString() : QString(c1)); QTest::sendKeyEvent(QTest::Press, w, static_cast(k1), c, b1); - QTest::sendKeyEvent(QTest::Release, w, static_cast(k1), c, b1); + QTest::sendKeyEvent(QTest::Release, w, static_cast(k1), c, b1); } if (k2 || c2.toLatin1()) { QString c(c2.unicode() == QChar::Null ? QString() : QString(c2)); - QTest::sendKeyEvent(QTest::Press, w, static_cast(k2), c, b2); - QTest::sendKeyEvent(QTest::Release, w, static_cast(k2), c, b2); + QTest::sendKeyEvent(QTest::Press, w, static_cast(k2), c, b2); + QTest::sendKeyEvent(QTest::Release, w, static_cast(k2), c, b2); } if (k3 || c3.toLatin1()) { QString c(c3.unicode() == QChar::Null ? QString() : QString(c3)); - QTest::sendKeyEvent(QTest::Press, w, static_cast(k3), c, b3); - QTest::sendKeyEvent(QTest::Release, w, static_cast(k3), c, b3); + QTest::sendKeyEvent(QTest::Press, w, static_cast(k3), c, b3); + QTest::sendKeyEvent(QTest::Release, w, static_cast(k3), c, b3); } if (k4 || c4.toLatin1()) { QString c(c4.unicode() == QChar::Null ? QString() : QString(c4)); - QTest::sendKeyEvent(QTest::Press, w, static_cast(k4), c, b4); - QTest::sendKeyEvent(QTest::Release, w, static_cast(k4), c, b4); + QTest::sendKeyEvent(QTest::Press, w, static_cast(k4), c, b4); + QTest::sendKeyEvent(QTest::Release, w, static_cast(k4), c, b4); } } @@ -1229,9 +1229,9 @@ void tst_QShortcut::testElement() QFETCH(tst_QShortcut::Result, result); if (action == ClearAll) { - clearAllShortcuts(); + clearAllShortcuts(); } else if (action == SetupAccel) { - setupShortcut(testWidget, txt, k1, k2, k3, k4); + setupShortcut(testWidget, txt, k1, k2, k3, k4); } else { sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4); QCOMPARE(currentResult, result); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index fc3b0d983c..38b629cad7 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -669,7 +669,7 @@ void tst_QWidget::cleanup() // Helper class... BezierViewer::BezierViewer( QWidget* parent) - : QWidget( parent ) + : QWidget(parent) { setObjectName(QLatin1String("TestWidget")); setWindowTitle(objectName()); @@ -689,9 +689,9 @@ void BezierViewer::paintEvent( QPaintEvent* ) { if ( points.size() != 4 ) { #if defined(QT_CHECK_RANGE) - qWarning( "QPolygon::bezier: The array must have 4 control points" ); + qWarning( "QPolygon::bezier: The array must have 4 control points" ); #endif - return; + return; } /* Calculate Bezier curve */ @@ -707,18 +707,18 @@ void BezierViewer::paintEvent( QPaintEvent* ) /* Scale Bezier curve vertices */ for ( QPolygonF::Iterator it = bezier.begin(); it != bezier.end(); ++it ) { - it->setX( (it->x()-br.x()) * scl + border ); - it->setY( (it->y()-br.y()) * scl + border ); + it->setX( (it->x()-br.x()) * scl + border ); + it->setY( (it->y()-br.y()) * scl + border ); } /* Draw grid */ painter.setPen( Qt::lightGray ); - int i; - for ( i = border; i <= pr.width(); i += scl ) { - painter.drawLine( i, 0, i, pr.height() ); + int i; + for ( i = border; i <= pr.width(); i += scl ) { + painter.drawLine( i, 0, i, pr.height() ); } for ( int j = border; j <= pr.height(); j += scl ) { - painter.drawLine( 0, j, pr.width(), j ); + painter.drawLine( 0, j, pr.width(), j ); } /* Write number of vertices */ @@ -736,17 +736,17 @@ void BezierViewer::paintEvent( QPaintEvent* ) /* Scale and draw control points */ painter.setPen( Qt::darkGreen ); for ( QPolygonF::Iterator p1 = points.begin(); p1 != points.end(); ++p1 ) { - int x = (p1->x()-br.x()) * scl + border; - int y = (p1->y()-br.y()) * scl + border; - painter.drawLine( x-4, y-4, x+4, y+4 ); - painter.drawLine( x+4, y-4, x-4, y+4 ); + int x = (p1->x()-br.x()) * scl + border; + int y = (p1->y()-br.y()) * scl + border; + painter.drawLine( x-4, y-4, x+4, y+4 ); + painter.drawLine( x+4, y-4, x-4, y+4 ); } /* Draw vertices */ painter.setPen( Qt::red ); painter.setBrush( Qt::red ); for ( QPolygonF::Iterator p2 = bezier.begin(); p2 != bezier.end(); ++p2 ) - painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 ); + painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 ); } void tst_QWidget::fontPropagation() @@ -1677,17 +1677,17 @@ public: Container() { box = new QVBoxLayout(this); - //(new QVBoxLayout(this))->setAutoAdd(true); + //(new QVBoxLayout(this))->setAutoAdd(true); } void tab() { - focusNextPrevChild(true); + focusNextPrevChild(true); } void backTab() { - focusNextPrevChild(false); + focusNextPrevChild(false); } }; @@ -1712,7 +1712,7 @@ public: setFocusProxy( lineEdit ); setFocusPolicy( Qt::StrongFocus ); - setTabOrder(lineEdit, button); + setTabOrder(lineEdit, button); } private: @@ -1761,9 +1761,9 @@ void tst_QWidget::setTabOrder() QTRY_VERIFY(lastEdit->hasFocus()); container.tab(); do { - QVERIFY(comp[current]->focusProxy()->hasFocus()); - container.tab(); - current--; + QVERIFY(comp[current]->focusProxy()->hasFocus()); + container.tab(); + current--; } while (current >= 0); QVERIFY(firstEdit->hasFocus()); diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index 93262722b9..523fac940d 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp @@ -419,7 +419,7 @@ void tst_QAbstractButton::setIcon() QPixmap p2( test2_xpm ); for ( int a = 0; a<5; a++ ) - testWidget->setIcon( p2 ); + testWidget->setIcon( p2 ); QCOMPARE( testWidget->icon().pixmap(12, 8), p2 ); diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index 14a8496b42..a3079cdaef 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp @@ -185,7 +185,7 @@ void tst_QCalendarWidget::buttonClickCheck() int month = object.monthShown(); QToolButton *button = object.findChild("qt_calendar_prevmonth"); QTest::mouseClick(button, Qt::LeftButton); - QCOMPARE(month > 1 ? month-1 : 12, object.monthShown()); + QCOMPARE(month > 1 ? month-1 : 12, object.monthShown()); button = object.findChild("qt_calendar_nextmonth"); QTest::mouseClick(button, Qt::LeftButton); QCOMPARE(month, object.monthShown()); diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index a4ad18c7a6..6551a88232 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -87,7 +87,7 @@ private slots: void task248604_infiniteResize(); void task258459_visibilityChanged(); void taskQTBUG_1665_closableChanged(); - void taskQTBUG_9758_undockedGeometry(); + void taskQTBUG_9758_undockedGeometry(); }; // Testing get/set functions @@ -588,7 +588,7 @@ void tst_QDockWidget::visibilityChanged() QCOMPARE(spy.count(), 0); mw.addDockWidget(Qt::RightDockWidgetArea, &dw2); - QTest::qWait(200); + QTest::qWait(200); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); } @@ -758,19 +758,19 @@ void tst_QDockWidget::task169808_setFloating() } }; QMainWindow mw; - mw.setCentralWidget(new MyWidget); - QDockWidget *dw = new QDockWidget("my dock"); - dw->setWidget(new MyWidget); - mw.addDockWidget(Qt::LeftDockWidgetArea, dw); - dw->setFloating(true); - mw.show(); + mw.setCentralWidget(new MyWidget); + QDockWidget *dw = new QDockWidget("my dock"); + dw->setWidget(new MyWidget); + mw.addDockWidget(Qt::LeftDockWidgetArea, dw); + dw->setFloating(true); + mw.show(); QVERIFY(QTest::qWaitForWindowExposed(&mw)); QCOMPARE(dw->widget()->size(), dw->widget()->sizeHint()); //and now we try to test if the contents margin is taken into account dw->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - dw->setFloating(false); + dw->setFloating(false); QVERIFY(QTest::qWaitForWindowExposed(&mw)); qApp->processEvents(); //leave time processing events diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 49f058862d..6784ee477b 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -640,7 +640,7 @@ void tst_QDoubleSpinBox::setDecimals() QTest::keyClick(&spin, Qt::Key_1); QTest::keyClick(&spin, Qt::Key_1); QTest::keyClick(&spin, Qt::Key_1); - if (sizeof(qreal) == sizeof(float)) + if (sizeof(qreal) == sizeof(float)) QCOMPARE(spin.text().left(17), expected.left(17)); else QCOMPARE(spin.text(), expected); diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 2fd15b891a..e3aa7fda51 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -189,9 +189,9 @@ void tst_QLabel::init() void tst_QLabel::cleanup() { if (QTest::currentTestFunction() == QLatin1String("setBuddy")) { - testWidget->show(); + testWidget->show(); - delete test_box; // this should delete tst_labl and test_edit as well. + delete test_box; // this should delete tst_labl and test_edit as well. } } diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index e9cc1e6abd..45167bac60 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -1468,7 +1468,7 @@ void tst_QLineEdit::undo_keypressevents() void tst_QLineEdit::QTBUG5786_undoPaste() { if (!PlatformClipboard::isAvailable()) - QSKIP("this machine doesn't support the clipboard"); + QSKIP("this machine doesn't support the clipboard"); QString initial("initial"); QString string("test"); QString additional("add"); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index e5a9b570bb..d02b86bd8a 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1340,8 +1340,8 @@ void tst_QMainWindow::restoreStateFromPreviousVersion() QCOMPARE(win.restoreState(ba), true); for( int i = 0; i < docks.size(); ++i) { - QCOMPARE( win.dockWidgetArea(docks[i]), Qt::DockWidgetArea(1 << i%4)); - } + QCOMPARE( win.dockWidgetArea(docks[i]), Qt::DockWidgetArea(1 << i%4)); + } } } @@ -1426,7 +1426,7 @@ public: QSize sizeHint() const { - return QSize(200, 200); + return QSize(200, 200); } }; diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 2b8e735a0e..2e492f3a5c 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -173,22 +173,22 @@ const int RESET = 0; /*! Test plan: insertItem (all flavors and combinations) - removing menu items - clearing the menu - - check the common behaviour + emitted signals for: - accelerator keys - navigating tru the menu and then pressing ENTER - mouse clicks - mouse drags - combinations of key + mouse (if possible) - checked / unckecked state of menu options - active / inactive state + removing menu items + clearing the menu + + check the common behaviour + emitted signals for: + accelerator keys + navigating tru the menu and then pressing ENTER + mouse clicks + mouse drags + combinations of key + mouse (if possible) + checked / unckecked state of menu options + active / inactive state Can't test these without pixmap comparison... - show and hide - icons in a menu - pixmaps in a menu + show and hide + icons in a menu + pixmaps in a menu */ @@ -481,17 +481,17 @@ void tst_QMenuBar::removeItemAt() switch (removeIndex ) { case 0: - QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 2") ); - QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") ); - break; + QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 2") ); + QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") ); + break; case 1: - QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") ); - QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") ); - break; + QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") ); + QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") ); + break; case 2: - QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") ); - QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 2") ); - break; + QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") ); + QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 2") ); + break; } QVERIFY( menuBarActions2.size() == 2 ); @@ -827,7 +827,7 @@ void tst_QMenuBar::check_escKey() // void tst_QMenuBar::check_mouse1() // { // if (QSystem::curStyle() == "Motif") -// QSKIP("This fails in Motif due to a bug in the testing framework"); +// QSKIP("This fails in Motif due to a bug in the testing framework"); // QFETCH( QString, popup_item ); // QFETCH( int, itemA_count ); // QFETCH( int, itemB_count ); @@ -888,7 +888,7 @@ void tst_QMenuBar::check_escKey() // void tst_QMenuBar::check_mouse2() // { // if (QSystem::curStyle() == "Motif") -// QSKIP("This fails in Motif due to a bug in the testing framework"); +// QSKIP("This fails in Motif due to a bug in the testing framework"); // QFETCH( QString, label ); // QFETCH( int, itemA_count ); // QFETCH( int, itemB_count ); @@ -961,8 +961,8 @@ void tst_QMenuBar::allowActiveAndDisabled() void tst_QMenuBar::check_altPress() { if ( !qApp->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation) ) { - QSKIP( QString( "this is not supposed to work in the %1 style. Skipping." ). - arg( qApp->style()->objectName() ).toLatin1()); + QSKIP(QString( "this is not supposed to work in the %1 style. Skipping." ). + arg(qApp->style()->objectName()).toLatin1()); } QMainWindow w; @@ -1141,7 +1141,7 @@ void tst_QMenuBar::task223138_triggered() void tst_QMenuBar::task256322_highlight() { QMainWindow win; - win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars + win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars QMenu menu; QAction *file = win.menuBar()->addMenu(&menu); file->setText("file"); diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index d336d00b3e..1eccdd768b 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -490,8 +490,8 @@ void tst_QPushButton::defaultAndAutoDefault() // Adding buttons to QDialog through a layout QDialog dialog; - QPushButton button3; - button3.setAutoDefault(false); + QPushButton button3; + button3.setAutoDefault(false); QPushButton button1; QVERIFY(!button1.autoDefault()); @@ -512,7 +512,7 @@ void tst_QPushButton::defaultAndAutoDefault() layout.addWidget(&button2, 0, 2); layout.addWidget(&button1, 0, 1); dialog.setLayout(&layout); - button3.setFocus(); + button3.setFocus(); QVERIFY(button1.autoDefault()); QVERIFY(button1.isDefault()); QVERIFY(button2.autoDefault()); diff --git a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp index a00db02c0a..13d958c8ca 100644 --- a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp +++ b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp @@ -252,9 +252,9 @@ void tst_QToolBox::change() QVERIFY( lastItem ); for ( int c = 0; c < testWidget->count(); ++c ) { - QString label = "Item " + QString::number(c); - testWidget->setItemText(c, label); - QCOMPARE( testWidget->itemText(c), label ); + QString label = "Item " + QString::number(c); + testWidget->setItemText(c, label); + QCOMPARE( testWidget->itemText(c), label ); } testWidget->setCurrentIndex( 0 ); diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp index c00a5c7caa..3dd733f61e 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp @@ -47,70 +47,70 @@ class ContentHandler : public QXmlDefaultHandler { - public: - ContentHandler(); - - // QXmlContentHandler methods - bool startDocument(); - bool endDocument(); - bool startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes & atts); - bool endElement(const QString &namespaceURI, - const QString &localName, - const QString &qName); - bool characters(const QString &ch); - void setDocumentLocator(QXmlLocator *locator); - bool startPrefixMapping (const QString &prefix, const QString & uri); - bool endPrefixMapping(const QString &prefix); - bool ignorableWhitespace (const QString & ch); - bool processingInstruction(const QString &target, const QString &data); - bool skippedEntity (const QString & name); - - // QXmlErrorHandler methods - bool warning (const QXmlParseException & exception); - bool error (const QXmlParseException & exception); - bool fatalError (const QXmlParseException & exception); - - // QXmlDTDHandler methods - bool notationDecl ( const QString & name, const QString & publicId, - const QString & systemId ); - bool unparsedEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId, - const QString & notationName ); - - // QXmlEntityResolver methods - bool resolveEntity ( const QString & publicId, - const QString & systemId, - QXmlInputSource *&); - - // QXmlLexicalHandler methods - bool startDTD ( const QString & name, const QString & publicId, const QString & systemId ); - bool endDTD (); - bool startEntity ( const QString & name ); - bool endEntity ( const QString & name ); - bool startCDATA (); - bool endCDATA (); - bool comment ( const QString & ch ); - - // QXmlDeclHandler methods - bool attributeDecl ( const QString & eName, const QString & aName, const QString & type, const QString & valueDefault, const QString & value ); - bool internalEntityDecl ( const QString & name, const QString & value ); - bool externalEntityDecl ( const QString & name, const QString & publicId, const QString & systemId ); - - - const QString &result() const { return m_result; } - const QString &errorMsg() const { return m_error_msg; } - - private: - QString nestPrefix() const { return QString().fill(' ', 3*m_nest); } - QString formatAttributes(const QXmlAttributes & atts); - QString escapeStr(const QString &s); - - unsigned m_nest; - QString m_result, m_error_msg; +public: + ContentHandler(); + + // QXmlContentHandler methods + bool startDocument(); + bool endDocument(); + bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes &atts); + bool endElement(const QString &namespaceURI, + const QString &localName, + const QString &qName); + bool characters(const QString &ch); + void setDocumentLocator(QXmlLocator *locator); + bool startPrefixMapping(const QString &prefix, const QString &uri); + bool endPrefixMapping(const QString &prefix); + bool ignorableWhitespace(const QString &ch); + bool processingInstruction(const QString &target, const QString &data); + bool skippedEntity(const QString &name); + + // QXmlErrorHandler methods + bool warning(const QXmlParseException &exception); + bool error(const QXmlParseException &exception); + bool fatalError(const QXmlParseException &exception); + + // QXmlDTDHandler methods + bool notationDecl(const QString &name, const QString &publicId, + const QString &systemId); + bool unparsedEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId, + const QString ¬ationName); + + // QXmlEntityResolver methods + bool resolveEntity(const QString &publicId, + const QString &systemId, + QXmlInputSource *&); + + // QXmlLexicalHandler methods + bool startDTD (const QString &name, const QString &publicId, const QString &systemId); + bool endDTD(); + bool startEntity(const QString &name); + bool endEntity(const QString &name); + bool startCDATA(); + bool endCDATA(); + bool comment(const QString &ch); + + // QXmlDeclHandler methods + bool attributeDecl(const QString &eName, const QString &aName, const QString &type, const QString &valueDefault, const QString &value); + bool internalEntityDecl(const QString &name, const QString &value); + bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId); + + + const QString &result() const { return m_result; } + const QString &errorMsg() const { return m_error_msg; } + +private: + QString nestPrefix() const { return QString().fill(' ', 3*m_nest); } + QString formatAttributes(const QXmlAttributes & atts); + QString escapeStr(const QString &s); + + unsigned m_nest; + QString m_result, m_error_msg; }; ContentHandler::ContentHandler() @@ -136,15 +136,15 @@ bool ContentHandler::endDocument() } bool ContentHandler::startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes & atts) + const QString &localName, + const QString &qName, + const QXmlAttributes &atts) { m_result += nestPrefix(); m_result += "startElement(namespaceURI=\"" + escapeStr(namespaceURI) - + "\", localName=\"" + escapeStr(localName) - + "\", qName=\"" + escapeStr(qName) - + "\", atts=[" + formatAttributes(atts) + "])\n"; + + "\", localName=\"" + escapeStr(localName) + + "\", qName=\"" + escapeStr(qName) + + "\", atts=[" + formatAttributes(atts) + "])\n"; ++m_nest; return true; } @@ -164,25 +164,25 @@ QString ContentHandler::formatAttributes(const QXmlAttributes &atts) { QString result; for (int i = 0, cnt = atts.count(); i < cnt; ++i) { - if (i != 0) result += ", "; - result += "{localName=\"" + escapeStr(atts.localName(i)) - + "\", qName=\"" + escapeStr(atts.qName(i)) - + "\", uri=\"" + escapeStr(atts.uri(i)) - + "\", type=\"" + escapeStr(atts.type(i)) - + "\", value=\"" + escapeStr(atts.value(i)) + "\"}"; + if (i != 0) result += ", "; + result += "{localName=\"" + escapeStr(atts.localName(i)) + + "\", qName=\"" + escapeStr(atts.qName(i)) + + "\", uri=\"" + escapeStr(atts.uri(i)) + + "\", type=\"" + escapeStr(atts.type(i)) + + "\", value=\"" + escapeStr(atts.value(i)) + "\"}"; } return result; } bool ContentHandler::endElement(const QString &namespaceURI, - const QString &localName, - const QString &qName) + const QString &localName, + const QString &qName) { --m_nest; m_result += nestPrefix(); m_result += "endElement(namespaceURI=\"" + escapeStr(namespaceURI) - + "\", localName=\"" + escapeStr(localName) - + "\", qName=\"" + escapeStr(qName) + "\")\n"; + + "\", localName=\"" + escapeStr(localName) + + "\", qName=\"" + escapeStr(qName) + "\")\n"; return true; } @@ -197,16 +197,16 @@ void ContentHandler::setDocumentLocator(QXmlLocator *locator) { m_result += nestPrefix(); m_result += "setDocumentLocator(locator={columnNumber=" - + QString::number(locator->columnNumber()) - + ", lineNumber=" + QString::number(locator->lineNumber()) - + "})\n"; + + QString::number(locator->columnNumber()) + + ", lineNumber=" + QString::number(locator->lineNumber()) + + "})\n"; } bool ContentHandler::startPrefixMapping (const QString &prefix, const QString & uri) { m_result += nestPrefix(); m_result += "startPrefixMapping(prefix=\"" + escapeStr(prefix) - + "\", uri=\"" + escapeStr(uri) + "\")\n"; + + "\", uri=\"" + escapeStr(uri) + "\")\n"; ++m_nest; return true; } @@ -230,7 +230,7 @@ bool ContentHandler::processingInstruction(const QString &target, const QString { m_result += nestPrefix(); m_result += "processingInstruction(target=\"" + escapeStr(target) - + "\", data=\"" + escapeStr(data) + "\")\n"; + + "\", data=\"" + escapeStr(data) + "\")\n"; return true; } @@ -249,13 +249,13 @@ bool ContentHandler::warning(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "warning(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } @@ -267,13 +267,13 @@ bool ContentHandler::error(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "error(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } @@ -285,49 +285,49 @@ bool ContentHandler::fatalError(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "fatalError(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } -bool ContentHandler::notationDecl ( const QString & name, - const QString & publicId, - const QString & systemId ) +bool ContentHandler::notationDecl(const QString &name, + const QString &publicId, + const QString &systemId ) { m_result += nestPrefix(); m_result += "notationDecl(name=\"" + escapeStr(name) + "\", publicId=\"" - + escapeStr(publicId) + "\", systemId=\"" - + escapeStr(systemId) + "\")\n"; + + escapeStr(publicId) + "\", systemId=\"" + + escapeStr(systemId) + "\")\n"; return true; } -bool ContentHandler::unparsedEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId, - const QString & notationName ) +bool ContentHandler::unparsedEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId, + const QString ¬ationName ) { m_result += nestPrefix(); m_result += "unparsedEntityDecl(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) - + "\", notationName=\"" + escapeStr(notationName) - + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + + "\", notationName=\"" + escapeStr(notationName) + + "\")\n"; return true; } -bool ContentHandler::resolveEntity(const QString & publicId, - const QString & systemId, - QXmlInputSource *&) +bool ContentHandler::resolveEntity(const QString &publicId, + const QString &systemId, + QXmlInputSource *&) { m_result += nestPrefix(); m_result += "resolveEntity(publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) - + "\", ret={})\n"; + + "\", systemId=\"" + escapeStr(systemId) + + "\", ret={})\n"; return true; } @@ -335,8 +335,8 @@ bool ContentHandler::startDTD ( const QString & name, const QString & publicId, { m_result += nestPrefix(); m_result += "startDTD(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; ++m_nest; return true; } @@ -388,37 +388,37 @@ bool ContentHandler::comment ( const QString & ch ) return true; } -bool ContentHandler::attributeDecl ( const QString & eName, - const QString & aName, - const QString & type, - const QString & valueDefault, - const QString & value ) +bool ContentHandler::attributeDecl(const QString &eName, + const QString &aName, + const QString &type, + const QString &valueDefault, + const QString &value) { m_result += nestPrefix(); m_result += "attributeDecl(eName=\"" + escapeStr(eName) + "\", aName=\"" - + escapeStr(aName) + "\", type=\"" + escapeStr(type) - + "\", valueDefault=\"" + escapeStr(valueDefault) - + "\", value=\"" + escapeStr(value) + "\")\n"; + + escapeStr(aName) + "\", type=\"" + escapeStr(type) + + "\", valueDefault=\"" + escapeStr(valueDefault) + + "\", value=\"" + escapeStr(value) + "\")\n"; return true; } -bool ContentHandler::internalEntityDecl ( const QString & name, - const QString & value ) +bool ContentHandler::internalEntityDecl(const QString &name, + const QString &value) { m_result += nestPrefix(); m_result += "internatlEntityDecl(name=\"" + escapeStr(name) - + "\", value=\"" + escapeStr(value) + "\")\n"; + + "\", value=\"" + escapeStr(value) + "\")\n"; return true; } -bool ContentHandler::externalEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId ) +bool ContentHandler::externalEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId) { m_result += nestPrefix(); m_result += "externalEntityDecl(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; return true; } diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h index b394f0f22d..e7af7b1cb5 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h @@ -49,16 +49,16 @@ class ContentHandler; class Parser : public QXmlSimpleReader { - public: - Parser(); - ~Parser(); +public: + Parser(); + ~Parser(); - bool parseFile(QFile *file); - QString result() const; - QString errorMsg() const; + bool parseFile(QFile *file); + QString result() const; + QString errorMsg() const; - private: - ContentHandler *handler; +private: + ContentHandler *handler; }; #endif diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index ed909946e6..6a3bcc7a7d 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -137,17 +137,17 @@ class tst_QXmlSimpleReader : public QObject Q_OBJECT public: - tst_QXmlSimpleReader(); - ~tst_QXmlSimpleReader(); + tst_QXmlSimpleReader(); + ~tst_QXmlSimpleReader(); private slots: void initTestCase(); - void testGoodXmlFile(); - void testGoodXmlFile_data(); - void testBadXmlFile(); - void testBadXmlFile_data(); - void testIncrementalParsing(); - void testIncrementalParsing_data(); + void testGoodXmlFile(); + void testGoodXmlFile_data(); + void testBadXmlFile(); + void testBadXmlFile_data(); + void testIncrementalParsing(); + void testIncrementalParsing_data(); void setDataQString(); void inputFromQIODevice(); void inputFromString(); @@ -278,8 +278,8 @@ static QStringList findXmlFiles(QString dir_name) QFileInfoList::const_iterator it = file_list.begin(); for (; it != file_list.end(); ++it) { - const QFileInfo &file_info = *it; - result.append(file_info.filePath()); + const QFileInfo &file_info = *it; + result.append(file_info.filePath()); } return result; @@ -289,21 +289,21 @@ static QStringList findXmlFiles(QString dir_name) void tst_QXmlSimpleReader::testGoodXmlFile_data() { const char * const good_data_dirs[] = { - "xmldocs/valid/sa", - "xmldocs/valid/not-sa", - "xmldocs/valid/ext-sa", - 0 + "xmldocs/valid/sa", + "xmldocs/valid/not-sa", + "xmldocs/valid/ext-sa", + 0 }; const char * const *d = good_data_dirs; QStringList good_file_list; for (; *d != 0; ++d) - good_file_list += findXmlFiles(*d); + good_file_list += findXmlFiles(*d); QTest::addColumn("file_name"); QStringList::const_iterator it = good_file_list.begin(); for (; it != good_file_list.end(); ++it) - QTest::newRow((*it).toLatin1()) << *it; + QTest::newRow((*it).toLatin1()) << *it; } void tst_QXmlSimpleReader::testGoodXmlFile() @@ -331,19 +331,19 @@ void tst_QXmlSimpleReader::testGoodXmlFile() void tst_QXmlSimpleReader::testBadXmlFile_data() { const char * const bad_data_dirs[] = { - "xmldocs/not-wf/sa", - 0 + "xmldocs/not-wf/sa", + 0 }; const char * const *d = bad_data_dirs; QStringList bad_file_list; for (; *d != 0; ++d) - bad_file_list += findXmlFiles(*d); + bad_file_list += findXmlFiles(*d); QTest::addColumn("file_name"); QStringList::const_iterator it = bad_file_list.begin(); for (; it != bad_file_list.end(); ++it) - QTest::newRow((*it).toLatin1()) << *it; + QTest::newRow((*it).toLatin1()) << *it; } void tst_QXmlSimpleReader::testBadXmlFile() @@ -413,31 +413,31 @@ void tst_QXmlSimpleReader::testIncrementalParsing_data() QTest::addColumn("chunkSize"); const char * const good_data_dirs[] = { - "xmldocs/valid/sa", - "xmldocs/valid/not-sa", - "xmldocs/valid/ext-sa", - 0 + "xmldocs/valid/sa", + "xmldocs/valid/not-sa", + "xmldocs/valid/ext-sa", + 0 }; const char * const *d = good_data_dirs; QStringList good_file_list; for (; *d != 0; ++d) - good_file_list += findXmlFiles(*d); + good_file_list += findXmlFiles(*d); for (int i=1; i<10; ++i) { - QStringList::const_iterator it = good_file_list.begin(); - for (; it != good_file_list.end(); ++it) { - if ( *it == "xmldocs/valid/sa/089.xml" ) - continue;// TODO: fails at the moment -- don't bother - if ( i==1 && ( - *it == "xmldocs/valid/sa/049.xml" || - *it == "xmldocs/valid/sa/050.xml" || - *it == "xmldocs/valid/sa/051.xml" || - *it == "xmldocs/valid/sa/052.xml" ) ) { - continue; // TODO: fails at the moment -- don't bother - } - QTest::newRow(QString("%1 %2").arg(*it).arg(i).toLatin1()) << *it << i; - } + QStringList::const_iterator it = good_file_list.begin(); + for (; it != good_file_list.end(); ++it) { + if ( *it == "xmldocs/valid/sa/089.xml" ) + continue;// TODO: fails at the moment -- don't bother + if ( i==1 && ( + *it == "xmldocs/valid/sa/049.xml" || + *it == "xmldocs/valid/sa/050.xml" || + *it == "xmldocs/valid/sa/051.xml" || + *it == "xmldocs/valid/sa/052.xml" ) ) { + continue; // TODO: fails at the moment -- don't bother + } + QTest::newRow(QString("%1 %2").arg(*it).arg(i).toLatin1()) << *it << i; + } } } @@ -459,7 +459,7 @@ void tst_QXmlSimpleReader::testIncrementalParsing() first = false; } else { QVERIFY(parser.parseContinue()); - } + } } // detect end of document QVERIFY(parser.parseContinue()); @@ -573,8 +573,8 @@ void tst_QXmlSimpleReader::inputFromSocket() const bool connectionSuccess = sock.waitForConnected(); if(!connectionSuccess) { - QTextStream out(stderr); - out << "QTcpSocket::errorString()" << sock.errorString(); + QTextStream out(stderr); + out << "QTcpSocket::errorString()" << sock.errorString(); } QVERIFY(connectionSuccess); -- cgit v1.2.3