Fix T61275: recognize values with decimal separator in svg importer
This commit is contained in:
parent
ee01e362ee
commit
829154dd12
Notes:
blender-bot
2023-02-14 03:49:16 +01:00
Referenced by issue blender/blender#61275, certain SVG type fails to import
|
@ -31,7 +31,7 @@ def check_points_equal(point_a, point_b):
|
|||
return (abs(point_a[0] - point_b[0]) < 1e-6 and
|
||||
abs(point_a[1] - point_b[1]) < 1e-6)
|
||||
|
||||
match_number = r"-?\d+([eE][-+]?\d+)?"
|
||||
match_number = r"-?\d+(\.\d+)?([eE][-+]?\d+)?"
|
||||
match_first_comma = r"^\s*(?=,)"
|
||||
match_comma_pair = r",\s*(?=,)"
|
||||
match_last_comma = r",\s*$"
|
||||
|
|
|
@ -66,6 +66,12 @@ class ParseArrayOfFloatsTest(unittest.TestCase):
|
|||
def test_all_commas(self):
|
||||
self.assertEqual(parse_array_of_floats(",,,"), [0, 0, 0, 0])
|
||||
|
||||
def test_value_with_decimal_separator(self):
|
||||
self.assertEqual(parse_array_of_floats("3.5"), [3.5])
|
||||
|
||||
def test_comma_separated_values_with_decimal_separator(self):
|
||||
self.assertEqual(parse_array_of_floats("2.75,8.5"), [2.75, 8.5])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
||||
|
|
Loading…
Reference in New Issue