2015-08-11 09:17:46 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
|
|
|
# Copyright 2015 Alexander Cogneau <alexander.cogneau@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/>.
|
|
|
|
|
|
|
|
"""Tests for qutebrowser.completion.models column widths"""
|
|
|
|
|
2015-08-12 09:08:04 +02:00
|
|
|
import pytest
|
|
|
|
|
2015-08-11 09:17:46 +02:00
|
|
|
from qutebrowser.completion.models.base import BaseCompletionModel
|
|
|
|
from qutebrowser.completion.models.configmodel import (
|
|
|
|
SettingOptionCompletionModel, SettingSectionCompletionModel,
|
|
|
|
SettingValueCompletionModel)
|
|
|
|
from qutebrowser.completion.models.miscmodels import (
|
|
|
|
CommandCompletionModel, HelpCompletionModel, QuickmarkCompletionModel,
|
|
|
|
BookmarkCompletionModel, SessionCompletionModel)
|
|
|
|
from qutebrowser.completion.models.urlmodel import UrlCompletionModel
|
|
|
|
|
|
|
|
|
|
|
|
class TestColumnWidths:
|
|
|
|
|
|
|
|
"""Tests for the column widths of the completion models"""
|
|
|
|
|
|
|
|
CLASSES = [BaseCompletionModel, SettingOptionCompletionModel,
|
|
|
|
SettingOptionCompletionModel, SettingSectionCompletionModel,
|
|
|
|
SettingValueCompletionModel, CommandCompletionModel,
|
|
|
|
HelpCompletionModel, QuickmarkCompletionModel,
|
|
|
|
BookmarkCompletionModel, SessionCompletionModel,
|
|
|
|
UrlCompletionModel]
|
|
|
|
|
2015-08-12 09:08:04 +02:00
|
|
|
@pytest.mark.parametrize("model", CLASSES)
|
|
|
|
def test_list_size(self, model):
|
2015-08-11 09:17:46 +02:00
|
|
|
"""Test if there are 3 items in the COLUMN_WIDTHS property"""
|
2015-08-12 09:08:04 +02:00
|
|
|
assert len(model.COLUMN_WIDTHS) == 3
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("model", CLASSES)
|
|
|
|
def test_column_width_sum(self, model):
|
2015-08-11 09:17:46 +02:00
|
|
|
"""Test if the sum of the widths asserts to 100"""
|
2015-08-12 09:08:04 +02:00
|
|
|
assert sum(model.COLUMN_WIDTHS) == 100
|