From 277ee9a676cb976b27a7b8667cac1ec0ba1e4ce0 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 12 Oct 2011 13:02:39 +1000 Subject: [PATCH] Fix TextInput echoMode test failure. The default input method hints for a QSGItem is Qt::ImhMultiline and TextInput is a single line input so clear that default flag in init. Task-number: QTBUG-21686 Change-Id: I3b57227ee4182bf89f6789f775b56efb156df85b Reviewed-by: Martin Jones --- src/declarative/items/qsgtextinput.cpp | 1 + .../declarative/qsgtextinput/tst_qsgtextinput.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index 1eddbde..1c6bccb 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -1856,6 +1856,7 @@ void QSGTextInputPrivate::init() q->connect(control, SIGNAL(displayTextChanged(QString)), q, SLOT(updateRect())); q->updateSize(); + imHints &= ~Qt::ImhMultiLine; oldValidity = control->hasAcceptableInput(); lastSelectionStart = 0; lastSelectionEnd = 0; diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 6189151..9ab6e69 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -1925,7 +1925,6 @@ void tst_qsgtextinput::echoMode() //Normal ref &= ~Qt::ImhHiddenText; ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); - QEXPECT_FAIL("", "QTBUG-21686", Abort); QCOMPARE(input->inputMethodHints(), ref); input->setEchoMode(QSGTextInput::NoEcho); QCOMPARE(input->text(), initial); @@ -1964,9 +1963,10 @@ void tst_qsgtextinput::echoMode() QCOMPARE(input->displayText(), QLatin1String("Q")); QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("Q")); input->setFocus(true); + QVERIFY(input->hasActiveFocus()); QInputMethodEvent inputEvent; inputEvent.setCommitString(initial); - QGuiApplication::sendEvent(&canvas, &inputEvent); + QGuiApplication::sendEvent(input, &inputEvent); QCOMPARE(input->text(), initial); QCOMPARE(input->displayText(), initial); QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), initial); -- 1.7.2.5