diff options
author | ck <qt-info@nokia.com> | 2010-04-26 08:28:54 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2010-04-26 08:28:54 (GMT) |
commit | ceab797e9ff58148fe6218c411a4ee1734acac40 (patch) | |
tree | 859f711908430f7ac10d6f95c0584881b2c86413 /tests/auto | |
parent | 7eea24f6c71cde7134cfb4b8c936f235da86289d (diff) | |
parent | 4affdc09b88025a93025a60fbecff57ca6ac97b7 (diff) | |
download | Qt-ceab797e9ff58148fe6218c411a4ee1734acac40.zip Qt-ceab797e9ff58148fe6218c411a4ee1734acac40.tar.gz Qt-ceab797e9ff58148fe6218c411a4ee1734acac40.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtabwidget/tst_qtabwidget.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp index 6d5a873..334d45c 100644 --- a/tests/auto/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp @@ -122,6 +122,8 @@ class tst_QTabWidget:public QObject { void keyboardNavigation(); void paintEventCount(); void minimumSizeHint(); + void heightForWidth_data(); + void heightForWidth(); private: int addPage(); @@ -646,5 +648,51 @@ void tst_QTabWidget::minimumSizeHint() QVERIFY(minSize.height() <= actSize.height()); } +void tst_QTabWidget::heightForWidth_data() +{ + QTest::addColumn<int>("tabPosition"); + QTest::newRow("West") << int(QTabWidget::West); + QTest::newRow("North") << int(QTabWidget::North); + QTest::newRow("East") << int(QTabWidget::East); + QTest::newRow("South") << int(QTabWidget::South); +} + +void tst_QTabWidget::heightForWidth() +{ + QFETCH(int, tabPosition); + + QWidget *window = new QWidget; + QVBoxLayout *lay = new QVBoxLayout(window); + lay->setMargin(0); + lay->setSpacing(0); + QTabWidget *tabWid = new QTabWidget(window); + QWidget *w = new QWidget; + tabWid->addTab(w, QLatin1String("HFW page")); + tabWid->setTabPosition(QTabWidget::TabPosition(tabPosition)); + QVBoxLayout *lay2 = new QVBoxLayout(w); + QLabel *label = new QLabel("Label with wordwrap turned on makes it trade height for width." + " Make it a really long text so that it spans on several lines" + " when the label is on its narrowest." + " I don't like to repeat myself." + " I don't like to repeat myself." + " I don't like to repeat myself." + " I don't like to repeat myself." + ); + label->setWordWrap(true); + lay2->addWidget(label); + lay2->setMargin(0); + + lay->addWidget(tabWid); + int h = window->heightForWidth(160); + window->resize(160, h); + window->show(); + + QTest::qWaitForWindowShown(window); + QVERIFY(label->height() >= label->heightForWidth(label->width())); + + delete window; +} + + QTEST_MAIN(tst_QTabWidget) #include "tst_qtabwidget.moc" |