Fixing issue #1651 (errors when adding polygons with 4 points) - needs some testing

This commit is contained in:
Matthias Koefferlein
2024-03-23 15:24:18 +01:00
parent 230bacf725
commit 38a3b8305e
8 changed files with 54 additions and 31 deletions
+10
View File
@@ -746,6 +746,16 @@ class DBPolygonTests(unittest.TestCase):
poly = pya.Polygon(hull).insert_hole(hole1).insert_hole(hole2)
self.assertEqual(str(poly), "(0,0;0,3000;6000,3000;6000,0/1000,1000;2000,1000;2000,2000;1000,2000/3000,1000;4000,1000;4000,2000;3000,2000)")
def test_argumentShortcuts(self):
# implicit conversion to a Point array:
poly = pya.Polygon([ (0,0), (0,1000), (1000,1000) ])
self.assertEqual(str(poly), "(0,0;0,1000;1000,1000)")
# issue 1651 - no binding to Box constructor
poly = pya.Polygon([ (0,0), (0,1000), (1000,1000), (1000,0) ])
self.assertEqual(str(poly), "(0,0;0,1000;1000,1000;1000,0)")
# run unit tests
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(DBPolygonTests)