Skip to content

Commit 4d2ab39

Browse files
committed
Focus and pane index test
1 parent e12db6e commit 4d2ab39

File tree

1 file changed

+8
-32
lines changed

1 file changed

+8
-32
lines changed

tmuxp/testsuite/test_workspacebuilder.py

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_split_windows(self):
9999
w.select_layout(wconf['layout'])
100100

101101

102-
class FocusTest(TmuxTestCase):
102+
class FocusAndPaneIndexTest(TmuxTestCase):
103103

104104
yaml_config = '''
105105
session_name: sampleconfig
@@ -131,10 +131,6 @@ class FocusTest(TmuxTestCase):
131131
132132
'''
133133

134-
@unittest.skip(
135-
'attached_{pane,window} needs to be fixed, this is working on tmux'
136-
' 1.9, if focus: true isn\'t working for you, please file an issue.'
137-
)
138134
def test_split_windows(self):
139135
s = self.session
140136
sconfig = kaptan.Kaptan(handler='yaml')
@@ -151,41 +147,21 @@ def test_split_windows(self):
151147
)
152148

153149
pane_base_index = self.session.attached_window().show_window_option(
154-
'base-pane-index')
150+
'pane-base-index'
151+
)
155152

156153
if not pane_base_index:
157154
pane_base_index = 0
158155
else:
159156
pane_base_index = int(pane_base_index)
160157

161-
# logger.error('attached window: %s' % (self.session.attached_window()))
162-
# logger.error('attached window: %s' % (self.session.attached_window()._TMUX))
163-
# logger.error('attached pane: %s' %
164-
# (self.session.attached_window().attached_pane()))
165-
import time
166-
time.sleep(1)
167-
self.session.list_windows()
168-
self.session.attached_window().list_panes()
169-
logger.error('attached pane: %s' % (
170-
self.session.attached_window().attached_pane()))
171-
logger.error('attached pane: %s' % (
172-
self.session.attached_window().attached_pane())._TMUX)
173-
logger.error('attached pane: %s' % (
174-
self.session.attached_window().list_panes()))
175-
logger.error('attached pane: %s' % (
176-
self.session.attached_window().where({'pane_active': '1'})[0]._TMUX))
177-
158+
# get the pane index for each pane
159+
pane_base_indexes = []
178160
for pane in self.session.attached_window().panes:
179-
logger.error(
180-
'%s and %s and %s, total panes %s' %
181-
(pane, pane['pane_index'], pane.window.get('window_name'), len(
182-
self.session.attached_window().list_panes()))
183-
)
161+
pane_base_indexes.append(int(pane.get('pane_index')))
184162

185-
self.assertEqual(
186-
self.session.attached_window().attached_pane().get('pane_index'),
187-
pane_base_index + 2
188-
)
163+
pane_indexes_should_be = [pane_base_index + x for x in range(0, 3)]
164+
self.assertListEqual(pane_indexes_should_be, pane_base_indexes)
189165

190166

191167
class WindowOptions(TmuxTestCase):

0 commit comments

Comments
 (0)