5 from TestSketcher import SketcherTestCase
7 class SketcherSetEqual(SketcherTestCase):
8 def test_length_equality(self):
10 l1 = self.sketch.addLine(0, 0, 0, 1)
11 l2 = self.sketch.addLine(0, 0, 1, 1)
12 self.sketch.setEqual(l1.result(), l2.result())
13 # Commit the transaction
17 math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) +
18 math.pow((l1.endPointData().y() - l1.startPointData().y()), 2)
21 math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) +
22 math.pow((l2.endPointData().y() - l2.startPointData().y()), 2)
24 self.assertAlmostEqual(length_1, length_2, delta=TestSketcher.DELTA)
26 def test_radius_equality(self):
28 circle_1 = self.sketch.addCircle(0, 0, 10.0)
29 circle_2 = self.sketch.addCircle(1, 2, 25.0)
30 self.sketch.setEqual(circle_1.result(), circle_2.result())
31 # Commit the transaction
34 self.assertAlmostEqual(
35 circle_1.radiusData().value(),
36 circle_2.radiusData().value(),
37 delta=TestSketcher.DELTA
40 if __name__ == "__main__":
41 suite = unittest.TestLoader().loadTestsFromTestCase(SketcherSetEqual)
42 unittest.TextTestRunner(verbosity=2).run(suite)