summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtabbar/tst_qtabbar.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-23 08:22:44 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-23 09:18:52 (GMT)
commit4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2 (patch)
treebdf4fbcd035ac238efa1eb73bc60fd5105d7e2d0 /tests/auto/qtabbar/tst_qtabbar.cpp
parent66da5958bc3ec0df60e76bb32ead94bfe7b2eac7 (diff)
downloadQt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.zip
Qt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.tar.gz
Qt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.tar.bz2
QTabBar: Widgets inside the tab bar where not properly laid out after moveTab()
Only the leftmost tab was being correctly laid out after the move due to a mistake in QTabBarPrivate::layoutTab(). Auto-test included. Reviewed-by: Thierry Task-number: QTBUG-10052
Diffstat (limited to 'tests/auto/qtabbar/tst_qtabbar.cpp')
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index 72f9dd3..ac3de20 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -95,6 +95,8 @@ private slots:
void task251184_removeTab();
void changeTitleWhileDoubleClickingTab();
+
+ void taskQTBUG_10052_widgetLayoutWhenMoving();
};
// Testing get/set functions
@@ -576,5 +578,38 @@ void tst_QTabBar::changeTitleWhileDoubleClickingTab()
QTest::mouseDClick(&bar, Qt::LeftButton, 0, tabPos);
}
+class Widget10052 : public QWidget
+{
+public:
+ Widget10052(QWidget *parent) : QWidget(parent), moved(false)
+ { }
+
+ void moveEvent(QMoveEvent *e)
+ {
+ moved = e->oldPos() != e->pos();
+ QWidget::moveEvent(e);
+ }
+
+ bool moved;
+};
+
+void tst_QTabBar::taskQTBUG_10052_widgetLayoutWhenMoving()
+{
+ QTabBar tabBar;
+ tabBar.insertTab(0, "My first tab");
+ Widget10052 w1(&tabBar);
+ tabBar.setTabButton(0, QTabBar::RightSide, &w1);
+ tabBar.insertTab(1, "My other tab");
+ Widget10052 w2(&tabBar);
+ tabBar.setTabButton(1, QTabBar::RightSide, &w2);
+
+ tabBar.show();
+ QTest::qWaitForWindowShown(&tabBar);
+ w1.moved = w2.moved = false;
+ tabBar.moveTab(0, 1);
+ QTRY_VERIFY(w1.moved);
+ QVERIFY(w2.moved);
+}
+
QTEST_MAIN(tst_QTabBar)
#include "tst_qtabbar.moc"