diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-12-30 15:51:05 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-03 02:57:12 +0100 |
commit | fda36df6babf20bcfd04a54a1336a9c26e72a8ef (patch) | |
tree | 0c09018e6db15ea40e156b38854e224e62e9130f /tests/auto/gui | |
parent | 39f3ee8a5dd499cf86f95e7fc9200eb3226b16be (diff) | |
download | qtbase-fda36df6babf20bcfd04a54a1336a9c26e72a8ef.tar.gz |
Use true and false in preference to TRUE and FALSE in tests.
Use the C++ boolean constants true and false instead of the C macros
TRUE and FALSE (which are actually integers), and use QVERIFY instead of
QCOMPARE for verifying simple boolean expressions.
Change-Id: Ie76dfcab6722df6b93b3fa62b0f3437901482932
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/gui')
7 files changed, 26 insertions, 28 deletions
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index 370338d24a..bbfaf4c408 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -72,7 +72,7 @@ protected: mousePressButton = e->button(); mousePressButtons = e->buttons(); mousePressModifiers = e->modifiers(); - mousePressEventRecieved = TRUE; + mousePressEventRecieved = true; e->accept(); } void mouseReleaseEvent(QMouseEvent *e) @@ -81,7 +81,7 @@ protected: mouseReleaseButton = e->button(); mouseReleaseButtons = e->buttons(); mouseReleaseModifiers = e->modifiers(); - mouseReleaseEventRecieved = TRUE; + mouseReleaseEventRecieved = true; e->accept(); } }; @@ -134,8 +134,8 @@ void tst_QMouseEvent::cleanupTestCase() void tst_QMouseEvent::init() { - testMouseWidget->mousePressEventRecieved = FALSE; - testMouseWidget->mouseReleaseEventRecieved = FALSE; + testMouseWidget->mousePressEventRecieved = false; + testMouseWidget->mouseReleaseEventRecieved = false; testMouseWidget->mousePressButton = 0; testMouseWidget->mousePressButtons = 0; testMouseWidget->mousePressModifiers = 0; diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp index d3a087eefc..af472c6c8e 100644 --- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp @@ -1254,10 +1254,8 @@ void tst_QShortcut::testElement() if (action == ClearAll) { clearAllShortcuts(); - QCOMPARE(TRUE, TRUE); } else if (action == SetupAccel) { setupShortcut(testWidget, txt, k1, k2, k3, k4); - QCOMPARE(TRUE, TRUE); } else { sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4); QCOMPARE(int(currentResult), result); diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index c868e9fa39..4faecad104 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -347,7 +347,7 @@ Q_DECLARE_METATYPE(QRegion) tst_QPainter::tst_QPainter() { // QtTestCase sets this to false, but this turns off alpha pixmaps on Unix. - QApplication::setDesktopSettingsAware(TRUE); + QApplication::setDesktopSettingsAware(true); } tst_QPainter::~tst_QPainter() diff --git a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp index 418c385717..a5a948a8e1 100644 --- a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp +++ b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp @@ -127,7 +127,7 @@ static QBitmap createSrcBitmap( int size, int border ) painter.drawRect( border, border, size, size2 ); painter.end(); if ( border > 0 ) { - QBitmap mask( totalSize, totalSize, TRUE ); + QBitmap mask( totalSize, totalSize, true ); QPainter painter; painter.begin( &mask ); painter.setPen( QPen( Qt::color1, 1 ) ); @@ -171,7 +171,7 @@ int main( int argc, char **argv ) 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 ); + QBitmap mask( 32, 48, true ); { QPainter painter; painter.begin( &mask ); diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index eeb5aae96d..832e9c2daa 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -117,22 +117,22 @@ void tst_QPen::operator_eq_eq_data() QTest::newRow("differentColor") << QPen(Qt::red) << QPen(Qt::blue) - << bool(FALSE); + << false; QTest::newRow("differentWidth") << QPen(Qt::red, 2) << QPen(Qt::red, 3) - << bool(FALSE); + << false; QTest::newRow("differentPenStyle") << QPen(Qt::red, 2, Qt::DashLine) << QPen(Qt::red, 2, Qt::DotLine) - << bool(FALSE); + << false; QTest::newRow("differentCapStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::SquareCap, Qt::BevelJoin) - << bool(FALSE); + << false; QTest::newRow("differentJoinStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin) - << bool(FALSE); + << false; QTest::newRow("same") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << bool(TRUE); + << true; } diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp index 8d0bed6128..f69e058183 100644 --- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp +++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp @@ -76,7 +76,7 @@ void tst_QPolygon::makeEllipse() int i; // make sure that all points are R+-1 away from the center - bool err = FALSE; + 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 ) ); diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp index 4767048929..2bb3cbeeef 100644 --- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp +++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp @@ -315,25 +315,25 @@ void tst_QPrinter::testSetOptions() QPrintDialog dlg(&prn); // Verify default values - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), TRUE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), FALSE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), TRUE); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), true); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), false); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), true); dlg.setEnabledOptions(QAbstractPrintDialog::PrintPageRange); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), FALSE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), FALSE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), TRUE); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), false); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), false); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), true); dlg.setEnabledOptions((QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintSelection | QAbstractPrintDialog::PrintPageRange))); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), FALSE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), TRUE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), TRUE); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), false); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), true); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), true); dlg.setEnabledOptions(QAbstractPrintDialog::PrintSelection); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), FALSE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), TRUE); - MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), FALSE); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintToFile), false); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintSelection), true); + MYCOMPARE(dlg.isOptionEnabled(QAbstractPrintDialog::PrintPageRange), false); } void tst_QPrinter::testMargins_data() |