20#include <boost/test/unit_test.hpp>
48#include <nlohmann/json.hpp>
176 BOOST_CHECK_CLOSE( areaMM,
M_PI * 5.0 * 3.0, 2.0 );
198 BOOST_REQUIRE_GE(
chain.PointCount(), 5 );
201 double firstDist =
chain.CPoint( 0 ).EuclideanNorm();
202 double lastDist =
chain.CPoint(
chain.PointCount() - 1 ).EuclideanNorm();
218 screen.
Append( innerShape );
219 screen.
Append( outerShape );
340 BOOST_CHECK_CLOSE( areaMM, 60.0 - ( 4.0 -
M_PI ), 2.0 );
351 pin->SetNumber( wxT(
"[A\\,1,B]" ) );
367 pin->SetNumber( wxT(
"[A1,B2]" ) );
383 pin->SetNumber( wxT(
"[A\\,B" ) );
424 group->AddItem( member );
425 group->SetLocked(
true );
454 rootScreen->
Append( child );
457 child->
GetFields().back().SetText( wxT(
"base note" ) );
468 variant.
m_Fields[wxT(
"Note" )] = wxT(
"variant note" );
556 const auto& variants = symbol->
GetInstances()[0].m_Variants;
558 BOOST_CHECK( variants.at( wxT(
"V1" ) ).m_PinMapOverride.IsDefault() );
586 for(
int style = 1; style <= 3; ++style )
589 pin->SetNumber( wxT(
"1" ) );
591 pin->SetBodyStyle( style );
693 == wxT(
"pin_map_override" ) );
727 variant.
m_DNP =
true;
752 auto readFile = [](
const std::string& aPath )
754 std::ifstream file( aPath, std::ios::binary );
756 return std::string( std::istreambuf_iterator<char>( file ), std::istreambuf_iterator<char>() );
758 std::map<std::string, std::string> originals;
760 for(
const std::string&
name : {
"embedded_files.kicad_pro",
"embedded_files.kicad_sch",
"child.kicad_sch" } )
770 LoadSchematic( wxFileName( fixture +
"embedded_files.kicad_sch" ) );
772 SCH_SHEET* root = m_schematic->GetTopLevelSheet( 0 );
784 const std::string output = ( tmp.
Path() /
"embedded_files.kicad_sch" ).string();
785 const std::string childOutput = ( tmp.
Path() /
"child.kicad_sch" ).string();
789 BOOST_REQUIRE( wxCopyFile( fixture +
"embedded_files.kicad_pro",
790 ( tmp.
Path() /
"embedded_files.kicad_pro" ).string() ) );
796 for(
const auto& [
name, expectedFile] :
expected.EmbeddedFileMap() )
812 for(
const auto& [
name, original] : originals )
837 screen.
Append( supported );
843 group->AddItem( item );
845 const auto& target =
kicad9;
852 for(
size_t i = 0; i <
normal.Entries().size(); ++i )
857 BOOST_CHECK( !omit.Entries()[i].m_detail.IsEmpty() );
887 const auto& target =
kicad9;
911 const auto& target =
kicad9;
929 for(
int style = 1; style <= 3; ++style )
932 pin->SetNumber( wxT(
"1" ) );
933 pin->SetBodyStyle( style );
944 group->AddItem( third );
951 BOOST_CHECK_EQUAL( std::distance( symbols.begin(), symbols.end() ), target.m_id == wxT(
"9.0" ) ? 2 : 3 );
957 if( target.m_id == wxT(
"10.0" ) )
970 const auto& target =
kicad9;
982 for(
bool drop : {
false,
true } )
989 pin->SetNumber( wxT(
"1" ) );
990 pin->SetCustomProperty( wxT(
"Role" ), wxT(
"Signal" ) );
1026 for(
bool drop : {
false,
true } )
1035 group->AddItem( line );
1121 text->SetText( wxT(
"${U1:PROPERTY.Vendor}" ) );
1125 text->SetText( wxT(
"\\${PROPERTY.Vendor}" ) );
1127 text->SetText( wxT(
"PROPERTY.Vendor" ) );
1136 for(
bool drop : {
false,
true } )
1139 std::unique_ptr<SCHEMATIC> schematic;
1141 auto symbols = schematic->RootScreen()->Items().OfType(
SCH_SYMBOL_T );
1146 schematic->Project().GetTextVars()[wxT(
"Alias" )] = wxT(
"${PROPERTY.Vendor}" );
1147 schematic->Project().GetTextVars()[wxT(
"Unused" )] = wxT(
"${PROPERTY.Missing}" );
1165 for(
bool drop : {
false,
true } )
1168 std::unique_ptr<SCHEMATIC> schematic;
1171 text->SetText( wxT(
"@{1 + 2} / ${PROJECTNAME}" ) );
1172 schematic->RootScreen()->Append(
text );
1179 == ( target.m_id == wxT(
"9.0" ) ? wxT(
"3 / ${PROJECTNAME}" )
1180 : wxT(
"@{1 + 2} / ${PROJECTNAME}" ) ) );
1181 text->SetText( wxT(
"\\@{1 + 2}" ) );
1183 target.m_id == wxT(
"9.0" ) );
1192 std::unique_ptr<SCHEMATIC> schematic;
1194 auto symbols = schematic->RootScreen()->Items().OfType(
SCH_SYMBOL_T );
1197 symbol->
SetCustomProperty( wxT(
"Vendor" ), wxT(
"\\${REFERENCE} \\@{1 + 2}" ) );
1199 field->
SetText( wxT(
"\\${PROPERTY.literal} ${PROPERTY.Vendor}" ) );
1204 BOOST_CHECK_EQUAL( resolvedBefore.ToStdString(), std::string(
"\\${PROPERTY.literal} \\${REFERENCE} \\3" ) );
1209 shownBefore.ToStdString() );
1218 std::unique_ptr<SCHEMATIC> schematic;
1220 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"Ordinary title" ) );
1221 schematic->Project().GetTextVars()[wxT(
"TITLE" )] = wxT(
"${PROPERTY.Unknown}" );
1223 text->SetText( wxT(
"${TITLE}" ) );
1224 schematic->RootScreen()->Append(
text );
1230 for(
bool drop : {
false,
true } )
1242 std::unique_ptr<SCHEMATIC> schematic;
1244 schematic->Project().GetTextVars()[wxT(
"BorderAlias" )] = wxT(
"${PROPERTY.Unknown}" );
1245 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"${BorderAlias}" ) );
1247 text->SetText( wxT(
"${TITLE}" ) );
1248 schematic->RootScreen()->Append(
text );
1250 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"Ordinary title" ) );
1252 schematic->RootScreen()->GetTitleBlock().SetComment( 8, wxT(
"@{1 + 2}" ) );
1260 std::vector<wxString> members;
1266 label->
SetText( wxT(
"D[00..02]" ) );
1270 label->
SetText( wxT(
"D[0..2]" ) );
1274 auto alias = std::make_shared<BUS_ALIAS>();
1275 alias->SetName( wxT(
"Data" ) );
1276 alias->SetMembers( { wxT(
"D[00..02]" ) } );
1307 for(
const wxString& malformed : { wxT(
"D[..2]" ), wxT(
"D[1..]" ), wxT(
"D[1..2" ) } )
1313 label->
SetText( wxString::Format( wxT(
"D[%ld..%ld]" ), LONG_MAX - 1, LONG_MAX ) );
1316 for(
const wxString& ordinary :
1317 { wxT(
"D[1..2]" ), wxT(
"D[foo]" ), wxT(
"D[..0]" ), wxT(
"text [literal]" ) } )
1323 label->
SetText( wxT(
"D[1..2]+" ) );
1326 label->
SetText( wxT(
"I^{2}C[1..2]" ) );
1337 std::unique_ptr<SCHEMATIC> schematic;
1340 label->
SetText( wxT(
"${BUS}" ) );
1341 schematic->RootScreen()->Append( label );
1342 for(
const wxString& bus : { wxT(
"D[01..3]" ), wxT(
"D[..2]" ), wxT(
"D[1..2" ) } )
1344 schematic->Project().GetTextVars()[wxT(
"BUS" )] = bus;
1347 for(
const wxString& ordinary : { wxT(
"D[1..3]" ), wxT(
"D[foo]" ) } )
1349 schematic->Project().GetTextVars()[wxT(
"BUS" )] = ordinary;
1362 path.LastScreen()->Append( symbol );
1366 variant.
m_DNP =
true;
1372 BOOST_CHECK( reason.Contains( wxT(
"Missing:Alternate" ) ) );
1380 std::unique_ptr<SCHEMATIC> schematic;
1386 struct TABLE_RESTORE
1392 previousTable && *previousTable ? wxFileName( ( *previousTable )->Path() ).GetPath() : wxString() };
1394 wxFile tableFile(
directory + wxT(
"/sym-lib-table" ), wxFile::write );
1396 BOOST_REQUIRE( tableFile.Write( wxT(
"(sym_lib_table (version 7))\n" ) ) );
1404 row.
SetType( wxT(
"KiCad" ) );
1410 base.
SetName( wxT(
"base" ) );
1414 schematic->RootScreen()->Append( symbol );
1420 variant.
m_Fields[wxT(
"Footprint" )] = wxEmptyString;
1423 std::vector<KIID> pins;
1425 pins.push_back(
pin->m_Uuid );
1435 for(
size_t i = 0; i < pins.size(); ++i )
1438 BOOST_REQUIRE( cached != schematic->RootScreen()->GetLibSymbols().end() );
1448 for(
const wxString& token :
1449 { wxT(
"start_shape" ), wxT(
"end_shape" ), wxT(
"symbol_override" ), wxT(
"custom_property" ) } )
1462 { {
"meta", { {
"version", 1 } } },
1464 nlohmann::json::array(
1466 { {
"error_type",
"ERCET_PIN_NOT_CONNECTED" },
1467 {
"position", { {
"x_nm",
"12300" }, {
"y_nm",
"-45600" } } },
1468 {
"items", nlohmann::json::array(
1469 { { {
"value",
"11111111-1111-1111-1111-111111111111" } } } ) } } },
1470 {
"comment",
"accepted" } } } ) } } }
1483 const auto& exclusion = document[
"erc"][
"erc_exclusions"].at( 0 );
1485 == nlohmann::json::array( {
"pin_not_connected|123|-456|11111111-1111-1111-1111-111111111111|"
1486 "00000000-0000-0000-0000-000000000000|||",
1489 const nlohmann::json once = document;
1503 auto& marker = document[
"erc"][
"erc_exclusions"][0][
"marker"];
1504 const nlohmann::json
path = {
1505 {
"path", nlohmann::json::array( { { {
"value",
"22222222-2222-2222-2222-222222222222" } } } ) }
1507 marker[
"sheet_specific_path"] =
path;
1508 marker[
"main_item_sheet_path"] =
path;
1509 marker[
"aux_item_sheet_path"] =
path;
1511 nlohmann::json allPaths = document;
1515 "pin_not_connected|123|-456|11111111-1111-1111-1111-111111111111|"
1516 "00000000-0000-0000-0000-000000000000|/22222222-2222-2222-2222-222222222222|"
1517 "/22222222-2222-2222-2222-222222222222|/22222222-2222-2222-2222-222222222222" );
1519 marker.erase(
"aux_item_sheet_path" );
1520 marker[
"error_type"] =
"ERCET_GENERIC_WARNING";
1521 marker[
"child"] = { {
"text_value",
"raw warning text" } };
1526 "generic-warning|123|-456|11111111-1111-1111-1111-111111111111|raw warning "
1527 "text|/22222222-2222-2222-2222-222222222222|/22222222-2222-2222-2222-222222222222|" );
1537 for(
int invalid = 0; invalid < 4; ++invalid )
1540 auto& marker = document[
"erc"][
"erc_exclusions"][0][
"marker"];
1542 marker[
"error_type"] =
"ERCET_EMPTY_LABEL_NAME";
1543 else if( invalid == 1 )
1544 marker[
"items"][0][
"value"] =
"malformed-id";
1545 else if( invalid == 2 )
1546 marker[
"position"][
"x_nm"] =
"12301";
1549 marker[
"error_type"] =
"ERCET_GENERIC_WARNING";
1550 marker[
"child"] = { {
"text_value",
"cannot|encode" } };
1566 for(
int schema = 0; schema < 5; ++schema )
1570 document[
"meta"][
"version"] = 5;
1571 else if( schema == 1 )
1572 document[
"board"][
"design_settings"][
"meta"][
"version"] = 4;
1573 else if( schema == 2 )
1574 document[
"erc"][
"meta"][
"version"] = 2;
1575 else if( schema == 3 )
1576 document[
"tuning_profiles"][
"meta"][
"version"] = 3;
1578 document[
"net_settings"][
"meta"][
"version"] = 6;
1579 const nlohmann::json original = document;
constexpr EDA_IU_SCALE schIUScale
What an export to a given target will keep, approximate, drop, or block.
bool IsLossy() const
True if anything is approximated or dropped. This is what triggers the lossy warning.
bool IsBlocked() const
True if some feature makes the target impossible. The user cannot export anyway.
int Count(DOWNGRADE_BUCKET aBucket) const
const std::vector< COMPAT_ENTRY > & Entries() const
void AddItem(EDA_ITEM *aItem)
Add item to group.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
bool HasCustomProperties() const
void SetCustomProperty(const wxString &aKey, const wxString &aValue)
virtual void SetEnd(const VECTOR2I &aEnd)
void SetEndEnding(const LINE_ENDING &aEnding)
FILL_T GetFillMode() const
virtual void SetCornerRadius(int aRadius)
SHAPE_POLY_SET & GetPolyShape()
virtual void SetEllipseEndAngle(const EDA_ANGLE &aA)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
virtual void SetEllipseCenter(const VECTOR2I &aPt)
virtual void SetEllipseMinorRadius(int aR)
virtual void SetEllipseMajorRadius(int aR)
virtual void SetEllipseStartAngle(const EDA_ANGLE &aA)
LINE_ENDING_STYLE GetEndEndingStyle() const
void SetFillMode(FILL_T aFill)
virtual void SetStart(const VECTOR2I &aStart)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
EE_TYPE OfType(KICAD_T aType) const
A generic fixture for loading schematics and associated settings for qa tests.
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
std::optional< LIBRARY_TABLE * > ProjectTable() const
Retrieves the project library table for this adapter type, or nullopt if one doesn't exist.
void LoadProjectTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the project library tables in the given list, or all tables if no list is given
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
void SetScope(LIBRARY_TABLE_SCOPE aScope)
const wxString & Nickname() const
A logical library item identifier and consists of various portions much like a URI.
Define a library symbol object.
const LIB_ID & GetLibId() const override
void SetDuplicatePinNumbersAreJumpers(bool aEnabled)
SCH_FIELD * GetField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName; return nullptr if not found.
void SetAssociatedFootprints(std::vector< ASSOCIATED_FOOTPRINT > aList)
void SetBodyStyleNames(const std::vector< wxString > &aBodyStyleNames)
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
bool IsLocalPower() const override
const std::vector< wxString > & GetBodyStyleNames() const
int GetBodyStyleCount() const override
The body styles are a property of the drawings, which a derived symbol inherits from its root symbol ...
void SetLibId(const LIB_ID &aLibId)
bool GetDuplicatePinNumbersAreJumpers() const
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const override
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
virtual void SetName(const wxString &aName)
Decorative shape (arrowhead, circle, square) at the start or end of a graphic line,...
size_t size(int aType=UNDEFINED_TYPE) const
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
virtual LIBRARY_MANAGER & GetLibraryManager() const
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
double GetOpacity() const
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation of the image content relative to the stored raster.
void SetOpacity(double aOpacity)
Holds all the data relating to one schematic.
void CreateDefaultScreens()
void AddTopLevelSheet(SCH_SHEET *aSheet)
Add a new top-level sheet to the schematic.
SCH_SHEET_LIST BuildUnorderedSheetList() const
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Object to handle a bitmap image that can be inserted in a schematic.
REFERENCE_IMAGE & GetReferenceImage()
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
void SetText(const wxString &aText) override
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetLocked(bool aLocked) override
bool IsLocked() const override
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Segment description base class to describe items which have 2 end points (track, wire,...
VECTOR2I GetEndPoint() const
LINE_ENDING_STYLE GetStartEndingStyle() const
void SetStartEnding(const LINE_ENDING &aEnding)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void SetExcludedFromSim(bool aExcludeFromSim, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void AddLibSymbol(LIB_SYMBOL *aLibSymbol)
Add aLibSymbol to the library symbol map.
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
void SetStroke(const STROKE_PARAMS &aStroke) override
STROKE_PARAMS GetStroke() const override
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SCREEN * LastScreen()
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Variant information for a schematic sheet.
void InitializeAttributes(const SCH_SHEET &aSheet)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
wxString GetFieldText(const SCH_FIELD *aField, const wxString &aFieldName, const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
void SetFileName(const wxString &aFilename)
void RemoveInstance(const KIID_PATH &aInstancePath)
bool HasRootInstance() const
Check to see if this sheet has a root sheet instance.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void AddInstance(const SCH_SHEET_INSTANCE &aInstance)
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add aFieldName to the list of fields.
Variant information for a schematic symbol.
PIN_MAP_INSTANCE_OVERRIDE m_PinMapOverride
Per-instance pin-to-pad map override for this variant (issue #2282).
std::optional< LIB_ID > m_SymbolOverride
Alternate library symbol to substitute for the base symbol in this variant, if any.
void InitializeAttributes(const SCH_SYMBOL &aSymbol)
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
wxString GetSchSymbolLibraryName() const
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
const LIB_ID & GetLibId() const override
bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void AddVariant(const SCH_SHEET_PATH &aInstance, const SCH_SYMBOL_VARIANT &aVariant)
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
wxString GetFieldText(const SCH_FIELD *aField, const wxString &aFieldName, const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
double Area(bool aAbsolute=true) const
Return the area of this chain.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Simple container to manage line stroke parameters.
LINE_STYLE GetLineStyle() const
An interface to the global shared library manager that is schematic-specific and linked to one projec...
std::optional< LIB_STATUS > LoadOne(LIB_DATA *aLib) override
Loads or reloads the given library, if it exists.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear exclude from position files flag.
std::map< wxString, wxString > m_Fields
void FinalizeTextVarExpansion(wxString &aText, RESOLUTION_CONTEXT aContext)
@ BLOCK
Cannot be represented at all, export to this target is not possible.
@ LOWER
Approximated down to a simpler equivalent.
@ DROP
No equivalent, left out.
static bool empty(const wxTextEntryBase *aCtrl)
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.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static bool readFile(const wxString &aFileName, wxString &aOut, size_t aLimit=0)
Read a file into aOut.
PGM_BASE & Pgm()
The global program "get" accessor.
void DowngradeProjectFileJson(nlohmann::json &aDoc, const DOWNGRADE_TARGET &aTarget, COMPATIBILITY_REPORT &aReport)
Migrate a .kicad_pro document down to what the target release expects.
COMPATIBILITY_REPORT ClassifySchematicStructureForDowngrade(const SCHEMATIC &aSchematic, const DOWNGRADE_TARGET &aTarget)
Schematic-wide structure the per-screen rules cannot see. Does not modify it.
void DowngradeScreenInPlace(SCH_SCREEN *aScreen, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Approximate or remove, in place, what the target cannot represent.
bool FlattenSchematicVariant(SCHEMATIC &aSchematic, const wxString &aVariantName, wxString *aConflict)
Bake a variant into the base attributes of every symbol and sheet.
int SymbolLibDowngradeCoveredVersion()
The symbol library format the denylist was generated against.
COMPATIBILITY_REPORT ClassifyLibSymbolForDowngrade(const LIB_SYMBOL *aSymbol, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Report what a library symbol would lose if exported to an older KiCad. Does not modify it.
void DowngradeLibSymbolInPlace(LIB_SYMBOL *aSymbol, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Symbol-scoped downgrade for standalone .kicad_sym files the screen pass never sees.
void SaveSchematicForTarget(SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
Save a schematic sheet file stamped for the target, using the writer for that version.
wxString FindUnsupportedSchToken(const wxString &aSerialized, const DOWNGRADE_TARGET &aTarget)
Scan serialized schematic text for tokens the target cannot parse.
int SchDowngradeCoveredVersion()
The format the denylist was generated against. A format bump forces a review.
COMPATIBILITY_REPORT ClassifyScreenForDowngrade(const SCH_SCREEN *aScreen, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
Report what a schematic screen would lose if exported to an older KiCad.
#define SEXPR_SYMBOL_LIB_FILE_VERSION
This file contains the file format version information for the s-expression schematic and symbol libr...
#define SEXPR_SCHEMATIC_FILE_VERSION
Schematic file version.
Class to handle a set of SCH_ITEMs.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName, REPORTER *aReporter)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
An older KiCad release we can export a project back to.
std::vector< char > decompressedData
std::string compressedEncodedData
PIN_MAP_OVERRIDE_MODE m_Mode
A simple container for sheet instance information.
std::map< wxString, SCH_SHEET_VARIANT > m_Variants
A list of sheet variants.
A simple container for schematic symbol instance information.
std::map< wxString, SCH_SYMBOL_VARIANT > m_Variants
A list of symbol variants.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ VALUE
Field Value of part, i.e. "3.3K".
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 nlohmann::json currentErcExclusionDocument()
static const DOWNGRADE_TARGET & kicad10
static const DOWNGRADE_TARGET & kicad9
BOOST_FIXTURE_TEST_CASE(EmbeddedFilesSurviveMissingRootInstanceForBothTargets, KI_TEST::SCHEMATIC_TEST_FIXTURE)
BOOST_AUTO_TEST_CASE(LibSymbolJumperPinsDroppedForKicad9)
const SHAPE_LINE_CHAIN chain
BOOST_TEST_CONTEXT("Test Clearance")
VECTOR2< int32_t > VECTOR2I