From 199ea00a9eea13315a652c62778738629185b059 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 10 Mar 2021 17:14:27 +0100 Subject: Fix normalization of app locales MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the internal Chromium routine to get the app locale Chromium expects. Fixes: QTBUG-91715 Change-Id: I5042eb066cb6879ad69628959912f2841867b4e8 Reviewed-by: Michael BrĂ¼ning --- .../widgets/qwebengineview/tst_qwebengineview.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp') diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 021986381..bf2c28ae6 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -123,6 +123,7 @@ private Q_SLOTS: void doNotBreakLayout(); void changeLocale(); + void mixLangLocale(); void inputMethodsTextFormat_data(); void inputMethodsTextFormat(); void keyboardEvents(); @@ -1210,6 +1211,29 @@ void tst_QWebEngineView::changeLocale() QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar")); } +void tst_QWebEngineView::mixLangLocale() +{ + for (QString locale : { "en_DK", "de_CH", "eu_ES" }) { + QLocale::setDefault(locale); + QWebEngineView view; + QSignalSpy loadSpy(&view, &QWebEngineView::loadFinished); + + bool terminated = false; + auto sc = connect(view.page(), &QWebEnginePage::renderProcessTerminated, [&] () { terminated = true; }); + + view.load(QUrl("qrc:///resources/dummy.html")); + QTRY_VERIFY(terminated || loadSpy.count() == 1); + + QVERIFY2(!terminated, + qPrintable(QString("Locale [%1] terminated: %2, loaded: %3").arg(locale).arg(terminated).arg(loadSpy.count()))); + QVERIFY(loadSpy.first().first().toBool()); + + QString content = toPlainTextSync(view.page()); + QVERIFY2(!content.isEmpty() && content.contains("test content"), qPrintable(content)); + } + QLocale::setDefault(QLocale("en")); +} + void tst_QWebEngineView::inputMethodsTextFormat_data() { QTest::addColumn("string"); -- cgit v1.2.3