/[escript]/trunk/pycad/test/python/run_pycad_test.py
ViewVC logotype

Diff of /trunk/pycad/test/python/run_pycad_test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 917 by gross, Tue Jan 2 02:46:53 2007 UTC revision 919 by gross, Wed Jan 3 22:54:50 2007 UTC
# Line 757  class Test_PyCAD_Primitives(unittest.Tes Line 757  class Test_PyCAD_Primitives(unittest.Tes
757          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")
758          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")
759    
760            self.failUnless(not c.isColocated(p1),"spline is colocated with point.")
761            self.failUnless(not c.isColocated(Spline(p0,p1,p2)),"spline is colocated with spline of different length.")
762            self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"spline is colocated with spline with different point.")
763            self.failUnless(c.isColocated(Spline(p0,p1,p2,p3)),"spline is not colocated with spline with same points.")
764            self.failUnless(c.isColocated(Spline(p3,p2,p1,p0)),"spline is not colocated with spline with same points but opposite direction.")
765            self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")
766    
767          co=c.getControlPoints()          co=c.getControlPoints()
768          self.failUnless(co[0]==p0, "1st control point is wrong.")          self.failUnless(co[0]==p0, "1st control point is wrong.")
769          self.failUnless(co[1]==p1, "2nd control point is wrong.")          self.failUnless(co[1]==p1, "2nd control point is wrong.")
# Line 782  class Test_PyCAD_Primitives(unittest.Tes Line 789  class Test_PyCAD_Primitives(unittest.Tes
789          self.failUnless(c in h, "missing spline curve in history.")          self.failUnless(c in h, "missing spline curve in history.")
790    
791          cp=c.copy()          cp=c.copy()
         self.failUnless(not cp == c, "copy returns same spline curve.")  
