diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-12-09 15:15:21 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-14 11:53:32 +0100 |
commit | 85328b975027c6e26bcaf2dd660acd3118049fd2 (patch) | |
tree | 64a241bc3155f01227a7c2867ae358005e75005e /tests/auto/qtquick2/qquicktextedit | |
parent | b0133b8fa4b1ad9a887fa6718983711b560a35ef (diff) |
TextEdits to include tentative commit in text property
Similar to what qtbase 1dbfbf4c66187e7522888c19d78024cfceaea570
did for QTextEdit. Now available only in plain text, html support
pending.
Change-Id: I0b23a45fc484512d3354f66e1a6134e2d70eb8b5
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2/qquicktextedit')
-rw-r--r-- | tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp index c34d8255ba..9e8af5617d 100644 --- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp @@ -1984,16 +1984,28 @@ void tst_qquicktextedit::textInput() QVERIFY(edit); QVERIFY(edit->hasActiveFocus() == true); - // test that input method event is committed + // test that input method event is committed and change signal is emitted + QSignalSpy spy(edit, SIGNAL(textChanged(QString))); QInputMethodEvent event; event.setCommitString( "Hello world!", 0, 0); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event); QCOMPARE(edit->text(), QString("Hello world!")); + QCOMPARE(spy.count(), 1); // QTBUG-12339 // test that document and internal text attribute are in sync QQuickTextEditPrivate *editPrivate = static_cast<QQuickTextEditPrivate*>(QQuickItemPrivate::get(edit)); QCOMPARE(editPrivate->text, QString("Hello world!")); + + // test that tentative commit is included in text property + edit->setText(""); + spy.clear(); + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event2("preedit", attributes); + event2.setTentativeCommitString("string"); + QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event2); + QCOMPARE(spy.count(), 1); + QCOMPARE(edit->text(), QString("string")); } class PlatformInputContext : public QPlatformInputContext |