diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-10-10 16:36:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 16:36:55 +0200 |
commit | fd39f5ce8c9bbda1b77ff6c03553148fadac5d57 (patch) | |
tree | c0c05713b01fa9d99ccbafbe87149366e1db69ce /test | |
parent | 468a3a14072a638865681dad88d3c3b31cf11e23 (diff) | |
parent | 372aa2eb3db375385cf19dc0a6571f790b858241 (diff) | |
download | rneovim-fd39f5ce8c9bbda1b77ff6c03553148fadac5d57.tar.gz rneovim-fd39f5ce8c9bbda1b77ff6c03553148fadac5d57.tar.bz2 rneovim-fd39f5ce8c9bbda1b77ff6c03553148fadac5d57.zip |
Merge pull request #25561 from glepnir/9663
feat(float): add fclose command
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/float_spec.lua | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 18c8a7370f..ab02094beb 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -10927,6 +10927,186 @@ describe('float window', function() ]]) end end) + + it('fclose command #9663', function() + local bufA = meths.create_buf(false,false) + local bufB = meths.create_buf(false,false) + local bufC = meths.create_buf(false,false) + local bufD = meths.create_buf(false,false) + local config_A = {relative='editor', width=11, height=11, row=5, col=5, border ='single', zindex=50} + local config_B = {relative='editor', width=8, height=8, row=7, col=7, border ='single', zindex=70} + local config_C = {relative='editor', width=4, height=4, row=9, col=9, border ='single',zindex=90} + local config_D = {relative='editor', width=2, height=2, row=10, col=10, border ='single',zindex=100} + meths.open_win(bufA, false, config_A) + meths.open_win(bufB, false, config_B) + meths.open_win(bufC, false, config_C) + meths.open_win(bufD, false, config_D) + --close window which have higher zindex value + command('fclose') + local expected_pos = { + [4]={{id=1001}, 'NW', 1, 5, 5, true, 50}, + [5]={{id=1002}, 'NW', 1, 7, 7, true, 70}, + [6]={{id=1003}, 'NW', 1, 9, 9, true, 90}, + } + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + + ## grid 4 + {5:┌───────────┐}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└───────────┘}| + ## grid 5 + {5:┌────────┐}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└────────┘}| + ## grid 6 + {5:┌────┐}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└────┘}| + ]],float_pos= expected_pos} + else + screen:expect([[ + ^ {5:┌─┌─┌────┐─┐┐} | + {0:~ }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~}{5:└────┘}{2: }{5:││}{0: }| + | + ]]) + end + -- with range + command('1fclose') + expected_pos[6]=nil + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + + ## grid 4 + {5:┌───────────┐}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└───────────┘}| + ## grid 5 + {5:┌────────┐}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└────────┘}| + ]],float_pos= expected_pos} + else + screen:expect([[ + ^ {5:┌─┌────────┐┐} | + {0:~ }{5:│}{1: }{5:│}{1: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| + | + ]]) + end + --with bang + command('fclose!') + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + + ]],float_pos= {}} + else + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end + end) end describe('with ext_multigrid', function() |