initial testing - local tox does not work yet
This commit is contained in:
parent
fe4800b68f
commit
7d9d4937aa
1
tests/integration/data/hinting.txt
Normal file
1
tests/integration/data/hinting.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
hinting
|
38
tests/integration/data/hints/issue1393.html
Normal file
38
tests/integration/data/hints/issue1393.html
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Let's Hint some words</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Word hints</h1>
|
||||||
|
<p>This page contains links to be hinted with words. The two
|
||||||
|
kinds of word hints will be described below.</p>
|
||||||
|
|
||||||
|
<h2>Smart hints</h2>
|
||||||
|
<p>In qutebrowser, urls can not only be hinted with letters and
|
||||||
|
numbers, but also with <a href="../words.txt">words</a>. When there is
|
||||||
|
a sensible url text available, qutebrowser will even use that
|
||||||
|
text to create a <a href="../smart.txt">smart</a> hint.</p>
|
||||||
|
|
||||||
|
<h2>Filled hints</h2>
|
||||||
|
<p>When no smart hints are available, because the hint text is
|
||||||
|
<a href="../l33t.txt">too</a> short or <a href="../l33t.txt">l33t</a> to
|
||||||
|
use, words from a dictionary will be used.</p>
|
||||||
|
|
||||||
|
<p>The current dictionary contains only the words: one, two,
|
||||||
|
three, four and five. As there are for none-smart hints in this
|
||||||
|
page, all five words should be used.</p>
|
||||||
|
|
||||||
|
<h2>Hint conflicts</h2>
|
||||||
|
<p>Of course, hints have to be unique. For instance, all hints
|
||||||
|
below should get a different hint, whether they're smart or
|
||||||
|
not:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="../hinting.txt">hinting</a> should be a smart hint</li>
|
||||||
|
<li><a href="../l33t.txt">word</a> is a prefix of words</li>
|
||||||
|
<li><a href="../l33t.txt">3</a> is too 1337</li>
|
||||||
|
<li><a href="../l33t.txt">4</a> is too 1337</li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
tests/integration/data/l33t.txt
Normal file
1
tests/integration/data/l33t.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
l33t
|
1
tests/integration/data/smart.txt
Normal file
1
tests/integration/data/smart.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
smart
|
1
tests/integration/data/words.txt
Normal file
1
tests/integration/data/words.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
words
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
@ -21,10 +22,12 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import pytest
|
import pytest
|
||||||
import bs4
|
import bs4
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
def collect_tests():
|
def collect_tests():
|
||||||
@ -54,3 +57,34 @@ def test_hints(test_name, quteproc):
|
|||||||
quteproc.wait_for(message='hints: a', category='hints')
|
quteproc.wait_for(message='hints: a', category='hints')
|
||||||
quteproc.send_cmd(':follow-hint a')
|
quteproc.send_cmd(':follow-hint a')
|
||||||
quteproc.wait_for_load_finished('data/' + parsed['target'])
|
quteproc.wait_for_load_finished('data/' + parsed['target'])
|
||||||
|
|
||||||
|
|
||||||
|
def test_word_hints_issue1393(quteproc, tmpdir):
|
||||||
|
dict_file = tmpdir / 'dict'
|
||||||
|
dict_file.write(textwrap.dedent("""
|
||||||
|
alpha
|
||||||
|
beta
|
||||||
|
gamma
|
||||||
|
delta
|
||||||
|
epsilon
|
||||||
|
"""))
|
||||||
|
targets = [
|
||||||
|
('words', 'words.txt'),
|
||||||
|
('smart', 'smart.txt'),
|
||||||
|
('hinting', 'hinting.txt'),
|
||||||
|
('alpha', 'l33t.txt'),
|
||||||
|
('beta', 'l33t.txt'),
|
||||||
|
('gamma', 'l33t.txt'),
|
||||||
|
('delta', 'l33t.txt'),
|
||||||
|
('epsilon', 'l33t.txt'),
|
||||||
|
]
|
||||||
|
|
||||||
|
quteproc.set_setting('hints', 'mode', 'words')
|
||||||
|
quteproc.set_setting('hints', 'dictionary', str(dict_file))
|
||||||
|
|
||||||
|
for hint, target in targets:
|
||||||
|
quteproc.open_path('data/hints/issue1393.html')
|
||||||
|
quteproc.send_cmd(':hint')
|
||||||
|
quteproc.wait_for(message=re.compile('hints: .*'), category='hints')
|
||||||
|
quteproc.send_cmd(':follow-hint {}'.format(hint))
|
||||||
|
quteproc.wait_for_load_finished('data/{}'.format(target))
|
||||||
|
Loading…
Reference in New Issue
Block a user