Design: 04.03.02.02/P01

This is an abstract, language-independent design. Grim details may be found in the corresponding source code. You may return to the documentation for the module containing this program design, or to the entire hierarchical table of topics covered by the PVT.


PROGRAM 1: Colour facilities

CHARACTERISTICS: ynnn

OPERATOR SCRIPT: passive test.

DESIGN:

<Inquire colour facilities> to determine
   numcol = number of available colours
   colavl = colour availability
   pricol(1 to 3) = primary colours

TEST: #SR 7 26
      "The primary colours returned by <inquire colour facilities>
       should be valid CIELUV values."
pass/fail depending on (0 <= pricol (1 to 3) <= 1)

TEST: #SR 7 32 33
      "The primary colours of the workstation should be realizable."
<set colour model> = CIELUV
do ipcol = 1 to 3
   <set colour representation> #1 to pricol(ipcol)
   <inquire colour representation> #1 as REALIZED: realco
   if realco approx= pricol(ipcol) then
      OK so far
   else
      fail
      goto end_pricol
   endif
loop
pass

end_pricol:

TEST: #SR 1 2 3
      "The number of available colours should be reported as 0 or
       at least 2."
pass/fail depending on (numcol = 0 or >=2)

TEST: #SR 4
      "Colour availability should be of type MONOCHROME or COLOUR."
pass/fail depending on (colavl = MONOCHROME or COLOUR)

Use angle around neutral (black-white) axis in RGB cube as a rough
metric for hue.

<set colour model> = RGB

<set colour representation> index #1 = (0,0,1)
<inquire colour representation> index #1 as REALIZED
   to determine rspec = realized color spec
ang0  = hue angle for rspec
dist0 = distance of rspec from neutral axis

<set colour representation> index #1 = (1,1,0)
<inquire colour representation> index #1 as REALIZED
   to determine rspec = realized color spec
ang1  = hue angle for rspec
dist1 = distance of rspec from neutral axis

husame = both rspecs have the same hue =
         ang0 approx= ang1            or
         dist0 is near gray scale     or
         dist1 is near gray scale

if colour workstation then
   TEST: #SR 5 32 33
         "For colour workstations, very different hues should not be
          realized as the same hue."
   pass/fail depending on (not husame)
else (monochrome)
   TEST: #SR 6 32 33
         "For monochrome workstations, different hues should be
          realized as the same hue."
   pass/fail depending on (husame)
endif

END PROGRAM 1