Add test for window completion

This commit is contained in:
Michael Hoang 2017-10-11 17:14:18 +11:00
parent 29f66dcd95
commit 249e497d36
3 changed files with 30 additions and 0 deletions

View File

@ -60,6 +60,9 @@ class WinRegistryHelper:
registry = attr.ib() registry = attr.ib()
def windowTitle(self):
return 'window title - qutebrowser'
def __init__(self): def __init__(self):
self._ids = [] self._ids = []

View File

@ -520,6 +520,9 @@ class TabbedBrowserStub(QObject):
def count(self): def count(self):
return len(self.tabs) return len(self.tabs)
def widgets(self):
return self.tabs
def widget(self, i): def widget(self, i):
return self.tabs[i] return self.tabs[i]

View File

@ -528,6 +528,30 @@ def test_tab_completion_delete(qtmodeltester, fake_web_tab, app_stub,
QUrl('https://duckduckgo.com')] QUrl('https://duckduckgo.com')]
def test_window_completion(qtmodeltester, fake_web_tab, tabbed_browser_stubs):
tabbed_browser_stubs[0].tabs = [
fake_web_tab(QUrl('https://github.com'), 'GitHub', 0),
fake_web_tab(QUrl('https://wikipedia.org'), 'Wikipedia', 1),
fake_web_tab(QUrl('https://duckduckgo.com'), 'DuckDuckGo', 2)
]
tabbed_browser_stubs[1].tabs = [
fake_web_tab(QUrl('https://wiki.archlinux.org'), 'ArchWiki', 0)
]
model = miscmodels.window()
model.set_pattern('')
qtmodeltester.data_display_may_return_none = True
qtmodeltester.check(model)
_check_completions(model, {
'Windows': [
('0', 'window title - qutebrowser',
'GitHub, Wikipedia, DuckDuckGo'),
('1', 'window title - qutebrowser', 'ArchWiki')
]
})
def test_setting_option_completion(qtmodeltester, config_stub, def test_setting_option_completion(qtmodeltester, config_stub,
configdata_stub, info): configdata_stub, info):
model = configmodel.option(info=info) model = configmodel.option(info=info)