diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-10-28 08:58:18 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-10-28 09:28:33 (GMT) |
commit | a925ba1ab6316a155f2ac61f898c52f07a1340b4 (patch) | |
tree | 89533a3f82bbf341ea840a85f31f47f07cf27cf0 /tests/auto/qsplitter | |
parent | 1f3218e086778a0e324542a00937cd44e8e10c79 (diff) | |
download | Qt-a925ba1ab6316a155f2ac61f898c52f07a1340b4.zip Qt-a925ba1ab6316a155f2ac61f898c52f07a1340b4.tar.gz Qt-a925ba1ab6316a155f2ac61f898c52f07a1340b4.tar.bz2 |
QSplitter would not show previously collapsed widgets.
After deleting or hiding the last non collapsed item in a QSplitter, none would
be visible. We now check wether there is any non-hidden, collapsed widget, and
set it to non-collapsed. Auto-test included.
Task-number: QTBUG-4101
Reviewed-by: Olivier
Diffstat (limited to 'tests/auto/qsplitter')
-rw-r--r-- | tests/auto/qsplitter/tst_qsplitter.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp index cf16421..b832f3a 100644 --- a/tests/auto/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/qsplitter/tst_qsplitter.cpp @@ -102,6 +102,8 @@ private slots: void task187373_addAbstractScrollAreas(); void task187373_addAbstractScrollAreas_data(); void task169702_sizes(); + void taskQTBUG_4101_ensureOneNonCollapsedWidget_data(); + void taskQTBUG_4101_ensureOneNonCollapsedWidget(); private: void removeThirdWidget(); @@ -1281,6 +1283,8 @@ class MyFriendlySplitter : public QSplitter public: MyFriendlySplitter(QWidget *parent = 0) : QSplitter(parent) {} void setRubberBand(int pos) { QSplitter::setRubberBand(pos); } + + friend class tst_QSplitter; }; void tst_QSplitter::rubberBandNotInSplitter() @@ -1403,5 +1407,35 @@ void tst_QSplitter::task169702_sizes() QCOMPARE(testW->size().height(), testW->minimumSizeHint().height()); } +void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget_data() +{ + QTest::addColumn<bool>("testingHide"); + + QTest::newRow("last non collapsed hidden") << true; + QTest::newRow("last non collapsed deleted") << false; +} + +void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget() +{ + QFETCH(bool, testingHide); + + MyFriendlySplitter s; + QLabel *l; + for (int i = 0; i < 5; ++i) { + l = new QLabel(QString("Label ") + QChar('A' + i)); + l->setAlignment(Qt::AlignCenter); + s.addWidget(l); + s.moveSplitter(0, i); // Collapse all the labels except the last one. + } + + s.show(); + if (testingHide) + l->hide(); + else + delete l; + QTest::qWait(100); + QVERIFY(s.sizes().at(0) > 0); +} + QTEST_MAIN(tst_QSplitter) #include "tst_qsplitter.moc" |