Design: 04.03.02.02/P04

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 4: Colour specification facilities

CHARACTERISTICS: ynnn

OPERATOR SCRIPT: passive test.

DESIGN:

Use <inquire colour model facilities> to determine
   lacm = list of available colour models

seterr = false
inqerr = false

All parameters of models 1-4 range from 0 to 1:
for each colmod in lacm, between 1 and 4
   <set current color model> = colmod
   for val = 0 to 1 by .19999
      <set colour representation>, index #1
            c1 = val
            c2 = val**2
            c3 = val**3
      if error signalled then
         seterr = true
         setprm = (c1, c2, c3)
         setcod = error code
         setmod = colmod
      endif

      <inquire colour representation>, index #1 as realized to
         determine c1,c2,c3
      if c1,c2,c3 outside [0, 1] then
         inqerr = true
         inqprm = (c1, c2, c3)
         inqmod = colmod
      endif
   next val
next colmod

TEST: #SR 21 26 27
      "All colour specification parameters within range of the
       current colour model should be accepted as valid."
if seterr then
   fail
   message about setmod, setprm, setcod
else
   pass
endif

TEST: #SR 21 26 32 33
      "The components of a realized colour specification should be
       reported within the range of the current colour model."
if inqerr then
   fail
   message about inqmod, inqprm
else
   pass
endif

TEST: #SR 21 26 32 33
      "The components of a realized colour specification should be
       reported within the range of the current colour model, even
       when converted from another colour model."
<set current color model> = CIE
<set colour representation>, index #0, uvY = 0, 0, 0.5
<set colour representation>, index #1, uvY = 1, 1, 1
<set current color model> = RGB
do ci = 0 to 1
   <inquire colour representation>, as realized, index #ci, rr, rg, rb
   if rr, rg, rb outside [0, 1] then
      fail
      goto end_cie_spec
   endif
loop
pass

end_cie_spec:

if (colour available and continuous range of colours) then
   TEST: #SR 3 5 32 33
         "For colour workstations with a continuous range of colours,
          the colour specification parameters should be realized as
          themselves."
   <set colour representation> index #1, red=.78, green=.36, blue=.23
   <inquire colour representation> REALIZED to determine
       rred=realized red, rgreen=realized green, rblue=realized blue
   pass/fail depending on (rred   approx= red   and
                           rgreen approx= green and
                           rblue  approx= blue)
else
   TEST: #SR 3 6 32 33
         "For workstations with a noncontinuous range of colours
          or monochrome workstations, the colour specification
          parameters should be realized as closely as possible."
   <set colour representation> index #1, red=.17, green=.92, blue=.87
   <inquire colour representation> as REALIZED to determine
      rred, rgreen, rblue
   <set colour representation> index #1, rred, rgreen, rblue
   <inquire colour representation> as REALIZED to determine
        new_red, new_green, new_blue
   pass/fail depending on (new_red   approx= rred   and
                           new_green approx= rgreen and
                           new_blue  approx= rblue)
endif

END PROGRAM 4