Design: 04.02.03.03/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: Text font in <inquire text extent>
CHARACTERISTICS: ynnn
OPERATOR SCRIPT: passive test.
DESIGN:
open primary workstation
Establish specwt = specific primary workstation type
Throughout, use variable names:
font: text font
chxp: character expansion factor
chsp: character spacing
chh: character height
txp: text path
txal: text alignment
str: character string
For approximate equality:
abstol = absolute tolerance = .02
reltol = relative tolerance = .02
<Inquire text extent> with:
font = 1
chxp = 1.0
chsp = 0.0
chh = 1.0
txp = RIGHT
txal = LEFT, BOTTOM
str = "Text extent"
to determine txexrx(2) = right side = rectangle width
and txexry(2) = top side = rectangle height
schw = standard character width = abs(txexrx(2) - txexrx(1)) / 11
schh = standard character width = abs(txexry(2) - txexry(1))
TEST: #SR 1 3 4 10 15
"For a horizontal text path, the width of a character
string in font 1 should be proportional to the number of
characters it contains."
<Inquire text extent> as before, but with:
str = "WWWW"
to determine txexrx(2) = right side
wwid = txexrx(2)
<Inquire text extent> as before, but with:
txp = LEFT
str = "..."
to determine txexrx(2) = right side
pwid = txexrx(2)
<Inquire text extent> as before, but with:
str = " "
to determine txexrx(2) = right side
bwid = txexrx(2)
pass/fail depending on (wwid approx= 4*schw and
pwid approx= 3*schw and
bwid approx= 2*schw )
TEST: #SR 1 3 4 10 16
"For a vertical text path, the width of a character
string in font 1 should always be the width of a single
character."
<Inquire text extent> as before, but with:
txp = DOWN
str = "WWW"
to determine txexrx(2) = right side
wwid = txexrx(2)
<Inquire text extent> as before, but with:
txp = DOWN
str = "...."
to determine txexrx(2) = right side
pwid = txexrx(2)
<Inquire text extent> as before, but with:
txp = UP
str = " "
to determine txexrx(2) = right side
bwid = txexrx(2)
pass/fail depending on (wwid approx= schw and
pwid approx= schw and
bwid approx= schw )
TEST: #SR 1 13
"All fonts reportedly available in stroke precision should
be valid for use with <inquire text extent>."
Use <inquire text facilities> using specwt to determine
lstfnt = list of fonts available in STROKE precision
for each fntx in lstfnt
<Inquire text extent> with:
font = fntx
chxp = 1.0
chsp = 0.0
chh = 1.0
txp = RIGHT
txal = LEFT, BOTTOM
str = "Text extent"
if (error reported) then
fail
goto end_valid_fonts
endif
next fntx
pass
end_valid_fonts:
TEST: #SR 1 2 3 9 10 15 16
"For any font, the nominal width of any rectangle whose text
path is vertical should equal the nominal width of the widest
character in the font."
maxcc = maximum valid character code = 255
for each fntx in lstfnt
<Inquire text extent> with:
font = fntx
chxp = 1.0, chsp = 0.0, chh = 1.0
txp = DOWN
txal = LEFT, BOTTOM
str = "."
to determine vw = width of vertical rectangle
if (error reported) then
goto next_font
endif
result = all characters so far are narrower = "L"
for cc = character code from 0 to maxcc
chcc = character for cc
<Inquire text extent> with:
font = fntx
chxp = 1.0, chsp = 0.0, chh = 1.0
txp = RIGHT
txal = LEFT, BOTTOM
str = chcc
to determine hw = width of horizontal rectangle
if (error reported) then
goto next_char
endif
if (hw app= vw) then
result = some character of equal width exists = "E"
elseif (hw > vw) then
fail
message: failed on fntx, chcc: character too wide
goto end_other_fonts
endif
next_char:
next cc
if (result = "L") then
fail
message: failed on fntx: all characters too narrow
goto end_other_fonts
endif
next_font:
next fntx
pass
end_other_fonts:
TEST: #SR 1 2 4 5 15 16
"Font 1 should generate character bodies of the same height
and width for all workstation types."
close primary workstation (because may not be able to open
several simultaneously)
test other specific types:
for each accessible secondary output workstation = wkid2
<open workstation> wkid2
<inquire workstation connection and type>
to determine spec2 = specific type
<inquire text extent> with:
wktype = spec2
font = 1
chxp = 1.0
chsp = 0.0
chh = 1.0
txp = RIGHT
txal = LEFT, BOTTOM
str = "......."
to determine txexrx(2) = right side = rectangle width
and txexry(2) = top side = rectangle height
<close workstation> wkid2
if (error reported or txexrx(2) not approx= 7*schw) then
or txexry(2) not approx= schh) then
fail
message about spec2 as failed type
goto end_other_types
endif
next wkid2
test generic types:
<inquire list of available workstation types>
to determine lavtyp = list of generic workstation types
for each gentyp in lavtyp
<inquire text extent> with:
wktype = gentyp
font = 1
chxp = 1.0
chsp = 0.0
chh = 1.0
txp = UP
txal = LEFT, BOTTOM
str = "WWWWW"
to determine txexrx(2) = right side = rectangle width
and txexry(2) = top side = rectangle height
if (error 51 reported) then
goto skip_gentyp
endif
if (error reported or txexrx(2) not approx= schw) then
or txexry(2) not approx= 5*schh) then
fail
message about gentyp as failed type
goto end_other_types
endif
skip_gentyp:
next gentyp
pass
end_other_types:
END PROGRAM 1