69 pad->SetNumber( wxT(
"1" ) );
87 FOOTPRINT* flipped = addFootprint( wxT(
"U1" ),
99 wxString tempPath = wxFileName::CreateTempFileName( wxT(
"kicad_ipc2581_test" ) );
101 std::map<std::string, UTF8> props;
102 props[
"units"] =
"mm";
103 props[
"version"] =
"C";
104 props[
"sigfig"] =
"3";
106 BOOST_REQUIRE_NO_THROW( ipc2581Plugin.
SaveBoard( tempPath, &board, &props ) );
109 std::ifstream xmlFile( tempPath.ToStdString() );
112 std::string xml( ( std::istreambuf_iterator<char>( xmlFile ) ),
113 std::istreambuf_iterator<char>() );
118 auto componentRegion =
119 [&](
const std::string& aRef ) -> std::string
121 size_t start = xml.find(
"refDes=\"" + aRef +
"\"" );
123 if( start == std::string::npos )
124 return std::string();
126 size_t end = xml.find(
"</Component>", start );
128 return xml.substr( start,
end == std::string::npos ? std::string::npos
132 std::string u1 = componentRegion(
"U1" );
133 BOOST_REQUIRE_MESSAGE( !u1.empty(),
"Flipped component U1 should be exported" );
136 "Flipped component must carry mirror=\"true\". Region: " + u1 );
138 "Flipped 30 degree component must export rotation=\"150.0\". Region: "
143 "Flipped rotation must not be a bare Invert() (330.0). Region: " + u1 );
145 "Flipped rotation must not be the unadjusted orientation (30.0). Region: "
148 std::string u2 = componentRegion(
"U2" );
149 BOOST_REQUIRE_MESSAGE( !u2.empty(),
"Top component U2 should be exported" );
152 "Top component must not be mirrored. Region: " + u2 );
154 "Top 30 degree component must export rotation=\"30.0\". Region: " + u2 );
156 std::filesystem::remove( std::filesystem::path( tempPath.ToStdString() ) );
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
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...