summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-21 13:00:06 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:46:41 +1000
commit0ea9ffef432d2df60b59bec146200a6acf0984be (patch)
tree5c5e73bd041b1756ab79ba1f4aab8d321f11db93 /tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
parent9e0049f656c7ec073ec042552ec7be1fb3946755 (diff)
Use meaningful variable names
Make the meaning of the code more obvious and avoid a compiler warning about the variable "w" being overridden. Change-Id: Ib76d3aa1cae46e263b2ab61b675d9ef74032aacc Reviewed-by: Rohan McGovern (cherry picked from commit 59634e825f1efa6f32befc8767cafedfeb9b7d59)
Diffstat (limited to 'tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 447385a7d8..a0360a33c1 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -132,33 +132,33 @@ 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();
+ Q_ASSERT(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;
}
}