summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-16 10:51:26 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-16 10:51:26 (GMT)
commite0a5d1f18d5dee85ddc312094f5bb4d49ea3d286 (patch)
treed735dcb44a164aa2e7d2b163841a5c00da56339e /tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
parent5f184a0c3485f9c8e35d3cc7c3c2f715f0f94111 (diff)
parentea52aef43acf862a51ea5b2eb65fa2ad60e5590f (diff)
downloadQt-e0a5d1f18d5dee85ddc312094f5bb4d49ea3d286.zip
Qt-e0a5d1f18d5dee85ddc312094f5bb4d49ea3d286.tar.gz
Qt-e0a5d1f18d5dee85ddc312094f5bb4d49ea3d286.tar.bz2
Merge branch 'fixes' of git://gitorious.org/~fleury/qt/fleury-openbossa-clone into 4.6
Conflicts: src/gui/graphicsview/qgraphicsanchorlayout_p.cpp src/gui/graphicsview/qgraphicsanchorlayout_p.h tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
Diffstat (limited to 'tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp85
1 files changed, 63 insertions, 22 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index cef56b9..cce7b4c 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -49,6 +49,14 @@
class tst_QGraphicsAnchorLayout : public QObject {
Q_OBJECT;
+public:
+ tst_QGraphicsAnchorLayout() : QObject() {
+ hasSimplification = qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
+ }
+
+private:
+ bool hasSimplification;
+
private slots:
void simple();
void simple_center();
@@ -185,8 +193,10 @@ void tst_QGraphicsAnchorLayout::simple()
p.setLayout(l);
p.adjustSize();
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::simple_center()
@@ -226,8 +236,10 @@ void tst_QGraphicsAnchorLayout::simple_center()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
- QVERIFY(usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
delete p;
}
@@ -417,8 +429,10 @@ void tst_QGraphicsAnchorLayout::diagonal()
QCOMPARE(e->geometry(), QRectF(100.0, 200.0, 75.0, 100.0));
QCOMPARE(p.size(), testA);
- QVERIFY(usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
QCOMPARE(checkReverseDirection(&p), true);
@@ -496,6 +510,9 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(f->geometry(), QRectF(350, 500, 100, 100));
QCOMPARE(p.size(), layoutMinimumSize);
+ if (!hasSimplification)
+ return;
+
p.resize(layoutPreferredSize);
QCOMPARE(a->geometry(), QRectF(0, 0, 150, 100));
QCOMPARE(b->geometry(), QRectF(150, 100, 150, 100));
@@ -565,8 +582,10 @@ void tst_QGraphicsAnchorLayout::parallel2()
p.resize(layoutMaximumSize);
QCOMPARE(p.size(), layoutMaximumSize);
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::snake()
@@ -758,6 +777,8 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(layoutMaximumSize, QSizeF(300.0, 400.0));
p.resize(layoutMinimumSize);
+ if (!hasSimplification)
+ QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
QCOMPARE(a->geometry(), QRectF(0.0, 0.0, 20.0, 100.0));
QCOMPARE(b->geometry(), QRectF(20.0, 100.0, 20.0, 100.0));
QCOMPARE(c->geometry(), QRectF(40.0, 200.0, 20.0, 100.0));
@@ -778,8 +799,10 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(d->geometry(), QRectF(0.0, 300.0, 300.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
@@ -836,6 +859,9 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(layoutPreferredSize, QSizeF(220.0, 500.0));
QCOMPARE(layoutMaximumSize, QSizeF(400.0, 500.0));
+ if (!hasSimplification)
+ return;
+
p.resize(layoutMinimumSize);
QCOMPARE(a->size(), b->size());
QCOMPARE(a->size(), c->size());
@@ -922,8 +948,10 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
QCOMPARE(c->size().width(), 14 * factor);
QCOMPARE(p.size(), QSizeF(12, 400));
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::example()
@@ -1008,8 +1036,10 @@ void tst_QGraphicsAnchorLayout::example()
QCOMPARE(b->size(), d->size());
QCOMPARE(f->size(), g->size());
- QVERIFY(usedSimplex(l, Qt::Horizontal));
- QVERIFY(usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::setSpacing()
@@ -1331,8 +1361,10 @@ void tst_QGraphicsAnchorLayout::sizePolicy()
QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(100, 100));
QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(100, 100));
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
delete p;
delete view;
@@ -1425,8 +1457,10 @@ void tst_QGraphicsAnchorLayout::expandingSequence()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize.width(), qreal(200));
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
@@ -1488,8 +1522,10 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize.width(), qreal(400));
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
// Now we change D to have more "room for growth" from its preferred size
// to its maximum size. We expect a proportional fair distribution. Note that
@@ -1514,8 +1550,10 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
QCOMPARE(c->geometry().size(), pref);
QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0));
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::expandingParallel()
@@ -1672,6 +1710,9 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
QCOMPARE(c->geometry(), QRectF(100, 0, 50, 10));
QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10));
+ if (!hasSimplification)
+ QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
+
p.resize(1000, 10);
QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10));
QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10));