summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsanchorlayout
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
commit9cacde74f7de702689725882633073e60c0a2baa (patch)
tree330d22dadbd28b14a7d8896823d1c33597e9993e /tests/auto/qgraphicsanchorlayout
parent006c8e22075112eff6230d8168d716e44a9e29d5 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
downloadQt-9cacde74f7de702689725882633073e60c0a2baa.zip
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.gz
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Conflicts: doc/src/examples/wheel.qdoc src/gui/util/qflickgesture.cpp src/gui/util/qflickgesture_p.h src/gui/util/qscroller.cpp src/gui/util/qscroller.h src/gui/util/qscroller_p.h src/gui/util/qscrollerproperties.cpp src/gui/util/qscrollerproperties.h tests/auto/qscroller/tst_qscroller.cpp
Diffstat (limited to 'tests/auto/qgraphicsanchorlayout')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 6c98c67..5987f4a 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -132,33 +132,32 @@ static void setAnchor(QGraphicsAnchorLayout *l,
anchor->setSpacing(spacing);
}
-static bool checkReverseDirection(QGraphicsWidget *w)
+static bool checkReverseDirection(QGraphicsWidget *widget)
{
- QGraphicsLayout *l = w->layout();
- Q_ASSERT(l);
+ QGraphicsLayout *layout = widget->layout();
qreal left, top, right, bottom;
- l->getContentsMargins(&left, &top, &right, &bottom);
- w->setLayoutDirection(Qt::LeftToRight);
+ layout->getContentsMargins(&left, &top, &right, &bottom);
+ widget->setLayoutDirection(Qt::LeftToRight);
QApplication::processEvents();
- const QRectF lg = l->geometry();
+ const QRectF layoutGeometry = layout->geometry();
QMap<QGraphicsLayoutItem *, QRectF> geometries;
- for (int i = 0; i < l->count(); ++i) {
- QGraphicsLayoutItem *w = l->itemAt(i);
- geometries.insert(w, w->geometry());
+ for (int i = 0; i < layout->count(); ++i) {
+ QGraphicsLayoutItem *item = layout->itemAt(i);
+ geometries.insert(item, item->geometry());
}
- w->setLayoutDirection(Qt::RightToLeft);
+ widget->setLayoutDirection(Qt::RightToLeft);
QApplication::processEvents();
- lg.adjusted(+right, +top, -left, -bottom);
- for (int i = 0; i < l->count(); ++i) {
- QGraphicsLayoutItem *w = l->itemAt(i);
- const QRectF rtlGeom = w->geometry();
- const QRectF ltrGeom = geometries.value(w);
- QRectF expectedGeom = ltrGeom;
- expectedGeom.moveRight(lg.right() - (0 + ltrGeom.left()));
- if (expectedGeom != rtlGeom) {
- qDebug() << "layout->geometry():" << lg
- << "expected:" << expectedGeom
- << "actual:" << rtlGeom;
+ layoutGeometry.adjusted(+right, +top, -left, -bottom);
+ for (int i = 0; i < layout->count(); ++i) {
+ QGraphicsLayoutItem *item = layout->itemAt(i);
+ const QRectF rightToLeftGeometry = item->geometry();
+ const QRectF leftToRightGeometry = geometries.value(item);
+ QRectF expectedGeometry = leftToRightGeometry;
+ expectedGeometry.moveRight(layoutGeometry.right() - leftToRightGeometry.left());
+ if (expectedGeometry != rightToLeftGeometry) {
+ qDebug() << "layout->geometry():" << layoutGeometry
+ << "expected:" << expectedGeometry
+ << "actual:" << rightToLeftGeometry;
return false;
}
}
@@ -345,6 +344,7 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
p->show();
view->show();
+ QVERIFY(p->layout());
QCOMPARE(checkReverseDirection(p), true);
if (hasSimplification) {
@@ -445,6 +445,7 @@ void tst_QGraphicsAnchorLayout::diagonal()
QVERIFY(!usedSimplex(l, Qt::Vertical));
}
+ QVERIFY(p.layout());
QCOMPARE(checkReverseDirection(&p), true);
c->setMinimumWidth(300);
@@ -735,6 +736,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+ QVERIFY(p.layout());
QCOMPARE(checkReverseDirection(&p), true);
}