Design: 04.03.02.02/P02

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 2: Validity of predefined colour table

CHARACTERISTICS: ynnn

OPERATOR SCRIPT: passive test.

DESIGN:

<Inquire colour model facilities> to determine
   defmod  = default colour model
chkcsr = true = check colour specification range
if defmod < 1 or > 4 then
   message about inability to check cspec within range
   chkcsr = false
endif

Use <inquire colour facilities> to determine
   npe  = number of predefined entries
TEST: #SR 8 11
      "<Inquire colour facilities> should report at least 2
       predefined entries."
pass/fail depending on (npe >= 2)

gotbf(0:1) = false = got background / foreground index
valcsv     = true  = valid colour specifications values

preal      = true  = predefined color specs are realizable
TEST: #SR 8 9 10
      "<Inquire predefined colour representation> should be able
       to access as many entries as reported by <inquire colour
       facilities>."
do ci = 0 to npe-1
   <inquire predefined colour representation> for ci to determine
      cspec = colour specification
   if error then
      fail
      goto nxt_test
   endif

   if ci = 0 or 1 then
      gotbf(ci) = true
   endif

   if chkcsr then
      if (numret not= 3 or cspec < 0 or > 1) then
      valscv = false
      errval = erroneous cspec
   endif

   <set color rep> index #1 to cspec
   <inquire color rep> index #1 as REALIZED to determine
       rspec = realized color specification
   if (cspec not= rspec) then
      preal = false
      errci = ci
   endif
loop
pass

nxt_text:

if chkcsr then
  TEST: #SR 9 15 26
        "The colour specification parameters for all the
         predefined colour indices should be valid for the
         default colour model."
   if (valcsv) then
      pass
   else
      fail
      informational message about errval
   endif
endif

TEST: #SR 9 15 32 33
      "The colour specification parameters for all the predefined
       colour indices should be realizable by the workstation."
if (preal) then
   pass
else
   fail
   informational message about errci
endif

TEST: #SR 11
      "The predefined colour indices should include entries 0 and 1."
pass/fail depending on (gotbf(0) and gotbf(1))

TEST: #SR 9 11 12
      "The first two predefined colour indices should be
       mutually distinguishable."
<inquire predefined colour representation> for index 0, determine
    cspec = predefined colour specification for index 0
<inquire predefined colour representation> for index 1, determine
    cspec1 = predefined colour specification for index 1
pass/fail depending on (cspec not= cspec1)

END PROGRAM 2