5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test creation of a fully-featured TeX document (with bibliography
29 and index) in a variant_dir.
31 Also test that the target can be named differently than what
32 Latex produces by default.
34 Test courtesy Rob Managan.
39 test = TestSCons.TestSCons()
41 latex = test.where_is('latex')
42 dvipdf = test.where_is('dvipdf')
43 makeindex = test.where_is('makeindex')
44 bibtex = test.where_is('bibtex')
45 if not latex or not makeindex or not bibtex or not dvipdf:
46 test.skip_test("Could not find 'latex', 'makeindex', 'bibtex', or dvipdf; skipping test.\n")
51 test.write(['SConstruct'], """\
54 env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
55 TOOLS = ['tex', 'latex', 'dvipdf'])
58 SConscript(os.path.join('docs', 'SConscript'),
59 variant_dir=os.path.join('mybuild','docs'),
64 test.write(['docs', 'SConscript'], """\
67 test_dvi = env.DVI(source='test.tex')
68 test2_dvi = env.DVI(target='result',source='test2.tex')
69 testpdf = env.PDF(target='pdfoutput',source=test_dvi)
70 test2pdf = env.PDF(target='pdfoutput.xyz',source=test2_dvi)
74 test.write(['docs', 'Fig1.ps'], """\
75 %!PS-Adobe-2.0 EPSF-2.0
77 %%Creator: fig2dev Version 3.2 Patchlevel 4
78 %%CreationDate: Tue Apr 25 09:56:11 2006
79 %%BoundingBox: 0 0 98 98
80 %%Magnification: 1.0000
82 /$F2psDict 200 dict def
84 $F2psDict /mtrx matrix put
85 /col-1 {0 setgray} bind def
86 /col0 {0.000 0.000 0.000 srgb} bind def
90 newpath 0 98 moveto 0 0 lineto 98 0 lineto 98 98 lineto closepath clip newpath
94 /cp {closepath} bind def
96 /gr {grestore} bind def
98 /rs {restore} bind def
101 /rm {rmoveto} bind def
102 /n {newpath} bind def
104 /slc {setlinecap} bind def
105 /slj {setlinejoin} bind def
106 /slw {setlinewidth} bind def
107 /srgb {setrgbcolor} bind def
109 /sf {setfont} bind def
110 /scf {scalefont} bind def
111 /tr {translate} bind def
119 /savematrix mtrx currentmatrix def
120 x y tr xrad yrad sc 0 0 1 startangle endangle arc
125 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
126 /$F2psEnd {$F2psEnteredState restore end} def
136 n 1170 945 766 766 0 360 DrawEllipse gs col0 s gr
143 test.write(['docs', 'Fig1.tex'],
144 r"""\begin{picture}(0,0)%
145 \includegraphics{Fig1.ps}%
147 \setlength{\unitlength}{4144sp}%
149 \begingroup\makeatletter\ifx\SetFigFont\undefined%
150 \gdef\SetFigFont#1#2#3#4#5{%
151 \reset@font\fontsize{#1}{#2pt}%
152 \fontfamily{#3}\fontseries{#4}\fontshape{#5}%
155 \begin{picture}(1548,1546)(397,-879)
156 \put(856,-196){\makebox(0,0)[lb]{\smash{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}{\color[rgb]{0,0,0}center $r_0$}%
162 test.write(['docs', 'test.bib'], """\
163 %% This BibTeX bibliography file was created using BibDesk.
164 %% http://bibdesk.sourceforge.net/
166 %% Saved with string encoding Western (ASCII)
168 @techreport{AnAuthor:2006fk,
169 Author = {A. N. Author},
170 Date-Added = {2006-11-15 12:51:30 -0800},
171 Date-Modified = {2006-11-15 12:52:35 -0800},
172 Institution = {none},
174 Title = {A Test Paper},
179 test.write(['docs', 'test.tex'],
180 r"""\documentclass{report}
182 \usepackage{graphicx}
183 \usepackage{epsfig,color} % for .tex version of figures if we go that way
192 \author{A. N. Author}
203 \chapter{Introduction}
205 The introduction is short.
207 \index{Acknowledgements}
209 \section{Acknowledgements}
211 The Acknowledgements are show as well \cite{AnAuthor:2006fk}.
213 \index{Getting the Report}
215 To get a hard copy of this report call me.
219 \input{Fig1.tex} % testing figure variant that uses TeX labeling
220 \caption{Zone and Node indexing}
227 \bibliographystyle{unsrt}
236 test.write(['docs', 'test2.tex'],
237 r"""\documentclass{report}
239 \usepackage{graphicx}
240 \usepackage{epsfig,color} % for .tex version of figures if we go that way
249 \author{A. N. Author}
260 \chapter{Introduction}
262 The introduction is short.
264 \index{Acknowledgements}
266 \section{Acknowledgements}
268 The Acknowledgements are show as well \cite{AnAuthor:2006fk}.
270 \index{Getting the Report}
272 To get a hard copy of this report call me.
276 \input{Fig1.tex} % testing figure variant that uses TeX labeling
277 \caption{Zone and Node indexing}
284 \bibliographystyle{unsrt}
294 # makeindex will write status messages to stderr (grrr...), so ignore it.
295 test.run(arguments = '.', stderr=None)
298 # All (?) the files we expect will get created in the variant_dir
299 # (mybuild/docs) and not in the srcdir (docs).
326 test.must_exist(['mybuild', 'docs', f])
327 test.must_not_exist(['docs', f])
334 # indent-tabs-mode:nil
336 # vim: set expandtab tabstop=4 shiftwidth=4: