From d08524fbfbb78eca09bbab58d5a9840387d2d0e7 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 19 Apr 2017 13:45:18 +0200 Subject: Disable setting background color in QInputMethodEvent IME managers may set background and foreground color of the composition string. Since there is no Chromium API for setting the foreground color, changing the background color to black may produce "black-on-black" text. Chromium locks the background color to transparent thus we do the same in this fix. Task-number: QTBUG-58362 Task-number: QTBUG-60031 Change-Id: I939c8aaaa847de191890d6924ba3c7652465f8a0 Reviewed-by: Alexandru Croitor --- tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 75795c170..78190622c 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1012,8 +1012,14 @@ void tst_QWebEngineView::inputMethodsTextFormat() QTextCharFormat format; format.setUnderlineStyle(static_cast(underlineStyle)); format.setUnderlineColor(underlineColor); + + // Setting background color is disabled for Qt WebEngine because some IME manager + // sets background color to black and there is no API for setting the foreground color. + // This may result black text on black background. However, we still test it to ensure + // changing background color doesn't cause any crash. if (backgroundColor.isValid()) format.setBackground(QBrush(backgroundColor)); + attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format)); QInputMethodEvent im(string, attrs); -- cgit v1.2.3