diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-02 15:25:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 15:25:41 +0800 |
commit | 7c1921e9d69e008781c9fb16c11e843f7bd9099a (patch) | |
tree | 2812af15ca89b1abd68009d00dc48b6af0849aaf /test/functional/ui/multigrid_spec.lua | |
parent | 86c9d8b53cd9c2713eb2f7fa07732ca9a65a4afb (diff) | |
download | rneovim-7c1921e9d69e008781c9fb16c11e843f7bd9099a.tar.gz rneovim-7c1921e9d69e008781c9fb16c11e843f7bd9099a.tar.bz2 rneovim-7c1921e9d69e008781c9fb16c11e843f7bd9099a.zip |
fix(mouse): fix popup_setpos position check with ext_multigrid (#23436)
Diffstat (limited to 'test/functional/ui/multigrid_spec.lua')
-rw-r--r-- | test/functional/ui/multigrid_spec.lua | 396 |
1 files changed, 395 insertions, 1 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index 6b6d6ad1d2..558b9e3e16 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -2235,7 +2235,7 @@ describe('ext_multigrid', function() {1:~ }| ]]} - meths.input_mouse('left', 'press', '', 1,8, 26) + meths.input_mouse('left', 'press', '', 1, 8, 26) poke_eventloop() meths.input_mouse('left', 'drag', '', 1, 6, 30) screen:expect{grid=[[ @@ -2276,6 +2276,400 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| ]]} + + command('aunmenu PopUp | vmenu PopUp.Copy y') + + funcs.setreg('"', '') + meths.input_mouse('left', 'press', '2', 2, 1, 6) + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {12:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] }{11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be {20:clicke}^d | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo | + {1:~ }| + ## grid 5 + some text | + to be {20:clicked} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + meths.input_mouse('right', 'press', '', 2, 1, 6) + meths.input_mouse('right', 'release', '', 2, 1, 6) + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {12:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] }{11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be {20:clicke}^d | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo | + {1:~ }| + ## grid 5 + some text | + to be {20:clicked} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 6 + {21: Copy }| + ]], float_pos={ + [6] = {{id = -1}, "NW", 2, 2, 5, false, 250}; + }} + feed('<Down><CR>') + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {12:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] }{11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be ^clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo | + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + eq('clicked', funcs.getreg('"')) + + funcs.setreg('"', '') + meths.input_mouse('left', 'press', '2', 4, 0, 64) + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do {20:eiusm}^o | + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + meths.input_mouse('right', 'press', '', 4, 0, 64) + meths.input_mouse('right', 'release', '', 4, 0, 64) + -- FIXME: popup menu position is strange + -- screen:expect{} + feed('<Down><CR>') + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo | + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + eq('eiusmo', funcs.getreg('"')) + + command('wincmd J') + screen:try_resize_grid(4, 7, 10) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + ^eiusmo| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + + funcs.setreg('"', '') + meths.input_mouse('left', 'press', '2', 4, 9, 1) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + {20:eiusm}^o| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + meths.input_mouse('right', 'press', '', 4, 9, 1) + meths.input_mouse('right', 'release', '', 4, 9, 1) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + {20:eiusm}^o| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 6 + {21: Copy }| + ]], float_pos={ + [6] = {{id = -1}, "SW", 4, 9, 0, false, 250}; + }} + feed('<Down><CR>') + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + ^eiusmo| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + eq('eiusmo', funcs.getreg('"')) end) it('supports mouse drag with mouse=a', function() |