1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
23 from salome.shaper import model
24 from salome.shaper import geom
26 from TestSketcher import SketcherTestCase
28 class SketcherAddArc(SketcherTestCase):
29 def test_arc_by_coords(self):
30 arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
32 self.assertEqual(arc.startPoint().x(), 0)
33 self.assertEqual(arc.startPoint().y(), 0)
35 def test_arc_by_points(self):
36 center = geom.Pnt2d(0, 1)
37 start = geom.Pnt2d(0, 0)
38 end = geom.Pnt2d(1, 1)
39 arc = self.sketch.addArc(center, start, end, False)
41 self.assertEqual(arc.startPoint().x(), 0)
42 self.assertEqual(arc.startPoint().y(), 0)
44 def test_modify_arc(self):
45 # Note: arc will modify startPoint and endPoint to be in circle
46 arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
47 arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, False)
49 self.assertEqual(arc.center().x(), 0)
50 self.assertEqual(arc.center().y(), 0)
51 self.assertEqual(arc.startPoint().x(), 1)
52 self.assertEqual(arc.startPoint().y(), 1)
53 self.assertEqual(arc.endPoint().x(), -1)
54 self.assertEqual(arc.endPoint().y(), -1)
57 if __name__ == "__main__":
58 unittest.main(verbosity=2)