Skip to content

Commit 715d52b

Browse files
committed
#26: test fixes for pane / height and width on tests.
1 parent 173497c commit 715d52b

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

examples/blank-panes.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"panes": [
55
null,
66
"pane",
7-
"blank",
7+
"blank"
8+
],
9+
"window_name": "Blank pane test"
10+
},
11+
{
12+
"panes": [
813
null,
914
{
1015
"shell_command": null
@@ -15,8 +20,7 @@
1520
]
1621
}
1722
],
18-
"layout": "tiled",
19-
"window_name": "Blank pane test"
23+
"window_name": "More blank panes"
2024
},
2125
{
2226
"panes": [

examples/blank-panes.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ windows:
33
# Emptiness will simply open a blank pane, if no shell_command_before.
44
# All these are equivalent
55
- window_name: Blank pane test
6-
layout: tiled
76
panes:
87
-
98
- pane
109
- blank
10+
- window_name: More blank panes
11+
panes:
1112
- null
1213
- shell_command:
1314
- shell_command:

tmuxp/testsuite/test_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,6 @@ class ConfigBlankPanes(TestCase):
747747
'windows': [
748748
{
749749
'window_name': 'Blank pane test',
750-
'layout': 'tiled',
751750
'panes': [
752751
{
753752
'shell_command': [],
@@ -757,7 +756,12 @@ class ConfigBlankPanes(TestCase):
757756
},
758757
{
759758
'shell_command': [],
760-
},
759+
}
760+
]
761+
},
762+
{
763+
'window_name': 'More blank panes',
764+
'panes': [
761765
{
762766
'shell_command': [],
763767
},

tmuxp/testsuite/test_pane.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ def test_resize_pane(self):
3131
pane1_height = pane1['pane_height']
3232
pane2 = window.split_window()
3333

34-
pane1.resize_pane(height=7)
34+
pane1.resize_pane(height=4)
3535
self.assertNotEqual(pane1['pane_height'], pane1_height)
36-
self.assertEqual(int(pane1['pane_height']), 7)
36+
self.assertEqual(int(pane1['pane_height']), 4)
3737

38-
pane1.resize_pane(height=9)
39-
self.assertEqual(int(pane1['pane_height']), 9)
38+
pane1.resize_pane(height=3)
39+
self.assertEqual(int(pane1['pane_height']), 3)
4040

4141
def test_set_height(self):
4242
window = self.session.new_window(window_name='test_set_height')
4343
pane2 = window.split_window()
4444
pane1 = window.attached_pane()
4545
pane1_height = pane1['pane_height']
4646

47-
pane1.set_height(6)
47+
pane1.set_height(2)
4848
self.assertNotEqual(pane1['pane_height'], pane1_height)
49-
self.assertEqual(int(pane1['pane_height']), 6)
49+
self.assertEqual(int(pane1['pane_height']), 2)
5050

5151
def test_set_width(self):
5252
window = self.session.new_window(window_name='test_set_width')
@@ -56,8 +56,8 @@ def test_set_width(self):
5656
pane1 = window.attached_pane()
5757
pane1_width = pane1['pane_width']
5858

59-
pane1.set_width(25)
59+
pane1.set_width(10)
6060
self.assertNotEqual(pane1['pane_width'], pane1_width)
61-
self.assertEqual(int(pane1['pane_width']), 25)
61+
self.assertEqual(int(pane1['pane_width']), 10)
6262

6363
pane1.reset()

tmuxp/testsuite/test_workspacebuilder.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,22 +195,19 @@ class WindowOptions(TmuxTestCase):
195195
windows:
196196
- layout: main-horizontal
197197
options:
198-
main-pane-height: 30
198+
main-pane-height: 5
199199
panes:
200-
- shell_command:
201-
- vim
202-
start_directory: '~'
203-
- shell_command:
204-
- echo "hey"
205-
- shell_command:
206-
- echo "moo"
200+
- pane
201+
- pane
202+
- pane
207203
window_name: editor
208204
"""
209205

210206
def test_window_options(self):
211207
s = self.session
212208
sconfig = kaptan.Kaptan(handler='yaml')
213209
sconfig = sconfig.import_config(self.yaml_config).get()
210+
sconfig = config.expand(sconfig)
214211

215212
builder = WorkspaceBuilder(sconf=sconfig)
216213

@@ -223,7 +220,7 @@ def test_window_options(self):
223220
p = p
224221
self.assertEqual(len(s._windows), window_count)
225222
self.assertIsInstance(w, Window)
226-
self.assertEqual(w.show_window_option('main-pane-height'), 30)
223+
self.assertEqual(w.show_window_option('main-pane-height'), 5)
227224

228225
self.assertEqual(len(s._windows), window_count)
229226
window_count += 1
@@ -315,18 +312,23 @@ def test_blank_pane_count(self):
315312

316313
test_config = kaptan.Kaptan().import_config(self.yaml_config_file).get()
317314
test_config = config.expand(test_config)
315+
# for window in test_config['windows']:
316+
# window['layout'] = 'tiled'
318317
builder = WorkspaceBuilder(sconf=test_config)
319318
builder.build(session=self.session)
320319

320+
self.assertEqual(self.session, builder.session)
321+
321322
window1 = self.session.findWhere({'window_name': 'Blank pane test'})
322-
self.assertEqual(len(window1._panes), 6)
323+
self.assertEqual(len(window1._panes), 3)
324+
325+
window2 = self.session.findWhere({'window_name': 'More blank panes'})
326+
self.assertEqual(len(window2._panes), 3)
323327

324-
window1 = self.session.findWhere(
328+
window3 = self.session.findWhere(
325329
{'window_name': 'Empty string (return)'}
326330
)
327-
self.assertEqual(len(window1._panes), 3)
328-
329-
self.assertEqual(self.session, builder.session)
331+
self.assertEqual(len(window3._panes), 3)
330332

331333

332334
class StartDirectoryTest(TmuxTestCase):
@@ -406,6 +408,7 @@ class PaneOrderingTest(TmuxTestCase):
406408
windows:
407409
- options:
408410
- automatic_rename: on
411+
layout: tiled
409412
panes:
410413
- cd /var/log
411414
- cd /sys

0 commit comments

Comments
 (0)