Exemple #1
0
    def test_segment_bearing_rel(self):
        segment = SVGPathSegment('b')
        self.assertEqual((), segment.values)
        self.assertEqual((None, None), segment.end)
        exp = segment.tostring()
        self.assertEqual('', exp)

        segment = SVGPathSegment()
        bearing = segment.get_bearing(-90)
        self.assertEqual(-90, bearing)
        self.assertEqual((), segment.values)
        self.assertEqual((None, None), segment.end)

        segment = SVGPathSegment()
        segment.set_bearing_rel(-45)
        bearing = segment.get_bearing(-90)
        self.assertEqual(-135, bearing)
        self.assertEqual((-45,), segment.values)
        self.assertEqual((None, None), segment.end)

        segment = SVGPathSegment('b', 45)
        self.assertEqual((45,), segment.values)
        bearing = segment.get_bearing(-90)
        self.assertEqual(-45, bearing)

        segment = SVGPathSegment('b', -45)
        exp = segment.tostring()
        self.assertEqual('b-45', exp)
Exemple #2
0
    def test_segment_bearing_abs(self):
        segment = SVGPathSegment('B')
        self.assertTrue(not segment.isvalid())
        self.assertTrue(segment.isabsolute())
        self.assertTrue(not segment.isrelative())
        self.assertEqual((), segment.values)
        self.assertEqual((None, None), segment.end)
        exp = segment.tostring()
        self.assertEqual('', exp)

        segment = SVGPathSegment('B')
        bearing = segment.get_bearing(-90)
        self.assertEqual(-90, bearing)
        self.assertEqual((), segment.values)
        self.assertEqual((None, None), segment.end)

        segment = SVGPathSegment()
        segment.set_bearing_abs(-45)
        bearing = segment.get_bearing(-90)
        self.assertEqual(-45, bearing)
        self.assertEqual(segment.values, (-45,))
        self.assertEqual((None, None), segment.end)

        segment = SVGPathSegment('B', 45)
        self.assertEqual((45,), segment.values)
        bearing = segment.get_bearing(-90)
        self.assertEqual(45, bearing)

        segment = SVGPathSegment('B', -45)
        exp = segment.tostring()
        self.assertEqual('B-45', exp)