From 5bdf574941475d834451142506b5cdb452027f7d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 15:33:01 +1000 Subject: [PATCH] Remove Q_ASSERTs from qgraphicsanchorlayout1 test Sanity-check the test data when using it rather than when creating it. Change-Id: Ie5d5e1ff3fc439d196096f17cb6f97680927a90c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 2c64404e2edd3b792b8a1d04c773860d40c04c4c) --- .../tst_qgraphicsanchorlayout1.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a03f7bc..ee25291 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -2585,15 +2585,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 30 ); sizeHints1.insert( Qt::PreferredSize, 35 ); sizeHints1.insert( Qt::MaximumSize, 40 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 5 ); sizeHints2.insert( Qt::PreferredSize, 35 ); sizeHints2.insert( Qt::MaximumSize, 300 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 35; const qreal width2 = 100-10-10-10-width1; @@ -2605,15 +2601,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 20 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 50 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 20; const qreal width2 = 100-10-10-10-width1; @@ -2625,15 +2617,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 40 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 60 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 28; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2645,15 +2633,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 10 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 40 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 22; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2669,6 +2653,12 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution() QFETCH(qreal, width1); QFETCH(qreal, width2); + // sanity-check the test data - MinimumSize <= PreferredSize <= MaximumSize + QVERIFY( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); + QVERIFY( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); + // create objects QGraphicsWidget widget; TheAnchorLayout *layout = new TheAnchorLayout; -- 2.7.4