Design: 04.02.03.02/P16

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 16: Appearance of text color index

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

DEFINED TEXT COLOR INDICES: All text lines but one are drawn in
the background color.  Identify the single text line drawn in the
default foreground color.

UNDEFINED TEXT COLOR INDICES: A star is drawn with several
horizontal text lines beneath it.  Normally, all of these will be
the same color as the star.  Count up and report the number of
text lines that match the star in color.

DESIGN:

set all ASFs to BUNDLED

TEST: #SR 3 5 6 64 65
      "A defined text color index should cause the addressed
       entry in the color table to be used when rendering a
       text primitive."

bckcol = background color = realized color spec for entry #0
forcol = foreground color = realized color spec for entry #1

szcolt = maximum size of color table (including entry #0)
numlin = number of text lines to be drawn = min(8, szcolt)
lncol  = random permutation of #0,#1, and numlin-2 random choices
         from entries #2 to #szcolt-1
visdx = from lncol, randomly select an entry to be made visible
        but not the one that contains 0, since this may not be
        re-settable.

for ix = 1 to numlin
   set entry lncol(ix) to bckcol
   randomly pick prec = precision, to ensure no interaction

   set text index = ix
   set text rep #ix color = lncol(ix)

   draw text line #ix, using text rep #ix
next ix

set entry lncol(visdx) to forcol

OPQA/DEFINED TEXT COLOR INDICES: which text line is visible?
pass/fail depending on (response = text line colored by visdx)

end_def_col:

TEST: #SR 3 5 6 63 64 66
      "An undefined text color index should cause entry
       number 1 in the color table to be used when rendering a
       text primitive."

set entry #1 in color table opposite from BCKCOL
set entry #1 different from FORCOL - make sure that the undefined
  entries default to *current* color-rep of #1, not just a
  predefined color.

set polyline index = 1
set polyline rep #1: type, width, color
                     1,    3.0,   1
draw star, using polyline rep #1

u1,u2,u3 = 3 undefined, positive color indices - all greater
  than maximum defined entry in color table
explct = number of explicit text lines of color #1 = random integer
   from 0 to 4

set text rep #1: color = u1
set text rep #2: color = u2
set text rep #3: color = u3
set text rep #4: color = 1

display interleaved:
  three text lines of color u1,u2,u3 (using text rep #1,2,3)
  explct text lines of color #1 (using text rep #4)

OPQA/UNDEFINED TEXT COLOR INDICES: how many text lines are the
  same color as the star?
pass/fail depending on response = 3+explct

END PROGRAM 16