tests/auto/qtoolbar/tst_qtoolbar.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
--- a/tests/auto/qtoolbar/tst_qtoolbar.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -102,6 +102,7 @@
     void orientationChanged();
     void iconSizeChanged();
     void toolButtonStyleChanged();
+    void visibilityChanged();
     void actionOwnership();
     void widgetAction();
     void accel();
@@ -998,6 +999,36 @@
 void tst_QToolBar::toolButtonStyleChanged()
 { DEPENDS_ON("toolButtonStyle()"); }
 
+void tst_QToolBar::visibilityChanged()
+{
+    QMainWindow mw;
+    QToolBar tb;
+    QSignalSpy spy(&tb, SIGNAL(visibilityChanged(bool)));
+
+    mw.addToolBar(&tb);
+    mw.show();
+
+    QCOMPARE(spy.count(), 1);
+    QCOMPARE(spy.at(0).at(0).toBool(), true);
+    spy.clear();
+
+    tb.hide();
+    QCOMPARE(spy.count(), 1);
+    QCOMPARE(spy.at(0).at(0).toBool(), false);
+    spy.clear();
+
+    tb.hide();
+    QCOMPARE(spy.count(), 0);
+
+    tb.show();
+    QCOMPARE(spy.count(), 1);
+    QCOMPARE(spy.at(0).at(0).toBool(), true);
+    spy.clear();
+
+    tb.show();
+    QCOMPARE(spy.count(), 0);
+}
+
 void tst_QToolBar::actionOwnership()
 {
     {