summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-13 13:21:10 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-13 13:21:10 (GMT)
commit3764f6a3109266bf55aed1a18dd992e90fb85221 (patch)
tree5b106c57cd66848dc92f3c29879f6d7c6430eaec /tests
parentd1d737d8497b6a0d80e16c81ef20b9eac6ee72b6 (diff)
parent3dcc9d6bc6385e2c4f4d7d7366c84b6dcc74508c (diff)
downloadQt-3764f6a3109266bf55aed1a18dd992e90fb85221.zip
Qt-3764f6a3109266bf55aed1a18dd992e90fb85221.tar.gz
Qt-3764f6a3109266bf55aed1a18dd992e90fb85221.tar.bz2
Merge branch 'fixes' of git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp26
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp4
2 files changed, 28 insertions, 2 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index c7ed309..2ad024f 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -85,6 +85,7 @@ private slots:
void simplificationVsOrder();
void parallelSimplificationOfCenter();
void simplificationVsRedundance();
+ void spacingPersistency();
};
class RectWidget : public QGraphicsWidget
@@ -1866,5 +1867,30 @@ void tst_QGraphicsAnchorLayout::simplificationVsRedundance()
QCOMPARE(usedSimplex(l, Qt::Vertical), false);
}
+/*
+ Avoid regression where the saved prefSize would be lost. This was
+ solved by saving the original spacing in the QGraphicsAnchorPrivate class
+*/
+void tst_QGraphicsAnchorLayout::spacingPersistency()
+{
+ QGraphicsWidget w;
+ QGraphicsWidget *a = createItem();
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&w);
+
+ l->addAnchors(l, a, Qt::Horizontal);
+ QGraphicsAnchor *anchor = l->anchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft);
+
+ anchor->setSpacing(-30);
+ QCOMPARE(anchor->spacing(), -30.0);
+
+ anchor->setSpacing(30);
+ QCOMPARE(anchor->spacing(), 30.0);
+
+ anchor->setSizePolicy(QSizePolicy::Ignored);
+ w.effectiveSizeHint(Qt::PreferredSize);
+
+ QCOMPARE(anchor->spacing(), 30.0);
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 0fbd069..bca59c3 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -1722,7 +1722,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QRectF expected = truncate(item.rect);
QRectF actual = truncate(widgets[item.index]->geometry());
- QCOMPARE(expected, actual);
+ QCOMPARE(actual, expected);
}
// Test mirrored mode
@@ -1739,7 +1739,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QRectF expected = truncate(mirroredRect);
QRectF actual = truncate(widgets[item.index]->geometry());
- QCOMPARE(expected, actual);
+ QCOMPARE(actual, expected);
delete widgets[item.index];
}