102 void menuSizeHint(); |
103 void menuSizeHint(); |
103 void task258920_mouseBorder(); |
104 void task258920_mouseBorder(); |
104 void setFixedWidth(); |
105 void setFixedWidth(); |
105 void deleteActionInTriggered(); |
106 void deleteActionInTriggered(); |
106 void pushButtonPopulateOnAboutToShow(); |
107 void pushButtonPopulateOnAboutToShow(); |
|
108 void QTBUG_10735_crashWithDialog(); |
107 protected slots: |
109 protected slots: |
108 void onActivated(QAction*); |
110 void onActivated(QAction*); |
109 void onHighlighted(QAction*); |
111 void onHighlighted(QAction*); |
110 void onStatusMessageChanged(const QString &); |
112 void onStatusMessageChanged(const QString &); |
111 void onStatusTipTimer(); |
113 void onStatusTipTimer(); |
930 QVERIFY(!lastMenu->geometry().intersects(b.geometry())); |
932 QVERIFY(!lastMenu->geometry().intersects(b.geometry())); |
931 |
933 |
932 } |
934 } |
933 |
935 |
934 |
936 |
|
937 class MyMenu : public QMenu |
|
938 { |
|
939 Q_OBJECT |
|
940 public: |
|
941 MyMenu() : m_currentIndex(0) |
|
942 { |
|
943 for (int i = 0; i < 2; ++i) |
|
944 dialogActions[i] = addAction( QString("dialog %1").arg(i), dialogs + i, SLOT(exec())); |
|
945 } |
|
946 |
|
947 |
|
948 void activateAction(int index) |
|
949 { |
|
950 m_currentIndex = index; |
|
951 popup(QPoint()); |
|
952 QTest::qWaitForWindowShown(this); |
|
953 setActiveAction(dialogActions[index]); |
|
954 QTimer::singleShot(500, this, SLOT(checkVisibility())); |
|
955 QTest::keyClick(this, Qt::Key_Enter); //activation |
|
956 } |
|
957 |
|
958 public slots: |
|
959 void activateLastAction() |
|
960 { |
|
961 activateAction(1); |
|
962 } |
|
963 |
|
964 void checkVisibility() |
|
965 { |
|
966 QTRY_VERIFY(dialogs[m_currentIndex].isVisible()); |
|
967 if (m_currentIndex == 1) { |
|
968 QApplication::closeAllWindows(); //this is the end of the test |
|
969 } |
|
970 } |
|
971 |
|
972 |
|
973 private: |
|
974 QAction *dialogActions[2]; |
|
975 QDialog dialogs[2]; |
|
976 int m_currentIndex; |
|
977 }; |
|
978 |
|
979 void tst_QMenu::QTBUG_10735_crashWithDialog() |
|
980 { |
|
981 MyMenu menu; |
|
982 |
|
983 QTimer::singleShot(1000, &menu, SLOT(activateLastAction())); |
|
984 menu.activateAction(0); |
|
985 |
|
986 } |
|
987 |
|
988 |
935 QTEST_MAIN(tst_QMenu) |
989 QTEST_MAIN(tst_QMenu) |
936 #include "tst_qmenu.moc" |
990 #include "tst_qmenu.moc" |