2016-01-20 18:20:19 +01:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2019-02-23 06:34:17 +01:00
|
|
|
# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
2016-01-20 18:20:19 +01:00
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
2016-04-10 20:16:10 +02:00
|
|
|
"""Test starting qutebrowser with special arguments/environments."""
|
2016-01-20 18:20:19 +01:00
|
|
|
|
2017-04-28 20:51:38 +02:00
|
|
|
import subprocess
|
2017-02-28 17:24:48 +01:00
|
|
|
import socket
|
2016-08-04 01:24:08 +02:00
|
|
|
import sys
|
2016-09-09 18:43:56 +02:00
|
|
|
import logging
|
2016-09-28 14:38:15 +02:00
|
|
|
import re
|
2016-08-04 01:24:08 +02:00
|
|
|
|
2016-01-20 18:20:19 +01:00
|
|
|
import pytest
|
2017-11-20 13:54:52 +01:00
|
|
|
from PyQt5.QtCore import QProcess, qVersion
|
2016-09-28 14:38:15 +02:00
|
|
|
|
2018-06-11 11:33:49 +02:00
|
|
|
from helpers import utils
|
2018-06-11 08:52:31 +02:00
|
|
|
|
2016-09-06 07:56:59 +02:00
|
|
|
|
2018-02-10 19:58:30 +01:00
|
|
|
ascii_locale = pytest.mark.skipif(sys.hexversion >= 0x03070000,
|
|
|
|
reason="Python >= 3.7 doesn't force ASCII "
|
|
|
|
"locale with LC_ALL=C")
|
|
|
|
|
|
|
|
|
2016-09-06 07:56:59 +02:00
|
|
|
def _base_args(config):
|
|
|
|
"""Get the arguments to pass with every invocation."""
|
|
|
|
args = ['--debug', '--json-logging', '--no-err-windows']
|
|
|
|
if config.webengine:
|
|
|
|
args += ['--backend', 'webengine']
|
|
|
|
else:
|
|
|
|
args += ['--backend', 'webkit']
|
2017-11-20 13:54:52 +01:00
|
|
|
if qVersion() == '5.7.1':
|
|
|
|
# https://github.com/qutebrowser/qutebrowser/issues/3163
|
|
|
|
args += ['--qt-flag', 'disable-seccomp-filter-sandbox']
|
2016-09-06 07:56:59 +02:00
|
|
|
args.append('about:blank')
|
|
|
|
return args
|
2016-05-25 13:13:36 +02:00
|
|
|
|
2016-01-20 18:20:19 +01:00
|
|
|
|
2016-04-26 23:51:48 +02:00
|
|
|
@pytest.fixture
|
2016-09-09 18:43:12 +02:00
|
|
|
def temp_basedir_env(tmpdir, short_tmpdir):
|
2016-04-26 23:51:48 +02:00
|
|
|
"""Return a dict of environment variables that fakes --temp-basedir.
|
2016-01-20 18:20:19 +01:00
|
|
|
|
2016-04-26 23:51:48 +02:00
|
|
|
We can't run --basedir or --temp-basedir for some tests, so we mess with
|
2016-01-20 18:20:19 +01:00
|
|
|
XDG_*_DIR to get things relocated.
|
|
|
|
"""
|
|
|
|
data_dir = tmpdir / 'data'
|
|
|
|
config_dir = tmpdir / 'config'
|
2016-09-09 18:43:12 +02:00
|
|
|
runtime_dir = short_tmpdir / 'rt'
|
2016-01-20 18:20:19 +01:00
|
|
|
cache_dir = tmpdir / 'cache'
|
|
|
|
|
|
|
|
runtime_dir.ensure(dir=True)
|
|
|
|
runtime_dir.chmod(0o700)
|
|
|
|
|
2018-09-18 17:25:24 +02:00
|
|
|
lines = [
|
|
|
|
'[general]',
|
|
|
|
'quickstart-done = 1',
|
|
|
|
'backend-warning-shown = 1',
|
|
|
|
'old-qt-warning-shown = 1',
|
|
|
|
'webkit-warning-shown = 1',
|
|
|
|
]
|
|
|
|
|
|
|
|
state_file = data_dir / 'qutebrowser' / 'state'
|
|
|
|
state_file.write_text('\n'.join(lines), encoding='utf-8', ensure=True)
|
2016-01-20 18:20:19 +01:00
|
|
|
|
|
|
|
env = {
|
|
|
|
'XDG_DATA_HOME': str(data_dir),
|
|
|
|
'XDG_CONFIG_HOME': str(config_dir),
|
|
|
|
'XDG_RUNTIME_DIR': str(runtime_dir),
|
|
|
|
'XDG_CACHE_HOME': str(cache_dir),
|
|
|
|
}
|
2016-04-26 23:51:48 +02:00
|
|
|
return env
|
|
|
|
|
2016-01-20 18:20:19 +01:00
|
|
|
|
2016-04-10 20:16:10 +02:00
|
|
|
@pytest.mark.linux
|
2018-02-10 19:58:30 +01:00
|
|
|
@ascii_locale
|
2017-10-22 19:39:46 +02:00
|
|
|
def test_downloads_with_ascii_locale(request, server, tmpdir, quteproc_new):
|
2016-04-10 20:16:10 +02:00
|
|
|
"""Test downloads with LC_ALL=C set.
|
|
|
|
|
2017-02-05 00:13:11 +01:00
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/908
|
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/1726
|
2016-04-10 20:16:10 +02:00
|
|
|
"""
|
2016-09-06 07:56:59 +02:00
|
|
|
args = ['--temp-basedir'] + _base_args(request.config)
|
2016-04-10 20:16:10 +02:00
|
|
|
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc_new.set_setting('downloads.location.directory', str(tmpdir))
|
2016-08-04 01:24:08 +02:00
|
|
|
|
|
|
|
# Test a normal download
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc_new.set_setting('downloads.location.prompt', 'false')
|
2016-04-10 20:16:10 +02:00
|
|
|
url = 'http://localhost:{port}/data/downloads/ä-issue908.bin'.format(
|
2017-09-19 10:35:54 +02:00
|
|
|
port=server.port)
|
2016-04-10 20:16:10 +02:00
|
|
|
quteproc_new.send_cmd(':download {}'.format(url))
|
2016-09-09 15:15:10 +02:00
|
|
|
quteproc_new.wait_for(category='downloads',
|
|
|
|
message='Download ?-issue908.bin finished')
|
2016-08-04 01:24:08 +02:00
|
|
|
|
|
|
|
# Test :prompt-open-download
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc_new.set_setting('downloads.location.prompt', 'true')
|
2016-08-04 01:24:08 +02:00
|
|
|
quteproc_new.send_cmd(':download {}'.format(url))
|
|
|
|
quteproc_new.send_cmd(':prompt-open-download "{}" -c pass'
|
|
|
|
.format(sys.executable))
|
2016-09-09 15:15:10 +02:00
|
|
|
quteproc_new.wait_for(category='downloads',
|
|
|
|
message='Download ä-issue908.bin finished')
|
2017-01-04 17:56:56 +01:00
|
|
|
quteproc_new.wait_for(category='misc',
|
2016-08-04 01:24:08 +02:00
|
|
|
message='Opening * with [*python*]')
|
|
|
|
|
2016-04-10 20:16:10 +02:00
|
|
|
assert len(tmpdir.listdir()) == 1
|
|
|
|
assert (tmpdir / '?-issue908.bin').exists()
|
2016-09-09 18:43:56 +02:00
|
|
|
|
|
|
|
|
2017-10-22 19:39:46 +02:00
|
|
|
@pytest.mark.linux
|
2017-11-07 16:55:02 +01:00
|
|
|
@pytest.mark.parametrize('url', ['/föö.html', 'file:///föö.html'])
|
2018-02-10 19:58:30 +01:00
|
|
|
@ascii_locale
|
2017-11-07 16:55:02 +01:00
|
|
|
def test_open_with_ascii_locale(request, server, tmpdir, quteproc_new, url):
|
2017-10-22 19:39:46 +02:00
|
|
|
"""Test opening non-ascii URL with LC_ALL=C set.
|
|
|
|
|
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/1450
|
|
|
|
"""
|
|
|
|
args = ['--temp-basedir'] + _base_args(request.config)
|
|
|
|
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
2017-11-07 16:55:02 +01:00
|
|
|
quteproc_new.set_setting('url.auto_search', 'never')
|
2017-10-22 19:39:46 +02:00
|
|
|
|
|
|
|
# Test opening a file whose name contains non-ascii characters.
|
|
|
|
# No exception thrown means test success.
|
|
|
|
quteproc_new.send_cmd(':open {}'.format(url))
|
2017-11-07 16:55:02 +01:00
|
|
|
|
|
|
|
if not request.config.webengine:
|
|
|
|
line = quteproc_new.wait_for(message="Error while loading *: Error "
|
|
|
|
"opening /*: No such file or directory")
|
|
|
|
line.expected = True
|
|
|
|
|
|
|
|
quteproc_new.wait_for(message="load status for <* tab_id=* "
|
|
|
|
"url='*/f%C3%B6%C3%B6.html'>: LoadStatus.error")
|
2017-10-22 19:39:46 +02:00
|
|
|
|
|
|
|
|
2017-10-23 22:27:00 +02:00
|
|
|
@pytest.mark.linux
|
2018-02-10 19:58:30 +01:00
|
|
|
@ascii_locale
|
2017-11-07 11:29:53 +01:00
|
|
|
def test_open_command_line_with_ascii_locale(request, server, tmpdir,
|
|
|
|
quteproc_new):
|
|
|
|
"""Test opening file via command line with a non-ascii name with LC_ALL=C.
|
2017-10-23 22:27:00 +02:00
|
|
|
|
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/1450
|
|
|
|
"""
|
|
|
|
# The file does not actually have to exist because the relevant checks will
|
|
|
|
# all be called. No exception thrown means test success.
|
2017-11-07 11:29:53 +01:00
|
|
|
args = (['--temp-basedir'] + _base_args(request.config) +
|
|
|
|
['/home/user/föö.html'])
|
2017-11-07 16:55:02 +01:00
|
|
|
quteproc_new.start(args, env={'LC_ALL': 'C'}, wait_focus=False)
|
|
|
|
|
|
|
|
if not request.config.webengine:
|
|
|
|
line = quteproc_new.wait_for(message="Error while loading *: Error "
|
|
|
|
"opening /*: No such file or directory")
|
|
|
|
line.expected = True
|
|
|
|
|
|
|
|
quteproc_new.wait_for(message="load status for <* tab_id=* "
|
|
|
|
"url='*/f*.html'>: LoadStatus.error")
|
2017-10-23 22:27:00 +02:00
|
|
|
|
|
|
|
|
2016-09-09 18:43:56 +02:00
|
|
|
@pytest.mark.linux
|
2017-09-19 10:35:54 +02:00
|
|
|
def test_misconfigured_user_dirs(request, server, temp_basedir_env,
|
2016-09-09 18:43:56 +02:00
|
|
|
tmpdir, quteproc_new):
|
2016-09-10 17:32:04 +02:00
|
|
|
"""Test downloads with a misconfigured XDG_DOWNLOAD_DIR.
|
2016-09-09 18:43:56 +02:00
|
|
|
|
2017-02-05 00:13:11 +01:00
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/866
|
|
|
|
https://github.com/qutebrowser/qutebrowser/issues/1269
|
2016-09-09 18:43:56 +02:00
|
|
|
"""
|
|
|
|
home = tmpdir / 'home'
|
|
|
|
home.ensure(dir=True)
|
|
|
|
temp_basedir_env['HOME'] = str(home)
|
|
|
|
|
|
|
|
assert temp_basedir_env['XDG_CONFIG_HOME'] == tmpdir / 'config'
|
|
|
|
(tmpdir / 'config' / 'user-dirs.dirs').write('XDG_DOWNLOAD_DIR="relative"',
|
|
|
|
ensure=True)
|
|
|
|
|
|
|
|
quteproc_new.start(_base_args(request.config), env=temp_basedir_env)
|
|
|
|
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc_new.set_setting('downloads.location.prompt', 'false')
|
2016-09-09 18:43:56 +02:00
|
|
|
url = 'http://localhost:{port}/data/downloads/download.bin'.format(
|
2017-09-19 10:35:54 +02:00
|
|
|
port=server.port)
|
2016-09-09 18:43:56 +02:00
|
|
|
quteproc_new.send_cmd(':download {}'.format(url))
|
|
|
|
line = quteproc_new.wait_for(
|
|
|
|
loglevel=logging.ERROR, category='message',
|
|
|
|
message='XDG_DOWNLOAD_DIR points to a relative path - please check '
|
|
|
|
'your ~/.config/user-dirs.dirs. The download is saved in your '
|
|
|
|
'home directory.')
|
|
|
|
line.expected = True
|
2016-09-10 15:50:54 +02:00
|
|
|
quteproc_new.wait_for(category='downloads',
|
|
|
|
message='Download download.bin finished')
|
2016-09-09 18:43:56 +02:00
|
|
|
|
|
|
|
assert (home / 'download.bin').exists()
|
2016-05-15 11:50:29 +02:00
|
|
|
|
|
|
|
|
2016-09-06 07:56:59 +02:00
|
|
|
def test_no_loglines(request, quteproc_new):
|
2017-04-06 20:38:15 +02:00
|
|
|
"""Test qute://log with --loglines=0."""
|
2016-09-06 07:56:59 +02:00
|
|
|
quteproc_new.start(args=['--temp-basedir', '--loglines=0'] +
|
|
|
|
_base_args(request.config))
|
2017-04-06 20:38:15 +02:00
|
|
|
quteproc_new.open_path('qute://log')
|
2016-05-15 11:50:29 +02:00
|
|
|
assert quteproc_new.get_content() == 'Log output was disabled.'
|
2016-08-10 09:05:04 +02:00
|
|
|
|
|
|
|
|
2016-08-10 15:05:55 +02:00
|
|
|
@pytest.mark.not_frozen
|
2016-08-10 09:05:04 +02:00
|
|
|
@pytest.mark.parametrize('level', ['1', '2'])
|
2016-09-06 07:56:59 +02:00
|
|
|
def test_optimize(request, quteproc_new, capfd, level):
|
|
|
|
quteproc_new.start(args=['--temp-basedir'] + _base_args(request.config),
|
2016-08-10 09:05:04 +02:00
|
|
|
env={'PYTHONOPTIMIZE': level})
|
|
|
|
if level == '2':
|
|
|
|
msg = ("Running on optimize level higher than 1, unexpected behavior "
|
|
|
|
"may occur.")
|
|
|
|
line = quteproc_new.wait_for(message=msg)
|
|
|
|
line.expected = True
|
2016-08-10 09:29:10 +02:00
|
|
|
|
|
|
|
# Waiting for quit to make sure no other warning is emitted
|
2016-08-10 09:05:04 +02:00
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
2016-09-28 14:38:15 +02:00
|
|
|
|
|
|
|
|
2017-05-02 09:12:06 +02:00
|
|
|
@pytest.mark.not_frozen
|
2017-07-24 08:05:51 +02:00
|
|
|
@pytest.mark.flaky # Fails sometimes with empty output...
|
2016-09-28 14:38:15 +02:00
|
|
|
def test_version(request):
|
|
|
|
"""Test invocation with --version argument."""
|
2017-05-02 09:12:06 +02:00
|
|
|
args = ['-m', 'qutebrowser', '--version'] + _base_args(request.config)
|
2016-09-28 14:38:15 +02:00
|
|
|
# can't use quteproc_new here because it's confused by
|
|
|
|
# early process termination
|
2017-05-02 09:12:06 +02:00
|
|
|
proc = QProcess()
|
|
|
|
proc.setProcessChannelMode(QProcess.SeparateChannels)
|
|
|
|
|
|
|
|
proc.start(sys.executable, args)
|
|
|
|
ok = proc.waitForStarted(2000)
|
|
|
|
assert ok
|
2017-09-10 14:28:42 +02:00
|
|
|
ok = proc.waitForFinished(10000)
|
2017-05-02 09:12:06 +02:00
|
|
|
|
2017-06-19 09:06:18 +02:00
|
|
|
stdout = bytes(proc.readAllStandardOutput()).decode('utf-8')
|
|
|
|
print(stdout)
|
|
|
|
stderr = bytes(proc.readAllStandardError()).decode('utf-8')
|
|
|
|
print(stderr)
|
2016-09-28 15:31:32 +02:00
|
|
|
|
2017-09-10 13:36:08 +02:00
|
|
|
assert ok
|
|
|
|
assert proc.exitStatus() == QProcess.NormalExit
|
|
|
|
|
2017-06-19 09:06:18 +02:00
|
|
|
assert re.search(r'^qutebrowser\s+v\d+(\.\d+)', stdout) is not None
|
2017-02-27 14:01:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_qt_arg(request, quteproc_new, tmpdir):
|
|
|
|
"""Test --qt-arg."""
|
2017-02-27 15:12:38 +01:00
|
|
|
args = (['--temp-basedir', '--qt-arg', 'stylesheet',
|
|
|
|
str(tmpdir / 'does-not-exist')] + _base_args(request.config))
|
2017-02-27 14:01:58 +01:00
|
|
|
quteproc_new.start(args)
|
|
|
|
|
|
|
|
msg = 'QCss::Parser - Failed to load file "*does-not-exist"'
|
|
|
|
line = quteproc_new.wait_for(message=msg)
|
|
|
|
line.expected = True
|
|
|
|
|
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
2017-02-28 17:24:48 +01:00
|
|
|
|
|
|
|
|
2018-06-11 08:52:31 +02:00
|
|
|
@utils.skip_qt511
|
2017-02-28 17:24:48 +01:00
|
|
|
def test_webengine_inspector(request, quteproc_new):
|
|
|
|
if not request.config.webengine:
|
|
|
|
pytest.skip()
|
|
|
|
args = (['--temp-basedir', '--enable-webengine-inspector'] +
|
|
|
|
_base_args(request.config))
|
|
|
|
quteproc_new.start(args)
|
|
|
|
line = quteproc_new.wait_for(
|
|
|
|
message='Remote debugging server started successfully. Try pointing a '
|
|
|
|
'Chromium-based browser to http://127.0.0.1:*')
|
|
|
|
port = int(line.message.split(':')[-1])
|
|
|
|
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
s.connect(('127.0.0.1', port))
|
|
|
|
s.close()
|
2017-03-01 23:43:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.linux
|
|
|
|
def test_webengine_download_suffix(request, quteproc_new, tmpdir):
|
|
|
|
"""Make sure QtWebEngine does not add a suffix to downloads."""
|
|
|
|
if not request.config.webengine:
|
|
|
|
pytest.skip()
|
|
|
|
|
|
|
|
download_dir = tmpdir / 'downloads'
|
|
|
|
download_dir.ensure(dir=True)
|
|
|
|
|
|
|
|
(tmpdir / 'user-dirs.dirs').write(
|
|
|
|
'XDG_DOWNLOAD_DIR={}'.format(download_dir))
|
|
|
|
env = {'XDG_CONFIG_HOME': str(tmpdir)}
|
|
|
|
args = (['--temp-basedir'] + _base_args(request.config))
|
|
|
|
quteproc_new.start(args, env=env)
|
|
|
|
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc_new.set_setting('downloads.location.prompt', 'false')
|
|
|
|
quteproc_new.set_setting('downloads.location.directory', str(download_dir))
|
2017-03-01 23:43:04 +01:00
|
|
|
quteproc_new.open_path('data/downloads/download.bin', wait=False)
|
|
|
|
quteproc_new.wait_for(category='downloads', message='Download * finished')
|
|
|
|
quteproc_new.open_path('data/downloads/download.bin', wait=False)
|
|
|
|
quteproc_new.wait_for(message='Entering mode KeyMode.yesno *')
|
|
|
|
quteproc_new.send_cmd(':prompt-accept yes')
|
|
|
|
quteproc_new.wait_for(category='downloads', message='Download * finished')
|
|
|
|
|
|
|
|
files = download_dir.listdir()
|
|
|
|
assert len(files) == 1
|
|
|
|
assert files[0].basename == 'download.bin'
|
2017-03-07 06:43:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_command_on_start(request, quteproc_new):
|
|
|
|
"""Make sure passing a command on start works.
|
|
|
|
|
|
|
|
See https://github.com/qutebrowser/qutebrowser/issues/2408
|
|
|
|
"""
|
|
|
|
args = (['--temp-basedir'] + _base_args(request.config) +
|
|
|
|
[':quickmark-add https://www.example.com/ example'])
|
|
|
|
quteproc_new.start(args)
|
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
2017-04-28 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_launching_with_python2():
|
|
|
|
try:
|
2017-10-23 11:22:56 +02:00
|
|
|
proc = subprocess.run(['python2', '-m', 'qutebrowser',
|
|
|
|
'--no-err-windows'], stderr=subprocess.PIPE)
|
2017-04-28 20:51:38 +02:00
|
|
|
except FileNotFoundError:
|
|
|
|
pytest.skip("python2 not found")
|
|
|
|
assert proc.returncode == 1
|
2017-09-18 09:41:12 +02:00
|
|
|
error = "At least Python 3.5 is required to run qutebrowser"
|
2017-10-23 11:22:56 +02:00
|
|
|
assert proc.stderr.decode('ascii').startswith(error)
|
2017-05-10 08:51:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_initial_private_browsing(request, quteproc_new):
|
|
|
|
"""Make sure the initial window is private when the setting is set."""
|
|
|
|
args = (_base_args(request.config) +
|
2017-06-16 17:04:08 +02:00
|
|
|
['--temp-basedir', '-s', 'content.private_browsing', 'true'])
|
2017-05-10 08:51:48 +02:00
|
|
|
quteproc_new.start(args)
|
|
|
|
|
|
|
|
quteproc_new.compare_session("""
|
|
|
|
windows:
|
|
|
|
- private: True
|
|
|
|
tabs:
|
|
|
|
- history:
|
|
|
|
- url: about:blank
|
|
|
|
""")
|
|
|
|
|
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
2017-05-28 11:07:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_loading_empty_session(tmpdir, request, quteproc_new):
|
|
|
|
"""Make sure loading an empty session opens a window."""
|
|
|
|
session = tmpdir / 'session.yml'
|
|
|
|
session.write('windows: []')
|
|
|
|
|
|
|
|
args = _base_args(request.config) + ['--temp-basedir', '-r', str(session)]
|
|
|
|
quteproc_new.start(args)
|
|
|
|
|
|
|
|
quteproc_new.compare_session("""
|
|
|
|
windows:
|
|
|
|
- tabs:
|
|
|
|
- history:
|
|
|
|
- url: about:blank
|
|
|
|
""")
|
|
|
|
|
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
2017-07-10 18:04:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_qute_settings_persistence(short_tmpdir, request, quteproc_new):
|
|
|
|
"""Make sure settings from qute://settings are persistent."""
|
|
|
|
args = _base_args(request.config) + ['--basedir', str(short_tmpdir)]
|
|
|
|
quteproc_new.start(args)
|
2018-07-09 23:38:47 +02:00
|
|
|
quteproc_new.open_path('qute://settings/')
|
|
|
|
quteproc_new.send_cmd(':jseval --world main '
|
|
|
|
'cset("search.ignore_case", "always")')
|
2018-07-21 23:33:23 +02:00
|
|
|
quteproc_new.wait_for(message='No output or error')
|
2018-07-09 23:38:47 +02:00
|
|
|
|
2017-10-27 14:49:22 +02:00
|
|
|
assert quteproc_new.get_setting('search.ignore_case') == 'always'
|
2017-07-10 18:04:39 +02:00
|
|
|
|
|
|
|
quteproc_new.send_cmd(':quit')
|
|
|
|
quteproc_new.wait_for_quit()
|
|
|
|
|
|
|
|
quteproc_new.start(args)
|
2017-10-27 14:49:22 +02:00
|
|
|
assert quteproc_new.get_setting('search.ignore_case') == 'always'
|