792          cpcp=cp.getControlPoints()          cpcp=cp.getControlPoints()
793          self.failUnless(p0.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")          self.failUnless(not cp == c, "copy returns same spline curve.")
794          self.failUnless(p1.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")          self.failUnless(c.isColocated(cp),"spline curve is not colocated with its copy.")
795          self.failUnless(p2.isColocated(cpcp[2]),"3rd point of copy and source are not collocated.")          self.failUnless(not p0 == cpcp[0],"1st point of deep copy and source are the same.")
796          self.failUnless(p3.isColocated(cpcp[3]),"4th point of copy and source are not collocated.")          self.failUnless(not p1 == cpcp[1],"2st point of deep copy and source are the same.")
797          self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")          self.failUnless(not p2 == cpcp[2],"3st point of deep copy and source are the same.")
798          self.failUnless(not c.isColocated(p0),"spline curve is collocated with point.")          self.failUnless(not p3 == cpcp[3],"4st point of deep copy and source are the same.")
         self.failUnless(not c.isColocated(Spline(p0,p1)),"spline curve is collocated with shorter spline curve.")  
         self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")  
         self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"spline curve is collocated with defomed spline curve.")  
799    
800          c.modifyBy(Dilation(-1.))          c.modifyBy(Dilation(-1.))
         self.failUnless(c.isColocated(Spline(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")  
         self.failUnless(p0.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")  
         self.failUnless(p1.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")  
         self.failUnless(p2.isColocated(Point(-2,-2,-2)),"3rd point has not been modified through Dilation.")  
         self.failUnless(p3.isColocated(Point(-3,-3,-3)),"4th point has not been modified through Dilation.")  
801          cp=c.getControlPoints()          cp=c.getControlPoints()
802            self.failUnless(c.isColocated(Spline(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")
803          self.failUnless(p0 == cp[0],"1st new point after Dilation.")          self.failUnless(p0 == cp[0],"1st new point after Dilation.")
804          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")
805          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")
806          self.failUnless(p3 == cp[3],"4th new point after Dilation.")          self.failUnless(p3 == cp[3],"4th new point after Dilation.")
807    
808          dc=c.apply(Dilation(-1.))          dc=c.apply(Dilation(-1.))
         self.failUnless(dc.isColocated(Spline(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")  
809          dccp=dc.getControlPoints()          dccp=dc.getControlPoints()
810            self.failUnless(dc.isColocated(Spline(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")
811          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")
812          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")
813          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")
# Line 829  class Test_PyCAD_Primitives(unittest.Tes Line 828  class Test_PyCAD_Primitives(unittest.Tes
828          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")
829          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")
830    
831            self.failUnless(not c.isColocated(p1),"spline is colocated with point.")
832            self.failUnless(not c.isColocated(BezierCurve(p0,p1,p2)),"spline is colocated with spline of different length.")
833            self.failUnless(not c.isColocated(BezierCurve(p0,p1,p4,p3)),"spline is colocated with spline with different point.")
834            self.failUnless(c.isColocated(BezierCurve(p0,p1,p2,p3)),"spline is not colocated with spline with same points.")
835            self.failUnless(c.isColocated(BezierCurve(p3,p2,p1,p0)),"spline is not colocated with spline with same points but opposite direction.")
836            self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")
837    
838          co=c.getControlPoints()          co=c.getControlPoints()
839          self.failUnless(co[0]==p0, "1st control point is wrong.")          self.failUnless(co[0]==p0, "1st control point is wrong.")
840          self.failUnless(co[1]==p1, "2nd control point is wrong.")          self.failUnless(co[1]==p1, "2nd control point is wrong.")
# Line 854  class Test_PyCAD_Primitives(unittest.Tes Line 860  class Test_PyCAD_Primitives(unittest.Tes
860          self.failUnless(c in h, "missing spline curve in history.")          self.failUnless(c in h, "missing spline curve in history.")
861    
862          cp=c.copy()          cp=c.copy()
         self.failUnless(not cp == c, "copy returns same spline curve.")  
863          cpcp=cp.getControlPoints()          cpcp=cp.getControlPoints()
864          self.failUnless(p0.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")          self.failUnless(not cp == c, "copy returns same spline curve.")
865          self.failUnless(p1.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")          self.failUnless(c.isColocated(cp),"spline curve is not colocated with its copy.")
866          self.failUnless(p2.isColocated(cpcp[2]),"3rd point of copy and source are not collocated.")          self.failUnless(not p0 == cpcp[0],"1st point of deep copy and source are the same.")
867          self.failUnless(p3.isColocated(cpcp[3]),"4th point of copy and source are not collocated.")          self.failUnless(not p1 == cpcp[1],"2st point of deep copy and source are the same.")
868          self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")          self.failUnless(not p2 == cpcp[2],"3st point of deep copy and source are the same.")
869          self.failUnless(not c.isColocated(p0),"spline curve is collocated with point.")          self.failUnless(not p3 == cpcp[3],"4st point of deep copy and source are the same.")
         self.failUnless(not c.isColocated(BezierCurve(p0,p1)),"spline curve is collocated with shorter spline curve.")  
         self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")  
         self.failUnless(not c.isColocated(BezierCurve(p0,p1,p4,p3)),"spline curve is collocated with defomed spline curve.")  
870    
871          c.modifyBy(Dilation(-1.))          c.modifyBy(Dilation(-1.))
         self.failUnless(c.isColocated(BezierCurve(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")  
         self.failUnless(p0.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")  
         self.failUnless(p1.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")  
         self.failUnless(p2.isColocated(Point(-2,-2,-2)),"3rd point has not been modified through Dilation.")  
         self.failUnless(p3.isColocated(Point(-3,-3,-3)),"4th point has not been modified through Dilation.")  
872          cp=c.getControlPoints()          cp=c.getControlPoints()
873            self.failUnless(c.isColocated(BezierCurve(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")
874          self.failUnless(p0 == cp[0],"1st new point after Dilation.")          self.failUnless(p0 == cp[0],"1st new point after Dilation.")
875          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")
876          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")
877          self.failUnless(p3 == cp[3],"4th new point after Dilation.")          self.failUnless(p3 == cp[3],"4th new point after Dilation.")
878    
879          dc=c.apply(Dilation(-1.))          dc=c.apply(Dilation(-1.))
         self.failUnless(dc.isColocated(BezierCurve(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")  
880          dccp=dc.getControlPoints()          dccp=dc.getControlPoints()
881            self.failUnless(dc.isColocated(BezierCurve(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")
882          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")
883          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")
884          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")
# Line 900  class Test_PyCAD_Primitives(unittest.Tes Line 898  class Test_PyCAD_Primitives(unittest.Tes
898          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")
899          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")          self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve")
900    
901            self.failUnless(not c.isColocated(p1),"spline is colocated with point.")
902            self.failUnless(not c.isColocated(BSpline(p0,p1,p2)),"spline is colocated with spline of different length.")
903            self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline is colocated with spline with different point.")
904            self.failUnless(c.isColocated(BSpline(p0,p1,p2,p3)),"spline is not colocated with spline with same points.")
905            self.failUnless(c.isColocated(BSpline(p3,p2,p1,p0)),"spline is not colocated with spline with same points but opposite direction.")
906            self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")
907    
908          co=c.getControlPoints()          co=c.getControlPoints()
909          self.failUnless(co[0]==p0, "1st control point is wrong.")          self.failUnless(co[0]==p0, "1st control point is wrong.")
910          self.failUnless(co[1]==p1, "2nd control point is wrong.")          self.failUnless(co[1]==p1, "2nd control point is wrong.")
# Line 925  class Test_PyCAD_Primitives(unittest.Tes Line 930  class Test_PyCAD_Primitives(unittest.Tes
930          self.failUnless(c in h, "missing spline curve in history.")          self.failUnless(c in h, "missing spline curve in history.")
931    
932          cp=c.copy()          cp=c.copy()
         self.failUnless(not cp == c, "copy returns same spline curve.")  
933          cpcp=cp.getControlPoints()          cpcp=cp.getControlPoints()
934          self.failUnless(p0.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")          self.failUnless(not cp == c, "copy returns same spline curve.")
935          self.failUnless(p1.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")          self.failUnless(c.isColocated(cp),"spline curve is not colocated with its copy.")
936          self.failUnless(p2.isColocated(cpcp[2]),"3rd point of copy and source are not collocated.")          self.failUnless(not p0 == cpcp[0],"1st point of deep copy and source are the same.")
937          self.failUnless(p3.isColocated(cpcp[3]),"4th point of copy and source are not collocated.")          self.failUnless(not p1 == cpcp[1],"2st point of deep copy and source are the same.")
938          self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")          self.failUnless(not p2 == cpcp[2],"3st point of deep copy and source are the same.")
939          self.failUnless(not c.isColocated(p0),"spline curve is collocated with point.")          self.failUnless(not p3 == cpcp[3],"4st point of deep copy and source are the same.")
         self.failUnless(not c.isColocated(BSpline(p0,p1)),"spline curve is collocated with shorter spline curve.")  
         self.failUnless(not c.isColocated(Curve(p0,p1,p2,p3)),"spline curve is identified with curve.")  
         self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline curve is collocated with defomed spline curve.")  
940    
941          c.modifyBy(Dilation(-1.))          c.modifyBy(Dilation(-1.))
         self.failUnless(c.isColocated(BSpline(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")  
         self.failUnless(p0.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")  
         self.failUnless(p1.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")  
         self.failUnless(p2.isColocated(Point(-2,-2,-2)),"3rd point has not been modified through Dilation.")  
         self.failUnless(p3.isColocated(Point(-3,-3,-3)),"4th point has not been modified through Dilation.")  
942          cp=c.getControlPoints()          cp=c.getControlPoints()
943            self.failUnless(c.isColocated(BSpline(Point(0,0,0),Point(-1,-1,-1),Point(-2,-2,-2),Point(-3,-3,-3))),"inplace dilation is wrong.")
944          self.failUnless(p0 == cp[0],"1st new point after Dilation.")          self.failUnless(p0 == cp[0],"1st new point after Dilation.")
945          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")
946          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")          self.failUnless(p2 == cp[2],"3rd new point after Dilation.")
947          self.failUnless(p3 == cp[3],"4th new point after Dilation.")          self.failUnless(p3 == cp[3],"4th new point after Dilation.")
948    
949          dc=c.apply(Dilation(-1.))          dc=c.apply(Dilation(-1.))
         self.failUnless(dc.isColocated(BSpline(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")  
950          dccp=dc.getControlPoints()          dccp=dc.getControlPoints()
951            self.failUnless(dc.isColocated(BSpline(Point(0,0,0),Point(1,1,1),Point(2,2,2),Point(3,3,3))),"dilation is wrong.")
952          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")
953          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")
954          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")          self.failUnless(not p2 == dccp[2],"3rd point of Dilation is identical to source.")
# Line 971  class Test_PyCAD_Primitives(unittest.Tes Line 968  class Test_PyCAD_Primitives(unittest.Tes
968          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")          self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve")
969          self.failUnless(c.getEndPoint()==p1, "wrong end point of spline curve")          self.failUnless(c.getEndPoint()==p1, "wrong end point of spline curve")
970    
971            self.failUnless(not c.isColocated(p1),"spline is colocated with point.")
972            self.failUnless(not c.isColocated(Line(p0,p4)),"spline is colocated with spline with different point.")
973            self.failUnless(c.isColocated(Line(p0,p1)),"spline is not colocated with spline with same points.")
974            self.failUnless(c.isColocated(Line(p1,p0)),"spline is not colocated with spline with same points but opposite direction.")
975            self.failUnless(not c.isColocated(Curve(p0,p1,p4)),"spline curve is identified with curve.")
976    
977          co=c.getControlPoints()          co=c.getControlPoints()
978          self.failUnless(co[0]==p0, "1st control point is wrong.")          self.failUnless(co[0]==p0, "1st control point is wrong.")
979          self.failUnless(co[1]==p1, "2nd control point is wrong.")          self.failUnless(co[1]==p1, "2nd control point is wrong.")
# Line 990  class Test_PyCAD_Primitives(unittest.Tes Line 993  class Test_PyCAD_Primitives(unittest.Tes
993          self.failUnless(c in h, "missing spline curve in history.")          self.failUnless(c in h, "missing spline curve in history.")
994    
995          cp=c.copy()          cp=c.copy()
         self.failUnless(not cp == c, "copy returns same spline curve.")  
996          cpcp=cp.getControlPoints()          cpcp=cp.getControlPoints()
997          self.failUnless(p0.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")          self.failUnless(not cp == c, "copy returns same spline curve.")
998          self.failUnless(p1.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")          self.failUnless(c.isColocated(cp),"spline curve is not colocated with its copy.")
999          self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")          self.failUnless(not p0 == cpcp[0],"1st point of deep copy and source are the same.")
1000          self.failUnless(not c.isColocated(p0),"spline curve is collocated with point.")          self.failUnless(not p1 == cpcp[1],"2st point of deep copy and source are the same.")
         self.failUnless(not c.isColocated(Curve(p0,p1)),"spline curve is identified with curve.")  
         self.failUnless(not c.isColocated(Line(p0,p4)),"spline curve is collocated with defomed spline curve.")  
1001    
1002          c.modifyBy(Dilation(-1.))          c.modifyBy(Dilation(-1.))
         self.failUnless(c.isColocated(Line(Point(0,0,0),Point(-1,-1,-1))),"inplace dilation is wrong.")  
         self.failUnless(p0.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")  
         self.failUnless(p1.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")  
1003          cp=c.getControlPoints()          cp=c.getControlPoints()
1004            self.failUnless(c.isColocated(Line(Point(0,0,0),Point(-1,-1,-1))),"inplace dilation is wrong.")
1005          self.failUnless(p0 == cp[0],"1st new point after Dilation.")          self.failUnless(p0 == cp[0],"1st new point after Dilation.")
1006          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")          self.failUnless(p1 == cp[1],"2nd new point after Dilation.")
1007    
1008          dc=c.apply(Dilation(-1.))          dc=c.apply(Dilation(-1.))
         self.failUnless(dc.isColocated(Line(Point(0,0,0),Point(1,1,1))),"dilation is wrong.")  
1009          dccp=dc.getControlPoints()          dccp=dc.getControlPoints()
1010            self.failUnless(dc.isColocated(Line(Point(0,0,0),Point(1,1,1))),"dilation is wrong.")
1011          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")          self.failUnless(not p0 == dccp[0],"1st point of Dilation is identical to source.")
1012          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")          self.failUnless(not p1 == dccp[1],"2nd point of Dilation is identical to source.")
1013    
# Line 1017  class Test_PyCAD_Primitives(unittest.Tes Line 1015  class Test_PyCAD_Primitives(unittest.Tes
1015          center=Point(0,0,0,0.1)          center=Point(0,0,0,0.1)
1016          p_start=Point(1,1,1,0.2)          p_start=Point(1,1,1,0.2)
1017          p_end=Point(1,2,3)          p_end=Point(1,2,3)
1018            p4=Point(10,2,3)
1019    
1020          self.failUnlessRaises(TypeError,Arc,Primitive())          self.failUnlessRaises(TypeError,Arc,Primitive())
1021    
# Line 1027  class Test_PyCAD_Primitives(unittest.Tes Line 1026  class Test_PyCAD_Primitives(unittest.Tes
1026          self.failUnless(c.getEndPoint()==p_end, "wrong end point")          self.failUnless(c.getEndPoint()==p_end, "wrong end point")
1027    
1028          code=c.getGmshCommand()          code=c.getGmshCommand()
1029          self.failUnless(code == "Circle(5) = {2, 1, 3};", "gmsh command wrong.")          self.failUnless(code == "Circle(6) = {2, 1, 3};", "gmsh command wrong.")
1030    
1031            self.failUnless(not c.isColocated(p4),"spline is colocated with point.")
1032            self.failUnless(not c.isColocated(Arc(p4,p_start,p_end)),"spline is colocated with spline with differnt center point.")
1033            self.failUnless(not c.isColocated(Arc(center,p4,p_end)),"spline is colocated with spline with differnt start point.")
1034            self.failUnless(not c.isColocated(Arc(center,p_start,p4)),"spline is colocated with spline with differnt end point.")
1035            self.failUnless(c.isColocated(Arc(center,p_start,p_end)),"spline is not colocated with spline with same points.")
1036            self.failUnless(c.isColocated(Arc(center,p_end,p_start)),"spline is not colocated with spline with same points but opposite direction.")
1037            self.failUnless(not c.isColocated(Curve(center,p_start,p_end)),"spline curve is identified with curve.")
1038    
1039          h=c.getPrimitives()          h=c.getPrimitives()
1040          self.failUnless(len(h) == 4, "number of primitives in history is wrong.")          self.failUnless(len(h) == 4, "number of primitives in history is wrong.")
# Line 1045  class Test_PyCAD_Primitives(unittest.Tes Line 1052  class Test_PyCAD_Primitives(unittest.Tes
1052          cp=c.copy()          cp=c.copy()
1053          self.failUnless(isinstance(cp,Arc), "copy returns is not an arc.")          self.failUnless(isinstance(cp,Arc), "copy returns is not an arc.")
1054          self.failUnless(not cp == c, "copy returns same arc.")          self.failUnless(not cp == c, "copy returns same arc.")
1055            self.failUnless(cp.isColocated(Arc(center,p_start,p_end)),"arc is not colocated with its copy.")
1056          cpcp=cp.getControlPoints()          self.failUnless(not cp.getCenterPoint()==center, "deep copy has same center point like source")
1057          self.failUnless(center.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")          self.failUnless(not cp.getStartPoint()==p_start, "deep copy has same start point like source")
1058          self.failUnless(p_start.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")          self.failUnless(not cp.getEndPoint()==p_end, "deep copy has same end point like source")
         self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")  
         self.failUnless(not c.isColocated(center),"spline curve is collocated with point.")  
         self.failUnless(not c.isColocated(Curve(center,p_start)),"spline curve is identified with curve.")  
         self.failUnless(not c.isColocated(Line(center,p4)),"spline curve is collocated with defomed spline curve.")  
1059    
1060          c.modifyBy(Dilation(-1.))          c.modifyBy(Dilation(-1.))
1061          self.failUnless(c.isColocated(Line(Point(0,0,0),Point(-1,-1,-1))),"inplace dilation is wrong.")          self.failUnless(c.isColocated(Arc(Point(0,0,0),Point(-1,-1,-1),Point(-1,-2,-3))),"inplace dilation is wrong.")
1062          self.failUnless(center.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")          self.failUnless(c.getCenterPoint() == center,"wrong center point after dilation.")
1063          self.failUnless(p_start.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")          self.failUnless(c.getStartPoint() == p_start,"wrong start point after dilation.")
1064          cp=c.getControlPoints()          self.failUnless(c.getEndPoint() == p_end,"wrong end point after dilation.")
         self.failUnless(center == cp[0],"1st new point after Dilation.")  
         self.failUnless(p_start == cp[1],"2nd new point after Dilation.")  
1065    
1066          dc=c.apply(Dilation(-1.))          dc=c.apply(Dilation(-1.))
1067          self.failUnless(dc.isColocated(Line(Point(0,0,0),Point(1,1,1))),"dilation is wrong.")          self.failUnless(dc.isColocated(Arc(Point(0,0,0),Point(1,1,1),Point(1,2,3))),"dilation is wrong.")
1068          dccp=dc.getControlPoints()          self.failUnless(not dc.getCenterPoint() == center,"center point of dilation is identical to source.")
1069          self.failUnless(not center == dccp[0],"1st point of Dilation is identical to source.")          self.failUnless(not dc.getStartPoint() == p_start,"start point of dilation is identical to source.")
1070          self.failUnless(not p_start == dccp[1],"2nd point of Dilation is identical to source.")          self.failUnless(not dc.getEndPoint() == p_end,"end point of dilation is identical to source.")
1071    
1072    
1073  if __name__ == '__main__':  if __name__ == '__main__':

Legend:
Removed from v.917  
changed lines
  Added in v.919

  ViewVC Help
Powered by ViewVC 1.1.26