summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtabbar
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-28 23:16:52 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-28 23:16:52 (GMT)
commitbce30f246347b91261b6618cee71b0274dbf04d9 (patch)
tree8723c84592e77c24b2416412591e8e98f15d8146 /tests/auto/qtabbar
parent576cb12c36f24917d674f4c0bf240441b4ac9b43 (diff)
parenteb4a3bbf2a780f87105c09d354adde04b0bf6ad8 (diff)
downloadQt-bce30f246347b91261b6618cee71b0274dbf04d9.zip
Qt-bce30f246347b91261b6618cee71b0274dbf04d9.tar.gz
Qt-bce30f246347b91261b6618cee71b0274dbf04d9.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Update changelog after last change. QTabBar: smaller minimumSizeHint in ElideMode, and unit-test. Fix tab stop in QPainter::drawText()
Diffstat (limited to 'tests/auto/qtabbar')
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index ac3de20..5819c3c 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -76,6 +76,7 @@ private slots:
void setElideMode_data();
void setElideMode();
+ void sizeHints();
void setUsesScrollButtons_data();
void setUsesScrollButtons();
@@ -280,6 +281,45 @@ void tst_QTabBar::setElideMode()
QTEST(int(tabBar.elideMode()), "expectedMode");
}
+void tst_QTabBar::sizeHints()
+{
+ QTabBar tabBar;
+ tabBar.setFont(QFont("Arial", 10));
+ tabBar.addTab("tab 01");
+ tabBar.addTab("tab 02");
+ tabBar.addTab("tab 03");
+ tabBar.addTab("tab 04");
+ tabBar.addTab("tab 05");
+ tabBar.addTab("tab 06");
+ tabBar.addTab("This is tab7");
+ tabBar.addTab("This is tab8");
+ tabBar.addTab("This is tab9 with a very long title");
+
+ // No eliding and no scrolling -> tabbar becomes very wide
+ tabBar.setUsesScrollButtons(false);
+ tabBar.setElideMode(Qt::ElideNone);
+// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() > 700);
+ QVERIFY(tabBar.sizeHint().width() > 700);
+
+ // Scrolling enabled -> no reason to become very wide
+ tabBar.setUsesScrollButtons(true);
+ // qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() < 200);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+
+ // Eliding enabled -> no reason to become very wide
+ tabBar.setUsesScrollButtons(false);
+ tabBar.setElideMode(Qt::ElideRight);
+// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() < 500);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+
+ tabBar.addTab("This is tab10 with a very long title");
+ QVERIFY(tabBar.minimumSizeHint().width() < 600);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+}
+
void tst_QTabBar::setUsesScrollButtons_data()
{
QTest::addColumn<int>("usesArrows");