From: Andrew den Exter Date: Wed, 9 Nov 2011 04:57:23 +0000 (+1000) Subject: Fix expected failure in TextInput horizontalAlignment_RightToLeft test. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=fbbc0932e1be389631529f8912964463650e93e9;p=konrad%2Fqtdeclarative.git Fix expected failure in TextInput horizontalAlignment_RightToLeft test. Send events to the input panels input item instead of the canvas. And clear the pre-edit text before testing implicit alignment of empty text. Change-Id: I5e6b04c53c9c6b344563b80b3aa76ab614b0ca0a Reviewed-by: Martin Jones --- diff --git a/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp index 62f5e03..95b5219 100644 --- a/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp @@ -1162,12 +1162,15 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() // If there is no commited text, the preedit text should determine the alignment. textInput->setText(QString()); - { QInputMethodEvent ev(rtlText, QList()); QGuiApplication::sendEvent(&canvas, &ev); } - QEXPECT_FAIL("", "QTBUG-21691", Continue); + { QInputMethodEvent ev(rtlText, QList()); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &ev); } QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); - { QInputMethodEvent ev("Hello world!", QList()); QGuiApplication::sendEvent(&canvas, &ev); } + { QInputMethodEvent ev("Hello world!", QList()); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &ev); } QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft); + // Clear pre-edit text. TextInput should maybe do this itself on setText, but that may be + // redundant as an actual input method may take care of it. + { QInputMethodEvent ev; QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &ev); } + #ifdef Q_OS_MAC // empty text with implicit alignment follows the system locale-based // keyboard input direction from QGuiApplication::keyboardInputDirection