summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-20 14:55:10 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-20 14:55:10 (GMT)
commit101bcfd2ac0cb6d7fed6cd2e7a54012ff34afe70 (patch)
tree3211aac1892ea0d7ec50ed8f5f3b1facdffac9ab /tests
parent393db7ada80e803c73fa65f68f5dd037c16ed836 (diff)
parentaf17ea048179ea0c21a897f803e79f825a9d13b6 (diff)
downloadQt-101bcfd2ac0cb6d7fed6cd2e7a54012ff34afe70.zip
Qt-101bcfd2ac0cb6d7fed6cd2e7a54012ff34afe70.tar.gz
Qt-101bcfd2ac0cb6d7fed6cd2e7a54012ff34afe70.tar.bz2
Merge branch 'qlayout-make_adjustSize_better' into 4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlayout/tst_qlayout.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp
index 9d6110d..efe14c3 100644
--- a/tests/auto/qlayout/tst_qlayout.cpp
+++ b/tests/auto/qlayout/tst_qlayout.cpp
@@ -83,6 +83,7 @@ private slots:
void layoutItemRect();
void warnIfWrongParent();
void controlTypes();
+ void adjustSizeShouldMakeSureLayoutIsActivated();
};
tst_QLayout::tst_QLayout()
@@ -110,8 +111,8 @@ void tst_QLayout::getSetCheck()
class SizeHinterFrame : public QFrame
{
public:
- SizeHinterFrame(const QSize &s)
- : QFrame(0), sh(s) {
+ SizeHinterFrame(const QSize &sh, const QSize &msh = QSize())
+ : QFrame(0), sh(sh), msh(msh) {
setFrameStyle(QFrame::Box | QFrame::Plain);
}
@@ -119,9 +120,11 @@ public:
void setSizeHint(const QSize &s) { sh = s; }
QSize sizeHint() const { return sh; }
+ QSize minimumSizeHint() const { return msh; }
private:
QSize sh;
+ QSize msh;
};
@@ -333,5 +336,26 @@ void tst_QLayout::controlTypes()
}
+void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
+{
+ QWidget main;
+
+ QVBoxLayout *const layout = new QVBoxLayout(&main);
+ layout->setMargin(0);
+ SizeHinterFrame *frame = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
+ frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ layout->addWidget(frame);
+
+ SizeHinterFrame *frame2 = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
+ frame2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ layout->addWidget(frame2);
+
+ main.show();
+
+ frame2->hide();
+ main.adjustSize();
+ QCOMPARE(main.size(), QSize(200, 10));
+}
+
QTEST_MAIN(tst_QLayout)
#include "tst_qlayout.moc"