|
8 | 8 | import pytest
|
9 | 9 |
|
10 | 10 | from libtmux import exc
|
11 |
| -from libtmux.common import has_gte_version, has_lt_version |
| 11 | +from libtmux.common import has_gte_version, has_lt_version, has_version |
12 | 12 | from libtmux.pane import Pane
|
13 | 13 | from libtmux.server import Server
|
14 | 14 | from libtmux.session import Session
|
@@ -158,6 +158,26 @@ def test_split_window_horizontal(session: Session) -> None:
|
158 | 158 | assert float(window.panes[0].width) <= ((float(window.width) + 1) / 2)
|
159 | 159 |
|
160 | 160 |
|
| 161 | +@pytest.mark.filterwarnings("ignore:.*deprecated in favor of Window.split()") |
| 162 | +def test_split_percentage( |
| 163 | + session: Session, |
| 164 | +) -> None: |
| 165 | + """Test deprecated percent param.""" |
| 166 | + window = session.new_window(window_name="split window size") |
| 167 | + window.resize(height=100, width=100) |
| 168 | + window_height_before = ( |
| 169 | + int(window.window_height) if isinstance(window.window_height, str) else 0 |
| 170 | + ) |
| 171 | + if has_version("3.4"): |
| 172 | + pytest.skip( |
| 173 | + "tmux 3.4 has a split-window bug." |
| 174 | + + " See https://github.com/tmux/tmux/pull/3840." |
| 175 | + ) |
| 176 | + with pytest.warns(match="Deprecated in favor of size.*"): |
| 177 | + pane = window.split_window(percent=10) |
| 178 | + assert pane.pane_height == str(int(window_height_before * 0.1)) |
| 179 | + |
| 180 | + |
161 | 181 | @pytest.mark.parametrize(
|
162 | 182 | "window_name_before,window_name_after",
|
163 | 183 | [("test", "ha ha ha fjewlkjflwef"), ("test", "hello \\ wazzup 0")],
|
|
0 commit comments