65 std::ifstream file( aFilePath, std::ios::binary );
71 file.read(
reinterpret_cast<char*
>( header ), 8 );
73 if( file.gcount() < 8 )
76 static const uint8_t
expected[] = { 0x07,
'D',
'T',
'S',
'C',
'H',
'E',
'M' };
78 return std::memcmp( header,
expected, 8 ) == 0;
93 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
95 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
99 std::set<wxString> refDesSet;
101 for(
const FOOTPRINT* fp : board->Footprints() )
103 wxString ref = fp->GetReference();
106 refDesSet.insert( ref );
110 BOOST_CHECK_GT( refDesSet.size(), 10 );
115 for(
const wxString& ref : refDesSet )
117 if( ref.StartsWith(
"U" ) || ref.StartsWith(
"IC" ) || ref.StartsWith(
"DD" ) )
124 BOOST_CHECK_MESSAGE( hasIC,
125 "Z80 board should have at least one IC/U-prefixed reference" );
136 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
138 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
142 std::set<wxString> netNames;
146 if( net->GetNetCode() > 0 )
147 netNames.insert( net->GetNetname() );
151 BOOST_CHECK_GT( netNames.size(), 20 );
154 BOOST_CHECK( netNames.count( wxT(
"GND" ) ) > 0 );
155 BOOST_CHECK( netNames.count( wxT(
"A0" ) ) > 0 );
156 BOOST_CHECK( netNames.count( wxT(
"D0" ) ) > 0 );
166 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
168 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
171 BOOST_CHECK_GT( board->Footprints().size(), 10 );
175 for(
const FOOTPRINT* fp : board->Footprints() )
176 totalPads +=
static_cast<int>( fp->Pads().size() );
178 BOOST_CHECK_GT( totalPads, 0 );
General utilities for PCB file IO for QA programs.
Handle the data for a net.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
Pcbnew PCB_IO for DipTrace binary .dip board files.
DIPTRACE_CROSS_LINK_FIXTURE()
std::string GetPcbTestDataDir()
bool HasDipTraceSchematicHeader(const std::string &aFilePath)
Check the first 8 bytes of a file for the DipTrace schematic magic: 0x07 "DTSCHEM".
PCB_IO_DIPTRACE m_pcbPlugin
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(BoardRefDesPresent)
Load the Z80 Board PCB and verify that reference designators were imported.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)