diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-01-13 15:48:44 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-13 22:46:50 +0100 |
commit | 882bf3475c8926abe62ed71e6719458b024caac0 (patch) | |
tree | f227c1c660776da1ece9149b1c9e3ca5b27d8687 /tests/auto/gui/painting | |
parent | 81157d23749f6ee1feef35a04fa9cc989ebc01eb (diff) |
expand tabs and related whitespace fixes in *.{cpp,h,qdoc}
the diff -w for this commit is empty.
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 52 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpainter/utils/createImages/main.cpp | 100 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpen/tst_qpen.cpp | 24 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp | 10 | ||||
-rw-r--r-- | tests/auto/gui/painting/qregion/tst_qregion.cpp | 186 | ||||
-rw-r--r-- | tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp | 218 |
6 files changed, 295 insertions, 295 deletions
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<result.height(); ++y) for (int x=0; x<result.width(); ++x) { - bool diff; + bool diff; if (qAlpha(expected) == 0) { diff = qAlpha(result.pixel(x, y)) != 0; } else { @@ -523,12 +523,12 @@ void tst_QPainter::drawPixmap_comp() || (qAbs(qBlue(pix) - qBlue(expected)) > 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<colorbands; i++ ) { - for ( int j=0; j<intensities; j++ ) { - int intensity = 255 * (j+1) / intensities; // 25%, 50%, 75% and 100% - for ( int k=0; k<8; k++ ) { - QColor col = baseColor( k, intensity ); - painter.setPen( QPen( col, 1 ) ); - painter.setBrush( col ); - painter.drawRect( k*4, j*4 + i*intensities*4, 4, 4 ); - } - } + for (int j = 0; j < intensities; j++) { + int intensity = 255 * (j+1) / intensities; // 25%, 50%, 75% and 100% + for (int k = 0; k < 8; k++) { + QColor col = baseColor(k, intensity); + painter.setPen(QPen(col, 1)); + painter.setBrush(col); + painter.drawRect(k*4, j*4 + i*intensities*4, 4, 4); + } + } } painter.end(); return pm; @@ -127,14 +127,14 @@ static QBitmap createSrcBitmap( int size, int border ) painter.drawRect( border, border, size, size2 ); painter.end(); if ( border > 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<bool>("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 } |