Bram Moolenaar | c31f9ae | 2017-07-23 22:02:02 +0200 | [diff] [blame] | 1 | " Tests for the preview window |
Bram Moolenaar | 5a4c308 | 2019-12-01 15:23:11 +0100 | [diff] [blame] | 2 | source check.vim |
| 3 | CheckFeature quickfix |
Bram Moolenaar | c31f9ae | 2017-07-23 22:02:02 +0200 | [diff] [blame] | 4 | |
| 5 | func Test_Psearch() |
| 6 | " this used to cause ml_get errors |
| 7 | help |
| 8 | let wincount = winnr('$') |
| 9 | 0f |
| 10 | ps. |
| 11 | call assert_equal(wincount + 1, winnr('$')) |
| 12 | pclose |
| 13 | call assert_equal(wincount, winnr('$')) |
| 14 | bwipe |
| 15 | endfunc |
Bram Moolenaar | ee4e0c1 | 2020-04-06 21:35:05 +0200 | [diff] [blame] | 16 | |
| 17 | func Test_window_preview() |
| 18 | CheckFeature quickfix |
| 19 | |
| 20 | " Open a preview window |
| 21 | pedit Xa |
| 22 | call assert_equal(2, winnr('$')) |
| 23 | call assert_equal(0, &previewwindow) |
| 24 | |
| 25 | " Go to the preview window |
| 26 | wincmd P |
| 27 | call assert_equal(1, &previewwindow) |
| 28 | |
| 29 | " Close preview window |
| 30 | wincmd z |
| 31 | call assert_equal(1, winnr('$')) |
| 32 | call assert_equal(0, &previewwindow) |
| 33 | |
| 34 | call assert_fails('wincmd P', 'E441:') |
| 35 | endfunc |
| 36 | |
| 37 | func Test_window_preview_from_help() |
| 38 | CheckFeature quickfix |
| 39 | |
| 40 | filetype on |
| 41 | call writefile(['/* some C code */'], 'Xpreview.c') |
| 42 | help |
| 43 | pedit Xpreview.c |
| 44 | wincmd P |
| 45 | call assert_equal(1, &previewwindow) |
| 46 | call assert_equal('c', &filetype) |
| 47 | wincmd z |
| 48 | |
| 49 | filetype off |
| 50 | close |
| 51 | call delete('Xpreview.c') |
| 52 | endfunc |
| 53 | |
| 54 | func Test_multiple_preview_windows() |
| 55 | new |
| 56 | set previewwindow |
| 57 | new |
| 58 | call assert_fails('set previewwindow', 'E590:') |
| 59 | %bw! |
| 60 | endfunc |
| 61 | |
| 62 | " vim: shiftwidth=2 sts=2 expandtab |