Remove Q_ASSERT from qgraphicsanchorlayout test
Q_ASSERT will only catch a violation of the precondition of the checkReverseDirection function in a debug build. This commit replaces the Q_ASSERT with QVERIFY'ing the precondition (that the widget has a layout) before calling the function. Change-Id: Ibaa2b52b7d67fa20784e0df022e8c8169da0e50e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit d1011fc9328fa335bc69a065b29e77ce60608c55)
This commit is contained in:
parent
5bdf574941
commit
319197880e
@ -135,7 +135,6 @@ static void setAnchor(QGraphicsAnchorLayout *l,
|
|||||||
static bool checkReverseDirection(QGraphicsWidget *widget)
|
static bool checkReverseDirection(QGraphicsWidget *widget)
|
||||||
{
|
{
|
||||||
QGraphicsLayout *layout = widget->layout();
|
QGraphicsLayout *layout = widget->layout();
|
||||||
Q_ASSERT(layout);
|
|
||||||
qreal left, top, right, bottom;
|
qreal left, top, right, bottom;
|
||||||
layout->getContentsMargins(&left, &top, &right, &bottom);
|
layout->getContentsMargins(&left, &top, &right, &bottom);
|
||||||
widget->setLayoutDirection(Qt::LeftToRight);
|
widget->setLayoutDirection(Qt::LeftToRight);
|
||||||
@ -345,6 +344,7 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
|
|||||||
p->show();
|
p->show();
|
||||||
view->show();
|
view->show();
|
||||||
|
|
||||||
|
QVERIFY(p->layout());
|
||||||
QCOMPARE(checkReverseDirection(p), true);
|
QCOMPARE(checkReverseDirection(p), true);
|
||||||
|
|
||||||
if (hasSimplification) {
|
if (hasSimplification) {
|
||||||
@ -445,6 +445,7 @@ void tst_QGraphicsAnchorLayout::diagonal()
|
|||||||
QVERIFY(!usedSimplex(l, Qt::Vertical));
|
QVERIFY(!usedSimplex(l, Qt::Vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVERIFY(p.layout());
|
||||||
QCOMPARE(checkReverseDirection(&p), true);
|
QCOMPARE(checkReverseDirection(&p), true);
|
||||||
|
|
||||||
c->setMinimumWidth(300);
|
c->setMinimumWidth(300);
|
||||||
@ -735,6 +736,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
|
|||||||
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
|
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
|
||||||
QCOMPARE(p.size(), layoutMaximumSize);
|
QCOMPARE(p.size(), layoutMaximumSize);
|
||||||
|
|
||||||
|
QVERIFY(p.layout());
|
||||||
QCOMPARE(checkReverseDirection(&p), true);
|
QCOMPARE(checkReverseDirection(&p), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user