23#include <boost/test/unit_test.hpp>
85 const std::string dest = ( tmp.
Path() /
"out.kicad_pcb" ).string();
90 std::ifstream file( dest );
91 std::string content( ( std::istreambuf_iterator<char>( file ) ), std::istreambuf_iterator<char>() );
93 const std::set<std::string> known =
99 if( !unsupported.empty() )
101 std::string msg =
"Downgraded board uses tokens " + aTarget.m_name.ToStdString() +
" cannot parse:";
103 for(
const std::string& token : unsupported )
131 fp->
SetUnitInfo( { { wxT(
"A" ), { wxT(
"1" ) } }, { wxT(
"B" ), { wxT(
"2" ) } } } );
140 pad->SetNumber( wxT(
"1" ) );
144 pad->SetPadToDieDelay( 1000 );
146 pad->Padstack().FrontPostMachining().size =
pcbIUScale.mmToIU( 1.2 );
147 pad->Padstack().FrontPostMachining().depth =
pcbIUScale.mmToIU( 0.2 );
150 PAD* customPad =
new PAD( fp );
159 fp->
Add( customPad );
173 aBoard.
Add( generator );
178 generator->AddItem(
via );
190 parent->Add( ended );
193 parent->Add( constraint );
205 parent->Add( ellipse );
213 parent->Add( rounded );
220 parent->Add( hatch );
227 parent->Add( copperHatch );
230 barcode->
SetText( wxT(
"TEST123" ) );
234 parent->Add( barcode );
237 textbox->
SetText( wxT(
"Knockout" ) );
242 parent->Add( textbox );
245 table->SetColCount( 1 );
250 cell->
SetText( wxT(
"Knockout cell" ) );
254 table->AddCell( cell );
255 parent->Add(
table );
267 group->SetName( wxT(
"transform group" ) );
268 group->SetDesignBlockLibId(
LIB_ID( wxT(
"Lib" ), wxT(
"Block" ) ) );
269 group->AddItem( hatch );
270 group->AddItem( barcode );
271 parent->Add(
group );
279 aBoard.
Add( skipVia );
286 aBoard.
Add( buriedVia );
288 ZONE* linkedArea =
new ZONE( &aBoard );
296 aBoard.
Add( linkedArea );
309 image->GetReferenceImage().SetImageScale( 2.0 );
323 bool aDropInsteadOfApproximate )
329 { wxT(
"Geometric constraints" ), 20260624, DOWNGRADE_BUCKET::DROP },
330 { wxT(
"Local grids" ), 20260728, DOWNGRADE_BUCKET::DROP },
331 { wxT(
"Via stitching and guarding" ), 20260816, DOWNGRADE_BUCKET::DROP },
332 { wxT(
"Microvia stack generators" ), 20260830, DOWNGRADE_BUCKET::DROP },
333 { wxT(
"Graphic line endings" ), 20260818, DOWNGRADE_BUCKET::LOWER },
334 { wxT(
"Footprint simulation exclusions" ), 20260828, DOWNGRADE_BUCKET::DROP },
335 { wxT(
"Custom properties" ), 20260831, DOWNGRADE_BUCKET::DROP },
336 { wxT(
"Drill charts and maps" ), 20260901, DOWNGRADE_BUCKET::DROP },
337 { wxT(
"Drill symbol configuration" ), 20260901, DOWNGRADE_BUCKET::DROP },
338 { wxT(
"Linked placement rule areas" ), 20261018, DOWNGRADE_BUCKET::DROP },
339 { wxT(
"Net chains" ), 20260512, DOWNGRADE_BUCKET::DROP },
340 { wxT(
"Ellipse graphics" ), 20260508, DOWNGRADE_BUCKET::LOWER },
341 { wxT(
"Extruded 3D bodies" ), 20260410, DOWNGRADE_BUCKET::DROP },
342 { wxT(
"Pad simulation types" ), 20260521, DOWNGRADE_BUCKET::DROP },
343 { wxT(
"Footprint unit metadata" ), 20250909, DOWNGRADE_BUCKET::DROP },
344 { wxT(
"Barcodes" ), 20250914, DOWNGRADE_BUCKET::LOWER },
345 { wxT(
"PCB variants" ), 20260101, DOWNGRADE_BUCKET::DROP },
346 { wxT(
"Jumper pad groups" ), 20250324, DOWNGRADE_BUCKET::DROP },
347 { wxT(
"Counterbore / countersink" ), 20251101, DOWNGRADE_BUCKET::DROP },
348 { wxT(
"Press-fit pads" ), 20250811, DOWNGRADE_BUCKET::DROP },
349 { wxT(
"Skip vias" ), 20250801, DOWNGRADE_BUCKET::LOWER, true },
350 { wxT(
"Buried vias" ), 20250926, DOWNGRADE_BUCKET::LOWER, true },
351 { wxT(
"Zone layer defaults" ), 20250302, DOWNGRADE_BUCKET::DROP },
352 { wxT(
"Pad-to-die delays" ), 20250401, DOWNGRADE_BUCKET::DROP },
353 { wxT(
"Hatched shape fills" ), 20250222, DOWNGRADE_BUCKET::LOWER },
354 { wxT(
"Hatched copper fills" ), 20250222, DOWNGRADE_BUCKET::LOWER, true },
355 { wxT(
"PCB points" ), 20250901, DOWNGRADE_BUCKET::DROP },
356 { wxT(
"Via protection" ), 20250228, DOWNGRADE_BUCKET::DROP },
357 { wxT(
"Dielectric frequency models" ), 20260511, DOWNGRADE_BUCKET::DROP },
358 { wxT(
"Group design block links" ), 20250513, DOWNGRADE_BUCKET::DROP },
359 { wxT(
"Knockout text boxes" ), 20250210, DOWNGRADE_BUCKET::LOWER },
360 { wxT(
"Rounded rectangles" ), 20250829, DOWNGRADE_BUCKET::LOWER },
361 { wxT(
"Knockout table cells" ), 20260603, DOWNGRADE_BUCKET::LOWER },
362 { wxT(
"Per-zone layer properties" ), 20250302, DOWNGRADE_BUCKET::DROP },
364 aDropInsteadOfApproximate );
369 const std::string& aTokenFileName )
372 const std::set<std::string> known =
376 for(
bool drop : {
false,
true } )
381 const std::string src = ( tmp.
Path() /
"source.kicad_pcb" ).string();
382 const std::string dest = ( tmp.
Path() /
"out.kicad_pcb" ).string();
384 std::unique_ptr<BOARD> board(
402 for(
const std::string& token : unsupported )
403 BOOST_ERROR(
"Transformed board uses unknown token: " + token );
406 != std::string::npos );
409 std::unique_ptr<BOARD> reloaded( io.
LoadBoard( dest,
nullptr ) );
416 if( aTarget.
m_id == wxT(
"9.0" ) )
419 size_t buriedCount = 0;
421 for(
PCB_TRACK* track : reloaded->Tracks() )
436 if(
via->IsBuriedVia() )
447 for(
const COMPAT_ENTRY& entry : reloadReport.Entries() )
449 if( entry.m_feature == wxT(
"Via protection" ) )
452 BOOST_ERROR(
"Unexpected feature after reload: " + entry.m_feature.ToStdString() );
479 const std::string& aBoard,
const std::string& aReference,
size_t aExpectedDrops,
480 size_t aExpectedLowerings,
bool aDropInsteadOfApproximate =
false )
485 const std::string dest = ( tmp.
Path() / ( aBoard +
".kicad_pcb" ) ).string();
490 nullptr, wxEmptyString, aDropInsteadOfApproximate ) );
494 const std::string difference =
496 BOOST_CHECK_MESSAGE( difference.empty(), difference );
540 const std::string& aReference,
bool aDropInsteadOfApproximate =
false )
544 const wxString dest = ( tmp.
Path() /
"metadata.kicad_mod" ).wstring();
545 const wxString src = wxString::FromUTF8( fixture +
"current/metadata.pretty/metadata.kicad_mod" );
551 fixture + aRelease +
"/" + aReference +
".pretty/metadata.kicad_mod", dest.ToStdString() );
552 BOOST_CHECK_MESSAGE( difference.empty(), difference );
563 const std::string dest = ( tmp.
Path() /
"out.kicad_pcb" ).string();
573 BOOST_CHECK_MESSAGE( out.find(
"gr_arc" ) != std::string::npos,
"the custom pad's arc primitive was dropped" );
576 bool inString =
false;
578 for(
size_t ii = 0; ii < out.size(); ++ii )
580 if( out[ii] ==
'"' && ( ii == 0 || out[ii - 1] !=
'\\' ) )
581 inString = !inString;
582 else if( !inString && out[ii] ==
'(' )
584 else if( !inString && out[ii] ==
')' )
588 BOOST_CHECK_MESSAGE( depth == 0,
"exported board is unbalanced by " + std::to_string( depth ) );
591 std::unique_ptr<BOARD> reloaded( io.
LoadBoard( dest,
nullptr ) );
595 BOOST_CHECK_EQUAL( reloaded->Footprints().front()->Pads().front()->GetPrimitives(
F_Cu ).size(), 1 );
659 const std::string golden =
"(kicad_pcb (version 20241229) (generator_version \"9.0\") "
660 "(setup (pad_to_mask_clearance 0.05)) "
661 "(pad \"1\" (at 100 100 30) (size 2 1) (net 1 \"SIGNAL\")))";
664 for(
const auto& [from, to] : std::vector<std::pair<std::string, std::string>>{ {
"100 100",
"0 0" },
665 {
"(size 2 1)",
"(size 1 2)" },
668 {
"100 100 30",
"100 100 31" },
669 {
"20241229",
"20260206" } } )
671 std::string changed = golden;
672 changed.replace( changed.find( from ), from.size(), to );
677 auto metadataOnly = parser.
Parse(
"(kicad_pcb (version 20241229) (generator_version \"10.99\") "
678 "(setup (pad_to_mask_clearance 0.05)) "
679 "(pad \"1\" (at 100.000001 99.999999 30) (size 2 1) (net 1 \"SIGNAL\")))" );
682 const std::string plotGolden =
"(kicad_pcb (setup (pcbplotparams (hpglpennumber 1) (hpglpenspeed 20) "
683 "(hpglpendiameter 15) (plotinvisibletext no))))";
684 auto plotExpected = parser.
Parse( plotGolden );
685 auto modernPlot = parser.
Parse(
"(kicad_pcb (setup (pcbplotparams (pngdpi 300) (pngantialias yes))))" );
688 for(
const auto& [from, to] :
689 std::vector<std::pair<std::string, std::string>>{ {
"hpglpennumber 1",
"hpglpennumber 2" },
690 {
"hpglpenspeed 20",
"hpglpenspeed 30" },
691 {
"hpglpendiameter 15",
"hpglpendiameter 16" },
692 {
"plotinvisibletext no",
"plotinvisibletext yes" } } )
694 std::string changed = plotGolden;
695 changed.replace( changed.find( from ), from.size(), to );
696 auto nonDefault = parser.
Parse( changed );
709 const wxString
path = ( tmp.
Path() / ( target.m_id.ToStdString() +
".kicad_pcb" ) ).string();
711 std::ifstream file(
path.ToStdString() );
712 std::string
text( ( std::istreambuf_iterator<char>( file ) ), std::istreambuf_iterator<char>() );
716 if( target.m_id == wxT(
"9.0" ) )
720 BOOST_CHECK(
text.find(
"(hpglpendiameter 15.000000)" ) != std::string::npos );
721 BOOST_CHECK(
text.find(
"(plotinvisibletext no)" ) != std::string::npos );
738 const wxString
path = ( tmp.
Path() / ( target.m_id.ToStdString() +
".kicad_pcb" ) ).string();
740 std::ifstream file(
path.ToStdString() );
741 std::string
text( ( std::istreambuf_iterator<char>( file ) ), std::istreambuf_iterator<char>() );
742 const std::string
expected = target.m_id == wxT(
"9.0" ) ?
"(paper \"User\" 123.457 100.123)"
743 :
"(paper \"User\" 123.456789 100.123456)";
753 for(
bool drop : {
false,
true } )
787 text.SetFont(
nullptr );
789 text.SetTextThickness( 100000 );
790 text.SetLineSpacing( 1.25 );
791 text.SetItalic(
true );
795 text.SetMirrored(
true );
796 text.SetVisible(
false );
797 text.SetHyperlink( wxT(
"https://example.com/datasheet" ) );
799 const std::string prefix =
"(effects(font(size 2 1)(line_spacing 1.25)(thickness 0.1)"
800 "(italic yes)(color 51 102 153 0.75))(justify left bottom mirror)";
801 const std::string href =
"(href \"https://example.com/datasheet\"))";
806 for(
bool v9 : {
false,
true } )
809 BOOST_CHECK( omitted.find(
"(color " ) == std::string::npos );
810 BOOST_CHECK( omitted.find(
"(href " ) == std::string::npos );
811 BOOST_CHECK( omitted.find(
"(justify left bottom mirror)" ) != std::string::npos );
823 text.SetFont(
nullptr );
826 for(
bool v9 : {
false,
true } )
828 text.SetBold(
false );
829 text.SetTextThickness( 0 );
833 text.SetTextThickness( 1 );
838 text.SetTextThickness( 100000 );
841 text.SetBold(
true );
845 text.SetTextThickness( 0 );
855 text.SetFont(
nullptr );
856 text.SetMultilineAllowed(
false );
858 text.SetAutoThickness(
true );
859 text.SetVisible(
false );
863 text.SetTextThickness( 1 );
867 text.SetTextThickness( 0 );
871 text.SetBold(
true );
873 text.SetBold(
false );
874 text.SetMirrored(
true );
886 title.
SetTitle( wxT(
"Production" ) );
887 title.
SetDate( wxT(
"2026-10-08" ) );
895 "(company \"KiCad\")(comment 1 \"First\")(comment 9 \"Last\"))" );
898 for(
const auto& [style, token] :
921 auto file = std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>();
922 file->name = wxT(
"metadata.bin" );
924 file->data_hash =
"metadata-only";
933 "(embedded_files (file (name \"metadata.bin\")(type other)(checksum \"metadata-only\")))" );
935 for(
bool writeData : {
false,
true } )
943 BOOST_CHECK( file->compressedEncodedData.empty() );
951 auto file = std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>();
952 file->name = wxT(
"payload.bin" );
955 for(
int ii = 0; ii < 4096; ++ii )
956 file->decompressedData.push_back(
static_cast<char>( ( ii * 131 + ii / 251 ) % 256 ) );
959 BOOST_REQUIRE_GT( file->compressedEncodedData.size(), 76 );
962 const std::string hash = file->data_hash;
964 std::string
expected =
"(embedded_files (file (name \"payload.bin\")(type other)(data";
966 for(
size_t first = 0; first < encoded.size(); first += 76 )
968 const std::string chunk = encoded.substr( first, 76 );
973 if( first + chunk.size() == encoded.size() )
979 expected +=
")(checksum \"" + hash +
"\")))";
981 for(
bool v9 : {
false,
true } )
999 "(embedded_files (file (name \"payload.bin\")(type other)(checksum \"" + hash +
"\")))" );
1023 hash.
addDataV1(
reinterpret_cast<const uint8_t*
>( aPayload.data() ), aPayload.size() );
1030 std::vector<size_t> sizes = { 4095, 4096, 4097 };
1032 for(
size_t size = 0; size <= 32; ++size )
1033 sizes.push_back( size );
1035 for(
size_t size : sizes )
1038 auto file = std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>();
1039 file->name = wxT(
"payload.bin" );
1041 for(
size_t ii = 0; ii < size; ++ii )
1042 file->decompressedData.push_back(
static_cast<char>( ( ii * 131 + ii / 251 ) % 256 ) );
1046 const auto original = *file;
1049 if( size % 16 != 0 )
1050 BOOST_CHECK_NE( checksum, original.data_hash );
1052 for(
bool v9 : {
false,
true } )
1054 for(
bool writeData : {
false,
true } )
1059 BOOST_CHECK( output.find(
"(checksum \"" + checksum +
"\")" ) != std::string::npos );
1064 BOOST_CHECK_EQUAL( output,
"(embedded_files (file (name \"payload.bin\")(type other)"
1066 + checksum +
"\")))" );
1069 BOOST_CHECK( file->decompressedData == original.decompressedData );
1070 BOOST_CHECK_EQUAL( file->compressedEncodedData, original.compressedEncodedData );
1082 for(
size_t size : { 0u, 1u, 13u, 17u, 31u, 4097u } )
1085 auto file = std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>();
1086 file->name = wxT(
"encoded.bin" );
1087 file->decompressedData.assign( size,
'x' );
1090 file->decompressedData.clear();
1092 const auto original = *file;
1094 for(
bool v9 : {
false,
true } )
1096 for(
bool writeData : {
false,
true } )
1101 BOOST_CHECK( output.find(
"(checksum \"" + checksum +
"\")" ) != std::string::npos );
1104 BOOST_CHECK_EQUAL( file->compressedEncodedData, original.compressedEncodedData );
1116 for(
bool badChecksum : {
false,
true } )
1119 auto file = std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>();
1120 file->name = wxT(
"invalid.bin" );
1121 file->decompressedData.assign( 13,
'x' );
1123 file->decompressedData.clear();
1126 file->data_hash =
"invalid-checksum";
1128 file->compressedEncodedData =
"invalid-base64";
1131 const auto original = *file;
1133 for(
bool v9 : {
false,
true } )
1135 for(
bool writeData : {
false,
true } )
1139 BOOST_CHECK_EQUAL( file->compressedEncodedData, original.compressedEncodedData );
1158 const std::vector<std::pair<wxString, std::string>> checksums = {
1159 { wxT(
"SchematicTemplate.kicad_wks" ),
"6003EC72C5978E83C182073E67278FCF" },
1160 { wxT(
"SchematicTemplateEmpty.kicad_wks" ),
"0D054F65E3E0563620A9E16BBBB777DD" }
1163 for(
const auto& [
name, checksum] : checksums )
1165 const auto* file = board->GetEmbeddedFile(
name );
1168 BOOST_CHECK_NE( file->data_hash, checksum );
1170 const auto original = *file;
1172 for(
bool v9 : {
false,
true } )
1174 for(
bool writeData : {
false,
true } )
1177 BOOST_CHECK( output.find(
"(name \"" +
name.ToStdString() +
"\")" ) != std::string::npos );
1178 BOOST_CHECK( output.find(
"(checksum \"" + checksum +
"\")" ) != std::string::npos );
1179 BOOST_CHECK( output.find(
"(checksum \"" + original.data_hash +
"\")" ) == std::string::npos );
1181 BOOST_CHECK( file->decompressedData == original.decompressedData );
1182 BOOST_CHECK_EQUAL( file->compressedEncodedData, original.compressedEncodedData );
constexpr EDA_IU_SCALE pcbIUScale
COMPATIBILITY_REPORT ClassifyBoardForDowngrade(const BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Report what a board would lose if exported to an older KiCad.
void SaveBoardForTarget(BOARD *aBoard, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
Save a board stamped for the target, using the writer for that version.
bool ExportBoardToOlderVersion(const wxString &aSrcFile, const wxString &aDestFile, const DOWNGRADE_TARGET &aTarget, COMPATIBILITY_REPORT &aReport, wxString *aUnsupportedToken, const wxString &aVariant, bool aDropInsteadOfApproximate)
Load a board, downgrade the copy, and write it stamped for the target.
DOWNGRADE_FILE_RESULT DowngradeFootprintFileToTemp(const wxString &aSrcFile, const wxString &aTmpFile, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Load one .kicad_mod, classify it against the rule table, and write the downgraded copy to aTmpFile.
void DowngradeBoardInPlace(BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Approximate or remove, in place, what the target cannot represent.
General utilities for PCB file IO for QA programs.
@ BS_ITEM_TYPE_DIELECTRIC
int GetLegacyPPI() const
Recompute the PPI the way it was computed before the pixels/cm truncation fix.
std::map< PCB_LAYER_ID, ZONE_LAYER_PROPERTIES > m_ZoneLayerProperties
DRILL_SYMBOL_PROFILE & GetDrillSymbolProfile()
BOARD_STACKUP & GetStackupDescriptor()
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void SetIsKnockout(bool aKnockout)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Manage one layer needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
Information pertinent to a Pcbnew printed circuit board.
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
void SetVariantNames(const std::vector< wxString > &aNames)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetPageSettings(const PAGE_INFO &aPageSettings)
const PCB_PLOT_PARAMS & GetPlotOptions() const
BOARD_DESIGN_SETTINGS & GetDesignSettings()
const DRAWINGS & Drawings() const
What an export to a given target will keep, approximate, drop, or block.
bool IsBlocked() const
True if some feature makes the target impossible. The user cannot export anyway.
int Count(DOWNGRADE_BUCKET aBucket) const
void SetName(const wxString &aName)
void SetCustomProperty(const wxString &aKey, const wxString &aValue)
void SetEndEndingStyle(LINE_ENDING_STYLE aStyle)
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual void SetText(const wxString &aText)
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
static RETURN_CODE CompressAndEncode(EMBEDDED_FILE &aFile)
Take data from the decompressedData buffer and compresses it using ZSTD into the compressedEncodedDat...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
A color representation with 4 components: red, green, blue, alpha.
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
A logical library item identifier and consists of various portions much like a URI.
A streaming C++ equivalent for MurmurHash3_x64_128.
FORCE_INLINE void addDataV1(const uint8_t *data, size_t length)
FORCE_INLINE HASH_128 digest()
Handle the data for a net.
void SetNetChain(const wxString &aNetChain)
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
MASK_LAYER_PROPS & FrontOuterLayers()
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
MASK_LAYER_PROPS & BackOuterLayers()
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
void AddPrimitive(PCB_LAYER_ID aLayer, PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetWidthMM(double aWidthInMM)
void SetHeightMM(double aHeightInMM)
EXTRUDED_3D_BODY * MutableExtruded()
void SetWidth(int aWidth)
void SetHeight(int aHeight)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the drawing layer for the barcode and its text.
void SetText(const wxString &aText)
Set the barcode content text to encode.
A geometric constraint between board items (issue #2329).
void AddMember(const KIID &aItem, CONSTRAINT_ANCHOR aAnchor=CONSTRAINT_ANCHOR::WHOLE, int aIndex=-1)
A drill chart placed on the board, kept in step with the holes.
Turns on drill symbols at the holes, for one layer.
A set of BOARD_ITEMs (i.e., without duplicates).
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
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...
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...
Parameters and options when plotting/printing a board.
PLOT_FORMAT GetFormat() const
void SetFormat(PLOT_FORMAT aFormat)
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Object to handle a bitmap image that can be inserted in a PCB.
void SetEllipseCenter(const VECTOR2I &aPt) override
void SetCornerRadius(int aCornerRadius) override
void SetWidth(int aWidth) override
void SetEllipseStartAngle(const EDA_ANGLE &aA) override
void SetEllipseEndAngle(const EDA_ANGLE &aA) override
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetEllipseMinorRadius(int aR) override
void SetStart(const VECTOR2I &aStart) override
void SetEllipseMajorRadius(int aR) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
const PADSTACK & Padstack() const
void SetDrill(int aDrill)
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
void SetViaType(VIATYPE aViaType)
void SetWidth(int aWidth) override
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
std::unique_ptr< SEXPR > Parse(const std::string &aString)
Simple container to manage line stroke parameters.
void SetColor(const KIGFX::COLOR4D &aColor)
Hold the information shown in the lower right corner of a plot, printout, or editing view.
void SetRevision(const wxString &aRevision)
void SetComment(int aIdx, const wxString &aComment)
void SetTitle(const wxString &aTitle)
const wxString & GetComment(int aIdx) const
void SetCompany(const wxString &aCompany)
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
Handle a list of polygons defining a copper zone.
bool AppendCorner(const VECTOR2I &aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
ZONE_LAYER_PROPERTIES & LayerProperties(PCB_LAYER_ID aLayer)
void SetLinkSet(const KIID &aLinkSet)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetIsRuleArea(bool aEnable)
void SetPlacementAreaEnabled(bool aEnabled)
@ LOWER
Approximated down to a simpler equivalent.
@ DROP
No equivalent, left out.
static bool empty(const wxTextEntryBase *aCtrl)
@ CONVERTED
The temp file holds the downgraded copy.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
@ FILLED_SHAPE
Fill with object color.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
Test utilities for timestamps.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::set< std::string > LoadTokenSet(const std::string &aFileName)
Read a release keyword file from qa/data/downgrade, one token per line.
std::string GoldenFileDifference(const std::string &aExpected, const std::string &aActual)
std::string ReadGoldenText(const std::string &aPath)
void CheckTransformCoverage(const COMPATIBILITY_REPORT &aReport, int aTargetVersion, std::initializer_list< EXPECTED_DOWNGRADE_FEATURE > aFeatures, bool aDropInsteadOfApproximate)
const DOWNGRADE_TARGET & RequireDowngradeTarget(const wxString &aId)
std::string GoldenSexprDifference(const SEXPR::SEXPR &aExpected, const SEXPR::SEXPR &aActual, const std::string &aPath="", const std::string &aParent="", size_t aIndex=0)
wxMemoryBuffer MakePngWithFractionalPixelsPerCm()
A tiny PNG whose embedded resolution gives a fractional pixels/cm, so the legacy truncating PPI diffe...
double SerializedImageScale(const std::string &aContent, const std::string &aUuid)
std::vector< std::string > UnknownSexprHeads(const std::string &aContent, const std::set< std::string > &aKnown, const std::set< std::string > &aHarmless={})
Every node head in the serialized text that is not in the known or harmless sets.
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
BARCODE class definition.
@ HORIZONTAL
A segment (or two points) is horizontal.
Class to handle a set of BOARD_ITEMs.
One line in the compatibility report.
An older KiCad release we can export a project back to.
int m_boardVersion
SEXPR_BOARD_FILE_VERSION for the target.
wxString m_id
Stable machine key for CLI and jobsets, e.g. "10.0".
std::string compressedEncodedData
std::string ToString() const
std::optional< bool > is_capped
True if the drill hole should be capped.
std::optional< bool > is_filled
True if the drill hole should be filled completely.
std::optional< bool > has_covering
True if the pad on this side should have covering.
std::optional< bool > has_plugging
True if the drill hole should be plugged on this side.
std::optional< VECTOR2I > hatching_offset
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(res.columns()==1)
static void checkBoardTransformCoverage(const COMPATIBILITY_REPORT &aReport, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
static void checkExportUsesOnlyKnownTokens(const DOWNGRADE_TARGET &aTarget, const std::string &aTokenFileName)
static void checkNativeFootprintGolden(const DOWNGRADE_TARGET &aTarget, const std::string &aRelease, const std::string &aReference, bool aDropInsteadOfApproximate=false)
static void checkNativeBoardGolden(const DOWNGRADE_TARGET &aTarget, const std::string &aRelease, const std::string &aBoard, const std::string &aReference, size_t aExpectedDrops, size_t aExpectedLowerings, bool aDropInsteadOfApproximate=false)
static void checkTransformedBoardUsesOnlyKnownTokens(const DOWNGRADE_TARGET &aTarget, const std::string &aTokenFileName)
static std::string releaseEmbeddedChecksum(const std::vector< char > &aPayload)
BOOST_AUTO_TEST_CASE(BoardToKicad9UsesOnlyKnownTokens)
static std::string historicalTextEffects(const EDA_TEXT &aText, bool aV9, int aControlBits=0)
static PCB_REFERENCE_IMAGE * addTransformFeatures(BOARD &aBoard)
static void checkCustomPadArcSurvives(const DOWNGRADE_TARGET &aTarget)
static std::string historicalEmbeddedFiles(const EMBEDDED_FILES &aFiles, bool aV9, bool aWriteData)
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
static const DOWNGRADE_TARGET & kicad10
static const DOWNGRADE_TARGET & kicad9
static void checkExportUsesOnlyKnownTokens(const DOWNGRADE_TARGET &aTarget, const std::string &aTokenFileName)
BOOST_TEST_CONTEXT("Test Clearance")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
VECTOR2< int32_t > VECTOR2I