diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-08-03 13:08:25 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-08-03 13:08:25 +0200 |
commit | dbccb12b49669ba30e8b184d983a55c3054bcd91 (patch) | |
tree | 98bd663b98ef2aded2b48c26aedf177611fa1344 /tests/unit/misc/test_miscwidgets.py | |
parent | fa7f9955a3c8a64d0fd298d84926af14b2e15145 (diff) | |
download | qutebrowser-dbccb12b49669ba30e8b184d983a55c3054bcd91.tar.gz qutebrowser-dbccb12b49669ba30e8b184d983a55c3054bcd91.zip |
Move WrapperLayout to miscwidgets
Diffstat (limited to 'tests/unit/misc/test_miscwidgets.py')
-rw-r--r-- | tests/unit/misc/test_miscwidgets.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/unit/misc/test_miscwidgets.py b/tests/unit/misc/test_miscwidgets.py index 5ecf7e37f..8e92176f9 100644 --- a/tests/unit/misc/test_miscwidgets.py +++ b/tests/unit/misc/test_miscwidgets.py @@ -20,11 +20,11 @@ """Test widgets in miscwidgets module.""" from unittest import mock -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QApplication +from PyQt5.QtCore import Qt, QSize +from PyQt5.QtWidgets import QApplication, QWidget import pytest -from qutebrowser.misc.miscwidgets import CommandLineEdit +from qutebrowser.misc import miscwidgets class TestCommandLineEdit: @@ -34,7 +34,7 @@ class TestCommandLineEdit: @pytest.yield_fixture def cmd_edit(self, qtbot): """Fixture to initialize a CommandLineEdit.""" - cmd_edit = CommandLineEdit(None) + cmd_edit = miscwidgets.CommandLineEdit(None) cmd_edit.set_prompt(':') qtbot.add_widget(cmd_edit) assert cmd_edit.text() == '' @@ -73,3 +73,24 @@ class TestCommandLineEdit: """Test preventing of an invalid prompt being entered.""" qtbot.keyClicks(cmd_edit, '$hello') assert cmd_edit.text() == '' + + +class WrappedWidget(QWidget): + + def sizeHint(self): + return QSize(23, 42) + + +class TestWrapperLayout: + + @pytest.fixture + def container(self, qtbot): + wrapped = WrappedWidget() + parent = QWidget() + qtbot.add_widget(wrapped) + qtbot.add_widget(parent) + miscwidgets.WrapperLayout(wrapped, parent) + return parent + + def test_size_hint(self, container): + assert container.sizeHint() == QSize(23, 42) |