37#include <boost/test/unit_test.hpp>
47#include <wx/filename.h>
48#include <wx/stdpaths.h>
56 wxString tempDir = wxStandardPaths::Get().GetTempDir();
57 wxString projectPath = tempDir + wxFileName::GetPathSeparator()
58 + wxT(
"test_group_annotation.kicad_pro" );
62 m_schematic = std::make_unique<SCHEMATIC>(
nullptr );
71 if( wxFileExists( file ) )
94 m_schematic->CreateDefaultScreens();
96 std::vector<SCH_SHEET*> topSheets = m_schematic->GetTopLevelSheets();
99 SCH_SCREEN* screen = topSheets[0]->GetScreen();
105 screen->
Append( symbol1 );
109 screen->
Append( symbol2 );
113 group->SetName( wxT(
"DesignBlock" ) );
114 group->AddItem( symbol1 );
115 group->AddItem( symbol2 );
119 std::unordered_set<SCH_SYMBOL*> foundSymbols;
121 group->RunOnChildren(
125 foundSymbols.insert(
static_cast<SCH_SYMBOL*
>( aChild ) );
131 BOOST_CHECK( foundSymbols.count( symbol1 ) == 1 );
132 BOOST_CHECK( foundSymbols.count( symbol2 ) == 1 );
143 m_schematic->CreateDefaultScreens();
145 std::vector<SCH_SHEET*> topSheets = m_schematic->GetTopLevelSheets();
148 SCH_SCREEN* screen = topSheets[0]->GetScreen();
154 screen->
Append( symbol1 );
158 screen->
Append( symbol2 );
162 screen->
Append( symbol3 );
166 innerGroup->
SetName( wxT(
"InnerGroup" ) );
167 innerGroup->
AddItem( symbol1 );
168 screen->
Append( innerGroup );
172 outerGroup->
SetName( wxT(
"OuterGroup" ) );
173 outerGroup->
AddItem( innerGroup );
174 outerGroup->
AddItem( symbol2 );
175 screen->
Append( outerGroup );
178 std::unordered_set<SCH_SYMBOL*> foundSymbols;
184 foundSymbols.insert(
static_cast<SCH_SYMBOL*
>( aChild ) );
190 BOOST_CHECK( foundSymbols.count( symbol1 ) == 1 );
191 BOOST_CHECK( foundSymbols.count( symbol2 ) == 1 );
192 BOOST_CHECK( foundSymbols.count( symbol3 ) == 0 );
void AddItem(EDA_ITEM *aItem)
Add item to group.
void SetName(const wxString &aName)
KICAD_T Type() const
Returns the type of object.
Container for project specific data.
A set of SCH_ITEMs (i.e., without duplicates).
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetPosition(const VECTOR2I &aPosition) override
Class to handle a set of SCH_ITEMs.
std::vector< wxString > m_tempFiles
~GROUP_ANNOTATION_FIXTURE()
GROUP_ANNOTATION_FIXTURE()
std::unique_ptr< SCHEMATIC > m_schematic
SETTINGS_MANAGER m_settingsManager
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestGroupRunOnChildrenFindsSymbols)
Test that SCH_GROUP::RunOnChildren correctly finds symbols inside a group.
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I