54 {
"ClaySight_MK1",
"ClaySight_MK1.asc" },
55 {
"TMS1mmX19",
"TMS1mmX19.asc" },
56 {
"MC4_PLUS_CSHAPE",
"MC4_PLUS_CSHAPE.asc" },
57 {
"MC2_PLUS_REV1",
"MC2_PLUS_REV1.asc" },
58 {
"Ems4_Rev2",
"Ems4_Rev2.asc" },
59 {
"LCORE_4",
"LCORE_4.asc" },
60 {
"LCORE_2",
"LCORE_2.asc" },
61 {
"Dexter_MotorCtrl",
"Dexter_MotorCtrl.asc" },
62 {
"MAIS_FC",
"MAIS_FC.asc" },
63 {
"ClaySight_MK2",
"ClaySight_MK2.asc" },
83 aBoard.
dir <<
" should be a readable PADS file" );
85 std::unique_ptr<BOARD> board;
89 board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
91 catch(
const std::exception& e )
93 BOOST_WARN_MESSAGE(
false,
94 aBoard.
dir <<
" threw exception during load: " << e.what() );
99 BOOST_CHECK_MESSAGE( board->Footprints().size() > 0,
100 aBoard.
dir <<
" should have footprints" );
120 BOOST_WARN_MESSAGE( board->Tracks().size() > 0,
121 aBoard.
dir <<
" has no tracks (parser may not support this format version)" );
123 if( board->Tracks().size() > 0 && board->Footprints().size() > 0 )
128 for(
FOOTPRINT* fp : board->Footprints() )
129 fpBbox.
Merge( fp->GetBoundingBox() );
135 trackBbox.
Merge( trk->GetBoundingBox() );
137 BOOST_CHECK_MESSAGE( fpBbox.
Intersects( trackBbox ),
138 aBoard.
dir <<
" footprint and track bounding boxes should overlap" );
142 std::set<std::pair<int, int>> viaPositions;
143 bool hasDuplicate =
false;
152 auto key = std::make_pair(
via->GetPosition().x,
via->GetPosition().y );
154 if( viaPositions.count( key ) )
160 viaPositions.insert( key );
163 BOOST_CHECK_MESSAGE( !hasDuplicate,
164 aBoard.
dir <<
" should have no duplicate through-hole vias" );
172 aBoard.
dir <<
" track on non-copper layer " << trk->GetLayer() );
177 for(
FOOTPRINT* fp : board->Footprints() )
179 for(
PAD*
pad : fp->Pads() )
183 aBoard.
dir <<
" " << fp->GetReference() <<
" pad has zero size" );
188 for(
ZONE* zone : board->Zones() )
192 aBoard.
dir <<
" zone has null outline" );
197 aBoard.
dir <<
" zone outline " << ii <<
" has "
232 for(
FOOTPRINT* fp : board->Footprints() )
233 totalPads += fp->Pads().size();
258 int edgeCutsCount = 0;
276 if(
dynamic_cast<PCB_TEXT*
>( item ) )
283 std::set<wxString> trackNets;
301 BOOST_CHECK_MESSAGE( layer ==
F_Cu || layer ==
B_Cu,
302 "trace on unexpected layer " << layer );
363 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
369 for(
PCB_TRACK* track : board->Tracks() )
389 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
393 int silkscreen_count = 0;
394 int comments_count = 0;
395 int copper_count = 0;
409 else if( layer ==
F_Cu )
445 for(
FOOTPRINT* fp : board->Footprints() )
446 totalPads += fp->Pads().size();
466 std::set<wxString> trackNets;
484 "trace on non-copper layer " << trk->GetLayer() );
498 if( shape->GetLayer() ==
F_SilkS )
516 BOOST_CHECK( defaultNc->GetViaDiameter() > defaultNc->GetViaDrill() );
523 int edgeCutsCount = 0;
538 wxString textContent;
545 textContent =
text->GetText();
554 BOOST_CHECK( textContent.Contains( wxT(
"\n" ) ) );
555 BOOST_CHECK( !textContent.Contains( wxT(
"_" ) ) );
556 BOOST_CHECK( textContent.Contains( wxT(
"CLAYSIGHT MCU V.2" ) ) );
557 BOOST_CHECK( textContent.Contains( wxT(
"The Ohio State University" ) ) );
578 bool foundCopperThickness =
false;
579 bool foundDielectric =
false;
585 if( item->GetThickness() > 0 )
586 foundCopperThickness =
true;
590 if( item->GetEpsilonR() > 3.0 )
591 foundDielectric =
true;
595 BOOST_CHECK_MESSAGE( foundCopperThickness,
"stackup should have non-zero copper thickness" );
596 BOOST_CHECK_MESSAGE( foundDielectric,
"stackup should have dielectric constant > 3.0" );
614 +
"plugins/pads/synthetic_degenerate_pour.asc";
616 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
626 if( board->Zones().size() == 1 )
628 ZONE* zone = board->Zones()[0];
648 +
"plugins/pads/synthetic_filled_copper.asc";
650 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
655 ZONE* zone = board->Zones()[0];
676 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
684 int dwgsUserCount = 0;
695 BOOST_CHECK_MESSAGE( dwgsUserCount > 0,
696 "graphics on PADS layer 18 (drill drawing) should map to Dwgs_User" );
703 for(
FOOTPRINT* fp : board->Footprints() )
705 if( fp->GetReference() == wxT(
"U1" ) )
714 bool foundOvalPad =
false;
727 BOOST_CHECK_MESSAGE( foundOvalPad,
"U1 should have oval pads (OF shape, not RT thermal)" );
732 int pourZoneCount = 0;
733 int filledZoneCount = 0;
735 for(
ZONE* zone : board->Zones() )
737 if( !zone->GetIsRuleArea() )
741 if( zone->IsFilled() )
746 BOOST_CHECK_MESSAGE( pourZoneCount <= 13,
747 "should not have duplicate zones from HATOUT; got " << pourZoneCount );
749 BOOST_CHECK_MESSAGE( filledZoneCount > 0,
"HATOUT records should produce filled zones" );
765 BOOST_CHECK_MESSAGE( start.
y ==
end.y,
766 "horizontal dimension endpoints should have equal Y coordinates; "
767 "start.y=" << start.
y <<
" end.y=" <<
end.y );
771 BOOST_CHECK_MESSAGE( dimCount > 0,
"should have at least one dimension" );
793 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
798 std::map<std::pair<int, int>,
int> viaPositionCount;
800 int throughCount = 0;
806 const int maxExpectedViaWidth = 1200000;
808 int oversizedViaCount = 0;
810 for(
PCB_TRACK* track : board->Tracks() )
818 auto key = std::make_pair( pos.
x, pos.
y );
819 viaPositionCount[key]++;
826 if(
via->GetWidth(
F_Cu ) > maxExpectedViaWidth )
831 BOOST_CHECK_MESSAGE( blindCount == 0,
832 "no vias should be blind; STANDARDVIA spans all copper layers; got "
833 << blindCount <<
" blind vias" );
835 BOOST_CHECK_MESSAGE( throughCount > 0,
"should have through-hole vias" );
838 BOOST_CHECK_MESSAGE( oversizedViaCount == 0,
839 "via size should use copper pad, not soldermask opening; got "
840 << oversizedViaCount <<
" oversized vias" );
843 int duplicateCount = 0;
845 for(
const auto& [pos, count] : viaPositionCount )
851 BOOST_CHECK_MESSAGE( duplicateCount == 0,
852 "should not have duplicate vias at the same position; got "
853 << duplicateCount <<
" positions with duplicates" );
858 int backTentedCount = 0;
861 for(
PCB_TRACK* track : board->Tracks() )
874 BOOST_CHECK_MESSAGE( backTentedCount == totalVias,
875 "vias without soldermask opening should be tented; "
876 << backTentedCount <<
" of " << totalVias <<
" back-tented" );
894 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
900 for(
FOOTPRINT* fp : board->Footprints() )
902 if( fp->GetReference() ==
"U1" )
914 const int expectedMajor = 6000000;
915 const int expectedMinor = 1500000;
916 const int tolerance = 10000;
922 wxString padNum =
pad->GetNumber();
924 if( padNum ==
"1" || padNum ==
"2" || padNum ==
"3"
925 || padNum ==
"4" || padNum ==
"5" )
928 "pad " << padNum <<
" should have oblong drill" );
931 int major = std::max( drillSize.
x, drillSize.
y );
932 int minor = std::min( drillSize.
x, drillSize.
y );
934 BOOST_CHECK_MESSAGE(
std::abs( major - expectedMajor ) < tolerance,
935 "pad " << padNum <<
" drill major axis " << major
936 <<
" should be ~" << expectedMajor );
938 BOOST_CHECK_MESSAGE(
std::abs( minor - expectedMinor ) < tolerance,
939 "pad " << padNum <<
" drill minor axis " << minor
940 <<
" should be ~" << expectedMinor );
947 BOOST_CHECK_MESSAGE( oblongCount == 5,
948 "expected 5 pads with oblong drill, got " << oblongCount );
966 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
972 for(
FOOTPRINT* fp : board->Footprints() )
974 if( fp->GetReference() ==
"M4" )
985 const int expectedPadSize = 6350000;
986 const int expectedDrill = 3175000;
987 const int tolerance = 10000;
990 "MTHOLEAAAB has 1 terminal; got " << m4->
Pads().size() );
995 "M4 pad 1 drill should be circular" );
998 int padDim = std::max( padSize.
x, padSize.
y );
1000 BOOST_CHECK_MESSAGE(
std::abs( padDim - expectedPadSize ) < tolerance,
1001 "M4 pad size " << padDim <<
" should be ~" << expectedPadSize
1005 int drillDim = std::max( drillSize.
x, drillSize.
y );
1007 BOOST_CHECK_MESSAGE(
std::abs( drillDim - expectedDrill ) < tolerance,
1008 "M4 drill size " << drillDim <<
" should be ~" << expectedDrill
1027 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1035 auto hasTrueCrossing = [](
const SHAPE_POLY_SET& aPoly,
int aIdx ) ->
bool
1037 std::vector<SEG> segs;
1040 segs.emplace_back( *it );
1042 for(
size_t i = 0; i < segs.size(); i++ )
1044 for(
size_t j = i + 1; j < segs.size(); j++ )
1048 if( segs[i].A == segs[j].A || segs[i].A == segs[j].
B
1049 || segs[i].
B == segs[j].A || segs[i].
B == segs[j].
B )
1054 if( segs[i].Intersects( segs[j] ) )
1062 int zonesChecked = 0;
1064 for(
ZONE* zone : board->Zones() )
1066 if( !zone->IsFilled() )
1071 if( !zone->HasFilledPolysForLayer( layer ) )
1074 std::shared_ptr<SHAPE_POLY_SET> fill = zone->GetFilledPolysList( layer );
1076 if( !fill || fill->OutlineCount() == 0 )
1081 for(
int pi = 0; pi < fill->OutlineCount(); pi++ )
1083 if( fill->Outline( pi ).PointCount() < 3 )
1086 BOOST_CHECK_MESSAGE(
1087 !hasTrueCrossing( *fill, pi ),
1088 "zone \"" << zone->GetNetname() <<
"\" on "
1089 << board->GetLayerName( layer )
1090 <<
" outline " << pi
1091 <<
" has self-intersecting fill polygon" );
1096 BOOST_CHECK_MESSAGE( zonesChecked > 0,
"no filled zones found to check" );
1121 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1126 auto findFP = [&](
const wxString& aRef ) ->
FOOTPRINT*
1128 for(
FOOTPRINT* fp : board->Footprints() )
1129 if( fp->GetReference() == aRef )
1141 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
"U1 pad should be on F.Cu" );
1142 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Mask ),
"U1 pad should have F.Mask (explicit in stack)" );
1143 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Paste ),
"U1 pad should have F.Paste (explicit in stack)" );
1144 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
B_Cu ),
"U1 SMD pad should not be on B.Cu" );
1154 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
"U2 pad should be on F.Cu" );
1155 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Mask ),
"U2 pad should have F.Mask (explicit in stack)" );
1156 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Paste ),
"U2 pad should have F.Paste (fallback for SMD)" );
1157 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
B_Cu ),
"U2 SMD pad should not be on B.Cu" );
1167 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
"U3 pad should be on F.Cu" );
1168 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Mask ),
"U3 pad should have F.Mask (SMD fallback)" );
1169 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Paste ),
"U3 pad should have F.Paste (SMD fallback)" );
1170 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
B_Cu ),
"U3 SMD pad should not be on B.Cu" );
1181 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
"U4 PTH pad should be on F.Cu" );
1182 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
B_Cu ),
"U4 PTH pad should be on B.Cu" );
1183 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Mask ),
"U4 pad should have F.Mask (explicit in stack)" );
1184 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
B_Mask ),
"U4 pad should have B.Mask (explicit in stack)" );
1185 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
F_Paste ),
"U4 PTH pad should not have F.Paste" );
1197 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
"U5 pad should be on F.Cu" );
1198 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Mask ),
"U5 pad should have F.Mask (SMD fallback)" );
1199 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
F_Paste ),
"U5 pad should NOT have F.Paste (explicitly zero-size)" );
1200 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
B_Cu ),
"U5 SMD pad should not be on B.Cu" );
1216 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1220 bool foundSmdWithMask =
false;
1222 for(
FOOTPRINT* fp : board->Footprints() )
1224 for(
PAD*
pad : fp->Pads() )
1229 foundSmdWithMask =
true;
1234 if( foundSmdWithMask )
1238 BOOST_CHECK_MESSAGE( foundSmdWithMask,
1239 "At least one SMD pad in issue23254.asc should have F.Mask and F.Paste" );
1252 std::unique_ptr<BOARD> board;
1253 board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1258 bool foundSquarePad =
false;
1260 for(
FOOTPRINT* fp : board->Footprints() )
1262 for(
PAD*
pad : fp->Pads() )
1266 foundSquarePad =
true;
1271 if( foundSquarePad )
1275 BOOST_CHECK_MESSAGE( foundSquarePad,
1276 "At least one pad should have RECTANGLE shape (square pad import)" );
1280 bool foundZoneWithFull =
false;
1281 bool foundPadWithThermal =
false;
1282 bool foundPadWithoutThermal =
false;
1284 for(
ZONE* zone : board->Zones() )
1288 foundZoneWithFull =
true;
1293 BOOST_CHECK_MESSAGE( foundZoneWithFull,
1294 "Zones should default to FULL (solid) connection" );
1296 for(
FOOTPRINT* fp : board->Footprints() )
1298 for(
PAD*
pad : fp->Pads() )
1301 foundPadWithThermal =
true;
1303 foundPadWithoutThermal =
true;
1307 BOOST_CHECK_MESSAGE( foundPadWithThermal,
1308 "Pads with RT/ST entries should have per-pad THERMAL connection" );
1309 BOOST_CHECK_MESSAGE( foundPadWithoutThermal,
1310 "Pads without RT/ST entries should not have per-pad THERMAL override" );
1316 auto nc1It = netclasses.find( wxT(
"NETTCLASS1" ) );
1317 auto nc2It = netclasses.find( wxT(
"NETTCLASS2" ) );
1319 BOOST_CHECK_MESSAGE( nc1It != netclasses.end(),
"NETTCLASS1 should exist" );
1320 BOOST_CHECK_MESSAGE( nc2It != netclasses.end(),
"NETTCLASS2 should exist" );
1322 if( nc1It != netclasses.end() )
1324 BOOST_CHECK_MESSAGE( nc1It->second->HasTrackWidth(),
1325 "NETTCLASS1 should have a track width rule" );
1328 if( nc2It != netclasses.end() )
1330 BOOST_CHECK_MESSAGE( nc2It->second->HasTrackWidth(),
1331 "NETTCLASS2 should have a track width rule" );
1332 BOOST_CHECK_MESSAGE( nc2It->second->HasClearance(),
1333 "NETTCLASS2 should have a clearance rule" );
1338 std::map<wxString, wxString> netAssignments;
1340 for(
const auto& [matcher, ncName] : patterns )
1341 netAssignments[matcher->GetPattern()] = ncName;
1343 BOOST_CHECK_MESSAGE( netAssignments.count( wxT(
"+24V0" ) ),
1344 "+24V0 should be assigned to a net class" );
1345 BOOST_CHECK_MESSAGE( netAssignments.count( wxT(
"+24V0_FILTER" ) ),
1346 "+24V0_FILTER should be assigned to a net class" );
1347 BOOST_CHECK_MESSAGE( netAssignments.count( wxT(
"+24V0_FILTER_RTN" ) ),
1348 "+24V0_FILTER_RTN should be assigned to a net class" );
1350 if( netAssignments.count( wxT(
"+24V0" ) ) )
1355 if( netAssignments.count( wxT(
"+24V0_FILTER_RTN" ) ) )
1357 BOOST_CHECK_EQUAL( netAssignments[wxT(
"+24V0_FILTER_RTN" )], wxT(
"NETTCLASS2" ) );
1375 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1381 BOOST_CHECK_MESSAGE( netclasses.find( wxT(
"NETTCLASS1" ) ) != netclasses.end(),
1382 "NETTCLASS1 should be imported" );
1383 BOOST_CHECK_MESSAGE( netclasses.find( wxT(
"NETTCLASS2" ) ) != netclasses.end(),
1384 "NETTCLASS2 should be imported" );
1388 std::map<wxString, wxString> netAssignments;
1390 for(
const auto& [matcher, ncName] : patterns )
1391 netAssignments[matcher->GetPattern()] = ncName;
1395 BOOST_CHECK_EQUAL( netAssignments[wxT(
"+24V0_FILTER" )], wxT(
"NETTCLASS1" ) );
1398 BOOST_CHECK_EQUAL( netAssignments[wxT(
"+24V0_FILTER_RTN" )], wxT(
"NETTCLASS2" ) );
1403 auto nc2It = netclasses.find( wxT(
"NETTCLASS2" ) );
1405 if( nc2It != netclasses.end() )
1407 BOOST_CHECK_MESSAGE( nc2It->second->HasClearance(),
1408 "NETTCLASS2 should have clearance from RULE_SET" );
1409 BOOST_CHECK_MESSAGE( nc2It->second->HasTrackWidth(),
1410 "NETTCLASS2 should have track width from RULE_SET" );
1430 +
"plugins/pads/issue23540/test_import.asc";
1432 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1451 BOOST_CHECK_MESSAGE( absDeg > 170.0 && absDeg < 190.0,
1452 "route arc angle " << absDeg <<
" should be ~180 degrees (semicircle)" );
1460 int chordY = ( start.
y +
end.y ) / 2;
1462 BOOST_CHECK_MESSAGE( mid.
y < chordY,
1463 "arc midpoint Y=" << mid.
y <<
" should be above (less than) "
1464 "chord center Y=" << chordY );
1468 "expected exactly 1 PCB_ARC from route CW/CCW arc, got " << arcCount );
1472 int straightOnArcNet = 0;
1480 BOOST_CHECK_MESSAGE( straightOnArcNet == 0,
1481 "route arc net should contain no straight track remnant, got "
1482 << straightOnArcNet );
1506 +
"plugins/pads/issue23425/controlCARDDockingStation.asc";
1508 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1514 for(
FOOTPRINT* fp : board->Footprints() )
1516 if( fp->GetReference() == wxT(
"J3" ) )
1526 const int expectedOffset = 762000;
1527 const int tolerance = 1000;
1529 int offsetPadCount = 0;
1541 BOOST_CHECK_MESSAGE( offset.
y == 0,
1542 "J3 pad " <<
pad->GetNumber()
1543 <<
" offset Y should be 0 (unrotated pad-local), got " << offset.
y );
1545 BOOST_CHECK_MESSAGE(
std::abs(
std::abs( offset.
x ) - expectedOffset ) < tolerance,
1546 "J3 pad " <<
pad->GetNumber()
1547 <<
" offset X magnitude " <<
std::abs( offset.
x )
1548 <<
" should be ~" << expectedOffset );
1554 BOOST_CHECK_MESSAGE( offsetPadCount >= 90,
1555 "expected the HSEC8 finger pads to carry a finger offset; got "
1556 << offsetPadCount );
1577 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1583 PAD* mtg_top_pad =
nullptr;
1584 PAD* mtg_bot_pad =
nullptr;
1585 PAD* conn_top_pin1 =
nullptr;
1586 PAD* conn_bot_pin1 =
nullptr;
1588 for(
FOOTPRINT* fp : board->Footprints() )
1590 wxString ref = fp->GetReference();
1592 for(
PAD*
pad : fp->Pads() )
1596 else if( ref ==
"E3" )
1598 else if( ref ==
"X1" &&
pad->GetNumber() ==
"1" )
1599 conn_top_pin1 =
pad;
1600 else if( ref ==
"X2" &&
pad->GetNumber() ==
"1" )
1601 conn_bot_pin1 =
pad;
1611 BOOST_CHECK_MESSAGE(
1613 "Mounting hole with same shape but different sizes should use NORMAL padstack mode" );
1615 BOOST_CHECK_MESSAGE(
1617 "Bottom-placed mounting hole should also use NORMAL padstack mode" );
1623 BOOST_CHECK_MESSAGE(
1624 top_size == bot_size,
1625 "Top and bottom mounting holes should have equal pad size on F_Cu; "
1626 "top=" << top_size.
x <<
" bot=" << bot_size.
x );
1631 BOOST_CHECK_MESSAGE(
1633 "Mounting hole pad size must be non-zero" );
1636 BOOST_CHECK_MESSAGE(
1638 "Connector pin-1 with square-on-top / round-on-bottom must use FRONT_INNER_BACK" );
1641 BOOST_CHECK_MESSAGE(
1643 "Top connector pin-1 must have RECTANGLE shape on F_Cu" );
1645 BOOST_CHECK_MESSAGE(
1647 "Top connector pin-1 must have CIRCLE shape on B_Cu" );
1650 BOOST_CHECK_MESSAGE(
1652 "Bottom connector pin-1 must have CIRCLE shape on F_Cu after flip" );
1654 BOOST_CHECK_MESSAGE(
1656 "Bottom connector pin-1 must have RECTANGLE shape on B_Cu after flip" );
1683 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1693 for(
FOOTPRINT* fp : board->Footprints() )
1695 if( fp->GetValue() == wxT(
"TP_BOTTOM_SMD" ) )
1697 else if( fp->GetValue() == wxT(
"TP_TOP_SMD" ) )
1705 if( tpBottom->
Pads().size() == 1 )
1708 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
B_Cu ),
1709 "TP_BOTTOM_SMD pad should be on B.Cu" );
1710 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
F_Cu ),
1711 "TP_BOTTOM_SMD pad should not be on F.Cu" );
1715 BOOST_CHECK_MESSAGE( padSize > 700000 && padSize < 900000,
1716 "TP_BOTTOM_SMD pad size " << padSize <<
" should be ~800000 nm" );
1723 if( tpTop->
Pads().size() == 1 )
1726 BOOST_CHECK_MESSAGE(
pad->IsOnLayer(
F_Cu ),
1727 "TP_TOP_SMD pad should be on F.Cu" );
1728 BOOST_CHECK_MESSAGE( !
pad->IsOnLayer(
B_Cu ),
1729 "TP_TOP_SMD pad should not be on B.Cu" );
1732 BOOST_CHECK_MESSAGE( padSize > 700000 && padSize < 900000,
1733 "TP_TOP_SMD pad size " << padSize <<
" should be ~800000 nm" );
1757 BOOST_CHECK_MESSAGE( pos != tpBottomPos,
1758 "TP_BOTTOM_SMD position should not have a bare PCB_VIA" );
1759 BOOST_CHECK_MESSAGE( pos != tpTopPos,
1760 "TP_TOP_SMD position should not have a bare PCB_VIA" );
1780 std::unique_ptr<BOARD> board;
1781 board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1786 int copyrightCount = 0;
1787 bool frontCopyrightNotMirrored =
false;
1788 bool backCopyrightMirrored =
false;
1798 BOOST_CHECK_MESSAGE( !t->
GetText().IsEmpty(),
1799 "imported free text should not be empty" );
1801 if( t->
GetText().Contains( wxT(
"TEXMATE" ) ) )
1806 BOOST_CHECK_MESSAGE( t->
GetText().Contains( wxString::FromUTF8(
"©" ) ),
1807 "copyright text should retain the (c) character" );
1812 "front silkscreen text should not be mirrored" );
1813 frontCopyrightNotMirrored =
true;
1818 "back-side text should be mirrored" );
1819 backCopyrightMirrored =
true;
1824 BOOST_CHECK_MESSAGE( copyrightCount >= 2,
1825 "expected the copyright text on both front and back, got " << copyrightCount );
1831 bool foundCN1 =
false;
1833 for(
FOOTPRINT* fp : board->Footprints() )
1835 if( fp->GetReference() != wxT(
"CN1" ) )
1840 BOOST_CHECK_MESSAGE( fp->Pads().size() >= 10,
1841 "CN1 should have at least 10 pads, got " << fp->Pads().size() );
1843 for(
PAD*
pad : fp->Pads() )
1849 BOOST_CHECK_MESSAGE(
1851 "CN1 finger pad " <<
pad->GetNumber().ToStdString()
1852 <<
" should be oriented 90 degrees, got "
1853 <<
pad->GetOrientation().AsDegrees() );
1858 BOOST_CHECK_MESSAGE( foundCN1,
"CN1 footprint should be imported" );
1874 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1877 auto findFP = [&](
const wxString& aRef ) ->
FOOTPRINT*
1879 for(
FOOTPRINT* fp : board->Footprints() )
1881 if( fp->GetReference() == aRef )
1888 const int tolerance = 5000;
1901 "L1 pad " <<
pad->GetNumber().ToStdString()
1902 <<
" should have THERMAL zone connection" );
1904 std::optional<int> spoke =
pad->GetLocalThermalSpokeWidthOverride();
1906 "L1 pad " <<
pad->GetNumber().ToStdString()
1907 <<
" should have a spoke-width override" );
1908 BOOST_CHECK_MESSAGE(
std::abs( spoke.value() - 1000000 ) < tolerance,
1909 "L1 pad " <<
pad->GetNumber().ToStdString() <<
" spoke width "
1910 << spoke.value() <<
" should be ~1000000 nm" );
1912 std::optional<int> gap =
pad->GetLocalThermalGapOverride();
1914 "L1 pad " <<
pad->GetNumber().ToStdString()
1915 <<
" should have a thermal gap override" );
1916 BOOST_CHECK_MESSAGE(
std::abs( gap.value() - 120000 ) < tolerance,
1917 "L1 pad " <<
pad->GetNumber().ToStdString() <<
" thermal gap "
1918 << gap.value() <<
" should be ~120000 nm" );
1931 "E1 pad should have THERMAL zone connection" );
1932 BOOST_CHECK_MESSAGE( !
pad->GetLocalThermalGapOverride().has_value(),
1933 "E1 pad should NOT have a thermal gap override (outer == pad size)" );
1952 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
1958 std::set<wxString> refDes;
1960 for(
FOOTPRINT* fp : board->Footprints() )
1961 refDes.insert( fp->GetReference() );
1963 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"J1" ) ),
"J1 should be present" );
1964 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"J2" ) ),
"J2 should be present" );
1965 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"J3" ) ),
"J3 should be present" );
1966 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"J4" ) ),
"J4 should be present" );
1967 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"J5" ) ),
"J5 should be present" );
1968 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"U1" ) ),
"U1 should be present" );
1969 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"U2" ) ),
"U2 should be present" );
1970 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"U3" ) ),
"U3 should be present" );
1971 BOOST_CHECK_MESSAGE( refDes.count( wxT(
"U4" ) ),
"U4 should be present" );
1988 parser.
Parse( filename );
1992 auto it = decals.find(
"104130-6" );
1996 auto sop_it = decals.find(
"SOP16" );
2026 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
2030 const double tolerance = 0.005;
2038 const std::map<wxString, EXPECTED>
expected = {
2039 { wxT(
"R1" ), { 2, 105000.0 / 900000.0 } },
2040 { wxT(
"D1" ), { 6, 225000.0 / 825000.0 } },
2043 int checkedRefs = 0;
2045 for(
FOOTPRINT* fp : board->Footprints() )
2047 auto it =
expected.find( fp->GetReference() );
2054 int roundRectCount = 0;
2056 for(
PAD*
pad : fp->Pads() )
2059 fp->GetReference() <<
" pad " <<
pad->GetNumber()
2060 <<
" should import as roundrect" );
2065 BOOST_CHECK_MESSAGE(
2066 std::abs(
pad->GetRoundRectRadiusRatio(
F_Cu ) - it->second.ratio ) < tolerance,
2067 fp->GetReference() <<
" pad " <<
pad->GetNumber() <<
" ratio "
2068 <<
pad->GetRoundRectRadiusRatio(
F_Cu ) <<
" should be ~" << it->second.ratio );
2073 BOOST_CHECK_MESSAGE( roundRectCount == it->second.padCount,
2074 fp->GetReference() <<
" should have " << it->second.padCount
2075 <<
" roundrect pads, got " << roundRectCount );
2078 BOOST_CHECK_MESSAGE( checkedRefs == (
int)
expected.size(),
2079 "expected R1 and D1 footprints to be imported, found " << checkedRefs );
2100 auto it = partTypes.find(
"QUARZ_32.768KHZ_12.5PF_1.2X1" );
2106 auto prev = partTypes.find(
"LT3481" );
2125 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
2131 for(
FOOTPRINT* fp : board->Footprints() )
2133 if( fp->GetReference() == wxT(
"X1" ) )
2143 std::set<VECTOR2I> padOffsets;
2148 BOOST_CHECK_MESSAGE( padOffsets.size() == 4,
"pads should sit on 4 distinct positions" );
2150 const int tolerance =
pcbIUScale.mmToIU( 0.01 );
2152 for(
const VECTOR2I& offset : padOffsets )
2166 std::unique_ptr<BOARD> board = plugin.
LoadBoard( filename,
nullptr,
nullptr );
2172 board->SetProject( &settingsManager.
Prj() );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
@ BS_ITEM_TYPE_DIELECTRIC
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
int m_CopperEdgeClearance
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
std::vector< VIA_DIMENSION > m_ViasDimensionsList
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.
Manage one layer needed to make a physical board.
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
Information pertinent to a Pcbnew printed circuit board.
BOARD_DESIGN_SETTINGS & GetDesignSettings()
constexpr void SetMaximum()
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
virtual const wxString & GetText() const
Return the string associated with the text object.
const UTF8 & GetLibItemName() const
Handle the data for a net.
const wxString & GetNetname() const
const std::map< wxString, std::shared_ptr< NETCLASS > > & GetNetclasses() const
Gets all netclasses.
std::shared_ptr< NETCLASS > GetDefaultNetclass() const
Gets the default netclass for the project.
std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > & GetNetclassPatternAssignments()
Gets the netclass pattern assignments.
@ NORMAL
Shape is the same on all layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
const std::map< std::string, PART_TYPE > & GetPartTypes() const
const std::map< std::string, PART_DECAL > & GetPartDecals() const
void Parse(const wxString &aFileName)
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
For better understanding of the points that make a dimension:
bool CanReadBoard(const wxString &aFileName) const override
std::unique_ptr< BOARD > LoadBoard(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into new BOA...
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true, bool aOverrideLock=false)
Load a project or sets up a new project with a specified path.
int PointCount() const
Return the number of points (vertices) in this line chain.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
CONST_SEGMENT_ITERATOR CIterateSegmentsWithHoles() const
Return an iterator object, for the aOutline-th outline in the set (with holes).
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Handle a list of polygons defining a copper zone.
SHAPE_POLY_SET * Outline()
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ SMD
Smd pad, appears on the solder paste layer (default)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE_MESSAGE(dc.CacheTableInfo(table, { "part_id", "val" }), dc.GetLastError())
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
static void RunStructuralChecks(const PADS_BOARD_INFO &aBoard)
Run structural integrity checks on a successfully loaded board.
static wxString GetBoardPath(const PADS_BOARD_INFO &aBoard)
static const PADS_BOARD_INFO PADS_BOARDS[]
static std::unique_ptr< BOARD > LoadAndVerify(const PADS_BOARD_INFO &aBoard)
Verify that the PADS file is recognized and loads without crashing.
BOOST_AUTO_TEST_CASE(ImportClaySight_MK1)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I
@ THERMAL
Use thermal relief for pads.
@ FULL
pads are covered by copper