Testing to ensure layout can properly be set via view

This commit is contained in:
Darren Burns
2022-01-21 15:50:58 +00:00
parent deb7f1cb54
commit 5690f946d1
2 changed files with 20 additions and 2 deletions

18
tests/test_view.py Normal file
View File

@@ -0,0 +1,18 @@
import pytest
from textual.layouts.dock import DockLayout
from textual.layouts.grid import GridLayout
from textual.layouts.vertical import VerticalLayout
from textual.view import View
@pytest.mark.parametrize("layout_name, layout_type", [
["dock", DockLayout],
["grid", GridLayout],
["vertical", VerticalLayout],
])
def test_view_layout_get_and_set(layout_name, layout_type):
view = View()
view.layout = layout_name
assert type(view.layout) is layout_type
assert view.styles.layout is view.layout