From fbbc0932e1be389631529f8912964463650e93e9 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 9 Nov 2011 14:57:23 +1000 Subject: [PATCH] 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 --- .../qquicktextinput/tst_qquicktextinput.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) 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 -- 1.7.2.5