Mercurial > vim
annotate src/testdir/test_hardcopy.vim @ 19619:1eb83d461033 v8.2.0366
patch 8.2.0366: hardcopy command not tested enough
Commit: https://github.com/vim/vim/commit/2e09634a7880f55a61cb6b959dd89c51972866af
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 9 12:13:27 2020 +0100
patch 8.2.0366: hardcopy command not tested enough
Problem: Hardcopy command not tested enough.
Solution: Add tests for printing. (Dominique Pelle, closes https://github.com/vim/vim/issues/5748)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 09 Mar 2020 12:15:03 +0100 |
parents | 873542706b0b |
children | f43c0e669bd6 |
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 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
3 func Test_printoptions() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
4 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
5 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
6 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
7 for opt in ['left:5in,right:10pt,top:8mm,bottom:2pc', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
8 \ 'left:2in,top:30pt,right:16mm,bottom:3pc', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
9 \ 'header:3,syntax:y,number:y,wrap:n', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
10 \ 'header:3,syntax:n,number:y,wrap:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
11 \ 'duplex:short,collate:n,jobsplit:y,portrait:n', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
12 \ 'duplex:long,collate:y,jobsplit:n,portrait:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
13 \ 'paper:10x14', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
14 \ 'paper:A3', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
15 \ 'paper:A4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
16 \ 'paper:A5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
17 \ 'paper:B4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
18 \ 'paper:B5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
19 \ 'paper:executive', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
20 \ 'paper:folio', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
21 \ 'paper:ledger', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
22 \ 'paper:legal', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
23 \ 'paper:letter', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
24 \ 'paper:quarto', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
25 \ 'paper:statement', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
26 \ 'paper:tabloid', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
27 \ 'formfeed:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
28 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
29 exe 'set printoptions=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
30 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
31 hardcopy > Xhardcopy_printoptions |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
32 let lines = readfile('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
33 call assert_true(len(lines) > 20, opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
34 call assert_true(lines[0] =~ 'PS-Adobe', opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
35 call delete('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
36 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
37 endfor |
8829
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
38 |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
39 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
|
40 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
|
41 call assert_fails('set printoptions=left:no', 'E552:') |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
42 set printoptions& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
43 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
44 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
45 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
46 func Test_printmbfont() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
47 " Print a small help page which contains tabs to cover code that expands tabs to spaces. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
48 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
49 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
50 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
51 for opt in [':WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
52 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
53 exe 'set printmbfont=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
54 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
55 hardcopy > Xhardcopy_printmbfont |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
56 let lines = readfile('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
57 call assert_true(len(lines) > 20, opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
58 call assert_true(lines[0] =~ 'PS-Adobe', opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
59 call delete('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
60 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
61 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
62 set printmbfont& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
63 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
66 func Test_printexpr() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
67 if !has('unix') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
68 return |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
69 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
70 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
71 " Not a very useful printexpr value, but enough to test |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
72 " hardcopy with 'printexpr'. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
73 function PrintFile(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
74 call writefile(['Test printexpr: ' .. v:cmdarg], |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
75 \ 'Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
76 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
77 return 0 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
78 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
79 set printexpr=PrintFile(v:fname_in) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
80 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
81 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
82 hardcopy dummy args |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
83 call assert_equal(['Test printexpr: dummy args'], |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
84 \ readfile('Xhardcopy_printexpr')) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
85 call delete('Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
86 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
87 " Function return 1 to test print failure. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
88 function PrintFails(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
89 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
90 return 1 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
91 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
92 set printexpr=PrintFails(v:fname_in) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
93 call assert_fails('hardcopy', 'E365:') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
94 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
95 set printexpr& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
96 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
97 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
98 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
99 func Test_errors() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
100 " FIXME: Windows fails differently than Unix. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
101 if has('unix') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
102 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
103 call assert_fails('hardcopy >', 'E324:') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
104 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
105 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
106 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
107 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
108 func Test_dark_background() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
109 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
110 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
111 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
112 for bg in ['dark', 'light'] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
113 exe 'set background=' .. bg |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
114 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
115 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
116 hardcopy > Xhardcopy_dark_background |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
117 let lines = readfile('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
118 call assert_true(len(lines) > 20) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
119 call assert_true(lines[0] =~ 'PS-Adobe') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
120 call delete('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
121 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
122 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
123 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
124 set background& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
125 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
126 endfun |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
127 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
128 func Test_empty_buffer() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
129 " FIXME: Unclear why this fails on Windows. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
130 if has('unix') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
131 new |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
132 call assert_equal("\nNo text to be printed", execute('hardcopy')) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
133 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
134 endif |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 func Test_printheader_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 " 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 set printheader= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 set printheader& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
147 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
|
148 if !has('postscript') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
149 return |
11467
9ca1c9997863
patch 8.0.0617: hardcopy test hangs on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11463
diff
changeset
|
150 endif |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
151 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
|
152 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
|
153 hardcopy > %.ps |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
154 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
|
155 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
|
156 bwipe! |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
157 endfunc |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
158 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
159 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
|
160 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
|
161 return |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
162 endif |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
163 new |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
164 " 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
|
165 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
|
166 hardcopy >Xpstest |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
167 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
168 bwipe! |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
169 call delete('Xpstest') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
170 endfunc |