diff options
Diffstat (limited to 'tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp')
-rw-r--r-- | tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index 1e20bb7..52ce9bb 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -62,6 +62,7 @@ private slots: void compressLayoutRequest(); void automaticReparenting(); void verifyActivate(); + void sizeHintOfHiddenLayout(); void invalidate(); void moveAndResize_data(); void moveAndResize(); @@ -299,6 +300,29 @@ void tst_QGraphicsLayout::verifyActivate() } + +void tst_QGraphicsLayout::sizeHintOfHiddenLayout() +{ + QGraphicsScene scene; + QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window); + scene.addItem(window); + TestLayout *lout = new TestLayout(window); + lout->setContentsMargins(1,2,2,1); + QGraphicsWidget *w = new QGraphicsWidget; + w->setPreferredSize(20, 20); + w->setMaximumSize(50, 50); + lout->addItem(w); + window->setLayout(lout); + + for (int pass = 0; pass < 3; ++pass) { + QCOMPARE(lout->sizeHint(Qt::MinimumSize), QSizeF(3,3)); + QCOMPARE(lout->sizeHint(Qt::PreferredSize), QSizeF(23,23)); + QCOMPARE(lout->sizeHint(Qt::MaximumSize), QSizeF(53,53)); + window->setVisible(pass % 2); + } +} + + static void clearAllCounters(TestGraphicsWidget *widget) { if (!widget) |