diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/macgui/tst_macgui.cpp | 27 | ||||
-rw-r--r-- | tests/auto/macnativeevents/tst_macnativeevents.cpp | 24 |
2 files changed, 24 insertions, 27 deletions
diff --git a/tests/auto/macgui/tst_macgui.cpp b/tests/auto/macgui/tst_macgui.cpp index 847ba4b..7f558a3 100644 --- a/tests/auto/macgui/tst_macgui.cpp +++ b/tests/auto/macgui/tst_macgui.cpp @@ -60,7 +60,6 @@ private slots: void dummy(); void splashScreenModality(); - void dialogModality(); void nonModalOrder(); void spinBoxArrowButtons(); @@ -157,32 +156,6 @@ void tst_MacGui::splashScreenModality() QVERIFY(QTestEventLoop::instance().timeout() == false); } - -/* - Test that a non-modal dialog created as a child of a modal dialog is - shown in front. -*/ -void tst_MacGui::dialogModality() -{ - QDialog d; - d.setModal(true); - d.show(); - - QProgressDialog progress(&d); - progress.setValue(2); - - InterfaceChildPair interface = wn.find(QAccessible::Name, "Cancel", &progress); - QVERIFY(interface.iface); - const int delay = 2000; - clickLater(interface, Qt::LeftButton, delay); - - connect(&progress, SIGNAL(canceled()), SLOT(exitLoopSlot())); - - const int timeout = 3; - QTestEventLoop::instance().enterLoop(timeout); - QVERIFY(QTestEventLoop::instance().timeout() == false); -} - class PrimaryWindowDialog : public QDialog { Q_OBJECT diff --git a/tests/auto/macnativeevents/tst_macnativeevents.cpp b/tests/auto/macnativeevents/tst_macnativeevents.cpp index 08ab9e6..70a14f5 100644 --- a/tests/auto/macnativeevents/tst_macnativeevents.cpp +++ b/tests/auto/macnativeevents/tst_macnativeevents.cpp @@ -41,6 +41,7 @@ #include <QApplication> #include <QWidget> +#include <QDialog> #include <QPushButton> #include <QtTest/QtTest> @@ -65,6 +66,7 @@ private slots: void testMouseDragToNonClientArea(); void testDragWindow(); void testMouseEnter(); + void testChildDialogInFrontOfModalParent(); }; void tst_MacNativeEvents::testMouseMoveLocation() @@ -282,6 +284,28 @@ void tst_MacNativeEvents::testMouseEnter() QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!"); } +void tst_MacNativeEvents::testChildDialogInFrontOfModalParent() +{ + // Test that a child dialog of a modal parent dialog is + // in front of the parent, and active: + QDialog parent; + parent.setWindowModality(Qt::ApplicationModal); + QDialog child(&parent); + QPushButton button("close", &child); + connect(&button, SIGNAL(clicked()), &child, SLOT(close())); + parent.show(); + child.show(); + QPoint inside = button.mapToGlobal(button.geometry().center()); + + // Post a click on the button to close the child dialog: + NativeEventList native; + native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 0, Qt::NoModifier)); + + native.play(); + QTest::qWait(100); + QVERIFY(!child.isVisible()); +} #include "tst_macnativeevents.moc" |