Mercurial > vim
annotate src/testdir/test_hardcopy.vim @ 23452:8fa9d31cd248 v8.2.2269
patch 8.2.2269: not all :hardcopy code covered by tests
Commit: https://github.com/vim/vim/commit/edc10b541b468f5f5aa2e2d5ef58a3e17e043bff
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 1 21:34:37 2021 +0100
patch 8.2.2269: not all :hardcopy code covered by tests
Problem: Not all :hardcopy code covered by tests.
Solution: Test more combinations. (Dominique Pell?, closes https://github.com/vim/vim/issues/7595)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 01 Jan 2021 21:45:04 +0100 |
parents | f43c0e669bd6 |
children | c2c40cefc17b |
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 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
3 source check.vim |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
4 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
5 func Test_printoptions() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
6 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
7 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
8 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
9 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
|
10 \ '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
|
11 \ '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
|
12 \ 'header:3,syntax:n,number:y,wrap:y', |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
13 \ 'header:0,syntax:a,number:y,wrap:y', |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
14 \ '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
|
15 \ 'duplex:long,collate:y,jobsplit:n,portrait:y', |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
16 \ 'duplex:off,collate:y,jobsplit:y,portrait:y', |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
17 \ 'paper:10x14', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
18 \ 'paper:A3', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
19 \ 'paper:A4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
20 \ 'paper:A5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
21 \ 'paper:B4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
22 \ 'paper:B5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
23 \ 'paper:executive', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
24 \ 'paper:folio', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
25 \ 'paper:ledger', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
26 \ 'paper:legal', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
27 \ 'paper:letter', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
28 \ 'paper:quarto', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
29 \ 'paper:statement', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
30 \ 'paper:tabloid', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
31 \ 'formfeed:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
32 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
33 exe 'set printoptions=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
34 if has('postscript') |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
35 1,50hardcopy > Xhardcopy_printoptions |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
36 let lines = readfile('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
37 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
|
38 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
|
39 call delete('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
40 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
41 endfor |
8829
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
42 |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 set printoptions& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
47 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
48 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
49 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
50 func Test_printmbfont() |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
51 " Print a help page which contains tabs, underlines (etc) to recover more code. |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
52 help syntax.txt |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
53 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
54 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
55 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
|
56 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
57 exe 'set printmbfont=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
58 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
59 hardcopy > Xhardcopy_printmbfont |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
60 let lines = readfile('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
61 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
|
62 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
|
63 call delete('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
64 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
65 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
66 set printmbfont& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
67 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
70 func Test_printmbcharset() |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
71 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
72 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
73 " digraph.txt has plenty of non-latin1 characters. |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
74 help digraph.txt |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
75 set printmbcharset=ISO10646 printencoding=utf-8 |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
76 for courier in ['yes', 'no'] |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
77 for ascii in ['yes', 'no'] |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
78 exe 'set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-BoldItalic' |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
79 \ .. ',c:' .. courier .. ',a:' .. ascii |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
80 hardcopy > Xhardcopy_printmbcharset |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
81 let lines = readfile('Xhardcopy_printmbcharset') |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
82 call assert_true(len(lines) > 20) |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
83 call assert_true(lines[0] =~ 'PS-Adobe') |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
84 endfor |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
85 endfor |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
86 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
87 set printmbcharset=does-not-exist printencoding=utf-8 printmbfont=r:WadaMin-Regular |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
88 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E456:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
89 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
90 set printmbcharset=GB_2312-80 printencoding=utf-8 printmbfont=r:WadaMin-Regular |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
91 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E673:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
92 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
93 set printmbcharset=ISO10646 printencoding=utf-8 printmbfont= |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
94 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E675:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
95 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
96 call delete('Xhardcopy_printmbcharset') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
97 set printmbcharset& printencoding& printmbfont& |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
98 bwipe |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
99 endfunc |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
100 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
101 func Test_printexpr() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
102 CheckFeature postscript |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
103 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
104 " 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
|
105 " hardcopy with 'printexpr'. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
106 function PrintFile(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
107 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
|
108 \ 'Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
109 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
110 return 0 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
111 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
112 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
|
113 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
114 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
115 hardcopy dummy args |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
116 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
|
117 \ readfile('Xhardcopy_printexpr')) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
118 call delete('Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
119 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
120 " Function returns 1 to test print failure. |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
121 function PrintFails(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
122 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
123 return 1 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
124 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
125 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
|
126 call assert_fails('hardcopy', 'E365:') |
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 set printexpr& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
129 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
130 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
131 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
132 func Test_errors() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
133 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
134 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
135 edit test_hardcopy.vim |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
136 call assert_fails('hardcopy >', 'E324:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
137 bwipe |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
138 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
139 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
140 func Test_dark_background() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
141 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
142 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
143 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
144 for bg in ['dark', 'light'] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
145 exe 'set background=' .. bg |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
146 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
147 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
148 hardcopy > Xhardcopy_dark_background |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 call delete('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
153 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
154 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
155 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
156 set background& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
157 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
158 endfun |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
159 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
160 func Test_empty_buffer() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
161 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
162 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
163 new |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
164 call assert_equal("\nNo text to be printed", execute('hardcopy')) |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
165 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 func Test_printheader_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 " 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 set printheader= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 set printheader& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
178 func Test_fname_with_spaces() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
179 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
180 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
181 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
|
182 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
|
183 hardcopy > %.ps |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
184 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
|
185 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
|
186 bwipe! |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
187 endfunc |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
188 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
189 func Test_illegal_byte() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
190 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
191 if &enc != 'utf-8' |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
192 return |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
193 endif |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
194 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
195 new |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
196 " 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
|
197 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
|
198 hardcopy >Xpstest |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
199 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
200 bwipe! |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
201 call delete('Xpstest') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
202 endfunc |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
203 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
204 " vim: shiftwidth=2 sts=2 expandtab |