Design: 02.03.03/P05

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 5: Inheritance of geometric attributes

CHARACTERISTICS: ynnn

OPERATOR SCRIPT: passive test.

DESIGN:

The only geometric attributes which affect the size or position
of primitives are the text attributes:
  chht   : character height
  chup   : character up vector
  txpath : text path
  txal   : text alignment

All ISS done with search ceiling of 1, no modelling clipping, and
null filter lists.

Set up CSS:

            101
            / |
          5/  |
          /   |
         /    |6
      102     |
         \    |
         5\   |
           \  |
            \ |
            103

Numbers 101-103 are structure identifiers.  Numbers on edges are
element positions of 'execute structure' elements.

tpos = text position = 3.1, 4.2
str  = character string = "PHIGS or bust ..."

Set up values as in PDT:

chup   = character up     = 0,1
chht   = character height = 0.01
txpath = text path        = RIGHT
txal   = text alignment   = NORMAL,NORMAL

Calculate expected values for PDT:
<inquire text extent> with
  workstation type           = primary workstation type
    (ignored because font #1 is workstation-independent)
  text font                  = 1
  character expansion factor = 1.0
  character spacing          = 0.0
    (three above set as assumed by spatial search, see SR15)
  character height           = chht
  text path                  = txpath
  text alignment             = txal
  character string           = str
    to determine:
  recxlo,recxhi,recylo,recyhi = text extent rectangle
    in TLC, with assumed text position = 0,0 character up vector
    = (0,1), and text precision = STROKE

Add in effect of character up vector:
rotang = rotation angle = atan2(chupy, chupx) - pi/2
xfrm = 2D transform for rotation by rotang and shift by tpos
Get lower-left and upper-right corner:
  transform recxlo,recylo, using xfrm to exxlo(0),exylo(0)
  transform recxhi,recyhi, using xfrm to exxhi(0),exyhi(0)


Set up values for structure 101:

chup   = character up     = 1,1.3
chht   = character height = 2.2
txpath = text path        = DOWN
txal   = text alignment   = RIGHT,TOP

Structure 101
-------------
1. set character up     to chup
2. set character height to chht
3. set text path        to txpath
4. set text alignment   to txal
5. execute 102
6. execute 103
7. set character height to chht/3

Calculate expected values for 101:
Use <inquire text extent> as above with new values for
  character height, character up, text path, text alignment
  to determine expected corners:
    exxlo(1),exylo(1), exxhi(1),exyhi(1)


Set up values for structure 102:

chup   = character up     = -1,1.6
chht   = character height = 0.023
txpath = text path        = UP
txal   = text alignment   = LEFT, HALF

Structure 102
-------------
1. set character up     to chup
2. set character height to chht
3. set text path        to txpath
4. set text alignment   to txal
5. execute 103
6. set character height to chht/3

Calculate expected values for 102:
Use <inquire text extent> as above with new values for
  character height, character up, text path, text alignment
  to determine expected corners:
    exxlo(2),exylo(2), exxhi(2),exyhi(2)

Structure 103
-------------
1. set text precision to STROKE
2. 2D text: str at tpos
3. set character height to 33.3

TEST: #SR 1 2 3 4 5 6 7
      "Actual geometric attributes should be those set by the
       most recent ancestor, even if a more distant ancestor also
       set them."

Test ISS (see below) for corners of text rectangle with:
  starting path:         101,0
  expected corner index: 2
  expected found path:   101,5 102,5, 103,2

TEST: #SR 1 2 3 4 5 6 7
      "Actual geometric attributes should be re-stored after
       being changed by a descendant structure that precedes the
       starting path."

Test ISS (see below) for corners of text rectangle with:
  starting path:         101,6, 103,0
  expected corner index: 1
  expected found path:   101,6, 103,2

TEST: #SR 1 2 3 4 5 6 7
      "When not explicitly set by an ancestor or by itself, the
       geometric attributes for a structure should be as
       inherited from the PHIGS description table."

Test ISS (see below) for corners of text rectangle with:
  starting path:         103,0
  expected corner index: 0
  expected found path:   103,2

Set up values for structure 103:

chup   = character up     = -1,-1.9
chht   = character height = 12.3
txpath = text path        = LEFT
txal   = text alignment   = CENTER,BOTTOM

Insert in beginning of structure 103:
-------------------------------------
1. set character up     to chup
2. set character height to chht
3. set text path        to txpath
4. set text alignment   to txal

old elements of 103:
5. set text precision to STROKE
6. 2D text: str at tpos
7. set character height to 33.3

Calculate expected values for 103:
Use <inquire text extent> as above with new values for
  character height, character up, text path, text alignment
  to determine expected corners:
    exxlo(3),exylo(3), exxhi(3),exyhi(3)


TEST: #SR 1 2 3 4 5 6 7
      "Actual geometric attributes should be as set in prior
       elements of the current structure, overriding the
       inherited attributes."

Test ISS (see below) for corners of text rectangle with:
  starting path:         101,0
  expected corner index: 3
  expected found path:   101,5, 102,5, 103,6

TEST: #SR 1 2 3 4 5 6 7
      "Actual geometric attributes should be as set in prior
       elements of the current structure when there are no
       inherited attributes."

Test ISS (see below) for corners of text rectangle with:
  starting path:         103,0
  expected corner index: 3
  expected found path:   103,6

TEST: #SR 1 2 3 4 5 6
      "Actual geometric attributes should be as set in prior
       elements of structure even when these precede the starting
       path."

Test ISS (see below) for corners of text rectangle with:
  starting path:         103,5
  expected corner index: 3
  expected found path:   103,6

end test

*** *** *** *** *** *** *** *** *** *** *** *** *** ***

Routine to test corners:

given:
  stpath = starting path
  excorn = expected corners
  expath = expected found path

sratio = search ratio = 0.1
diagv = diagonal vector = vector from lower-left expected corner
  to upper-right
incrv = incremental vector = sratio*diagv
sdist = search distance  = length of incrv
srp = upper-right corner + incrv

ISS: with stpath, srp, try search distance first just above and
   then just below sdist.
pass/fail depending on (text first not found with expected path,
   then found with expected path)

END PROGRAM 5