summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-05 17:44:04 (GMT)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-11-06 18:17:17 (GMT)
commitf2f7ad1e0a73ef28aee406de358e1308f817bf6d (patch)
tree55d91c8df881931421a0eadddcccffdcffbdf96e /tests/auto
parent720e04ac5f572c1ca0a32e1675fbda6e778d3e8c (diff)
downloadQt-f2f7ad1e0a73ef28aee406de358e1308f817bf6d.zip
Qt-f2f7ad1e0a73ef28aee406de358e1308f817bf6d.tar.gz
Qt-f2f7ad1e0a73ef28aee406de358e1308f817bf6d.tar.bz2
QGAL (Test): Add test where center anchor is simplified by parallel
We were not handling the case where a parallel anchor is created to simplify a central anchor. Unfortunately no tests had shown that case yet. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index cc96edb..8b52674 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -83,6 +83,7 @@ private slots:
void infiniteMaxSizes();
void simplifiableUnfeasible();
void simplificationVsOrder();
+ void parallelSimplificationOfCenter();
};
class RectWidget : public QGraphicsWidget
@@ -1801,5 +1802,30 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder()
}
}
+void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter()
+{
+ QSizeF min(10, 10);
+ QSizeF pref(20, 10);
+ QSizeF max(50, 10);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "A");
+ QGraphicsWidget *b = createItem(min, pref, max, "B");
+
+ QGraphicsWidget parent;
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent);
+ l->setContentsMargins(0, 0, 0, 0);
+
+ l->addAnchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft);
+ l->addAnchor(l, Qt::AnchorRight, a, Qt::AnchorRight);
+
+ l->addAnchor(a, Qt::AnchorHorizontalCenter, b, Qt::AnchorLeft);
+ l->addAnchor(b, Qt::AnchorRight, a, Qt::AnchorRight);
+
+ parent.resize(l->effectiveSizeHint(Qt::PreferredSize));
+
+ QCOMPARE(a->geometry(), QRectF(0, 0, 40, 10));
+ QCOMPARE(b->geometry(), QRectF(20, 0, 20, 10));
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"