%%
%% This is file `hycolor-test1.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hycolor.dtx  (with options: `test,test1')
%% 
%% This is a generated file.
%% 
%% Project: hycolor
%% Version: 2011/01/30 v1.7
%% 
%% Copyright (C) 2007-2011 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and 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,
%%    hycolor-test-xcol4.tex.
%% 
\ProvidesFile{hycolor-test1.tex}[2011/01/30 test file 1]
\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}[2011/01/30]
\begin{qstest}{NumNormalize}{num, normalize}
  \def\test#1#2{%
    \HyColor@NormalizeNum{#1}\cmd
    \Expect*{\cmd}{#2}%
  }%
  \test{0}{0}%
  \test{000}{0}%
  \test{-1}{0}%
  \test{ 0 }{0}%
  \test{1.1}{1}%
  \test{100}{1}%
  \test{00100}{1}%
  \test{99.99}{1}%
  \test{0.0}{0}%
  \test{00.00}{0}%
  \test{0.}{0}%
  \test{.0}{0}%
  \test{0.1}{.1}%
  \test{0.10}{.1}%
  \test{0.1000}{.1}%
  \test{.1000}{.1}%
  \test{0.01}{.01}%
  \test{0.01010}{.0101}%
  \test{.0000000001}{.0000000001}%
  \test{.9999999999}{.9999999999}%
\end{qstest}

\begin{qstest}{BookmarkColor without xcolor}{bookmark, noxcolor}
  \def\test#1#2{%
    \HyColor@BookmarkColor{#1}\cmd\TestPackageName\TestOptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{[rgb]{1,0,0}}{1 0 0}%
  \test{[gray]{0.10}}{.1 .1 .1}%
  \test{}{}%
  \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
  \def\errortest[#1]#2{%
    \ExpectError{%
      Color model `#1' is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `\TestOptionName=[#1]{#2}'% hash-ok
    }{%
      \test{[#1]{#2}}{}% hash-ok
    }%
  }%
  \errortest[cmyk]{1,0,0,0}%
  \errortest[empty]{}%
  \def\errortest#1{%
    \ExpectError{%
      This color specification is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `\TestOptionName=#1'%
    }{%
      \test{#1}{}%
    }%
  }%
\end{qstest}
\begin{qstest}{X0134 without xcolor}{X0134, noxcolor}
  \def\test#1#2{%
    \HyColor@XZeroOneThreeFour{#1}\cmd\TestPackageName\TestOptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{[empty]{}}{}%
  \test{[rgb]{1,0,0}}{1 0 0}%
  \test{[gray]{0.10}}{.1}%
  \test{[cmyk]{0,1,0,0}}{0 1 0 0}%
  \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
  \def\errortest[#1]#2{%
    \ExpectError{%
      Color model `#1' is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `test-option=[#1]{#2}'% hash-ok
    }{%
      \HyColor@XZeroOneThreeFour{[{#1}]{#2}}\cmd
          \TestPackageName\TestOptionName
      \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
    }%
  }%
  \errortest[Gray]{10}%
  \errortest[cmy]{1,0,0}%
  \def\errortest#1{%
    \ExpectError{%
      This color specification is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `test-option=#1'%
    }{%
      \HyColor@XZeroOneThreeFour{#1}\cmd\TestPackageName\TestOptionName
      \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
    }%
  }%
  \errortest{yellow}%
\end{qstest}

\begin{qstest}{HyperrefBorderColor without xcolor}%
              {hyperef bordercolor, noxcolor}%
  \def\test#1#2{%
    \HyColor@HyperrefBorderColor{#1}\cmd\TestPackageName\TestOptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{[rgb]{1,0,0}}{1 0 0}%
  \test{[gray]{0.10}}{.1 .1 .1}%
  \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
  \def\errortest[#1]#2{%
    \ExpectError{%
      Color model `#1' is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `test-option=[#1]{#2}'% hash-ok
    }{%
      \HyColor@HyperrefBorderColor{[{#1}]{#2}}\cmd
          \TestPackageName\TestOptionName
      \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
    }%
  }%
  \errortest[Gray]{10}%
  \errortest[cmy]{1,0,0}%
  \errortest[cmyk]{0,1,0,0}%
  \def\errortest#1{%
    \ExpectError{%
      This color specification is not supported\MessageBreak
      without package `xcolor' in\MessageBreak
      `test-option=#1'%
    }{%
      \HyColor@HyperrefBorderColor{#1}\cmd
          \TestPackageName\TestOptionName
      \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
    }%
  }%
  \errortest{yellow}%
\end{qstest}
\usepackage{xcolor}
\definecolor[named]{MyGreen}{rgb}{0,0.7,0}
\definecolor{mygreen}{named}{MyGreen}
\begin{qstest}{BookmarkColor with xcolor}{bookmark, xcolor}
  \def\test#1#2{%
    \HyColor@BookmarkColor{#1}\cmd\PackageName\OptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{[rgb]{1,0,0}}{1 0 0}%
  \test{[gray]{0.10}}{.1 .1 .1}%
  \test{}{}%
  \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
  \test{[cmyk]{1,0,0,0}}{0 1 1}%
  \test{red}{1 0 0}%
  \test{cyan}{0 1 1}%
  \test{red!40!blue}{.4 0 .6}%
  \test{[Gray]{10}}{.66667 .66667 .66667}%
  \test{[RGB]{100,200,50}}{.39217 .78432 .19609}%
  \test{[wave]{363}}{.00316 0 .00316}%
  \test{[wave]814}{.00797 0 0}%
  \test{[HSB]{100,200,50}}{.03473 .20833 .12152}%
  \test{[HTML]{A800FF}}{.65881 0 1}%
  \test{[cmy]{.3,.5,.2}}{.7 .5 .8}%
  \test{[cmyk]{.3,.5,.2,.1}}{.6 .4 .7}%
  \test{[hsb]{.3,.5,.2}}{.12 .2 .1}%
  \test{[Hsb]{120,.5,.2}}{.1 .2 .1}%
  \test{[tHsb]{120,.5,.2}}{.2 .2 .1}%
  \test{[named]{MyGreen}}{0 .7 0}%
  \test{mygreen}{0 .7 0}%
\end{qstest}

\begin{qstest}{HyperrefColor}{hyperref, color}
  \def\test#1#2{%
    \HyColor@HyperrefColor{#1}\cmd
    \Expect*{\cmd}{#2}%
  }%
  \test{red}{red}%
  \test{[rgb]{1,0,0}}{[{rgb}]{1,0,0}}%
  \HyColor@HyperrefColor{}\cmd
  \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
\end{qstest}
\begin{qstest}{X0134 with xcolor}{hyperref, X0134, xcolor}
  \def\test#1#2{%
    \HyColor@XZeroOneThreeFour{#1}\cmd\PackageName\OptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{[empty]{}}{}%
  \test{[gray]{0.1}}{.1}%
  \test{[rgb]{1,0.5,0.0}}{1 .5 0}%
  \test{[cmyk]{0,1,0,0.5}}{0 1 0 .5}%
  \test{[Gray]{10}}{.66667}%
  \test{red}{1 0 0}%
  \test{1 0 0}{1 0 0}%
  \test{001.0 .23 0}{1 .23 0}%
  \test{[named]{MyGreen}}{0 .7 0}%
  \test{mygreen}{0 .7 0}%
  \HyColor@XZeroOneThreeFour{}\cmd\PackageName\OptionName
  \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
\end{qstest}

\begin{qstest}{FieldColor}{hyperref, field, FieldColor}
  \def\test#1#2{%
    \HyColor@FieldColor{#1}\cmd\PackageName\OptionName
    \Expect*{\cmd}{#2}%
  }%
  \test{}{}%
  \test{[gray]{0.7}}{.7 g}%
  \test{[rgb]{1,0,0}}{1 0 0 rg}%
  \test{[cmyk]{0,1,0,0}}{0 1 0 0 k}%
  \test{[cmy]{.5,.4,.3}}{.5 .6 .7 rg}%
\end{qstest}
\begin{document}
\end{document}
\endinput
%%
%% End of file `hycolor-test1.tex'.
