robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , before_each , pending =t . describe , t . before_each , t . pending 6local clear , eq , api =n . clear , t . eq , n . api 7local command , fn =n . command , n . fn 8local feed =n . feed 9 10describe ( 'screenrow() and screencol() function' , function () 11local function with_ext_multigrid ( multigrid ) 12before_each ( function () 13clear () 14Screen . new ( 41 , 41 , { ext_multigrid =multigrid } ) 15end ) 16 17pending ( 'works in floating window' , function () 18local opts ={ 19relative ='editor' , 20height =8 , 21width =12 , 22row =6 , 23col =8 , 24anchor ='NW' , 25style ='minimal' , 26border ='none' , 27focusable =1 , 28} 29local float =api . nvim_open_win ( api . nvim_create_buf ( false , true ), false , opts ) 30 31api . nvim_set_current_win ( float ) 32command ( 'redraw' ) 33 34eq ( 7 , fn . screenrow ()) 35eq ( 9 , fn . screencol ()) 36end ) 37 38pending ( 'works in vertical split' , function () 39command ( 'vsplit' ) 40command ( 'wincmd l' ) -- move to right split 41feed ( 'iA<CR>BC<ESC>' ) -- insert two lines 42command ( 'redraw' ) 43 44eq ( 2 , fn . screenrow ()) 45eq ( 23 , fn . screencol ()) -- 20 (left) | 1 (border) | 2 (2nd col) 46end ) 47 48pending ( 'works in horizontal split' , function () 49command ( 'split' ) 50command ( 'wincmd j' ) -- move to bottom split 51feed ( 'iA<CR>BC<ESC>' ) -- insert two lines 52command ( 'redraw' ) 53 54eq ( 22 , fn . screenrow ()) -- 19 (top) | 1 (border) | 2 (2nd row) + 17 (rest) | 2 (cmd) 55eq ( 2 , fn . screencol ()) 56end ) 57end 58 59describe ( 'with ext_multigrid' , function () 60with_ext_multigrid ( true ) 61end ) 62 63describe ( 'without ext_multigrid' , function () 64with_ext_multigrid ( false ) 65end ) 66end )