def test_big_cache_size(config_stub):
    """Make sure a too big cache size is handled correctly."""
    config_stub.val.content.cache.size = 2**63 - 1
    webenginesettings._update_settings('content.cache.size')

    size = webenginesettings.default_profile.httpCacheMaximumSize()
    assert size == 2**31 - 1
Exemplo n.º 2
0
def test_spell_check_disabled(config_stub, monkeypatch):
    monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebEngine)
    config_stub.val.spellcheck.languages = []
    webenginesettings._update_settings('spellcheck.languages')
    for profile in [webenginesettings.default_profile,
                    webenginesettings.private_profile]:
        assert not profile.isSpellCheckEnabled()
Exemplo n.º 3
0
def test_spell_check_disabled(config_stub, monkeypatch):
    config_stub.val.spellcheck.languages = []
    webenginesettings._update_settings('spellcheck.languages')
    for profile in [
            webenginesettings.default_profile,
            webenginesettings.private_profile
    ]:
        assert not profile.isSpellCheckEnabled()
def test_existing_dict(config_stub, monkeypatch, global_settings,
                       default_profile, private_profile):
    monkeypatch.setattr(webenginesettings.spell, 'local_filename',
                        lambda _code: 'en-US-8-0')
    config_stub.val.spellcheck.languages = ['en-US']
    webenginesettings._update_settings('spellcheck.languages')
    for profile in [default_profile, private_profile]:
        assert profile.isSpellCheckEnabled()
        assert profile.spellCheckLanguages() == ['en-US-8-0']
def test_existing_dict(config_stub, monkeypatch):
    monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebEngine)
    monkeypatch.setattr(webenginesettings.spell, 'local_filename',
                        lambda _code: 'en-US-8-0')
    config_stub.val.spellcheck.languages = ['en-US']
    webenginesettings._update_settings('spellcheck.languages')
    for profile in [webenginesettings.default_profile,
                    webenginesettings.private_profile]:
        assert profile.isSpellCheckEnabled()
        assert profile.spellCheckLanguages() == ['en-US-8-0']
def test_existing_dict(config_stub, monkeypatch):
    monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebEngine)
    monkeypatch.setattr(webenginesettings.spell, 'local_filename',
                        lambda _code: 'en-US-8-0')
    config_stub.val.spellcheck.languages = ['en-US']
    webenginesettings._update_settings('spellcheck.languages')
    for profile in [webenginesettings.default_profile,
                    webenginesettings.private_profile]:
        assert profile.isSpellCheckEnabled()
        assert profile.spellCheckLanguages() == ['en-US-8-0']
Exemplo n.º 7
0
def test_non_existing_dict(config_stub, monkeypatch, message_mock, caplog):
    monkeypatch.setattr(webenginesettings.spell, 'local_filename',
                        lambda _code: None)
    config_stub.val.spellcheck.languages = ['af-ZA']

    with caplog.at_level(logging.WARNING):
        webenginesettings._update_settings('spellcheck.languages')

    msg = message_mock.getmsg(usertypes.MessageLevel.warning)
    expected = ("Language af-ZA is not installed - see scripts/dictcli.py in "
                "qutebrowser's sources")
    assert msg.text == expected
def test_non_existing_dict(config_stub, monkeypatch, message_mock, caplog):
    monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebEngine)
    monkeypatch.setattr(webenginesettings.spell, 'local_filename',
                        lambda _code: None)
    config_stub.val.spellcheck.languages = ['af-ZA']

    with caplog.at_level(logging.WARNING):
        webenginesettings._update_settings('spellcheck.languages')

    msg = message_mock.getmsg(usertypes.MessageLevel.warning)
    expected = ("Language af-ZA is not installed - see scripts/dictcli.py in "
                "qutebrowser's sources")
    assert msg.text == expected