Bram Moolenaar | b569079 | 2016-01-14 22:10:41 +0100 | [diff] [blame] | 1 | " Test :hardcopy |
| 2 | |
| 3 | func Test_printoptions_parsing() |
| 4 | " Only test that this doesn't throw an error. |
| 5 | set printoptions=left:5in,right:10pt,top:8mm,bottom:2pc |
| 6 | set printoptions=left:2in,top:30pt,right:16mm,bottom:3pc |
| 7 | set printoptions=header:3,syntax:y,number:7,wrap:n |
| 8 | set printoptions=duplex:short,collate:n,jobsplit:y,portrait:n |
| 9 | set printoptions=paper:10x14 |
| 10 | set printoptions=paper:A3 |
| 11 | set printoptions=paper:A4 |
| 12 | set printoptions=paper:A5 |
| 13 | set printoptions=paper:B4 |
| 14 | set printoptions=paper:B5 |
| 15 | set printoptions=paper:executive |
| 16 | set printoptions=paper:folio |
| 17 | set printoptions=paper:ledger |
| 18 | set printoptions=paper:legal |
| 19 | set printoptions=paper:letter |
| 20 | set printoptions=paper:quarto |
| 21 | set printoptions=paper:statement |
| 22 | set printoptions=paper:tabloid |
| 23 | set printoptions=formfeed:y |
| 24 | set printoptions= |
| 25 | set printoptions& |
Bram Moolenaar | 4afc7c5 | 2016-04-03 14:56:52 +0200 | [diff] [blame] | 26 | |
| 27 | call assert_fails('set printoptions=paper', 'E550:') |
| 28 | call assert_fails('set printoptions=shredder:on', 'E551:') |
| 29 | call assert_fails('set printoptions=left:no', 'E552:') |
Bram Moolenaar | b569079 | 2016-01-14 22:10:41 +0100 | [diff] [blame] | 30 | endfunc |
| 31 | |
| 32 | func Test_printmbfont_parsing() |
| 33 | " Only test that this doesn't throw an error. |
| 34 | set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no |
| 35 | set printmbfont= |
| 36 | set printmbfont& |
| 37 | endfunc |
| 38 | |
| 39 | func Test_printheader_parsing() |
| 40 | " Only test that this doesn't throw an error. |
| 41 | set printheader=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P |
| 42 | set printheader=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P |
| 43 | set printheader=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' |
| 44 | set printheader=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... |
| 45 | set printheader= |
| 46 | set printheader& |
| 47 | endfunc |
| 48 | |
| 49 | " Test that :hardcopy produces a non-empty file. |
| 50 | " We don't check much of the contents. |
| 51 | func Test_with_syntax() |
Bram Moolenaar | ccb8098 | 2016-01-15 15:56:35 +0100 | [diff] [blame] | 52 | if has('postscript') |
Bram Moolenaar | cf1ba35 | 2017-10-27 00:55:04 +0200 | [diff] [blame] | 53 | edit test_hardcopy.vim |
Bram Moolenaar | ccb8098 | 2016-01-15 15:56:35 +0100 | [diff] [blame] | 54 | set printoptions=syntax:y |
| 55 | syn on |
| 56 | hardcopy > Xhardcopy |
| 57 | let lines = readfile('Xhardcopy') |
| 58 | call assert_true(len(lines) > 20) |
| 59 | call assert_true(lines[0] =~ 'PS-Adobe') |
| 60 | call delete('Xhardcopy') |
| 61 | set printoptions& |
| 62 | endif |
Bram Moolenaar | b569079 | 2016-01-14 22:10:41 +0100 | [diff] [blame] | 63 | endfunc |
Bram Moolenaar | bf15b8d | 2017-06-04 20:43:48 +0200 | [diff] [blame] | 64 | |
| 65 | func Test_fname_with_spaces() |
Bram Moolenaar | 763209c | 2017-06-04 21:40:36 +0200 | [diff] [blame] | 66 | if has('postscript') |
| 67 | split t\ e\ s\ t.txt |
| 68 | call setline(1, ['just', 'some', 'text']) |
| 69 | hardcopy > %.ps |
| 70 | call assert_true(filereadable('t e s t.txt.ps')) |
| 71 | call delete('t e s t.txt.ps') |
| 72 | bwipe! |
| 73 | endif |
Bram Moolenaar | bf15b8d | 2017-06-04 20:43:48 +0200 | [diff] [blame] | 74 | endfunc |