aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-08-09 14:52:58 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2016-08-14 21:53:02 +0200
commit82b434dd510d635dd0756778441739344e2f7585 (patch)
treee4329abf94f8e8315b117c6fca31adba74d07345
parenta63f770bcb4d7c100565c6d729a7b1d3714aebfa (diff)
downloadrneovim-82b434dd510d635dd0756778441739344e2f7585.tar.gz
rneovim-82b434dd510d635dd0756778441739344e2f7585.tar.bz2
rneovim-82b434dd510d635dd0756778441739344e2f7585.zip
tests: don't ignore highlights in mouse_spec
-rw-r--r--test/functional/ui/mouse_spec.lua315
1 files changed, 160 insertions, 155 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index c1ecca3ebe..3f6d8e4663 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -17,6 +17,7 @@ describe('Mouse input', function()
screen = Screen.new(25, 5)
screen:attach()
screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.LightGrey},
[2] = {bold = true},
[3] = {
@@ -24,14 +25,15 @@ describe('Mouse input', function()
background = Screen.colors.LightGrey,
bold = true,
},
+ [4] = {reverse = true},
+ [5] = {bold = true, reverse = true},
})
- screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[
testing |
mouse |
support and selectio^n |
- ~ |
+ {0:~ }|
|
]])
end)
@@ -46,7 +48,7 @@ describe('Mouse input', function()
testing |
mo^use |
support and selection |
- ~ |
+ {0:~ }|
|
]])
feed('<LeftMouse><0,0>')
@@ -54,7 +56,7 @@ describe('Mouse input', function()
^testing |
mouse |
support and selection |
- ~ |
+ {0:~ }|
|
]])
end)
@@ -68,7 +70,7 @@ describe('Mouse input', function()
{1:testin}^g |
mouse |
support and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
end)
@@ -84,7 +86,7 @@ describe('Mouse input', function()
^t{1:esting}{3: } |
mouse |
support and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL LINE --} |
]])
end)
@@ -102,17 +104,20 @@ describe('Mouse input', function()
^testing |
mouse |
support and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL BLOCK --} |
]])
end)
describe('tabline', function()
- local tab_attrs = {
- tab = { background=Screen.colors.LightGrey, underline=true },
- sel = { bold=true },
- fill = { reverse=true }
- }
+ before_each(function()
+ screen:set_default_attr_ids( {
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ tab = { background=Screen.colors.LightGrey, underline=true },
+ sel = { bold=true },
+ fill = { reverse=true }
+ })
+ end)
it('left click in default tabline (position 4) switches to tab', function()
execute('%delete')
@@ -122,18 +127,18 @@ describe('Mouse input', function()
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
feed('<LeftMouse><4,0>')
screen:expect([[
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
this is fo^o |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
end)
it('left click in default tabline (position 24) closes tab', function()
@@ -145,18 +150,18 @@ describe('Mouse input', function()
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
feed('<LeftMouse><24,0>')
screen:expect([[
this is fo^o |
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
end)
it('double click in default tabline (position 4) opens new tab', function()
@@ -168,18 +173,18 @@ describe('Mouse input', function()
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
feed('<2-LeftMouse><4,0>')
screen:expect([[
{sel: Name] }{tab: + foo + bar }{fill: }{tab:X}|
^ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
end)
describe('%@ label', function()
@@ -201,9 +206,9 @@ describe('Mouse input', function()
{fill:test-test2 }|
mouse |
support and selectio^n |
- ~ |
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
meths.set_var('reply', {})
end)
@@ -259,7 +264,7 @@ describe('Mouse input', function()
testing |
mo^use |
support and selection |
- ~ |
+ {0:~ }|
|
]])
feed('<LeftDrag><4,1>')
@@ -267,7 +272,7 @@ describe('Mouse input', function()
testing |
mo{1:us}^e |
support and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
feed('<LeftDrag><2,2>')
@@ -275,7 +280,7 @@ describe('Mouse input', function()
testing |
mo{1:use}{3: } |
{1:su}^pport and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
feed('<LeftDrag><0,0>')
@@ -283,18 +288,19 @@ describe('Mouse input', function()
^t{1:esting}{3: } |
{1:mou}se |
support and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
end)
it('left drag changes visual selection after tab click', function()
- local tab_attrs = {
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
tab = { background=Screen.colors.LightGrey, underline=true },
sel = { bold=true },
fill = { reverse=true },
vis = { background=Screen.colors.LightGrey }
- }
+ })
execute('silent file foo | tabnew | file bar')
insert('this is bar')
execute('tabprevious') -- go to first tab
@@ -302,27 +308,27 @@ describe('Mouse input', function()
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
mouse |
support and selectio^n |
- ~ |
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab
helpers.wait()
feed('<LeftMouse><0,1>')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
^this is bar |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
|
- ]], tab_attrs)
+ ]])
feed('<LeftDrag><4,1>')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
{vis:this}^ is bar |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
{sel:-- VISUAL --} |
- ]], tab_attrs)
+ ]])
end)
it('two clicks will select the word and enter VISUAL', function()
@@ -331,7 +337,7 @@ describe('Mouse input', function()
testing |
mouse |
{1:suppor}^t and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
end)
@@ -342,7 +348,7 @@ describe('Mouse input', function()
testing |
mouse |
{1:su}^p{1:port and selection}{3: } |
- ~ |
+ {0:~ }|
{2:-- VISUAL LINE --} |
]])
end)
@@ -353,7 +359,7 @@ describe('Mouse input', function()
testing |
mouse |
su^pport and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL BLOCK --} |
]])
end)
@@ -364,7 +370,7 @@ describe('Mouse input', function()
^testing |
mouse |
support and selection |
- ~ |
+ {0:~ }|
|
]])
feed('<RightMouse><2,2>')
@@ -372,7 +378,7 @@ describe('Mouse input', function()
{1:testing}{3: } |
{1:mouse}{3: } |
{1:su}^pport and selection |
- ~ |
+ {0:~ }|
{2:-- VISUAL --} |
]])
end)
@@ -404,73 +410,71 @@ describe('Mouse input', function()
]])
screen:try_resize(53, 14)
execute('sp', 'vsp')
- screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue},
- {reverse=true}, {bold=true, reverse=true}} )
screen:expect([[
- lines |lines |
- to |to |
- test |test |
- mouse scrolling |mouse scrolling |
- ^ | |
- ~ |~ |
- [No Name] [+] [No Name] [+] |
+ lines {4:|}lines |
+ to {4:|}to |
+ test {4:|}test |
+ mouse scrolling {4:|}mouse scrolling |
+ ^ {4:|} |
+ {0:~ }{4:|}{0:~ }|
+ {5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- ~ |
- [No Name] [+] |
+ {0:~ }|
+ {4:[No Name] [+] }|
:vsp |
]])
feed('<MouseUp><0,0>')
screen:expect([[
- mouse scrolling |lines |
- ^ |to |
- ~ |test |
- ~ |mouse scrolling |
- ~ | |
- ~ |~ |
- [No Name] [+] [No Name] [+] |
+ mouse scrolling {4:|}lines |
+ ^ {4:|}to |
+ {0:~ }{4:|}test |
+ {0:~ }{4:|}mouse scrolling |
+ {0:~ }{4:|} |
+ {0:~ }{4:|}{0:~ }|
+ {5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- ~ |
- [No Name] [+] |
+ {0:~ }|
+ {4:[No Name] [+] }|
|
]])
feed('<MouseDown><27,0>')
screen:expect([[
- mouse scrolling |text |
- ^ |with |
- ~ |many |
- ~ |lines |
- ~ |to |
- ~ |test |
- [No Name] [+] [No Name] [+] |
+ mouse scrolling {4:|}text |
+ ^ {4:|}with |
+ {0:~ }{4:|}many |
+ {0:~ }{4:|}lines |
+ {0:~ }{4:|}to |
+ {0:~ }{4:|}test |
+ {5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- ~ |
- [No Name] [+] |
+ {0:~ }|
+ {4:[No Name] [+] }|
|
]])
feed('<MouseDown><27,7><MouseDown>')
screen:expect([[
- mouse scrolling |text |
- ^ |with |
- ~ |many |
- ~ |lines |
- ~ |to |
- ~ |test |
- [No Name] [+] [No Name] [+] |
+ mouse scrolling {4:|}text |
+ ^ {4:|}with |
+ {0:~ }{4:|}many |
+ {0:~ }{4:|}lines |
+ {0:~ }{4:|}to |
+ {0:~ }{4:|}test |
+ {5:[No Name] [+] }{4:[No Name] [+] }|
Inserting |
text |
with |
many |
lines |
- [No Name] [+] |
+ {4:[No Name] [+] }|
|
]])
end)
@@ -483,7 +487,7 @@ describe('Mouse input', function()
|
|
bbbbbbbbbbbbbbb^b |
- ~ |
+ {0:~ }|
|
]])
@@ -492,7 +496,7 @@ describe('Mouse input', function()
|
|
n bbbbbbbbbbbbbbbbbbb^b |
- ~ |
+ {0:~ }|
|
]])
@@ -501,7 +505,7 @@ describe('Mouse input', function()
g |
|
^t and selection bbbbbbbbb|
- ~ |
+ {0:~ }|
|
]])
end)
@@ -509,12 +513,13 @@ describe('Mouse input', function()
describe('on concealed text', function()
-- Helpful for reading the test expectations:
-- :match Error /\^/
- local concealed = {
- c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }
- }
before_each(function()
screen:try_resize(25, 7)
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
+ })
feed('ggdG')
execute('set concealcursor=n')
@@ -540,44 +545,44 @@ describe('Mouse input', function()
{c:^Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><1,0>')
screen:expect([[
{c:Y}^rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,0>')
screen:expect([[
{c:Y}rem ip{c:X}um do{c: } {c:^X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
{c:Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}^ber{c:X}en, no|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
end) -- level 1 - non wrapped
it('(level 1) click on wrapped lines', function()
@@ -592,7 +597,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><6,1>')
screen:expect([[
@@ -603,7 +608,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
@@ -614,7 +619,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,3>')
screen:expect([[
@@ -625,7 +630,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
end) -- level 1 - wrapped
@@ -637,44 +642,44 @@ describe('Mouse input', function()
{c:^Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><1,0>')
screen:expect([[
{c:Y}^rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,0>')
screen:expect([[
{c:Y}rem ip{c:X}um do {c:X}^it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
{c:Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}b^er{c:X}en, no |
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
end) -- level 2 - non wrapped
it('(level 2) click on wrapped lines', function()
@@ -689,7 +694,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><6,1>')
screen:expect([[
@@ -700,7 +705,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
@@ -711,7 +716,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,3>')
screen:expect([[
@@ -722,7 +727,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. |
|
- ]], concealed)
+ ]])
end) -- level 2 - wrapped
@@ -734,44 +739,44 @@ describe('Mouse input', function()
^rem ipum do it , conetetu|
tet ta kad beren, no ea t|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><1,0>')
screen:expect([[
r^em ipum do it , conetetu|
tet ta kad beren, no ea t|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,0>')
screen:expect([[
rem ipum do it ^, conetetu|
tet ta kad beren, no ea t|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
rem ipum do it , conetetu|
tet ta kad bere^n, no ea t|
|
- ~ |
- ~ |
- ~ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], concealed)
+ ]])
end) -- level 3 - non wrapped
it('(level 3) click on wrapped lines', function()
@@ -786,7 +791,7 @@ describe('Mouse input', function()
, no ea takimata anctu |
et. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><6,1>')
screen:expect([[
@@ -797,7 +802,7 @@ describe('Mouse input', function()
, no ea takimata anctu |
et. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,1>')
screen:expect([[
@@ -808,7 +813,7 @@ describe('Mouse input', function()
, no ea takimata anctu |
et. |
|
- ]], concealed)
+ ]])
feed('<esc><LeftMouse><15,3>')
screen:expect([[
@@ -819,7 +824,7 @@ describe('Mouse input', function()
, no ea takimata anctu |
et. |
|
- ]], concealed)
+ ]])
end) -- level 3 - wrapped
end)
end)