2017-08-07 01:10:12 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
|
|
|
# Copyright 2017 Michal Siedlaczek <michal.siedlaczek@gmail.com>
|
|
|
|
|
|
|
|
# This file is part of qutebrowser.
|
|
|
|
#
|
|
|
|
# qutebrowser is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# qutebrowser is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
from qutebrowser.browser.webengine import spell
|
|
|
|
|
|
|
|
|
2017-10-04 01:54:54 +02:00
|
|
|
def test_installed_file_dictionary_does_not_exist(tmpdir, monkeypatch):
|
|
|
|
monkeypatch.setattr(
|
|
|
|
spell, 'dictionary_dir', lambda: '/some-non-existing-dir')
|
|
|
|
assert not spell.installed_file('en-US')
|
2017-08-07 01:10:12 +02:00
|
|
|
|
|
|
|
|
2017-10-04 01:54:54 +02:00
|
|
|
def test_installed_file_dictionary_not_installed(tmpdir, monkeypatch):
|
|
|
|
monkeypatch.setattr(spell, 'dictionary_dir', lambda: str(tmpdir))
|
|
|
|
assert not spell.installed_file('en-US')
|
2017-08-12 21:19:06 +02:00
|
|
|
|
|
|
|
|
2017-10-04 01:54:54 +02:00
|
|
|
def test_installed_file_dictionary_installed(tmpdir, monkeypatch):
|
|
|
|
monkeypatch.setattr(spell, 'dictionary_dir', lambda: str(tmpdir))
|
|
|
|
for lang_file in ['en-US-7-1.bdic', 'pl-PL-3-0.bdic']:
|
|
|
|
(tmpdir / lang_file).ensure()
|
|
|
|
assert spell.installed_file('en-US') == 'en-US-7-1'
|
|
|
|
assert spell.installed_file('pl-PL') == 'pl-PL-3-0'
|