Design: 04.03.02.01/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: Setting and inquiring colour table
CHARACTERISTICS: ynnn
OPERATOR SCRIPT: passive test.
DESIGN:
<set colour model> to RGB
This statement is NOT meant to test <set colour model>, but is
necessary to give meaningful value to colour specifications used
in <set colour representation>
<inquire workstation state table lengths> to determine maximum
number of entries in workstation's colour table:
mne = maximum number of entries
*** *** *** *** *** initialized entries *** *** *** *** ***
<inquire list of colour indices> to determine initialized entries
nie = number of initialized entries
aii = an initialized index
TEST: #SR 3
"<Inquire list of colour indices> should return initialized
indices."
if (<inquire list of colour indices> indicates error) then
fail
goto undefined_test
else
pass
endif
initialized_test:
<inquire colour representation> for index# aii, as set
determines:
old_red
old_green
old_blue
if old_red < .5 then
new_red = old_red + .25
else
new_red = old_red -.15
endif
if old_green < .5 then
new_green = old_green + .25
else
new_green = old_green -.15
endif
if old_blue < .5 then
new_blue = old_blue + .25
else
new_blue = old_blue -.15
endif
<set colour representation> sets:
index = aii
RGB colour spec = (new_red, new_green, new_blue)
<inquire list of colour indices> returns defined list
TEST: #SR 1 3
"Re-defining a system-initialized entry should not change
the number of defined entries."
pass/fail depending on (current number of entries = nie)
TEST: #SR 1 3
"Initialized table entry should be reported as defined after
being set."
if (defined list includes #aii) then
pass
else
fail
goto undefined_test
endif
<inquire colour representation> for index# aii, as SET
to determine RGB colour_spec
TEST: #SR 2 5
"New values should be set for initialized table entry."
pass/fail depending on
(RGB colour_spec = (new_red, new_green, new_blue))
*** *** *** *** *** undefined entries *** *** *** *** ***
undefined_test:
If (number of initialized entries
>= max table size in test program) then
skip rest of undefined_test; goto redefined_test
endif
<inquire list of colour indices> returns defined list
determine lowest undefined index (not in defined list) = lui
determine current number defined entries = cnde
TEST: #SR 3 6
"<Inquire colour representation> should return attributes for
colour index #1 when inquiring an undefined entry as REALIZED."
<inquire colour representation> as REALIZED for index #lui
to get colour_spec for undefined_entry.
<inquire colour representation> as REALIZED for index #1
to get colour_spec for index #1.
pass/fail depending on
(colour_spec for undefined_entry = colour_spec for index #1).
If (number of initialized entries
>= max size of colour table) then
skip rest of undefined_test; goto redefined_test
endif
<set colour representation>:
index = lui
RGB colour_spec = (.85, .27, .76)
<inquire list of colour indices> to determine
listot = total number of entries in list
TEST: #SR 1 3
"Defining an undefined entry should increment the number
of defined entries."
pass/fail depending on (listot = cnde + 1)
TEST: #SR 1 3
"Undefined table entry should be reported as defined after set."
if (resulting list of indices contains lui) then
pass
else
fail
goto redefined_test
endif
<inquire colour representation> for index# lui, as SET
to determine RGB colour_spec
TEST: #SR 2 5
"New values should be set for undefined table entry."
pass/fail depending on RGB colour_spec = (.85, .27, .76)
*** *** *** *** *** redefined entries *** *** *** *** ***
redefined_test:
dci = defined colour index
cnde = current number of defined entries
<set colour representation>:
index = dci
RGB colour_spec = (0.0, 1.0, 0.0)
new_red = 1.0
new_green = 1.0
new_blue = 1.0
<set colour representation>:
index = dci
RGB colour_spec = (new_red, new_green, new_blue)
<inquire list of colour indices> to determine
nnde = new number of defined entries
TEST: #SR 1 3
"Re-defining a user-defined entry should not change number
of defined entries."
pass/fail depending on (nnde = cnde)
TEST: #SR 1 3
"Redefined table entry should be reported as defined after
set."
if (resulting list of indices contains dci) then
pass
else
fail
goto end_redefined_test
endif
<inquire colour representation> for index #dci, as SET
to determine RGB colour_spec
TEST: #SR 2 5
"New values should be set for redefined table entry."
pass/fail depending on
(RGB colour_spec = (new_red, new_green, new_blue))
end_redefined_test:
*** *** *** *** *** access all defined entries *** *** *** *** ***
TEST: #SR 3 4
"<Inquire list of colour indices> and <inquire colour
representation> should detect all defined entries."
Use <inquire list of colour indices> to get
list of defined indices
if (non-zero error code) then
fail
goto end_access_all
endif
For each defined index, apply <inquire colour representation>
if (non-zero error code) then
fail
goto end_access_all
endif
loop to next index
pass
end_access_all:
END PROGRAM 1