annotate src/testdir/test_hardcopy.vim @ 7580:e9c8eacb6760 v7.4.1090

commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 14 22:10:41 2016 +0100 patch 7.4.1090 Problem: No tests for :hardcopy and related options. Solution: Add test_hardcopy.
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Jan 2016 22:15:05 +0100
parents
children 0738fa9c4971
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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&
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 func Test_printmbfont_parsing()
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " 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
30 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
31 set printmbfont=
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 set printmbfont&
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 func Test_printheader_parsing()
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " 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
37 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
38 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
39 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
40 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
41 set printheader=
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 set printheader&
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " 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
46 " 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
47 func Test_with_syntax()
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 set printoptions=syntax:y
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 syn on
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 hardcopy > Xhardcopy
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let lines = readfile('Xhardcopy')
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_true(len(lines) > 20)
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_true(lines[0] =~ 'PS-Adobe')
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call delete('Xhardcopy')
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 set printoptions&
e9c8eacb6760 commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 endfunc