summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtabbar/tst_qtabbar.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-04-17 13:27:49 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-04-17 13:31:52 (GMT)
commitcd5d8313583e002742b9b00988c2011e8eaa923c (patch)
treecb4eb59e5b9529a11b01de20177da389c25452c6 /tests/auto/qtabbar/tst_qtabbar.cpp
parent7c815bc2d4ea922d75f49f7dc29c81362ce5210e (diff)
downloadQt-cd5d8313583e002742b9b00988c2011e8eaa923c.zip
Qt-cd5d8313583e002742b9b00988c2011e8eaa923c.tar.gz
Qt-cd5d8313583e002742b9b00988c2011e8eaa923c.tar.bz2
Possible assert when hiding tabbed QDockWidget
The problem is in QTabBar which emits the currentChanged signal before accessing its own internal data. As we react to that signal by possibly removing/adding tabs, it can cause a assertion failure. Task-number: 251184 Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qtabbar/tst_qtabbar.cpp')
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index 433eb86..31722de 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -92,6 +92,8 @@ private slots:
void moveTab_data();
void moveTab();
+
+ void task251184_removeTab();
};
// Testing get/set functions
@@ -503,5 +505,35 @@ void tst_QTabBar::moveTab()
bar.callMoveTab(from, to);
}
+
+class MyTabBar : public QTabBar
+{
+ Q_OBJECT
+public slots:
+ void onCurrentChanged()
+ {
+ //we just want this to be done once
+ disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(onCurrentChanged()));
+ removeTab(0);
+ }
+};
+
+void tst_QTabBar::task251184_removeTab()
+{
+ MyTabBar bar;
+ bar.addTab("bar1");
+ bar.addTab("bar2");
+ QCOMPARE(bar.count(), 2);
+ QCOMPARE(bar.currentIndex(), 0);
+
+ bar.connect(&bar, SIGNAL(currentChanged(int)), SLOT(onCurrentChanged()));
+ bar.setCurrentIndex(1);
+
+ QCOMPARE(bar.count(), 1);
+ QCOMPARE(bar.currentIndex(), 0);
+ QCOMPARE(bar.tabText(bar.currentIndex()), QString("bar2"));
+}
+
+
QTEST_MAIN(tst_QTabBar)
#include "tst_qtabbar.moc"