99
1010import pytest
1111
12- from libtmux .common import has_gte_version , has_lt_version , has_lte_version
1312from libtmux .constants import PaneDirection , ResizeAdjustmentDirection
1413from libtmux .test .retry import retry_until
1514
@@ -158,10 +157,6 @@ def test_capture_pane_end(session: Session) -> None:
158157 assert pane_contents == '$ printf "%s"\n $'
159158
160159
161- @pytest .mark .skipif (
162- has_lte_version ("3.1" ),
163- reason = "3.2 has the -Z flag on split-window" ,
164- )
165160def test_pane_split_window_zoom (
166161 session : Session ,
167162) -> None :
@@ -188,10 +183,6 @@ def test_pane_split_window_zoom(
188183 assert pane_with_zoom .height == pane_with_zoom .window_height
189184
190185
191- @pytest .mark .skipif (
192- has_lt_version ("2.9" ),
193- reason = "resize-window only exists in tmux 2.9+" ,
194- )
195186def test_resize_pane (
196187 session : Session ,
197188) -> None :
@@ -229,21 +220,20 @@ def test_resize_pane(
229220 )
230221 assert int (pane .pane_width ) == 75
231222
232- if has_gte_version ("3.1" ):
233- # Manual: Height percentage
234- window .select_layout ("main-vertical" )
235- pane_height_before = int (pane .pane_height )
236- pane .resize_pane (
237- height = "15%" ,
238- )
239- assert int (pane .pane_height ) == 75
240-
241- # Manual: Width percentage
242- window .select_layout ("main-horizontal" )
243- pane .resize_pane (
244- width = "15%" ,
245- )
246- assert int (pane .pane_width ) == 75
223+ # Manual: Height percentage
224+ window .select_layout ("main-vertical" )
225+ pane_height_before = int (pane .pane_height )
226+ pane .resize_pane (
227+ height = "15%" ,
228+ )
229+ assert int (pane .pane_height ) == 75
230+
231+ # Manual: Width percentage
232+ window .select_layout ("main-horizontal" )
233+ pane .resize_pane (
234+ width = "15%" ,
235+ )
236+ assert int (pane .pane_width ) == 75
247237
248238 #
249239 # Adjustments
@@ -287,43 +277,30 @@ def test_split_pane_size(session: Session) -> None:
287277 pane = window .active_pane
288278 assert pane is not None
289279
290- if has_gte_version ("3.1" ):
291- short_pane = pane .split (size = 10 )
292- assert short_pane .pane_height == "10"
293-
294- assert short_pane .at_left
295- assert short_pane .at_right
296- assert not short_pane .at_top
297- assert short_pane .at_bottom
298-
299- narrow_pane = pane .split (direction = PaneDirection .Right , size = 10 )
300- assert narrow_pane .pane_width == "10"
301-
302- assert not narrow_pane .at_left
303- assert narrow_pane .at_right
304- assert narrow_pane .at_top
305- assert not narrow_pane .at_bottom
306-
307- new_pane = pane .split (size = "10%" )
308- assert new_pane .pane_height == "8"
309-
310- new_pane = short_pane .split (direction = PaneDirection .Right , size = "10%" )
311- assert new_pane .pane_width == "10"
312-
313- assert not new_pane .at_left
314- assert new_pane .at_right
315- else :
316- window_height_before = (
317- int (window .window_height ) if isinstance (window .window_height , str ) else 0
318- )
319- window_width_before = (
320- int (window .window_width ) if isinstance (window .window_width , str ) else 0
321- )
322- new_pane = pane .split (size = "10%" )
323- assert new_pane .pane_height == str (int (window_height_before * 0.1 ))
324-
325- new_pane = new_pane .split (direction = PaneDirection .Right , size = "10%" )
326- assert new_pane .pane_width == str (int (window_width_before * 0.1 ))
280+ short_pane = pane .split (size = 10 )
281+ assert short_pane .pane_height == "10"
282+
283+ assert short_pane .at_left
284+ assert short_pane .at_right
285+ assert not short_pane .at_top
286+ assert short_pane .at_bottom
287+
288+ narrow_pane = pane .split (direction = PaneDirection .Right , size = 10 )
289+ assert narrow_pane .pane_width == "10"
290+
291+ assert not narrow_pane .at_left
292+ assert narrow_pane .at_right
293+ assert narrow_pane .at_top
294+ assert not narrow_pane .at_bottom
295+
296+ new_pane = pane .split (size = "10%" )
297+ assert new_pane .pane_height == "8"
298+
299+ new_pane = short_pane .split (direction = PaneDirection .Right , size = "10%" )
300+ assert new_pane .pane_width == "10"
301+
302+ assert not new_pane .at_left
303+ assert new_pane .at_right
327304
328305
329306def test_pane_context_manager (session : Session ) -> None :
0 commit comments