CAM: Make CAM tests and serialization robust to locale-dependent decimal separators
Updated CAM unit tests and LinuxCNC serializer to handle decimal separators consistently, ensuring tests pass regardless of system locale. Assertions now compare FreeCAD.Units.Quantity objects directly or normalize decimal separators in strings. LinuxCNC serializer output is forced to use periods for decimals. src/Mod/CAM/CAMTests/TestPathToolBitListWidget.py: - Normalize decimal separators in tool description assertions for locale robustness. src/Mod/CAM/CAMTests/TestPathToolBitPropertyEditorWidget.py: - Use FreeCAD.Units.Quantity for direct quantity comparisons in property editor tests. src/Mod/CAM/CAMTests/TestPathToolBitSerializer.py: - Compare deserialized and serialized quantities using FreeCAD.Units.Quantity for consistency. src/Mod/CAM/CAMTests/TestPathToolShapeClasses.py: - Compare parameter values and units directly instead of relying on string formatting. src/Mod/CAM/Path/Tool/library/serializers/linuxcnc.py: - Force period as decimal separator in LinuxCNC serializer output to avoid locale issues.
This commit is contained in:
committed by
Max Wilfinger
parent
e937063e41
commit
9cab1f8f52
@@ -56,7 +56,8 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
self.assertEqual(cell_widget.tool_no, str(tool_no))
|
||||
self.assertEqual(cell_widget.upper_text, toolbit.label)
|
||||
# Assuming the 5mm_Endmill asset has a shape named 'Endmill'
|
||||
self.assertEqual(cell_widget.lower_text, "5.00 mm 4-flute endmill, 30.00 mm cutting edge")
|
||||
normalized_lower_text = cell_widget.lower_text.replace(",00 ", ".00 ")
|
||||
self.assertEqual(normalized_lower_text, "5.00 mm 4-flute endmill, 30.00 mm cutting edge")
|
||||
|
||||
# Verify URI is stored in item data
|
||||
stored_uri = item.data(ToolBitUriRole)
|
||||
|
||||
Reference in New Issue
Block a user