/[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 916 by gross, Fri Dec 15 08:25:57 2006 UTC revision 917 by gross, Tue Jan 2 02:46:53 2007 UTC
# Line 1013  class Test_PyCAD_Primitives(unittest.Tes Line 1013  class Test_PyCAD_Primitives(unittest.Tes
1013          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.")
1014          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.")
1015    
1016       def test_arc(self):
1017            center=Point(0,0,0,0.1)
1018            p_start=Point(1,1,1,0.2)
1019            p_end=Point(1,2,3)
1020    
1021            self.failUnlessRaises(TypeError,Arc,Primitive())
1022    
1023            c=Arc(center,p_start,p_end)
1024    
1025            self.failUnless(c.getCenterPoint()==center, "wrong center point")
1026            self.failUnless(c.getStartPoint()==p_start, "wrong start point")
1027            self.failUnless(c.getEndPoint()==p_end, "wrong end point")
1028    
1029            code=c.getGmshCommand()
1030            self.failUnless(code == "Circle(5) = {2, 1, 3};", "gmsh command wrong.")
1031    
1032            h=c.getPrimitives()
1033            self.failUnless(len(h) == 4, "number of primitives in history is wrong.")
1034            self.failUnless(center in h, "missing center in history.")
1035            self.failUnless(p_start in h, "missing p_start in history.")
1036            self.failUnless(p_end in h, "missing p_end in history.")
1037            self.failUnless(c in h, "missing spline curve in history.")
1038    
1039    
1040            c.setLocalScale(3.)
1041            self.failUnless(c.getCenterPoint().getLocalScale() == 3., "new local scale of center point is wrong.")
1042            self.failUnless(c.getStartPoint().getLocalScale() == 3., "new local scale of start point is wrong.")
1043            self.failUnless(c.getEndPoint().getLocalScale() == 3., "new local scale of end point is wrong.")
1044    
1045            cp=c.copy()
1046            self.failUnless(isinstance(cp,Arc), "copy returns is not an arc.")
1047            self.failUnless(not cp == c, "copy returns same arc.")
1048    
1049            cpcp=cp.getControlPoints()
1050            self.failUnless(center.isColocated(cpcp[0]),"1st point of copy and source are not collocated.")
1051            self.failUnless(p_start.isColocated(cpcp[1]),"2nd point of copy and source are not collocated.")
1052            self.failUnless(c.isColocated(cp),"spline curve is not collocated with its copy.")
1053            self.failUnless(not c.isColocated(center),"spline curve is collocated with point.")
1054            self.failUnless(not c.isColocated(Curve(center,p_start)),"spline curve is identified with curve.")
1055            self.failUnless(not c.isColocated(Line(center,p4)),"spline curve is collocated with defomed spline curve.")
1056    
1057            c.modifyBy(Dilation(-1.))
1058            self.failUnless(c.isColocated(Line(Point(0,0,0),Point(-1,-1,-1))),"inplace dilation is wrong.")
1059            self.failUnless(center.isColocated(Point(0,0,0)),"1st point has not been modified through Dilation.")
1060            self.failUnless(p_start.isColocated(Point(-1,-1,-1)),"2nd point has not been modified through Dilation.")
1061            cp=c.getControlPoints()
1062            self.failUnless(center == cp[0],"1st new point after Dilation.")
1063            self.failUnless(p_start == cp[1],"2nd new point after Dilation.")
1064    
1065            dc=c.apply(Dilation(-1.))
1066            self.failUnless(dc.isColocated(Line(Point(0,0,0),Point(1,1,1))),"dilation is wrong.")
1067            dccp=dc.getControlPoints()
1068            self.failUnless(not center == dccp[0],"1st point of Dilation is identical to source.")
1069            self.failUnless(not p_start == dccp[1],"2nd point of Dilation is identical to source.")
1070    
1071    
1072  if __name__ == '__main__':  if __name__ == '__main__':
1073     suite = unittest.TestSuite()     suite = unittest.TestSuite()

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

  ViewVC Help
Powered by ViewVC 1.1.26