46#include <wx/filename.h>
55 std::string
path(
const std::string& aName )
60 bool haveSample(
const std::string& aName ) {
return wxFileName::FileExists(
path( aName ) ); }
71 if( !haveSample(
"PRJ.PCB" ) )
77 BOOST_CHECK( m_plugin.CanReadBoard(
path(
"PRJ.PCB" ) ) );
85 if( !haveSample(
"PRJ.PCB" ) )
91 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
93 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"PRJ.PCB" ) ) );
96 BOOST_CHECK_GT( board->Footprints().size(), 0 );
100 for(
FOOTPRINT* fp : board->Footprints() )
101 pads += fp->Pads().size();
103 BOOST_CHECK_GT( pads, 0 );
104 BOOST_CHECK_GT( board->Tracks().size(), 0 );
113 if( !haveSample(
"PRJ12.PCB" ) )
119 std::unique_ptr<BOARD> board;
121 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"PRJ12.PCB" ) ) );
135 BOOST_CHECK_GT( tracks, 0 );
136 BOOST_CHECK_GT( vias, 0 );
137 BOOST_CHECK_GT( board->Footprints().size(), 0 );
141 for(
FOOTPRINT* fp : board->Footprints() )
142 pads += fp->Pads().size();
144 BOOST_CHECK_GT( pads, 0 );
152 const std::vector<std::string> samples = {
"PRJ.PCB",
"PRJ2.PCB",
"PRJ10.PCB",
"PRJ12.PCB" };
156 for(
const std::string&
name : samples )
158 if( !haveSample(
name ) )
163 std::unique_ptr<BOARD> board;
164 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
name ) ) );
167 size_t items = board->Tracks().size() + board->Footprints().size() + board->Drawings().size();
168 BOOST_CHECK_GT( items, 0 );
179 std::unique_ptr<BOARD> board;
181 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"DEMOSMD.PCB" ) ) );
184 FOOTPRINT* u5 = board->FindFootprintByReference( wxS(
"U5" ) );
187 auto netOf = [&](
const wxString& aNumber ) -> wxString
191 return pad->GetNetname();
203 std::unique_ptr<BOARD> board;
205 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"DEMOSMD.PCB" ) ) );
208 FOOTPRINT* r6 = board->FindFootprintByReference( wxS(
"R6" ) );
221 auto angleOf = [](
const PCB_TEXT& aText )
227 std::unique_ptr<BOARD> smd;
228 BOOST_REQUIRE_NO_THROW( smd = m_plugin.LoadBoard(
path(
"DEMOSMD.PCB" ) ) );
229 FOOTPRINT* r6 = smd->FindFootprintByReference( wxS(
"R6" ) );
235 std::unique_ptr<BOARD> prj;
236 BOOST_REQUIRE_NO_THROW( prj = m_plugin.LoadBoard(
path(
"PRJ12.PCB" ) ) );
237 FOOTPRINT* a32 = prj->FindFootprintByReference( wxS(
"A32" ) );
249 std::unique_ptr<BOARD> board;
251 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"PRJ.PCB" ) ) );
252 FOOTPRINT* u7 = board->FindFootprintByReference( wxS(
"U7" ) );
271 std::unique_ptr<BOARD> board;
273 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"DEMOSMD.PCB" ) ) );
291 std::unique_ptr<BOARD> board;
294 BOOST_REQUIRE_NO_THROW( board = m_plugin.LoadBoard(
path(
"DEMO.PCB" ) ) );
296 BOOST_CHECK(
reporter.GetMessages().Contains( wxS(
"87 pad(s) ask for a ground or power plane" ) ) );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
VECTOR2I GetArcMid() const
virtual bool IsVisible() const
Read-only importer for Protel Autotrax (.PCB, "PCB FILE 4") and Easytrax (.PCB, "PCB FILE 5") layout ...
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
VECTOR2I GetPosition() const override
A wrapper for reporting to a wxString object.
A type-safe container of any type.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::string path(const std::string &aName)
AUTOTRAX_IMPORT_FIXTURE()
bool haveSample(const std::string &aName)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(SniffRecognizesPcb)
CanReadBoard must accept a real Autotrax file by sniffing the magic header, not just the (gEDA-shared...
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
IbisParser parser & reporter
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)