[layouts] Address feedback on "Fix vertical layout bug with centered content" PR

This commit is contained in:
Olivier Philippon
2022-05-10 09:12:55 +01:00
parent 7843683f5c
commit 72c9622b82
5 changed files with 8 additions and 29 deletions

View File

@@ -1,6 +1,5 @@
from __future__ import annotations
import asyncio
import platform
from typing import cast, List
import pytest
@@ -11,9 +10,6 @@ from textual.geometry import Size
from textual.widget import Widget
from textual.widgets import Placeholder
PLATFORM = platform.system()
WINDOWS = PLATFORM == "Windows"
# Let's allow ourselves some abbreviated names for those tests,
# in order to make the test cases a bit easier to read :-)
SCREEN_W = 100 # width of our Screens
@@ -153,22 +149,11 @@ async def test_composition_of_vertical_container_with_children(
expected_screen_size = Size(*screen_size)
# On Windows the screen size is always 1 cell smaller than the requested dimensions.
# Let's take this into account into our "expected_*" measurements:
if WINDOWS:
expected_screen_size = expected_screen_size._replace(
width=expected_screen_size.width - 1
)
expected_placeholders_size = (
expected_placeholders_size[0] - 1,
expected_placeholders_size[1],
)
async with app.in_running_state():
app.log_tree()
# root widget checks:
root_widget = cast(Widget, app.query_one("#root"))
root_widget = cast(Widget, app.get_child("root"))
assert root_widget.size == expected_screen_size
root_widget_region = app.screen.get_widget_region(root_widget)
assert root_widget_region == (