summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-03-21 16:23:33 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-23 00:41:38 +0100
commit337eedb316e94217d6d8b4bb6dc664d26ef3a741 (patch)
treef3bb76fb442dbc27c353a1ef58c03830d1a3dd14 /tests/auto/widgets/widgets
parentb188221fee0eaacec115b514185a0508ef655897 (diff)
Fixed QLineEdit to emit selectionChanged
Was not emitted when removed by input method event. Change-Id: Ia2c0dcb09d42826188d4612f4c1705a41874a31d Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 81dc940c00..f67f7ce1e8 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3846,13 +3846,26 @@ void tst_QLineEdit::inputMethodSelection()
QCOMPARE(selectionSpy.count(), 1);
QCOMPARE(testWidget->selectionStart(), 0);
- QList<QInputMethodEvent::Attribute> attributes;
- attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
- QInputMethodEvent event("", attributes);
- QApplication::sendEvent(testWidget, &event);
+ // selection gained
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
+ QInputMethodEvent event("", attributes);
+ QApplication::sendEvent(testWidget, &event);
+ }
QCOMPARE(selectionSpy.count(), 2);
QCOMPARE(testWidget->selectionStart(), 12);
+
+ // selection removed
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
+ QInputMethodEvent event("", attributes);
+ QApplication::sendEvent(testWidget, &event);
+ }
+
+ QCOMPARE(selectionSpy.count(), 3);
}
void tst_QLineEdit::inputMethodTentativeCommit()