69 if(
group->m_Uuid == aUuid )
80 path.push_back( aUuid );
89 if(
group->GetName() == aName )
97void loadNetlist(
NETLIST& aNetlist,
const wxString& aFileName )
101 std::unique_ptr<NETLIST_READER> netlistReader(
105 netlistReader->LoadNetlist();
109 BOOST_FAIL(
"netlist load failed: " + ioe.
What().ToStdString() );
125 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
126 board->SetProject( &settingsManager.
Prj() );
139 KIID r1 = addComponent(
netlist, wxS(
"R1" ), fpid );
140 KIID r2 = addComponent(
netlist, wxS(
"R2" ), fpid );
141 KIID x3 = addComponent(
netlist, wxS(
"X3" ), fpid );
142 KIID x4 = addComponent(
netlist, wxS(
"X4" ), fpid );
143 KIID x5 = addComponent(
netlist, wxS(
"X5" ), fpid );
149 std::vector<KIID_PATH>{ pathOf( r1 ), pathOf( r2 ) } ) );
154 std::vector<KIID_PATH>{ pathOf( x3 ), pathOf( x4 ), pathOf( x5 ), pathOf( childUuid ) } ) );
156 netlist.ApplyGroupMembership();
159 toolMgr.
SetEnvironment( board.get(),
nullptr,
nullptr,
nullptr,
nullptr );
171 PCB_GROUP* parentGroup = findGroup( board.get(), parentUuid );
172 PCB_GROUP* childGroup = findGroup( board.get(), childUuid );
178 "child group RPI is not nested inside parent group RPI1 "
179 "(nested group membership was lost on update)" );
181 BOOST_CHECK_MESSAGE( parentGroup->
GetItems().count( childGroup ) == 1,
182 "parent group RPI1 does not list child group RPI as a member" );
191 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
192 board->SetProject( &settingsManager.
Prj() );
207 toolMgr.
SetEnvironment( board.get(),
nullptr,
nullptr,
nullptr,
nullptr );
221 PCB_GROUP* outer = findGroupByName( board.get(), wxS(
"OUTER" ) );
222 PCB_GROUP* inner = findGroupByName( board.get(), wxS(
"INNER" ) );
228 "group INNER is not nested inside group OUTER" );
230 BOOST_CHECK_MESSAGE( outer->
GetItems().count( inner ) == 1,
"group OUTER does not list group INNER as a member" );
239 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
240 board->SetProject( &settingsManager.
Prj() );
251 KIID r1 = addComponent(
netlist, wxS(
"R1" ), fpid );
252 KIID r2 = addComponent(
netlist, wxS(
"R2" ), fpid );
253 KIID r3 = addComponent(
netlist, wxS(
"R3" ), fpid );
259 std::vector<KIID_PATH>{ pathOf( r1 ), pathOf( r2 ) } ) );
261 std::vector<KIID_PATH>{ pathOf( r3 ), pathOf( innerUuid ) } ) );
262 netlist.ApplyGroupMembership();
265 toolMgr.
SetEnvironment( board.get(),
nullptr,
nullptr,
nullptr,
nullptr );
282 PCB_GROUP* outer = findGroup( board.get(), outerUuid );
283 PCB_GROUP* inner = findGroup( board.get(), innerUuid );
288 "the first update did not nest INNER inside OUTER" );
294 outerNetlistGroup->
members = { pathOf( r3 ) };
298 outer = findGroup( board.get(), outerUuid );
299 inner = findGroup( board.get(), innerUuid );
303 BOOST_CHECK_MESSAGE( outer->
GetItems().count( inner ) == 0,
"group OUTER still lists group INNER as a member" );
305 BOOST_CHECK_MESSAGE( inner->
GetParentGroup() ==
nullptr,
"group INNER is still nested inside group OUTER" );
314 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
315 board->SetProject( &settingsManager.
Prj() );
324 KIID r1 = addComponent(
netlist, wxS(
"R1" ), fpid );
333 std::vector<KIID_PATH>{ pathOf( r1 ) } ) );
335 std::vector<KIID_PATH>{ pathOf( innerUuid ) } ) );
337 std::vector<KIID_PATH>{ pathOf( outerUuid ) } ) );
338 netlist.ApplyGroupMembership();
341 toolMgr.
SetEnvironment( board.get(),
nullptr,
nullptr,
nullptr,
nullptr );
358 PCB_GROUP* inner = findGroup( board.get(), innerUuid );
359 PCB_GROUP* outer = findGroup( board.get(), outerUuid );
367 "group INNER is not nested inside group OUTER" );
370 "group OUTER is not nested inside group TOP" );
384 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
385 board->SetProject( &settingsManager.
Prj() );
395 KIID r1 = addComponent(
netlist, wxS(
"R1" ), fpid );
396 KIID r2 = addComponent(
netlist, wxS(
"R2" ), fpid );
402 std::vector<KIID_PATH>{ pathOf( r1 ), pathOf( r2 ) } ) );
403 netlist.ApplyGroupMembership();
406 toolMgr.
SetEnvironment( board.get(),
nullptr,
nullptr,
nullptr,
nullptr );
409 auto update = [&](
bool aDryRun )
427 std::vector<KIID_PATH>{ pathOf( innerUuid ) } ) );
431 BOOST_CHECK_MESSAGE( board->Groups().size() == 1,
"a dry run created a group on the board" );
432 BOOST_CHECK_MESSAGE( findGroup( board.get(), outerUuid ) ==
nullptr,
"a dry run created group OUTER on the board" );
General utilities for PCB file IO for QA programs.
Update the BOARD with a new netlist.
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
void SetWillDrag(bool aWillDrag)
void SetIsDryRun(bool aEnabled)
Enable dry run mode (just report, no changes to PCB).
void SetDeleteUnusedFootprints(bool aEnabled)
void SetReplaceFootprints(bool aEnabled)
void SetTransferGroups(bool aEnabled)
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const GROUPS & Groups() const
The groups must maintain the following invariants.
A set of EDA_ITEMs (i.e., without duplicates).
std::unordered_set< EDA_ITEM * > & GetItems()
virtual EDA_GROUP * GetParentGroup() const
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
wxString AsString() const
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
static NETLIST_READER * GetNetlistReader(NETLIST *aNetlist, const wxString &aNetlistFileName, const wxString &aCompFootprintFileName=wxEmptyString)
Attempt to determine the net list file type of aNetlistFileName and return the appropriate NETLIST_RE...
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
void AddComponent(COMPONENT *aComponent)
Add aComponent to the NETLIST.
A set of BOARD_ITEMs (i.e., without duplicates).
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true, bool aOverrideLock=false)
Load a project or sets up a new project with a specified path.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
Class to handle a set of BOARD_ITEMs.
std::vector< KIID > members
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(NestedSchematicGroupNestsOnBoard)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE_MESSAGE(dc.CacheTableInfo(table, { "part_id", "val" }), dc.GetLastError())
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
static FOOTPRINT * addFootprint(BOARD &aBoard, const wxString &aReference)
KIBIS top(path, &reporter)