24#include <boost/test/unit_test.hpp>
33#include <wx/filename.h>
45 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
83 auto tmpFile = std::filesystem::temp_directory_path() /
"net_chain_terminal_pads_roundtrip.kicad_pcb";
84 plugin.SaveBoard( tmpFile.string(), board.get() );
86 std::unique_ptr<BOARD> loaded = std::make_unique<BOARD>();
87 plugin.LoadBoard( tmpFile.string(), loaded.get() );
94 n->ResolveTerminalPads( loaded.get() );
107 BOOST_TEST_MESSAGE( wxString::Format( wxS(
"orig p1a=%s p2a=%s"), orig_p1a, orig_p2a ) );
118 bool foundA =
false, foundB =
false;
119 for(
FOOTPRINT* fp : loaded->Footprints() )
121 for(
PAD*
pad : fp->Pads() )
123 if(
pad == termA1 ) foundA =
true;
124 if(
pad == termB1 ) foundB =
true;
127 BOOST_CHECK( foundA );
128 BOOST_CHECK( foundB );
133 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
140 auto tmpFile = std::filesystem::temp_directory_path() /
"single_net_chain_roundtrip.kicad_pcb";
141 plugin.SaveBoard( tmpFile.string(), board.get() );
143 std::unique_ptr<BOARD> loaded = std::make_unique<BOARD>();
144 plugin.LoadBoard( tmpFile.string(), loaded.get() );
152 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
161 n->SetNetChain( wxS(
"Signal1" ) );
165 for(
int code : { 1, 2, 3, 4 } )
175 auto tmpFile = std::filesystem::temp_directory_path() /
"net_chains_survive_buildlist.kicad_pcb";
176 plugin.SaveBoard( tmpFile.string(), board.get() );
178 std::unique_ptr<BOARD> loaded = std::make_unique<BOARD>();
179 plugin.LoadBoard( tmpFile.string(), loaded.get() );
182 loaded->BuildListOfNets();
185 std::set<wxString> expectedNames = { wxS(
"Net-(R1-Pad1)"), wxS(
"Net-(R1-Pad2)"), wxS(
"Net-(R2-Pad2)"), wxS(
"Net-(R3-Pad2)") };
186 std::set<wxString> seenNames;
189 if( net->GetNetChain() == wxS(
"Signal1" ) )
192 seenNames.insert( net->GetNetname() );
197 for(
const wxString&
name : expectedNames )
198 BOOST_CHECK( seenNames.count(
name ) );
General utilities for PCB file IO for QA programs.
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
wxString AsString() const
Handle the data for a net.
const wxString & GetNetChain() const
PAD * GetTerminalPad(int aIndex) const
void SetNetChain(const wxString &aNetChain)
void SetTerminalPad(int aIndex, PAD *aPad)
void SetFrontShape(PAD_SHAPE aShape)
VECTOR2I GetPosition() const override
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
void SetPosition(const VECTOR2I &aPos) override
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
PCB_IO_KICAD_SEXPR plugin
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(SignalTerminalPadsRoundTrip)
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I