summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextedit/tst_qtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtextedit/tst_qtextedit.cpp')
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index deb9379..101baa5 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -201,6 +201,9 @@ private slots:
void noWrapBackgrounds();
void preserveCharFormatAfterUnchangingSetPosition();
void twoSameInputMethodEvents();
+#ifndef QT_NO_CONTEXTMENU
+ void taskQTBUG_7902_contextMenuCrash();
+#endif
private:
void createSelection();
@@ -2202,5 +2205,24 @@ void tst_QTextEdit::twoSameInputMethodEvents()
QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
}
+#ifndef QT_NO_CONTEXTMENU
+void tst_QTextEdit::taskQTBUG_7902_contextMenuCrash()
+{
+ QTextEdit *w = new QTextEdit;
+ w->show();
+ QTest::qWaitForWindowShown(w);
+
+ QTimer ti;
+ w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater()));
+ ti.start(200);
+
+ QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center());
+ qApp->postEvent(w->viewport(), cme);
+
+ QTest::qWait(300);
+ // No crash, it's allright.
+}
+#endif
+
QTEST_MAIN(tst_QTextEdit)
#include "tst_qtextedit.moc"