52 m_mgr.LoadProject(
"" );
85 m_screen->Append( busWire );
89 m_screen->Append( label );
92 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
93 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
101 BOOST_CHECK( busConn->
IsBus() );
102 BOOST_CHECK( busConn->
Members().empty() );
105 manager.
SetEnvironment( m_schematic.get(),
nullptr,
nullptr,
nullptr,
nullptr );
107 commit.
Modify( label, m_screen );
108 label->
SetText( wxT(
"test[0..7]" ) );
114 BOOST_CHECK( busConn->
IsBus() );
115 BOOST_CHECK_MESSAGE( !busConn->
Members().empty(),
116 "Bus wire should have members after label changed to bus name" );
119 if( !busConn->
Members().empty() )
135 m_screen->Append( busWire );
139 m_screen->Append( label );
142 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
143 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
150 BOOST_CHECK( busConn->
IsBus() );
151 BOOST_CHECK_MESSAGE( !busConn->
Members().empty(),
152 "Bus wire should have members from bus label" );
155 if( !busConn->
Members().empty() )
170 const wxString busName( wxT(
"bus{A B}" ) );
171 const int sheetLeft = 10000000;
177 childScreen->
SetFileName( wxT(
"child.kicad_sch" ) );
179 childSheet->
SetName( wxT(
"child" ) );
180 childSheet->
SetFileName( wxT(
"child.kicad_sch" ) );
181 m_screen->Append( childSheet );
191 m_screen->Append( busWire );
193 m_schematic->RefreshHierarchy();
196 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
201 BOOST_REQUIRE_MESSAGE( pinConn !=
nullptr,
"Sheet pin has no connection before the move" );
202 BOOST_REQUIRE_MESSAGE( pinConn->
IsBus(),
"Sheet pin is not a bus before the move" );
205 const VECTOR2I newPos( sheetLeft, 8000000 );
207 pin->SetPosition( newPos );
209 pin->SetConnectivityDirty(
true );
215 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
219 BOOST_CHECK_MESSAGE( !
pin->IsConnectivityDirty(),
220 "Sheet pin connectivity still dirty after recalculation" );
222 pinConn =
pin->Connection( &rootPath );
224 BOOST_REQUIRE_MESSAGE( pinConn !=
nullptr,
"Sheet pin lost its connection after the move" );
225 BOOST_CHECK_MESSAGE( pinConn->
IsBus(),
"Sheet pin lost its bus connection after the move" );
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
virtual void SetText(const wxString &aText)
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
const std::vector< std::shared_ptr< SCH_CONNECTION > > & Members() const
void SetConnectivityDirty(bool aDirty=true)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Segment description base class to describe items which have 2 end points (track, wire,...
void SetEndPoint(const VECTOR2I &aPosition)
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
void SetName(const wxString &aName)
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
std::unique_ptr< SCHEMATIC > m_schematic
LABEL_BUS_CONNECTIVITY_FIXTURE()
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_CASE(LabelNetToBusConnectivity, LABEL_BUS_CONNECTIVITY_FIXTURE)
Test that changing a label from a net name to a bus name properly updates the connected bus wire's co...
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I