Exemplo n.º 1
0
def test_no_locales_available(qtwe_version, monkeypatch, caplog):
    monkeypatch.setattr(qtargs.QLibraryInfo, 'location',
                        lambda _path: '/doesnotexist')
    assert qtargs._get_lang_override(qtwe_version, "de-CH") is None
    assert caplog.messages == [
        f"{os.sep}doesnotexist{os.sep}qtwebengine_locales not found, skipping "
        "workaround!"
    ]
Exemplo n.º 2
0
def test_no_locales_available(qtwe_version, monkeypatch, caplog, request):
    path = pathlib.Path('/doesnotexist/qtwebengine_locales')
    assert not path.exists()
    monkeypatch.setattr(qtargs, '_webengine_locales_path', lambda: path)

    assert qtargs._get_lang_override(qtwe_version, "de-CH") is None
    assert caplog.messages == [
        f"{os.sep}doesnotexist{os.sep}qtwebengine_locales not found, skipping "
        "workaround!"]
Exemplo n.º 3
0
def test_lang_workaround_all_locales(lang, expected, qtwe_version):
    locale_name = QLocale(lang).bcp47Name()
    print(locale_name)

    override = qtargs._get_lang_override(
        webengine_version=qtwe_version,
        locale_name=locale_name,
    )

    locales_path = qtargs._webengine_locales_path()
    original_path = qtargs._get_locale_pak_path(locales_path, locale_name)

    if override is None:
        assert original_path.exists()
    else:
        assert override == expected
        assert not original_path.exists()
        assert qtargs._get_locale_pak_path(locales_path, override).exists()
Exemplo n.º 4
0
def test_lang_workaround_all_locales(lang, expected, qtwe_version):
    locale_name = QLocale(lang).bcp47Name()
    print(locale_name)

    override = qtargs._get_lang_override(
        webengine_version=qtwe_version,
        locale_name=locale_name,
    )

    locales_path = pathlib.Path(
        QLibraryInfo.location(
            QLibraryInfo.TranslationsPath)) / 'qtwebengine_locales'

    original_path = qtargs._get_locale_pak_path(locales_path, locale_name)
    if override is None:
        assert original_path.exists()
    else:
        assert override == expected
        assert not original_path.exists()
        assert qtargs._get_locale_pak_path(locales_path, override).exists()
Exemplo n.º 5
0
def test_disabled(qtwe_version, config_stub):
    config_stub.val.qt.workarounds.locale = False
    assert qtargs._get_lang_override(qtwe_version, "de-CH") is None
Exemplo n.º 6
0
def test_non_linux(qtwe_version):
    assert qtargs._get_lang_override(qtwe_version, "de-CH") is None
Exemplo n.º 7
0
def test_different_qt_version(version):
    assert qtargs._get_lang_override(version, "de-CH") is None