@@ -4064,7 +4064,7 @@ def compose(self) -> ComposeResult:
4064
4064
(130 , 50 ),
4065
4065
],
4066
4066
)
4067
- def test_breakpoints (snap_compare , size ):
4067
+ def test_breakpoints_horizontal (snap_compare , size ):
4068
4068
"""Test HORIZONTAL_BREAKPOINTS
4069
4069
4070
4070
You should see four terminals of different sizes with a grid of placeholders.
@@ -4081,50 +4081,80 @@ class BreakpointApp(App):
4081
4081
(120 , "-very-wide" ),
4082
4082
]
4083
4083
4084
- VERTICAL_BREAKPOINTS = [
4085
- (0 , "-low" ),
4086
- (30 , "-middle" ),
4087
- (40 , "-high" ),
4088
- (50 , "-very-high" ),
4089
- ]
4090
-
4091
4084
CSS = """
4092
4085
Screen {
4093
4086
&.-narrow {
4094
- Grid { grid-columns: 20 ; }
4087
+ Grid { grid-size: 1 ; }
4095
4088
}
4096
4089
&.-normal {
4097
- Grid { grid-columns: 40 ; }
4090
+ Grid { grid-size: 2 ; }
4098
4091
}
4099
4092
&.-wide {
4100
- Grid { grid-columns: 80 ; }
4093
+ Grid { grid-size: 4 ; }
4101
4094
}
4102
4095
&.-very-wide {
4103
- Grid { grid-columns: 120 ; }
4096
+ Grid { grid-size: 6 ; }
4104
4097
}
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 {
4105
4136
&.-low {
4106
- Grid { grid-rows : 1; }
4137
+ Grid { grid-size : 1; }
4107
4138
}
4108
4139
&.-middle {
4109
- Grid { grid-rows : 2; }
4140
+ Grid { grid-size : 2; }
4110
4141
}
4111
4142
&.-high {
4112
- Grid { grid-rows : 4; }
4143
+ Grid { grid-size : 4; }
4113
4144
}
4114
4145
&.-very-high {
4115
- Grid { grid-rows : 6; }
4146
+ Grid { grid-size : 6; }
4116
4147
}
4117
4148
}
4118
4149
"""
4119
-
4150
+
4120
4151
def compose (self ) -> ComposeResult :
4121
4152
with Grid ():
4122
4153
for n in range (16 ):
4123
4154
yield Placeholder (f"Placeholder { n + 1 } " )
4124
4155
4125
4156
assert snap_compare (BreakpointApp (), terminal_size = size )
4126
4157
4127
-
4128
4158
def test_compact (snap_compare ):
4129
4159
"""Test compact styles.
4130
4160
0 commit comments