37#include <wx/filename.h>
70 pad->SetNumber( wxT(
"1" ) );
96 wxString tempPath = wxFileName::CreateTempFileName( wxT(
"kicad_ipc2581_test" ) );
98 std::map<std::string, UTF8> props;
99 props[
"units"] =
"mm";
100 props[
"version"] =
"C";
101 props[
"sigfig"] =
"3";
103 BOOST_REQUIRE_NO_THROW( ipc2581Plugin.
SaveBoard( tempPath, board, &props ) );
106 std::ifstream xmlFile( tempPath.ToStdString() );
109 std::string xml( ( std::istreambuf_iterator<char>( xmlFile ) ),
110 std::istreambuf_iterator<char>() );
115 auto componentRegion =
116 [&](
const std::string& aRef ) -> std::string
118 size_t start = xml.find(
"refDes=\"" + aRef +
"\"" );
120 if( start == std::string::npos )
121 return std::string();
123 size_t end = xml.find(
"</Component>", start );
125 return xml.substr( start,
end == std::string::npos ? std::string::npos
129 std::string u1 = componentRegion(
"U1" );
132 BOOST_CHECK_MESSAGE( u1.find(
"mirror=\"true\"" ) != std::string::npos,
133 "Flipped component must carry mirror=\"true\". Region: " + u1 );
134 BOOST_CHECK_MESSAGE( u1.find(
"rotation=\"150.0\"" ) != std::string::npos,
135 "Flipped 30 degree component must export rotation=\"150.0\". Region: " + u1 );
138 BOOST_CHECK_MESSAGE( u1.find(
"rotation=\"330.0\"" ) == std::string::npos,
139 "Flipped rotation must not be a bare Invert() (330.0). Region: " + u1 );
140 BOOST_CHECK_MESSAGE( u1.find(
"rotation=\"30.0\"" ) == std::string::npos,
141 "Flipped rotation must not be the unadjusted orientation (30.0). Region: " + u1 );
143 std::string u2 = componentRegion(
"U2" );
146 BOOST_CHECK_MESSAGE( u2.find(
"mirror=\"true\"" ) == std::string::npos,
147 "Top component must not be mirrored. Region: " + u2 );
148 BOOST_CHECK_MESSAGE( u2.find(
"rotation=\"30.0\"" ) != std::string::npos,
149 "Top 30 degree component must export rotation=\"30.0\". Region: " + u2 );
151 std::filesystem::remove( std::filesystem::path( tempPath.ToStdString() ) );
constexpr EDA_IU_SCALE pcbIUScale
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
LSET is a set of PCB_LAYER_IDs.
@ NORMAL
Shape is the same on all layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
void SaveBoard(const wxString &aFileName, BOARD &aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
@ SMD
Smd pad, appears on the solder paste layer (default)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE_MESSAGE(dc.CacheTableInfo(table, { "part_id", "val" }), dc.GetLastError())
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
static FOOTPRINT * addFootprint(BOARD &aBoard, const wxString &aReference)
KIBIS top(path, &reporter)
VECTOR2< int32_t > VECTOR2I