54 m_mgr.LoadProject(
"" );
87 m_screen->Append( busWire );
91 m_screen->Append( label );
94 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
95 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
103 BOOST_CHECK( busConn->
IsBus() );
104 BOOST_CHECK( busConn->
Members().empty() );
107 manager.
SetEnvironment( m_schematic.get(),
nullptr,
nullptr,
nullptr,
nullptr );
109 commit.
Modify( label, m_screen );
110 label->
SetText( wxT(
"test[0..7]" ) );
116 const auto view = m_schematic->Connectivity().Connection( busWire->
m_Uuid,
path.Path() );
118 BOOST_CHECK( view->IsBus() );
126 BOOST_CHECK( busConn->
IsBus() );
127 BOOST_CHECK_MESSAGE( !busConn->
Members().empty(),
128 "Bus wire should have members after label changed to bus name" );
131 if( !busConn->
Members().empty() )
147 m_screen->Append( busWire );
151 m_screen->Append( label );
154 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
155 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
162 BOOST_CHECK( busConn->
IsBus() );
163 BOOST_CHECK_MESSAGE( !busConn->
Members().empty(),
164 "Bus wire should have members from bus label" );
167 if( !busConn->
Members().empty() )
182 const wxString busName( wxT(
"bus{A B}" ) );
183 const int sheetLeft = 10000000;
189 childScreen->
SetFileName( wxT(
"child.kicad_sch" ) );
191 childSheet->
SetName( wxT(
"child" ) );
192 childSheet->
SetFileName( wxT(
"child.kicad_sch" ) );
193 m_screen->Append( childSheet );
203 m_screen->Append( busWire );
205 m_schematic->RefreshHierarchy();
208 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
213 BOOST_REQUIRE_MESSAGE( pinConn !=
nullptr,
"Sheet pin has no connection before the move" );
214 BOOST_REQUIRE_MESSAGE( pinConn->
IsBus(),
"Sheet pin is not a bus before the move" );
217 const VECTOR2I newPos( sheetLeft, 8000000 );
219 pin->SetPosition( newPos );
221 pin->SetConnectivityDirty(
true );
227 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
231 BOOST_CHECK_MESSAGE( !
pin->IsConnectivityDirty(),
232 "Sheet pin connectivity still dirty after recalculation" );
234 pinConn =
pin->Connection( &rootPath );
236 BOOST_REQUIRE_MESSAGE( pinConn !=
nullptr,
"Sheet pin lost its connection after the move" );
237 BOOST_CHECK_MESSAGE( pinConn->
IsBus(),
"Sheet pin lost its bus connection after the move" );
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
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)
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, 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)
Set the dirty flag.
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