Fix expected failure in TextEdit hAlign_RightToLeft test.
Send events to the input item instead of the canvas. And apply the fix from 4.8 for the tested condition which somehow wasn't applied when the test itself was. Change-Id: I0f5bfe8fc13fc426b395fa8ef87cb5549789a92e Reviewed-by: Martin Jones <martin.jones@nokia.com>
This commit is contained in:
parent
a0d18924b5
commit
19cdd020ab
|
@ -550,7 +550,15 @@ bool QQuickTextEditPrivate::determineHorizontalAlignment()
|
|||
{
|
||||
Q_Q(QQuickTextEdit);
|
||||
if (hAlignImplicit && q->isComponentComplete()) {
|
||||
bool alignToRight = text.isEmpty() ? QGuiApplication::keyboardInputDirection() == Qt::RightToLeft : rightToLeftText;
|
||||
bool alignToRight;
|
||||
if (text.isEmpty()) {
|
||||
const QString preeditText = control->textCursor().block().layout()->preeditAreaText();
|
||||
alignToRight = preeditText.isEmpty()
|
||||
? QGuiApplication::keyboardInputDirection() == Qt::RightToLeft
|
||||
: preeditText.isRightToLeft();
|
||||
} else {
|
||||
alignToRight = rightToLeftText;
|
||||
}
|
||||
return setHAlign(alignToRight ? QQuickTextEdit::AlignRight : QQuickTextEdit::AlignLeft);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -572,12 +572,15 @@ void tst_qquicktextedit::hAlign_RightToLeft()
|
|||
QTRY_COMPARE(&canvas, qGuiApp->focusWindow());
|
||||
|
||||
textEdit->setText(QString());
|
||||
{ QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(&canvas, &ev); }
|
||||
QEXPECT_FAIL("", "QTBUG-21691", Abort);
|
||||
{ QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &ev); }
|
||||
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
|
||||
{ QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(&canvas, &ev); }
|
||||
{ QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &ev); }
|
||||
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
|
||||
|
||||
// Clear pre-edit text. TextEdit 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); }
|
||||
|
||||
#ifndef Q_OS_MAC // QTBUG-18040
|
||||
// empty text with implicit alignment follows the system locale-based
|
||||
// keyboard input direction from QGuiApplication::keyboardInputDirection
|
||||
|
|
Loading…
Reference in New Issue