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)
This commit is contained in:
parent
46412f7128
commit
5bdf574941
@ -2585,15 +2585,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data()
|
|||||||
sizeHints1.insert( Qt::MinimumSize, 30 );
|
sizeHints1.insert( Qt::MinimumSize, 30 );
|
||||||
sizeHints1.insert( Qt::PreferredSize, 35 );
|
sizeHints1.insert( Qt::PreferredSize, 35 );
|
||||||
sizeHints1.insert( Qt::MaximumSize, 40 );
|
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;
|
SizeHintArray sizeHints2;
|
||||||
sizeHints2.insert( Qt::MinimumSize, 5 );
|
sizeHints2.insert( Qt::MinimumSize, 5 );
|
||||||
sizeHints2.insert( Qt::PreferredSize, 35 );
|
sizeHints2.insert( Qt::PreferredSize, 35 );
|
||||||
sizeHints2.insert( Qt::MaximumSize, 300 );
|
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 width1 = 35;
|
||||||
const qreal width2 = 100-10-10-10-width1;
|
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::MinimumSize, 0 );
|
||||||
sizeHints1.insert( Qt::PreferredSize, 20 );
|
sizeHints1.insert( Qt::PreferredSize, 20 );
|
||||||
sizeHints1.insert( Qt::MaximumSize, 100 );
|
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;
|
SizeHintArray sizeHints2;
|
||||||
sizeHints2.insert( Qt::MinimumSize, 0 );
|
sizeHints2.insert( Qt::MinimumSize, 0 );
|
||||||
sizeHints2.insert( Qt::PreferredSize, 50 );
|
sizeHints2.insert( Qt::PreferredSize, 50 );
|
||||||
sizeHints2.insert( Qt::MaximumSize, 100 );
|
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 width1 = 20;
|
||||||
const qreal width2 = 100-10-10-10-width1;
|
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::MinimumSize, 0 );
|
||||||
sizeHints1.insert( Qt::PreferredSize, 40 );
|
sizeHints1.insert( Qt::PreferredSize, 40 );
|
||||||
sizeHints1.insert( Qt::MaximumSize, 100 );
|
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;
|
SizeHintArray sizeHints2;
|
||||||
sizeHints2.insert( Qt::MinimumSize, 0 );
|
sizeHints2.insert( Qt::MinimumSize, 0 );
|
||||||
sizeHints2.insert( Qt::PreferredSize, 60 );
|
sizeHints2.insert( Qt::PreferredSize, 60 );
|
||||||
sizeHints2.insert( Qt::MaximumSize, 100 );
|
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 width1 = 28; // got from manual calculation
|
||||||
const qreal width2 = 100-10-10-10-width1;
|
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::MinimumSize, 0 );
|
||||||
sizeHints1.insert( Qt::PreferredSize, 10 );
|
sizeHints1.insert( Qt::PreferredSize, 10 );
|
||||||
sizeHints1.insert( Qt::MaximumSize, 100 );
|
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;
|
SizeHintArray sizeHints2;
|
||||||
sizeHints2.insert( Qt::MinimumSize, 0 );
|
sizeHints2.insert( Qt::MinimumSize, 0 );
|
||||||
sizeHints2.insert( Qt::PreferredSize, 40 );
|
sizeHints2.insert( Qt::PreferredSize, 40 );
|
||||||
sizeHints2.insert( Qt::MaximumSize, 100 );
|
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 width1 = 22; // got from manual calculation
|
||||||
const qreal width2 = 100-10-10-10-width1;
|
const qreal width2 = 100-10-10-10-width1;
|
||||||
@ -2669,6 +2653,12 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution()
|
|||||||
QFETCH(qreal, width1);
|
QFETCH(qreal, width1);
|
||||||
QFETCH(qreal, width2);
|
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
|
// create objects
|
||||||
QGraphicsWidget widget;
|
QGraphicsWidget widget;
|
||||||
TheAnchorLayout *layout = new TheAnchorLayout;
|
TheAnchorLayout *layout = new TheAnchorLayout;
|
||||||
|
Loading…
Reference in New Issue
Block a user