diff options
Diffstat (limited to 'tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp')
-rw-r--r-- | tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index dd5b9d0..ab20bfc 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -108,6 +108,7 @@ private slots: void testOffByOneInLargerLayout(); void testDefaultAlignment(); void combineSizePolicies(); + void hiddenItems(); // Task specific tests void task218400_insertStretchCrash(); @@ -1649,6 +1650,33 @@ void tst_QGraphicsLinearLayout::combineSizePolicies() QCOMPARE(layout->maximumHeight(), qreal(200)); } +void tst_QGraphicsLinearLayout::hiddenItems() +{ + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, widget); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(2); + + RectWidget *w1 = new RectWidget; + w1->setPreferredSize(QSizeF(20, 20)); + layout->addItem(w1); + + RectWidget *w2 = new RectWidget; + w2->setPreferredSize(QSizeF(20, 20)); + layout->addItem(w2); + + RectWidget *w3 = new RectWidget; + w3->setPreferredSize(QSizeF(20, 20)); + layout->addItem(w3); + + QCOMPARE(layout->preferredWidth(), qreal(64)); + w2->hide(); + QCOMPARE(layout->preferredWidth(), qreal(42)); + w2->show(); + QCOMPARE(layout->preferredWidth(), qreal(64)); +} + + QTEST_MAIN(tst_QGraphicsLinearLayout) #include "tst_qgraphicslinearlayout.moc" |