-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1627 from Textualize/fix-1616
Changing overflow programmatically updates layout
- Loading branch information
Showing
5 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Regression test for #1616 https://github.com/Textualize/textual/issues/1616""" | ||
import pytest | ||
|
||
|
||
from textual.app import App | ||
from textual.containers import Vertical | ||
|
||
|
||
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 |