Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-45715

Auto tests might fail due to translated messages (localization)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.5.0 Beta
    • 5.5.0 Alpha
    • WebEngine
    • None
    • Linux and Windows platforms with non "en" localization
    • Change-Id: Iac08a5c18514c605265aad875b30f7cb5307b420 Change-Id: I39f3a891e55ee47a57afc394e849ea02b0c76ad5

    Description

      tst_loadFail.qml auto test fails on Windows and Linux with localization settings with non English settings.

      Actual result:

      FAIL!  : qmltests::WebEngineViewLoadFail::test_error_page() Compared values are not the same
         Actual   (): file:///home/stampho/Qt/qt5-55-src/qtwebengine/tests/auto/quick/qmltests/data/file_that_does_not_exist.html nem található
         Expected (): file:///home/stampho/Qt/qt5-55-src/qtwebengine/tests/auto/quick/qmltests/data/file_that_does_not_exist.html is not found
      

      Expected result:

      Test pass: the title should not be translated -> "... is not found"

      Proposed solution:

      Force en_US locale for QML Tests:

      diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
      index 4f4f847..f95580b 100644
      --- a/tests/auto/quick/qmltests/tst_qmltests.cpp
      +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
      @@ -49,6 +49,9 @@ int main(int argc, char **argv)
           qputenv("QML2_IMPORT_PATH", QByteArray(TESTS_SOURCE_DIR "qmltests/mock-delegates"));
           QScopedPointer<Application> app;
       
      +    QLocale curLocale(QLocale("en"));
      +    QLocale::setDefault(curLocale);
      +
           if (!QCoreApplication::instance())
               app.reset(new Application(argc, argv));
           QtWebEngine::initialize();
      

      This solution does not work yet due to other problems:

      • Glib code path is used in chromium that overrides the preferred language settings in the test's main entry point
      • The browser process does not pass the custom localization settings to child process thus the zygote process initialize the Resource Bundle with the system-wide localization setting instead of the preferred one

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pvarga Peter Varga
            pvarga Peter Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes