Mercurial > vim
annotate src/testdir/test_hardcopy.vim @ 18435:bdaf40503e2a
Added tag v8.1.2211 for changeset 5da355d15b88360e33bac2e45e38f44f6adcd60e
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Oct 2019 20:15:03 +0200 |
parents | 873542706b0b |
children | 1eb83d461033 |
rev | line source |
---|---|
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test :hardcopy |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_printoptions_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Only test that this doesn't throw an error. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 set printoptions=left:5in,right:10pt,top:8mm,bottom:2pc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 set printoptions=left:2in,top:30pt,right:16mm,bottom:3pc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 set printoptions=header:3,syntax:y,number:7,wrap:n |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 set printoptions=duplex:short,collate:n,jobsplit:y,portrait:n |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 set printoptions=paper:10x14 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 set printoptions=paper:A3 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 set printoptions=paper:A4 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 set printoptions=paper:A5 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 set printoptions=paper:B4 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 set printoptions=paper:B5 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 set printoptions=paper:executive |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 set printoptions=paper:folio |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 set printoptions=paper:ledger |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 set printoptions=paper:legal |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 set printoptions=paper:letter |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 set printoptions=paper:quarto |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 set printoptions=paper:statement |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 set printoptions=paper:tabloid |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set printoptions=formfeed:y |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 set printoptions= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 set printoptions& |
8829
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
26 |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
27 call assert_fails('set printoptions=paper', 'E550:') |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
28 call assert_fails('set printoptions=shredder:on', 'E551:') |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
29 call assert_fails('set printoptions=left:no', 'E552:') |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 func Test_printmbfont_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " Only test that this doesn't throw an error. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 set printmbfont= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 set printmbfont& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 func Test_printheader_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 " Only test that this doesn't throw an error. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 set printheader=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 set printheader=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 set printheader=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 set printheader=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 set printheader= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 set printheader& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 " Test that :hardcopy produces a non-empty file. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 " We don't check much of the contents. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 func Test_with_syntax() |
7588
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
52 if has('postscript') |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
11467
diff
changeset
|
53 edit test_hardcopy.vim |
7588
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
54 set printoptions=syntax:y |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
55 syn on |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
56 hardcopy > Xhardcopy |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
57 let lines = readfile('Xhardcopy') |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
58 call assert_true(len(lines) > 20) |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
59 call assert_true(lines[0] =~ 'PS-Adobe') |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
60 call delete('Xhardcopy') |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
61 set printoptions& |
0738fa9c4971
commit https://github.com/vim/vim/commit/ccb80989f2779c8441f7f15d160fb2141bd1676d
Christian Brabandt <cb@256bit.org>
parents:
7580
diff
changeset
|
62 endif |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 endfunc |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
64 |
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
65 func Test_fname_with_spaces() |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
66 if !has('postscript') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
67 return |
11467
9ca1c9997863
patch 8.0.0617: hardcopy test hangs on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11463
diff
changeset
|
68 endif |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
69 split t\ e\ s\ t.txt |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
70 call setline(1, ['just', 'some', 'text']) |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
71 hardcopy > %.ps |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
72 call assert_true(filereadable('t e s t.txt.ps')) |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
73 call delete('t e s t.txt.ps') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
74 bwipe! |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
75 endfunc |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
76 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
77 func Test_illegal_byte() |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
78 if !has('postscript') || &enc != 'utf-8' |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
79 return |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
80 endif |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
81 new |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
82 " conversion of 0xff will fail, this used to cause a crash |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
83 call setline(1, "\xff") |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
84 hardcopy >Xpstest |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
85 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
86 bwipe! |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
87 call delete('Xpstest') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
88 endfunc |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
89 |