|
|
|
|
@ -916,6 +916,37 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(1, result["wire_duct_carriers"])
|
|
|
|
|
self.assertEqual("selection", result["source_mode"])
|
|
|
|
|
|
|
|
|
|
def test_generate_routing_paths_does_not_duplicate_selected_wire_duct_carriers(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
auto_routing_panel = importlib.import_module("AutoRoutingPanel")
|
|
|
|
|
app = sys.modules["FreeCAD"]
|
|
|
|
|
gui = sys.modules["FreeCADGui"]
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
app.ActiveDocument = doc
|
|
|
|
|
terminal_objects.ensure_root_group(doc, "project-1")
|
|
|
|
|
duct = doc.addObject("Part::Feature", "UnlabeledLongDuct")
|
|
|
|
|
duct.Shape = FakeShape(FakeBoundBox(0, 160, -10, 10, 0, 20))
|
|
|
|
|
gui.Selection = types.SimpleNamespace(
|
|
|
|
|
getSelection=lambda: [],
|
|
|
|
|
getSelectionEx=lambda: [FakeSelectionItem(obj=duct)],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
first = auto_routing_panel.AutoRoutingController().generate_routing_paths()
|
|
|
|
|
second = auto_routing_panel.AutoRoutingController().generate_routing_paths()
|
|
|
|
|
carriers = routing_network.collect_route_carriers(doc)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, first["selected_wire_duct_carriers"])
|
|
|
|
|
self.assertEqual(0, second["selected_wire_duct_carriers"])
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
1,
|
|
|
|
|
len([item for item in carriers if item.QetRouteCarrierKind == "WireDuct"]),
|
|
|
|
|
)
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
2,
|
|
|
|
|
len([item for item in carriers if item.QetRouteCarrierKind == "WireDuctOpenEnd"]),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def test_prepare_layout_space_uses_whole_document_not_selected_face_workflow(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, _routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
|