#include #include "core/app/edit.hpp" #include "core/domain/parts.hpp" #include "core/domain/pins.hpp" // app::set_connector_type is pure core: validate the kind, tag the part and // apply the connector model. No Print/dialog/FTXUI. TEST_CASE("set_connector_type tags a part with a free-form kind") { Part p("J1"); p.add(new Pin("1")); p.add(new Pin("2")); app::SetConnectorTypeResult r = app::set_connector_type(&p, "myconn"); CHECK(r.ok); CHECK(r.error.empty()); CHECK(p.connector_type == "myconn"); } TEST_CASE("set_connector_type refuses a kind the part doesn't fit — no mutation") { Part p("J1"); p.add(new Pin("1")); p.add(new Pin("2")); p.add(new Pin("3")); // numeric pins don't fit the VPX single-letter columns app::SetConnectorTypeResult r = app::set_connector_type(&p, "vpx-3u-bkp-p0"); CHECK_FALSE(r.ok); CHECK_FALSE(r.error.empty()); CHECK(p.connector_type.empty()); // refused before any change } TEST_CASE("set_connector_type on a null part fails cleanly") { app::SetConnectorTypeResult r = app::set_connector_type(nullptr, "x"); CHECK_FALSE(r.ok); CHECK_FALSE(r.error.empty()); }