Bram Moolenaar | 8e95636 | 2019-08-25 23:08:17 +0200 | [diff] [blame^] | 1 | " Tests for popup windows for text properties |
| 2 | |
| 3 | source check.vim |
| 4 | CheckFeature textprop |
| 5 | |
| 6 | source screendump.vim |
| 7 | CheckScreendump |
| 8 | |
| 9 | func Test_textprop_popup() |
| 10 | let lines =<< trim END |
| 11 | call setline(1, range(1, 100)) |
| 12 | call setline(50, 'some text to work with') |
| 13 | 50 |
| 14 | normal zz |
| 15 | set scrolloff=0 |
| 16 | call prop_type_add('popupMarker', #{highlight: 'DiffAdd'}) |
| 17 | call prop_add(50, 11, #{ |
| 18 | \ length: 7, |
| 19 | \ type: 'popupMarker', |
| 20 | \ }) |
| 21 | let winid = popup_create('the text', #{ |
| 22 | \ pos: 'botleft', |
| 23 | \ textprop: 'popupMarker', |
| 24 | \ border: [], |
| 25 | \ padding: [0,1,0,1], |
| 26 | \ close: 'click', |
| 27 | \ }) |
| 28 | END |
| 29 | call writefile(lines, 'XtestTextpropPopup') |
| 30 | let buf = RunVimInTerminal('-S XtestTextpropPopup', #{rows: 10}) |
| 31 | call VerifyScreenDump(buf, 'Test_popup_textprop_01', {}) |
| 32 | |
| 33 | call term_sendkeys(buf, "zt") |
| 34 | call VerifyScreenDump(buf, 'Test_popup_textprop_02', {}) |
| 35 | |
| 36 | call term_sendkeys(buf, "zzIawe\<Esc>") |
| 37 | call VerifyScreenDump(buf, 'Test_popup_textprop_03', {}) |
| 38 | |
| 39 | call term_sendkeys(buf, "0dw") |
| 40 | call VerifyScreenDump(buf, 'Test_popup_textprop_04', {}) |
| 41 | |
| 42 | call term_sendkeys(buf, "Oinserted\<Esc>") |
| 43 | call VerifyScreenDump(buf, 'Test_popup_textprop_05', {}) |
| 44 | |
| 45 | call term_sendkeys(buf, "k2dd") |
| 46 | call VerifyScreenDump(buf, 'Test_popup_textprop_06', {}) |
| 47 | |
| 48 | " clean up |
| 49 | call StopVimInTerminal(buf) |
| 50 | call delete('XtestTextpropPopup') |
| 51 | endfunc |
| 52 | |
| 53 | |
| 54 | " vim: shiftwidth=2 sts=2 |