summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtabwidget
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-04-20 12:01:06 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2010-04-21 07:33:29 (GMT)
commitdd5d297d2969795a47ef7a5234b64a791e080c38 (patch)
treeda4c25057028067b7b6992f3c7e19c7425bea49c /tests/auto/qtabwidget
parentee3841ae90156f991717376f34921de97e47097c (diff)
downloadQt-dd5d297d2969795a47ef7a5234b64a791e080c38.zip
Qt-dd5d297d2969795a47ef7a5234b64a791e080c38.tar.gz
Qt-dd5d297d2969795a47ef7a5234b64a791e080c38.tar.bz2
Made sure that QTabWidget reported a big enough size hint.
This avoids some minor clipping issues observed (see autotest). Reviewed-by: MortenS
Diffstat (limited to 'tests/auto/qtabwidget')
-rw-r--r--tests/auto/qtabwidget/tst_qtabwidget.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp
index 4491fb3..6d5a873 100644
--- a/tests/auto/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp
@@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qapplication.h>
#include <qlabel.h>
+#include <QtGui/qboxlayout.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -120,6 +121,7 @@ class tst_QTabWidget:public QObject {
void clear();
void keyboardNavigation();
void paintEventCount();
+ void minimumSizeHint();
private:
int addPage();
@@ -621,6 +623,28 @@ void tst_QTabWidget::paintEventCount()
QCOMPARE(tab2->count, 1);
}
+void tst_QTabWidget::minimumSizeHint()
+{
+ QTabWidget tw;
+ QWidget *page = new QWidget;
+ QVBoxLayout *lay = new QVBoxLayout;
+
+ QLabel *label = new QLabel(QLatin1String("XXgypq lorem ipsum must be long, must be long. lorem ipsumMMMW"));
+ lay->addWidget(label);
+
+ page->setLayout(lay);
+
+ tw.addTab(page, QLatin1String("page1"));
+
+ tw.show();
+ QTest::qWaitForWindowShown(&tw);
+ tw.resize(tw.minimumSizeHint());
+
+ QSize minSize = label->minimumSizeHint();
+ QSize actSize = label->geometry().size();
+ QVERIFY(minSize.width() <= actSize.width());
+ QVERIFY(minSize.height() <= actSize.height());
+}
QTEST_MAIN(tst_QTabWidget)
#include "tst_qtabwidget.moc"