Skip to content

Commit 48b152a

Browse files
Make vertical breakpoints test separate
1 parent b568908 commit 48b152a

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

tests/snapshot_tests/test_snapshots.py

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,7 +4064,7 @@ def compose(self) -> ComposeResult:
40644064
(130, 50),
40654065
],
40664066
)
4067-
def test_breakpoints(snap_compare, size):
4067+
def test_breakpoints_horizontal(snap_compare, size):
40684068
"""Test HORIZONTAL_BREAKPOINTS
40694069
40704070
You should see four terminals of different sizes with a grid of placeholders.
@@ -4081,50 +4081,80 @@ class BreakpointApp(App):
40814081
(120, "-very-wide"),
40824082
]
40834083

4084-
VERTICAL_BREAKPOINTS = [
4085-
(0, "-low"),
4086-
(30, "-middle"),
4087-
(40, "-high"),
4088-
(50, "-very-high"),
4089-
]
4090-
40914084
CSS = """
40924085
Screen {
40934086
&.-narrow {
4094-
Grid { grid-columns: 20; }
4087+
Grid { grid-size: 1; }
40954088
}
40964089
&.-normal {
4097-
Grid { grid-columns: 40; }
4090+
Grid { grid-size: 2; }
40984091
}
40994092
&.-wide {
4100-
Grid { grid-columns: 80; }
4093+
Grid { grid-size: 4; }
41014094
}
41024095
&.-very-wide {
4103-
Grid { grid-columns: 120; }
4096+
Grid { grid-size: 6; }
41044097
}
4098+
}
4099+
"""
4100+
4101+
def compose(self) -> ComposeResult:
4102+
with Grid():
4103+
for n in range(16):
4104+
yield Placeholder(f"Placeholder {n+1}")
4105+
4106+
assert snap_compare(BreakpointApp(), terminal_size=size)
4107+
4108+
@pytest.mark.parametrize(
4109+
"size",
4110+
[
4111+
(30, 20),
4112+
(40, 30),
4113+
(80, 40),
4114+
(130, 50),
4115+
],
4116+
)
4117+
def test_breakpoints_vertical(snap_compare, size):
4118+
"""Test VERTICAL_BREAKPOINTS
4119+
4120+
You should see four terminals of different sizes with a grid of placeholders.
4121+
The first should have a single column, then two columns, then 4, then 6.
4122+
4123+
"""
4124+
4125+
class BreakpointApp(App):
4126+
4127+
VERTICAL_BREAKPOINTS = [
4128+
(0, "-low"),
4129+
(30, "-middle"),
4130+
(40, "-high"),
4131+
(50, "-very-high"),
4132+
]
4133+
4134+
CSS = """
4135+
Screen {
41054136
&.-low {
4106-
Grid { grid-rows: 1; }
4137+
Grid { grid-size: 1; }
41074138
}
41084139
&.-middle {
4109-
Grid { grid-rows: 2; }
4140+
Grid { grid-size: 2; }
41104141
}
41114142
&.-high {
4112-
Grid { grid-rows: 4; }
4143+
Grid { grid-size: 4; }
41134144
}
41144145
&.-very-high {
4115-
Grid { grid-rows: 6; }
4146+
Grid { grid-size: 6; }
41164147
}
41174148
}
41184149
"""
4119-
4150+
41204151
def compose(self) -> ComposeResult:
41214152
with Grid():
41224153
for n in range(16):
41234154
yield Placeholder(f"Placeholder {n+1}")
41244155

41254156
assert snap_compare(BreakpointApp(), terminal_size=size)
41264157

4127-
41284158
def test_compact(snap_compare):
41294159
"""Test compact styles.
41304160

0 commit comments

Comments
 (0)