diff options
Diffstat (limited to 'test/functional/ui/winbar_spec.lua')
-rw-r--r-- | test/functional/ui/winbar_spec.lua | 181 |
1 files changed, 176 insertions, 5 deletions
diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua index abc6088801..af7736293c 100644 --- a/test/functional/ui/winbar_spec.lua +++ b/test/functional/ui/winbar_spec.lua @@ -5,6 +5,7 @@ local command = helpers.command local insert = helpers.insert local meths = helpers.meths local eq = helpers.eq +local poke_eventloop = helpers.poke_eventloop describe('winbar', function() local screen @@ -20,8 +21,9 @@ describe('winbar', function() [4] = {bold = true, reverse = true}, [5] = {bold = true, foreground = Screen.colors.Red}, [6] = {foreground = Screen.colors.Blue}, + [7] = {background = Screen.colors.LightGrey}, }) - command('set winbar=Set\\ Up\\ The\\ Bars') + meths.set_option('winbar', 'Set Up The Bars') end) it('works', function() screen:expect([[ @@ -180,8 +182,9 @@ describe('winbar', function() | ]]) end) - it('sets correct position on mouse click', function() - insert[[ + + it('mouse click and drag work correctly in buffer', function() + insert([[ line 1 line 2 line 3 @@ -189,9 +192,177 @@ describe('winbar', function() line -42 line i line sin(theta) - line 8 - ]] + line 8]]) + meths.input_mouse('left', 'press', '', 0, 5, 1) + screen:expect([[ + {1:Set Up The Bars }| + line 1 | + line 2 | + line 3 | + line 4 | + l^ine -42 | + line i | + line sin(theta) | + line 8 | + {3:~ }| + {3:~ }| + {3:~ }| + | + ]]) eq({5, 1}, meths.win_get_cursor(0)) + + meths.input_mouse('left', 'drag', '', 0, 6, 2) + screen:expect([[ + {1:Set Up The Bars }| + line 1 | + line 2 | + line 3 | + line 4 | + l{7:ine -42} | + {7:li}^ne i | + line sin(theta) | + line 8 | + {3:~ }| + {3:~ }| + {3:~ }| + {1:-- VISUAL --} | + ]]) + eq({6, 2}, meths.win_get_cursor(0)) + + meths.input_mouse('left', 'drag', '', 0, 1, 2) + screen:expect([[ + {1:Set Up The Bars }| + li^n{7:e 1} | + {7:line 2} | + {7:line 3} | + {7:line 4} | + {7:li}ne -42 | + line i | + line sin(theta) | + line 8 | + {3:~ }| + {3:~ }| + {3:~ }| + {1:-- VISUAL --} | + ]]) + eq({1, 2}, meths.win_get_cursor(0)) + + meths.input_mouse('left', 'drag', '', 0, 0, 2) + screen:expect_unchanged() + eq({1, 2}, meths.win_get_cursor(0)) + end) + + it('dragging statusline with mouse works correctly', function() + command('split') + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {4:[No Name] }| + {1:Set Up The Bars }| + | + {3:~ }| + {3:~ }| + {3:~ }| + {2:[No Name] }| + | + ]]) + + meths.input_mouse('left', 'press', '', 1, 5, 10) + poke_eventloop() + meths.input_mouse('left', 'drag', '', 1, 6, 10) + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {4:[No Name] }| + {1:Set Up The Bars }| + | + {3:~ }| + {3:~ }| + {2:[No Name] }| + | + ]]) + + meths.input_mouse('left', 'drag', '', 1, 4, 10) + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {4:[No Name] }| + {1:Set Up The Bars }| + | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {2:[No Name] }| + | + ]]) + + meths.input_mouse('left', 'press', '', 1, 11, 10) + poke_eventloop() + meths.input_mouse('left', 'drag', '', 1, 9, 10) + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {4:[No Name] }| + {1:Set Up The Bars }| + | + {3:~ }| + {3:~ }| + {2:[No Name] }| + | + | + | + ]]) + eq(3, meths.get_option('cmdheight')) + + meths.input_mouse('left', 'drag', '', 1, 11, 10) + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {4:[No Name] }| + {1:Set Up The Bars }| + | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {2:[No Name] }| + | + ]]) + eq(1, meths.get_option('cmdheight')) + end) + it('properly equalizes window height for window-local value', function() + command('set equalalways | set winbar= | setlocal winbar=a | split') + command('setlocal winbar= | split') + command('setlocal winbar=b | split') + screen:expect([[ + {1:b }| + ^ | + {4:[No Name] }| + {1:b }| + | + {2:[No Name] }| + | + {3:~ }| + {2:[No Name] }| + {1:a }| + | + {2:[No Name] }| + | + ]]) end) end) |