70 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
72 kicadPlugin.LoadBoard( dataPath +
"LayerWildcard.kicad_pcb", testBoard.get() );
75 BOOST_CHECK( testBoard->Zones().size() == 1 );
77 ZONE* z = testBoard->Zones()[0];
87 auto tmpBoard = std::filesystem::temp_directory_path() /
"Issue19775_RoundTrip.kicad_pcb";
91 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
92 kicadPlugin.LoadBoard( dataPath +
"LayerEnumerate.kicad_pcb", testBoard.get() );
93 kicadPlugin.SaveBoard( tmpBoard.string(), testBoard.get() );
97 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
98 kicadPlugin.LoadBoard( tmpBoard.string(), testBoard.get() );
101 BOOST_CHECK( testBoard->Zones().size() == 1 );
103 ZONE* z = testBoard->Zones()[0];
124 +
"plugins/kicad_sexpr/Issue23125_EmptyZone/";
126 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
128 kicadPlugin.LoadBoard( dataPath +
"EmptyZone.kicad_pcb", testBoard.get() );
135 ZONE* z = testBoard->Zones()[0];
149 +
"plugins/kicad_sexpr/";
151 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
153 kicadPlugin.LoadBoard( dataPath +
"ScientificNotation.kicad_pcb", testBoard.get() );
176 +
"plugins/kicad_sexpr/Issue23625_CorruptedStackup/";
178 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
180 BOOST_CHECK_NO_THROW( kicadPlugin.LoadBoard( dataPath +
"corrupted_stackup.kicad_pcb",
184 testBoard->GetDesignSettings().GetStackupDescriptor();
189 BOOST_CHECK_LE( stackup.
GetCount(), 128 );
190 BOOST_CHECK_GT( stackup.
GetCount(), 0 );
205 std::string destinationPath = dataPath +
"issue3812.kicad_pcb";
207 std::string sourcePath = dataPath +
"issue18142.kicad_pcb";
208 std::map<std::string, UTF8> props;
222 int copperLayerCount = 0;
230 return copperLayerCount;
244 std::unique_ptr<BOARD> testBoard = std::make_unique<BOARD>();
246 kicadPlugin.LoadBoard( destinationPath, testBoard.get() );
248 const BOARD_STACKUP& initialStackup = testBoard->GetDesignSettings().GetStackupDescriptor();
249 const BOARD_STACKUP_ITEM* initialFirstDielectric = findFirstDielectric( initialStackup );
250 const int initialCopperLayerCount = testBoard->GetCopperLayerCount();
251 const LSET initialEnabledLayers = testBoard->GetEnabledLayers();
252 const wxString initialFinishType = initialStackup.
m_FinishType;
254 BOOST_REQUIRE_EQUAL( initialCopperLayerCount, 4 );
255 BOOST_REQUIRE_EQUAL( countCopperLayers( initialStackup ), 4 );
257 BOOST_REQUIRE_EQUAL( initialFinishType, wxS(
"ENIG" ) );
258 const wxString initialFirstDielectricMaterial = initialFirstDielectric->
GetMaterial();
259 const int initialFirstDielectricThickness = initialFirstDielectric->
GetThickness();
261 kicadPlugin.LoadBoard( sourcePath, testBoard.get(), &props );
263 const int appendedCopperLayerCount = testBoard->GetCopperLayerCount();
265 if( appendedCopperLayerCount > initialCopperLayerCount )
266 testBoard->SetCopperLayerCount( appendedCopperLayerCount );
268 LSET enabledLayers = testBoard->GetEnabledLayers();
269 enabledLayers |= initialEnabledLayers;
270 testBoard->SetEnabledLayers( enabledLayers );
271 testBoard->GetDesignSettings().GetStackupDescriptor().SynchronizeWithBoard( &testBoard->GetDesignSettings() );
273 const BOARD_STACKUP& finalStackup = testBoard->GetDesignSettings().GetStackupDescriptor();
304 auto tmpLib = std::filesystem::temp_directory_path() /
"qa_fp_save_netinfo.pretty";
305 std::filesystem::remove_all( tmpLib );
306 std::filesystem::create_directories( tmpLib );
308 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
315 fp->
SetFPID(
LIB_ID( wxT(
"scratch" ), wxT(
"test_fp_save_netinfo" ) ) );
336 BOOST_REQUIRE_EQUAL(
pad->GetNet(), net );
337 BOOST_REQUIRE_EQUAL( shape->
GetNet(), net );
338 BOOST_REQUIRE_EQUAL( zone->
GetNet(), net );
341 BOOST_REQUIRE_NO_THROW( kicadPlugin.FootprintSave( tmpLib.string(), fp ) );
343 auto savedFile = tmpLib /
"test_fp_save_netinfo.kicad_mod";
346 std::ifstream in( savedFile );
347 BOOST_REQUIRE_MESSAGE( in.is_open(),
348 "Failed to open serialized footprint: " << savedFile.string() );
350 std::stringstream ss;
354 const std::string contents = ss.str();
358 "Saved footprint library file must not contain (net ...) tokens:\n"
366 std::unique_ptr<FOOTPRINT> detached(
static_cast<FOOTPRINT*
>( fp->
Clone() ) );
367 detached->SetParent(
nullptr );
368 detached->SetParentGroup(
nullptr );
369 detached->ClearAllNets();
375 detached->RunOnChildren(
378 switch( aItem->
Type() )
395 std::filesystem::remove_all( tmpLib );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
@ BS_ITEM_TYPE_DIELECTRIC
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage one layer needed to make a physical board.
int GetThickness(int aDielectricSubLayer=0) const
wxString GetMaterial(int aDielectricSubLayer=0) const
Manage layers needed to make a physical board.
wxString m_FinishType
The name of external copper finish.
KICAD_T Type() const
Returns the type of object.
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
VECTOR2I GetArcMid() const
A logical library item identifier and consists of various portions much like a URI.
LSET is a set of PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
Handle the data for a net.
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
int TotalVertices() const
Return total number of vertices stored in the set.
Handle a list of polygons defining a copper zone.
ZONE_LAYER_PROPERTIES & LayerProperties(PCB_LAYER_ID aLayer)
std::shared_ptr< SHAPE_POLY_SET > GetFilledPolysList(PCB_LAYER_ID aLayer) const
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
VECTOR2I GetPosition() const override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
int GetNumCorners(void) const
Access to m_Poly parameters.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
constexpr char APPEND_PRESERVE_DESTINATION_STACKUP[]
PCB_IO_KICAD_SEXPR kicadPlugin
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_TEST(contains==c.ExpectedContains)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Issue19775_ZoneLayerWildcards)
Declares the struct as the Boost test fixture.
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I