summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-16 10:13:42 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-16 10:13:42 (GMT)
commit179967425585a70fd626e98bf4f34a8e48998f35 (patch)
tree96f3f20acc521fb90da673d66c2015147c000a94 /tests/auto
parentc9a89b253176547901e11d27c042983a65f43b1f (diff)
parent183abff6ffcb020b8f0c4041cc82bba0d3b03863 (diff)
downloadQt-179967425585a70fd626e98bf4f34a8e48998f35.zip
Qt-179967425585a70fd626e98bf4f34a8e48998f35.tar.gz
Qt-179967425585a70fd626e98bf4f34a8e48998f35.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed problem with wrong size hints when items were removed.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp86
1 files changed, 64 insertions, 22 deletions
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 8127f84..b9a5c66 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -741,31 +741,73 @@ void tst_QGraphicsGridLayout::setColumnFixedWidth()
// public qreal columnSpacing(int column) const
void tst_QGraphicsGridLayout::columnSpacing()
{
- QGraphicsScene scene;
- QGraphicsView view(&scene);
- QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
- QGraphicsGridLayout *layout = new QGraphicsGridLayout();
- scene.addItem(widget);
- widget->setLayout(layout);
- populateLayout(layout, 3, 2);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
- QCOMPARE(layout->columnSpacing(0), 0.0);
+ {
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout();
+ scene.addItem(widget);
+ widget->setLayout(layout);
+ populateLayout(layout, 3, 2);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ QCOMPARE(layout->columnSpacing(0), 0.0);
+
+ layout->setColumnSpacing(0, 20);
+ view.show();
+ widget->show();
+ widget->resize(widget->effectiveSizeHint(Qt::PreferredSize));
+ QApplication::processEvents();
- layout->setColumnSpacing(0, 20);
- view.show();
- widget->show();
- widget->resize(widget->effectiveSizeHint(Qt::PreferredSize));
- QApplication::processEvents();
+ QCOMPARE(layout->itemAt(0,0)->geometry().left(), 0.0);
+ QCOMPARE(layout->itemAt(0,0)->geometry().right(), 25.0);
+ QCOMPARE(layout->itemAt(0,1)->geometry().left(), 45.0);
+ QCOMPARE(layout->itemAt(0,1)->geometry().right(), 70.0);
+ QCOMPARE(layout->itemAt(0,2)->geometry().left(), 70.0);
+ QCOMPARE(layout->itemAt(0,2)->geometry().right(), 95.0);
- QCOMPARE(layout->itemAt(0,0)->geometry().left(), 0.0);
- QCOMPARE(layout->itemAt(0,0)->geometry().right(), 25.0);
- QCOMPARE(layout->itemAt(0,1)->geometry().left(), 45.0);
- QCOMPARE(layout->itemAt(0,1)->geometry().right(), 70.0);
- QCOMPARE(layout->itemAt(0,2)->geometry().left(), 70.0);
- QCOMPARE(layout->itemAt(0,2)->geometry().right(), 95.0);
+ delete widget;
+ }
+
+ {
+ // don't include items and spacings that was previously part of the layout
+ // (horizontal)
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ populateLayout(layout, 3, 1);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ layout->setColumnSpacing(0, 10);
+ layout->setColumnSpacing(1, 10);
+ layout->setColumnSpacing(2, 10);
+ layout->setColumnSpacing(3, 10);
+ QCOMPARE(layout->preferredSize(), QSizeF(95, 25));
+ layout->removeAt(2);
+ QCOMPARE(layout->preferredSize(), QSizeF(60, 25));
+ layout->removeAt(1);
+ QCOMPARE(layout->preferredSize(), QSizeF(25, 25));
+ delete layout;
+ }
+ {
+ // don't include items and spacings that was previously part of the layout
+ // (vertical)
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ populateLayout(layout, 2, 2);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ layout->setColumnSpacing(0, 10);
+ layout->setColumnSpacing(1, 10);
+ layout->setRowSpacing(0, 10);
+ layout->setRowSpacing(1, 10);
+ QCOMPARE(layout->preferredSize(), QSizeF(60, 60));
+ layout->removeAt(3);
+ QCOMPARE(layout->preferredSize(), QSizeF(60, 60));
+ layout->removeAt(2);
+ QCOMPARE(layout->preferredSize(), QSizeF(60, 25));
+ layout->removeAt(1);
+ QCOMPARE(layout->preferredSize(), QSizeF(25, 25));
+ delete layout;
+ }
- delete widget;
}
// public int columnStretchFactor(int column) const