tests/auto/qregion/tst_qregion.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    86     void operator_intersect_data();
    86     void operator_intersect_data();
    87     void operator_intersect();
    87     void operator_intersect();
    88     void operator_xor_data();
    88     void operator_xor_data();
    89     void operator_xor();
    89     void operator_xor();
    90 
    90 
    91     void numRects_data();
    91     void rectCount_data();
    92     void numRects();
    92     void rectCount();
    93 
    93 
    94     void isEmpty_data();
    94     void isEmpty_data();
    95     void isEmpty();
    95     void isEmpty();
    96 #ifdef Q_OS_WIN
    96 #ifdef Q_OS_WIN
    97     void handle();
    97     void handle();
   552     if (r1 + r2 != expected) {
   552     if (r1 + r2 != expected) {
   553         qDebug() << "r1 + r2" << (r1 + r2);
   553         qDebug() << "r1 + r2" << (r1 + r2);
   554         qDebug() << "expected" << expected;
   554         qDebug() << "expected" << expected;
   555     }
   555     }
   556     QCOMPARE(r1 + r2, expected);
   556     QCOMPARE(r1 + r2, expected);
   557     if (r2.numRects() == 1) {
   557     if (r2.rectCount() == 1) {
   558         if (r1 + r2.boundingRect() != expected) {
   558         if (r1 + r2.boundingRect() != expected) {
   559             qDebug() << "r1 + QRect(r2)" << (r1 + r2.boundingRect());
   559             qDebug() << "r1 + QRect(r2)" << (r1 + r2.boundingRect());
   560             qDebug() << "expected" << expected;
   560             qDebug() << "expected" << expected;
   561         }
   561         }
   562         QCOMPARE(r1 + r2.boundingRect(), expected);
   562         QCOMPARE(r1 + r2.boundingRect(), expected);
   565     if (r2 + r1 != expected) {
   565     if (r2 + r1 != expected) {
   566         qDebug() << "r2 + r1" << (r2 + r1);
   566         qDebug() << "r2 + r1" << (r2 + r1);
   567         qDebug() << "expected" << expected;
   567         qDebug() << "expected" << expected;
   568     }
   568     }
   569     QCOMPARE(r2 + r1, expected);
   569     QCOMPARE(r2 + r1, expected);
   570     if (r1.numRects() == 1) {
   570     if (r1.rectCount() == 1) {
   571         if (r1 + r2.boundingRect() != expected) {
   571         if (r1 + r2.boundingRect() != expected) {
   572             qDebug() << "r2 + QRect(r1)" << (r2 + r1.boundingRect());
   572             qDebug() << "r2 + QRect(r1)" << (r2 + r1.boundingRect());
   573             qDebug() << "expected" << expected;
   573             qDebug() << "expected" << expected;
   574         }
   574         }
   575         QCOMPARE(r2 + r1.boundingRect(), expected);
   575         QCOMPARE(r2 + r1.boundingRect(), expected);
   580     if (result1 != expected) {
   580     if (result1 != expected) {
   581         qDebug() << "r1 += r2" << result1;
   581         qDebug() << "r1 += r2" << result1;
   582         qDebug() << "expected" << expected;
   582         qDebug() << "expected" << expected;
   583     }
   583     }
   584     QCOMPARE(result1, expected);
   584     QCOMPARE(result1, expected);
   585     if (r2.numRects() == 1) {
   585     if (r2.rectCount() == 1) {
   586         result1 = r1;
   586         result1 = r1;
   587         result1 += r2.boundingRect();
   587         result1 += r2.boundingRect();
   588         if (result1 != expected) {
   588         if (result1 != expected) {
   589             qDebug() << "r1 += QRect(r2)" << result1;
   589             qDebug() << "r1 += QRect(r2)" << result1;
   590             qDebug() << "expected" << expected;
   590             qDebug() << "expected" << expected;
   597     if (result2 != expected) {
   597     if (result2 != expected) {
   598         qDebug() << "r2 += r1" << result2;
   598         qDebug() << "r2 += r1" << result2;
   599         qDebug() << "expected" << expected;
   599         qDebug() << "expected" << expected;
   600     }
   600     }
   601     QCOMPARE(result2, expected);
   601     QCOMPARE(result2, expected);
   602     if (r1.numRects() == 1) {
   602     if (r1.rectCount() == 1) {
   603         result2 = r2;
   603         result2 = r2;
   604         result2 += r1.boundingRect();
   604         result2 += r1.boundingRect();
   605         if (result2 != expected) {
   605         if (result2 != expected) {
   606             qDebug() << "r2 += QRect(r1)" << result2;
   606             qDebug() << "r2 += QRect(r1)" << result2;
   607             qDebug() << "expected" << expected;
   607             qDebug() << "expected" << expected;
   800 
   800 
   801     dest ^= arg;
   801     dest ^= arg;
   802     QCOMPARE(dest, expected);
   802     QCOMPARE(dest, expected);
   803 }
   803 }
   804 
   804 
   805 void tst_QRegion::numRects_data()
   805 void tst_QRegion::rectCount_data()
   806 {
   806 {
   807     QTest::addColumn<QRegion>("region");
   807     QTest::addColumn<QRegion>("region");
   808     QTest::addColumn<int>("expected");
   808     QTest::addColumn<int>("expected");
   809 
   809 
   810     QTest::newRow("empty") << QRegion() << 0;
   810     QTest::newRow("empty") << QRegion() << 0;
   816     dest.setRects(rects.constData(), rects.size());
   816     dest.setRects(rects.constData(), rects.size());
   817 
   817 
   818     QTest::newRow("2 rects") << dest << rects.size();
   818     QTest::newRow("2 rects") << dest << rects.size();
   819 }
   819 }
   820 
   820 
   821 void tst_QRegion::numRects()
   821 void tst_QRegion::rectCount()
   822 {
   822 {
   823     QFETCH(QRegion, region);
   823     QFETCH(QRegion, region);
   824     QFETCH(int, expected);
   824     QFETCH(int, expected);
   825 
   825 
   826     QCOMPARE(region.numRects(), expected);
   826     QCOMPARE(region.rectCount(), expected);
   827 }
   827 }
   828 
   828 
   829 void tst_QRegion::isEmpty_data()
   829 void tst_QRegion::isEmpty_data()
   830 {
   830 {
   831     QTest::addColumn<QRegion>("region");
   831     QTest::addColumn<QRegion>("region");
   848 {
   848 {
   849     QFETCH(QRegion, region);
   849     QFETCH(QRegion, region);
   850 
   850 
   851     QVERIFY(region.isEmpty());
   851     QVERIFY(region.isEmpty());
   852     QCOMPARE(region, QRegion());
   852     QCOMPARE(region, QRegion());
   853     QCOMPARE(region.numRects(), 0);
   853     QCOMPARE(region.rectCount(), 0);
   854     QCOMPARE(region.boundingRect(), QRect());
   854     QCOMPARE(region.boundingRect(), QRect());
   855     QVERIFY(region.rects().isEmpty());
   855     QVERIFY(region.rects().isEmpty());
   856 }
   856 }
   857 
   857 
   858 #ifdef Q_OS_WIN
   858 #ifdef Q_OS_WIN