mirror of https://github.com/KLayout/klayout.git
Doc update, tests for new annotation features
This commit is contained in:
parent
069c3e6447
commit
eedfc7c00f
|
|
@ -76,6 +76,7 @@
|
|||
<li><b>X:</b> The horizontal extension of the ruler in micron units.</li>
|
||||
<li><b>Y:</b> The vertical extension of the ruler in micron units.</li>
|
||||
<li><b>A:</b> The area enclosed by the ruler (if it was a box) in square millimeters.</li>
|
||||
<li><b>G:</b> The angle enclosed by the first and last segment of the ruler (used for angle measurement rulers).</li>
|
||||
</ul>
|
||||
|
||||
</doc>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,19 @@ def annot_obj( p1, p2, fmt, fmt_x, fmt_y, style, outline, snap, ac )
|
|||
return a
|
||||
end
|
||||
|
||||
def annot_obj2( pts, fmt, fmt_x, fmt_y, style, outline, snap, ac )
|
||||
a = RBA::Annotation::new
|
||||
a.points = pts
|
||||
a.fmt = fmt
|
||||
a.fmt_x = fmt_x
|
||||
a.fmt_y = fmt_y
|
||||
a.style = style
|
||||
a.outline = outline
|
||||
a.snap = snap
|
||||
a.angle_constraint = ac
|
||||
return a
|
||||
end
|
||||
|
||||
class RBA::Annotation
|
||||
def style_to_s(s)
|
||||
if s == StyleRuler
|
||||
|
|
@ -72,6 +85,12 @@ class RBA::Annotation
|
|||
"diag_yx"
|
||||
elsif s == OutlineBox
|
||||
"diag_box"
|
||||
elsif s == OutlineEllipse
|
||||
"ellipse"
|
||||
elsif s == OutlineAngle
|
||||
"angle"
|
||||
elsif s == OutlineRadius
|
||||
"radius"
|
||||
else
|
||||
""
|
||||
end
|
||||
|
|
@ -119,7 +138,7 @@ class RBA::Annotation
|
|||
""
|
||||
end
|
||||
end
|
||||
def to_s
|
||||
def to_s_debug
|
||||
s = "p1=" + p1.to_s + ", p2=" + p2.to_s + ", fmt=" + fmt + ", fmt_x=" + fmt_x + ", fmt_y=" + fmt_y +
|
||||
", style=" + self.style_to_s(style) + ", outline=" + self.outline_to_s(outline) + ", snap=" + snap?.to_s + ", ac=" + self.ac_to_s(angle_constraint)
|
||||
if category != ""
|
||||
|
|
@ -160,13 +179,52 @@ class Ant_TestClass < TestBase
|
|||
end
|
||||
|
||||
a = RBA::Annotation::new
|
||||
assert_equal( a.to_s, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
|
||||
a.outline = RBA::Annotation::OutlineXY
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=xy, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineDiagXY
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag_xy, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineYX
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=yx, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineDiagYX
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag_yx, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineBox
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag_box, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineEllipse
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=ellipse, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineAngle
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=angle, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineRadius
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=radius, snap=true, ac=global" )
|
||||
a.outline = RBA::Annotation::OutlineDiag
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
|
||||
a.style = RBA::Annotation::StyleArrowEnd
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=arrow_end, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleArrowStart
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=arrow_start, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleArrowBoth
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=arrow_both, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleLine
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=line, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleCrossEnd
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=cross_end, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleCrossStart
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=cross_start, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleCrossBoth
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=cross_both, outline=diag, snap=true, ac=global" )
|
||||
a.style = RBA::Annotation::StyleRuler
|
||||
assert_equal( a.to_s_debug, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
a = annot_obj2( [ RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ) ], "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
b = a.dup
|
||||
assert_equal( b.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( b.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
a = RBA::Annotation::new
|
||||
|
||||
assert_equal( a == b, false )
|
||||
|
|
@ -177,10 +235,10 @@ class Ant_TestClass < TestBase
|
|||
assert_equal( a != b, false )
|
||||
|
||||
c = a.transformed( RBA::DTrans::new( RBA::DPoint::new( 10.0, 20.0 ) ) )
|
||||
assert_equal( c.to_s, "p1=11,22, p2=13,24, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( c.to_s_debug, "p1=11,22, p2=13,24, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
c = a.transformed_cplx( RBA::DCplxTrans::new( RBA::DTrans::new( RBA::DPoint::new( 11.0, 22.0 ) ) ) )
|
||||
assert_equal( c.to_s, "p1=12,24, p2=14,26, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( c.to_s_debug, "p1=12,24, p2=14,26, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
a.fmt = "X=$X,Y=$Y,D=$D,A=$A,P=$P,Q=$Q,U=$U,V=$V"
|
||||
a.fmt_x = "$(X*1000)+$(Y*1e3)"
|
||||
|
|
@ -189,199 +247,199 @@ class Ant_TestClass < TestBase
|
|||
assert_equal( a.text_y, "c" )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.category = "abc"
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, category=abc" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, category=abc" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_position = RBA::Annotation::PositionP1
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=p1" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=p1" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_position = RBA::Annotation::PositionP2
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=p2" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=p2" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_position = RBA::Annotation::PositionCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_position=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_xalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_xalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_xalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_xalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_yalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_yalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.main_yalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, main_yalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_xalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_xalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_xalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_xalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_yalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_yalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.xlabel_yalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, xlabel_yalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_xalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_xalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_xalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_xalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_yalign = RBA::Annotation::AlignCenter
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=center" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=center" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_yalign = RBA::Annotation::AlignLeft
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=down" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=down" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
||||
a = annot_obj( RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ), "a", "b", "c", 1, 2, false, 3 )
|
||||
assert_equal( a.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
aa = a.dup
|
||||
aa.ylabel_yalign = RBA::Annotation::AlignRight
|
||||
assert_equal( aa.to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=up" )
|
||||
assert_equal( aa.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal, ylabel_yalign=up" )
|
||||
assert_equal( a == aa, false )
|
||||
a = aa.dup
|
||||
assert_equal( a == aa, true )
|
||||
|
|
@ -421,10 +479,10 @@ class Ant_TestClass < TestBase
|
|||
assert_equal( a.is_valid?, true )
|
||||
assert_equal( lv.annotation( -1 ).is_valid?, false )
|
||||
assert_equal( lv.annotation( a.id ).is_valid?, true )
|
||||
assert_equal( lv.annotation( a.id ).to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
assert_equal( lv.annotation( a.id ).to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
id = nil
|
||||
|
|
@ -445,19 +503,19 @@ class Ant_TestClass < TestBase
|
|||
assert_equal( asc, 1 )
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=u, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
lv.erase_annotation(id)
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
|
||||
lv.clear_annotations
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "" )
|
||||
|
||||
mw.close_all
|
||||
|
|
@ -483,25 +541,25 @@ class Ant_TestClass < TestBase
|
|||
lv.insert_annotation( a )
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |x| arr.push( x.to_s ) }
|
||||
lv.each_annotation { |x| arr.push( x.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
a.fmt = "u"
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=u, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
a.delete
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||
|
||||
a0.delete
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "" )
|
||||
|
||||
a0 = RBA::Annotation::new
|
||||
|
|
@ -511,19 +569,19 @@ class Ant_TestClass < TestBase
|
|||
lv.insert_annotation( a )
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |x| arr.push( x.to_s ) }
|
||||
lv.each_annotation { |x| arr.push( x.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
lv.each_annotation { |x| x.fmt = "q" }
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |x| arr.push( x.to_s ) }
|
||||
lv.each_annotation { |x| arr.push( x.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "p1=0,0, p2=0,0, fmt=q, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global;p1=1,2, p2=3,4, fmt=q, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal" )
|
||||
|
||||
lv.each_annotation { |x| x.delete }
|
||||
|
||||
arr = []
|
||||
lv.each_annotation { |a| arr.push( a.to_s ) }
|
||||
lv.each_annotation { |a| arr.push( a.to_s_debug ) }
|
||||
assert_equal( arr.join( ";" ), "" )
|
||||
|
||||
mw.close_all
|
||||
|
|
@ -551,14 +609,14 @@ class Ant_TestClass < TestBase
|
|||
arr = []
|
||||
lv.each_annotation_selected { |a| arr.push(a) }
|
||||
assert_equal(arr.size, 1)
|
||||
assert_equal(arr[0].to_s, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
assert_equal(arr[0].to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
|
||||
arr[0].p1 = RBA::DPoint::new(11, 12)
|
||||
|
||||
arr = []
|
||||
lv.each_annotation_selected { |a| arr.push(a) }
|
||||
assert_equal(arr.size, 1)
|
||||
assert_equal(arr[0].to_s, "p1=11,12, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
assert_equal(arr[0].to_s_debug, "p1=11,12, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
|
||||
mw.close_all
|
||||
|
||||
|
|
@ -601,6 +659,53 @@ class Ant_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
# multi-segment rulers
|
||||
def test_6
|
||||
|
||||
a = annot_obj2( [ RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 3.0, 4.0 ) ], "a", "b", "c", 1, 2, false, 3)
|
||||
assert_equal(a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
assert_equal(a.to_s, "id=-1,x1=1,y1=2,x2=3,y2=4,category='',fmt=a,fmt_x=b,fmt_y=c,position=auto,xalign=auto,yalign=auto,xlabel_xalign=auto,xlabel_yalign=auto,ylabel_xalign=auto,ylabel_yalign=auto,style=arrow_end,outline=diag_xy,snap=false,angle_constraint=horizontal")
|
||||
aa = RBA::Annotation::from_s(a.to_s)
|
||||
assert_equal(aa.to_s, a. to_s)
|
||||
|
||||
a = annot_obj2( [ RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 1.5, 2.5 ), RBA::DPoint::new( 3.0, 4.0 ) ], "a", "b", "c", 1, 2, false, 3)
|
||||
assert_equal(a.to_s_debug, "p1=1,2, p2=3,4, fmt=a, fmt_x=b, fmt_y=c, style=arrow_end, outline=diag_xy, snap=false, ac=horizontal")
|
||||
assert_equal(a.to_s, "id=-1,pt=1:2,pt=1.5:2.5,pt=3:4,category='',fmt=a,fmt_x=b,fmt_y=c,position=auto,xalign=auto,yalign=auto,xlabel_xalign=auto,xlabel_yalign=auto,ylabel_xalign=auto,ylabel_yalign=auto,style=arrow_end,outline=diag_xy,snap=false,angle_constraint=horizontal")
|
||||
assert_equal(a.segments, 2)
|
||||
assert_equal(a.seg_p1(0).to_s, "1,2")
|
||||
assert_equal(a.seg_p2(0).to_s, "1.5,2.5")
|
||||
assert_equal(a.seg_p1(1).to_s, "1.5,2.5")
|
||||
assert_equal(a.seg_p2(1).to_s, "3,4")
|
||||
a.fmt_x = "$X"
|
||||
a.fmt_y = "$(Y*2)"
|
||||
a.fmt = "$D"
|
||||
assert_equal(a.text_x(0), "0.5")
|
||||
assert_equal(a.text_x(1), "1.5")
|
||||
assert_equal(a.text_y(0), "1")
|
||||
assert_equal(a.text_y(1), "3")
|
||||
assert_equal(a.text(0), "0.70710678")
|
||||
assert_equal(a.text(1), "2.1213203")
|
||||
aa = RBA::Annotation::from_s(a.to_s)
|
||||
assert_equal(aa.to_s, a. to_s)
|
||||
|
||||
assert_equal(a.points.collect { |p| p.to_s }.join(";"), "1,2;1.5,2.5;3,4")
|
||||
|
||||
a.p1 = RBA::DPoint::new(1.1, 2.1)
|
||||
assert_equal(a.points.collect { |p| p.to_s }.join(";"), "1.1,2.1;1.5,2.5;3,4")
|
||||
|
||||
a.p2 = RBA::DPoint::new(3.1, 4.1)
|
||||
assert_equal(a.points.collect { |p| p.to_s }.join(";"), "1.1,2.1;1.5,2.5;3.1,4.1")
|
||||
|
||||
a.points = [ RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 2.0, 3.0 ) ]
|
||||
assert_equal(a.points.collect { |p| p.to_s }.join(";"), "1,2;2,3")
|
||||
assert_equal(a.segments, 1)
|
||||
|
||||
a.points = [ RBA::DPoint::new( 1.0, 2.0 ), RBA::DPoint::new( 1.0, 2.0 ) ]
|
||||
assert_equal(a.points.collect { |p| p.to_s }.join(";"), "1,2")
|
||||
assert_equal(a.segments, 1)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
|
|
|||
Loading…
Reference in New Issue