1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
%%
%% This is file `hycolor-test3.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hycolor.dtx (with options: `test,test3')
%%
%% This is a generated file.
%%
%% Copyright (C) 2007, 2008 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Heiko Oberdiek.
%%
%% This work consists of the main source file hycolor.dtx
%% and the derived files
%% hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv,
%% xcolor-patch.sty, hycolor-test1.tex, hycolor-test2.tex,
%% hycolor-test3.tex, hycolor-test-xcol1.tex,
%% hycolor-test-xcol2.tex, hycolor-test-xcol3.tex.
%%
\ProvidesFile{hycolor-test3.tex}[2008/08/01 test file 3]
\documentclass{article}
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
\makeatletter
\newcommand*{\TestPackageName}{test-package}
\newcommand*{\TestOptionName}{test-option}
\newcommand\Message{}
\def\Message#1#{\immediate\write16}
\newcommand*{\ExpectError}[2]{%
\begingroup
\global\let\saved@errhelp\errhelp
\global\let\saved@errmessage\errmessage
\let\errhelp\@gobble
\def\errmessage##1{%
\xdef\@ExpectErrorMessage{##1}%
}%
\PackageError\TestPackageName{#1}\@ehc
\def\errhelp##1{%
\global\let\errhelp\saved@errhelp
}%
\global\let\@ResultErrorMessage\@empty
\def\errmessage##1{%
\xdef\@ResultErrorMessage{##1}%
\global\let\errmessage\saved@errmessage
% \Message{[ ##1}%
% \Message{] (ignored error)}%
% \Message{}%
}%
#2%
\endgroup
\Expect*{\@ResultErrorMessage}*{\@ExpectErrorMessage}%
}
\usepackage{scrlfile}
\usepackage{hycolor}[2008/08/01]
\def\atfi@SETRGBCOLORtest{set-rgb}
\def\atfi@SETGRAYCOLORtest{set-gray}
\def\atfi@SETCMYKCOLORtest{set-cmyk}
\def\Test#1#2#3#4#5{%
\begingroup
\setbox0=\hbox{%
\begingroup
\chardef\HyColor@PdfVersion=6 %
\HyColor@AttachfileColor{#1}\spec\inlinemacro\annot
\TestPackageName\TestOptionName
\edef\inline{\inlinemacro{test}}%
\expandafter\Expect\expandafter{\spec}{#2}%
\expandafter\Expect\expandafter{\inline}{#3}%
\expandafter\Expect\expandafter{\annot}{#4}%
\endgroup
\begingroup
\chardef\HyColor@PdfVersion=7 %
\HyColor@AttachfileColor{#1}\spec\inlinemacro\annot
\TestPackageName\TestOptionName
\edef\inline{\inlinemacro{test}}%
\expandafter\Expect\expandafter{\spec}{#2}%
\expandafter\Expect\expandafter{\inline}{#3}%
\expandafter\Expect\expandafter{\annot}{#5}%
\endgroup
}%
\Expect*{\the\wd0}{0.0pt}%
\endgroup
}
\newif\ifError
\def\TestError[#1]#2#3#4#5#6{%
\begingroup
\global\Errorfalse
\let\OrgPackageError\PackageError
\def\PackageError##1##2##3{%
\edef\TestTemp{##1}%
\ifx\TestTemp\TestPackageName
\Expect*{\ifError too many errors\else ok\fi}{ok}%
\Expect*{#6}*{##2}%
\global\Errortrue
\else
\OrgPackageError{##1}{##2}{##3}%
\fi
}%
\setbox0=\hbox{%
\begingroup
\chardef\HyColor@PdfVersion=#1 %
\HyColor@AttachfileColor{#2}\spec\inlinemacro\annot
\TestPackageName\TestOptionName
\edef\inline{\inlinemacro{test}}%
\expandafter\Expect\expandafter{\spec}{#3}%
\expandafter\Expect\expandafter{\inline}{#4}%
\expandafter\Expect\expandafter{\annot}{#5}%
\endgroup
\ifx\\#6\\%
\else
\Expect*{\ifError ok\else missing error\fi}{ok}%
\fi
}%
\Expect*{\the\wd0}{0.0pt}%
\endgroup
}
\def\NoEmptyModel{%
Color model `empty' is not permitted for option `\TestOptionName'%
}
\def\ModelNoXcolor#1#2{%
Color model `#1' is not supported\MessageBreak
without package `xcolor' in\MessageBreak
`\TestOptionName=[#1]{#2}'% hash-ok
}
\def\SpecNoXColor#1{%
This color specification is not supported\MessageBreak
without package `xcolor' in\MessageBreak
`test-option=#1'%
}
\begin{qstest}{AttachfileColor}{AttachfileColor}
\Test{}{}{}{}{}%
\Test{0.1 0.2 0.3}{[rgb]{.1,.2,.3}}{.1 .2 .3 set-rgb}%
{/C[.1 .2 .3]}{/C[.1 .2 .3]}%
\Test{[gray]{0.4}}{[gray]{0.4}}{.4 set-gray}%
{/C[.4 .4 .4]}{/C[.4]}%
\Test{[rgb]{0.3,.2,.1}}{[rgb]{0.3,.2,.1}}{.3 .2 .1 set-rgb}%
{/C[.3 .2 .1]}{/C[.3 .2 .1]}%
\Test{0.0 1.0 1}{[rgb]{0,1,1}}{0 1 1 set-rgb}%
{/C[0 1 1]}{/C[0 1 1]}%
\Test{[gray]1}{[gray]1}{1 set-gray}{/C[1 1 1]}{/C[1]}%
\TestError[6]{[empty]{}}{}{}{}\NoEmptyModel
\TestError[7]{[empty]{}}{}{}{}\NoEmptyModel
\TestError[6]{[cmyk]{.1,.2,.3,.4}}{[cmyk]{.1,.2,.3,.4}}%
{.1 .2 .3 .4 set-cmyk}{}%
{\ModelNoXcolor{cmyk}{.1,.2,.3,.4}}%
\TestError[7]{[cmyk]{.1,.2,.3,.4}}{[cmyk]{.1,.2,.3,.4}}%
{.1 .2 .3 .4 set-cmyk}{/C[.1 .2 .3 .4]}{}%
\TestError[6]{red}{red}{}{}{\SpecNoXColor{red}}%
\TestError[7]{red}{red}{}{}{\SpecNoXColor{red}}%
\end{qstest}
\usepackage{xcolor}
\definecolor[named]{MyGreen}{rgb}{0,0.7,0}
\definecolor{mygreen}{named}{MyGreen}
\definecolor{graynine}{gray}{0.9}
\definecolor{GraySix}{Gray}{9}
\begin{qstest}{AttachfileColorX}{AttachfileColorX}
\Test{}{}{}{}{}%
\Test{0.1 0.2 0.3}{[rgb]{.1,.2,.3}}{.1 .2 .3 set-rgb}%
{/C[.1 .2 .3]}{/C[.1 .2 .3]}%
\Test{[gray]{0.4}}{[gray]{0.4}}{.4 set-gray}%
{/C[.4 .4 .4]}{/C[.4]}%
\Test{[rgb]{0.3,.2,.1}}{[rgb]{0.3,.2,.1}}{.3 .2 .1 set-rgb}%
{/C[.3 .2 .1]}{/C[.3 .2 .1]}%
\Test{0.0 1.0 1}{[rgb]{0,1,1}}{0 1 1 set-rgb}%
{/C[0 1 1]}{/C[0 1 1]}%
\Test{[gray]1}{[gray]1}{1 set-gray}{/C[1 1 1]}{/C[1]}%
\Test{red}{red}{1 0 0 set-rgb}{/C[1 0 0]}{/C[1 0 0]}%
\Test{black}{black}{0 set-gray}{/C[0 0 0]}{/C[0]}%
\Test{cyan}{cyan}{1 0 0 0 set-cmyk}{/C[0 1 1]}{/C[1 0 0 0]}%
\Test{[named]{black}}{[named]{black}}{0 0 0 set-rgb}%
{/C[0 0 0]}{/C[0 0 0]}%
\Test{[Gray]{9}}{[Gray]{9}}{.6 set-gray}{/C[.6 .6 .6]}{/C[.6]}%
\Test{[HTML]{0080FF}}{[HTML]{0080FF}}{0 .50195 1 set-rgb}%
{/C[0 .50195 1]}{/C[0 .50195 1]}%
\Test{graynine}{graynine}{.9 set-gray}{/C[.9 .9 .9]}{/C[.9]}%
\Test{GraySix}{GraySix}{.6 set-gray}{/C[.6 .6 .6]}{/C[.6]}%
\Test{[wave]{500}}{[wave]{500}}{0 1 .49846 set-rgb}%
{/C[0 1 .49846]}{/C[0 1 .49846]}%
\TestError[6]{[empty]{}}{}{}{}\NoEmptyModel
\TestError[7]{[empty]{}}{}{}{}\NoEmptyModel
\end{qstest}
\begin{document}
\end{document}
\endinput
%%
%% End of file `hycolor-test3.tex'.
|