mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add regression test for #1616.
This commit is contained in:
38
tests/test_overflow_change.py
Normal file
38
tests/test_overflow_change.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Regression test for #1616 https://github.com/Textualize/textual/issues/1616"""
|
||||
import pytest
|
||||
|
||||
|
||||
from textual.app import App
|
||||
from textual.containers import Vertical
|
||||
|
||||
|
||||
@pytest.mark.xfail("Needs #1610 so that overflow changes trigger layout recomputation.")
|
||||
async def test_overflow_change_updates_virtual_size_appropriately():
|
||||
class MyApp(App):
|
||||
def compose(self):
|
||||
yield Vertical()
|
||||
|
||||
app = MyApp()
|
||||
|
||||
async with app.run_test() as pilot:
|
||||
vertical = app.query_one(Vertical)
|
||||
|
||||
height = vertical.virtual_size.height
|
||||
|
||||
vertical.styles.overflow_x = "scroll"
|
||||
await pilot.pause() # Let changes propagate.
|
||||
assert vertical.virtual_size.height < height
|
||||
|
||||
vertical.styles.overflow_x = "hidden"
|
||||
await pilot.pause()
|
||||
assert vertical.virtual_size.height == height
|
||||
|
||||
width = vertical.virtual_size.width
|
||||
|
||||
vertical.styles.overflow_y = "scroll"
|
||||
await pilot.pause()
|
||||
assert vertical.virtual_size.width < width
|
||||
|
||||
vertical.styles.overflow_y = "hidden"
|
||||
await pilot.pause()
|
||||
assert vertical.virtual_size.width == width
|
||||
Reference in New Issue
Block a user