20#include <boost/test/unit_test.hpp>
47#include <nlohmann/json.hpp>
97 BOOST_CHECK( report.
IsLossy() );
136 BOOST_CHECK_CLOSE( areaMM,
M_PI * 5.0 * 3.0, 2.0 );
158 BOOST_REQUIRE_GE(
chain.PointCount(), 5 );
161 double firstDist =
chain.CPoint( 0 ).EuclideanNorm();
162 double lastDist =
chain.CPoint(
chain.PointCount() - 1 ).EuclideanNorm();
167 BOOST_CHECK(
chain.CPoint( 0 ) !=
chain.CPoint(
chain.PointCount() - 1 ) );
178 screen.
Append( innerShape );
179 screen.
Append( outerShape );
195 BOOST_CHECK( groups.begin() == groups.end() );
273 BOOST_CHECK( !area->
GetDNP() );
300 BOOST_CHECK_CLOSE( areaMM, 60.0 - ( 4.0 -
M_PI ), 2.0 );
311 pin->SetNumber( wxT(
"[A\\,1,B]" ) );
327 pin->SetNumber( wxT(
"[A1,B2]" ) );
343 pin->SetNumber( wxT(
"[A\\,B" ) );
365 BOOST_CHECK( screen.
GetLibSymbols().begin()->second->GetAssociatedFootprints().empty() );
384 group->AddItem( member );
385 group->SetLocked(
true );
393 BOOST_CHECK(
group->IsLocked() );
414 rootScreen->
Append( child );
417 child->
GetFields().back().SetText( wxT(
"base note" ) );
428 variant.
m_Fields[wxT(
"Note" )] = wxT(
"variant note" );
439 BOOST_CHECK( child->
GetFieldText( wxT(
"Note" ) ) == wxT(
"variant note" ) );
515 BOOST_REQUIRE_EQUAL( symbol->
GetInstances().size(), 1 );
516 const auto& variants = symbol->
GetInstances()[0].m_Variants;
518 BOOST_CHECK( variants.at( wxT(
"V1" ) ).m_PinMapOverride.IsDefault() );
546 for(
int style = 1; style <= 3; ++style )
549 pin->SetNumber( wxT(
"1" ) );
551 pin->SetBodyStyle( style );
563 BOOST_REQUIRE_EQUAL( third->
GetRawPins().size(), 1 );
573 BOOST_REQUIRE_EQUAL( third->
GetRawPins().size(), 1 );
574 BOOST_CHECK( third->
GetRawPins().front()->m_Uuid == pinUuid );
612 BOOST_CHECK( !screen.
GetLibSymbols().begin()->second->GetExcludedFromPosFiles() );
653 == wxT(
"pin_map_override" ) );
687 variant.
m_DNP =
true;
692 BOOST_CHECK( !symbol->
GetDNP() );
697 BOOST_CHECK( symbol->
GetDNP() );
712 auto readFile = [](
const std::string& aPath )
714 std::ifstream file( aPath, std::ios::binary );
716 return std::string( std::istreambuf_iterator<char>( file ), std::istreambuf_iterator<char>() );
718 std::map<std::string, std::string> originals;
720 for(
const std::string&
name : {
"embedded_files.kicad_pro",
"embedded_files.kicad_sch",
"child.kicad_sch" } )
730 LoadSchematic( wxFileName( fixture +
"embedded_files.kicad_sch" ) );
732 SCH_SHEET* root = m_schematic->GetTopLevelSheet( 0 );
742 BOOST_REQUIRE_EQUAL( std::distance( children.begin(), children.end() ), 1 );
744 const std::string output = ( tmp.
GetPath() /
"embedded_files.kicad_sch" ).string();
745 const std::string childOutput = ( tmp.
GetPath() /
"child.kicad_sch" ).string();
748 BOOST_CHECK(
readFile( childOutput ).
find(
"(embedded_files" ) == std::string::npos );
749 BOOST_REQUIRE( wxCopyFile( fixture +
"embedded_files.kicad_pro",
750 ( tmp.
GetPath() /
"embedded_files.kicad_pro" ).string() ) );
754 BOOST_REQUIRE_EQUAL(
actual.EmbeddedFileMap().size(),
expected.EmbeddedFileMap().size() );
756 for(
const auto& [
name, expectedFile] :
expected.EmbeddedFileMap() )
763 BOOST_CHECK( actualFile->
is_valid );
764 BOOST_CHECK( actualFile->
type == expectedFile->type );
767 BOOST_CHECK( actualFile->
decompressedData == expectedFile->decompressedData );
772 for(
const auto& [
name, original] : originals )
797 screen.
Append( supported );
803 group->AddItem( item );
805 const auto& target =
kicad9;
811 BOOST_REQUIRE_EQUAL(
normal.Entries().size(), omit.Entries().size() );
812 for(
size_t i = 0; i <
normal.Entries().size(); ++i )
814 BOOST_CHECK(
normal.Entries()[i].m_feature == omit.Entries()[i].m_feature );
816 BOOST_CHECK(
normal.Entries()[i].m_detail != omit.Entries()[i].m_detail );
817 BOOST_CHECK( !omit.Entries()[i].m_detail.IsEmpty() );
821 BOOST_REQUIRE_EQUAL( std::distance( shapes.begin(), shapes.end() ), 1 );
822 BOOST_CHECK( *shapes.begin() == supported );
828 BOOST_CHECK( &item == cachedSupported );
847 const auto& target =
kicad9;
855 BOOST_CHECK( &item == hatch );
871 const auto& target =
kicad9;
889 for(
int style = 1; style <= 3; ++style )
892 pin->SetNumber( wxT(
"1" ) );
893 pin->SetBodyStyle( style );
904 group->AddItem( third );
911 BOOST_CHECK_EQUAL( std::distance( symbols.begin(), symbols.end() ), target.m_id == wxT(
"9.0" ) ? 2 : 3 );
914 BOOST_CHECK( base->
GetRawPins().front()->m_Uuid == basePin );
915 BOOST_CHECK( second->
GetRawPins().front()->m_Uuid == secondPin );
917 if( target.m_id == wxT(
"10.0" ) )
930 const auto& target =
kicad9;
942 for(
bool drop : {
false,
true } )
949 pin->SetNumber( wxT(
"1" ) );
950 pin->SetCustomProperty( wxT(
"Role" ), wxT(
"Signal" ) );
961 BOOST_CHECK( !report.IsBlocked() );
972 BOOST_CHECK( !standalone.
GetGraphicalPins().front()->HasCustomProperties() );
986 for(
bool drop : {
false,
true } )
995 group->AddItem( line );
1002 BOOST_CHECK( !
group->GetItems().empty() );
1004 BOOST_CHECK( member->GetParentGroup() ==
group );
1032 BOOST_REQUIRE_EQUAL( std::distance( shapes.begin(), shapes.end() ), 1 );
1051 BOOST_CHECK(
static_cast<const SCH_SHAPE&
>( drawing ).GetEndEndingStyle()
1081 text->SetText( wxT(
"${U1:PROPERTY.Vendor}" ) );
1085 text->SetText( wxT(
"\\${PROPERTY.Vendor}" ) );
1087 text->SetText( wxT(
"PROPERTY.Vendor" ) );
1096 for(
bool drop : {
false,
true } )
1099 std::unique_ptr<SCHEMATIC> schematic;
1101 auto symbols = schematic->RootScreen()->Items().OfType(
SCH_SYMBOL_T );
1106 schematic->Project().GetTextVars()[wxT(
"Alias" )] = wxT(
"${PROPERTY.Vendor}" );
1107 schematic->Project().GetTextVars()[wxT(
"Unused" )] = wxT(
"${PROPERTY.Missing}" );
1109 BOOST_CHECK( !report.IsBlocked() );
1125 for(
bool drop : {
false,
true } )
1128 std::unique_ptr<SCHEMATIC> schematic;
1131 text->SetText( wxT(
"@{1 + 2} / ${PROJECTNAME}" ) );
1132 schematic->RootScreen()->Append(
text );
1134 BOOST_CHECK( !report.IsBlocked() );
1138 BOOST_CHECK(
text->GetText()
1139 == ( target.m_id == wxT(
"9.0" ) ? wxT(
"3 / ${PROJECTNAME}" )
1140 : wxT(
"@{1 + 2} / ${PROJECTNAME}" ) ) );
1141 text->SetText( wxT(
"\\@{1 + 2}" ) );
1143 target.m_id == wxT(
"9.0" ) );
1152 std::unique_ptr<SCHEMATIC> schematic;
1154 auto symbols = schematic->RootScreen()->Items().OfType(
SCH_SYMBOL_T );
1157 symbol->
SetCustomProperty( wxT(
"Vendor" ), wxT(
"\\${REFERENCE} \\@{1 + 2}" ) );
1159 field->
SetText( wxT(
"\\${PROPERTY.literal} ${PROPERTY.Vendor}" ) );
1164 BOOST_CHECK_EQUAL( resolvedBefore.ToStdString(), std::string(
"\\${PROPERTY.literal} \\${REFERENCE} \\3" ) );
1169 shownBefore.ToStdString() );
1178 std::unique_ptr<SCHEMATIC> schematic;
1180 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"Ordinary title" ) );
1181 schematic->Project().GetTextVars()[wxT(
"TITLE" )] = wxT(
"${PROPERTY.Unknown}" );
1183 text->SetText( wxT(
"${TITLE}" ) );
1184 schematic->RootScreen()->Append(
text );
1186 BOOST_REQUIRE_EQUAL(
text->GetShownText( &
path,
FOR_CANVAS ).ToStdString(), std::string(
"Ordinary title" ) );
1190 for(
bool drop : {
false,
true } )
1202 std::unique_ptr<SCHEMATIC> schematic;
1204 schematic->Project().GetTextVars()[wxT(
"BorderAlias" )] = wxT(
"${PROPERTY.Unknown}" );
1205 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"${BorderAlias}" ) );
1207 text->SetText( wxT(
"${TITLE}" ) );
1208 schematic->RootScreen()->Append(
text );
1210 schematic->RootScreen()->GetTitleBlock().SetTitle( wxT(
"Ordinary title" ) );
1212 schematic->RootScreen()->GetTitleBlock().SetComment( 8, wxT(
"@{1 + 2}" ) );
1220 std::vector<wxString> members;
1222 BOOST_REQUIRE_EQUAL( members.size(), 3 );
1223 BOOST_CHECK( members.front() == wxT(
"D00" ) );
1226 label->
SetText( wxT(
"D[00..02]" ) );
1230 label->
SetText( wxT(
"D[0..2]" ) );
1234 auto alias = std::make_shared<BUS_ALIAS>();
1235 alias->SetName( wxT(
"Data" ) );
1236 alias->SetMembers( { wxT(
"D[00..02]" ) } );
1255 BOOST_CHECK( !symbol->
GetInstances().front().m_Variants.at( variant.
m_Name ).m_SymbolOverride );
1267 for(
const wxString& malformed : { wxT(
"D[..2]" ), wxT(
"D[1..]" ), wxT(
"D[1..2" ) } )
1273 label->
SetText( wxString::Format( wxT(
"D[%ld..%ld]" ), LONG_MAX - 1, LONG_MAX ) );
1276 for(
const wxString& ordinary :
1277 { wxT(
"D[1..2]" ), wxT(
"D[foo]" ), wxT(
"D[..0]" ), wxT(
"text [literal]" ) } )
1283 label->
SetText( wxT(
"D[1..2]+" ) );
1286 label->
SetText( wxT(
"I^{2}C[1..2]" ) );
1297 std::unique_ptr<SCHEMATIC> schematic;
1300 label->
SetText( wxT(
"${BUS}" ) );
1301 schematic->RootScreen()->Append( label );
1302 for(
const wxString& bus : { wxT(
"D[01..3]" ), wxT(
"D[..2]" ), wxT(
"D[1..2" ) } )
1304 schematic->Project().GetTextVars()[wxT(
"BUS" )] = bus;
1307 for(
const wxString& ordinary : { wxT(
"D[1..3]" ), wxT(
"D[foo]" ) } )
1309 schematic->Project().GetTextVars()[wxT(
"BUS" )] = ordinary;
1322 path.LastScreen()->Append( symbol );
1326 variant.
m_DNP =
true;
1332 BOOST_CHECK( reason.Contains( wxT(
"Missing:Alternate" ) ) );
1333 BOOST_CHECK( !symbol->
GetDNP() );
1340 std::unique_ptr<SCHEMATIC> schematic;
1346 struct TABLE_RESTORE
1352 previousTable && *previousTable ? wxFileName( ( *previousTable )->Path() ).GetPath() : wxString() };
1354 wxFile tableFile(
directory + wxT(
"/sym-lib-table" ), wxFile::write );
1356 BOOST_REQUIRE( tableFile.Write( wxT(
"(sym_lib_table (version 7))\n" ) ) );
1364 row.
SetType( wxT(
"KiCad" ) );
1370 base.
SetName( wxT(
"base" ) );
1374 schematic->RootScreen()->Append( symbol );
1380 variant.
m_Fields[wxT(
"Footprint" )] = wxEmptyString;
1383 std::vector<KIID> pins;
1385 pins.push_back(
pin->m_Uuid );
1394 BOOST_REQUIRE_EQUAL( symbol->
GetRawPins().size(), pins.size() );
1395 for(
size_t i = 0; i < pins.size(); ++i )
1396 BOOST_CHECK( symbol->
GetRawPins()[i]->m_Uuid == pins[i] );
1398 BOOST_REQUIRE( cached != schematic->RootScreen()->GetLibSymbols().end() );
1399 BOOST_CHECK( cached->second->GetField(
FIELD_T::VALUE )->GetText()
1408 for(
const wxString& token :
1409 { wxT(
"start_shape" ), wxT(
"end_shape" ), wxT(
"symbol_override" ), wxT(
"custom_property" ) } )
1422 { {
"meta", { {
"version", 1 } } },
1424 nlohmann::json::array(
1426 { {
"error_type",
"ERCET_PIN_NOT_CONNECTED" },
1427 {
"position", { {
"x_nm",
"12300" }, {
"y_nm",
"-45600" } } },
1428 {
"items", nlohmann::json::array(
1429 { { {
"value",
"11111111-1111-1111-1111-111111111111" } } } ) } } },
1430 {
"comment",
"accepted" } } } ) } } }
1443 const auto& exclusion = document[
"erc"][
"erc_exclusions"].at( 0 );
1444 BOOST_CHECK( exclusion
1445 == nlohmann::json::array( {
"pin_not_connected|123|-456|11111111-1111-1111-1111-111111111111|"
1446 "00000000-0000-0000-0000-000000000000|||",
1448 BOOST_CHECK( !report.
IsLossy() );
1449 const nlohmann::json once = document;
1452 BOOST_CHECK( document == once );
1453 BOOST_CHECK( !repeated.
IsLossy() );
1463 auto& marker = document[
"erc"][
"erc_exclusions"][0][
"marker"];
1464 const nlohmann::json
path = {
1465 {
"path", nlohmann::json::array( { { {
"value",
"22222222-2222-2222-2222-222222222222" } } } ) }
1467 marker[
"sheet_specific_path"] =
path;
1468 marker[
"main_item_sheet_path"] =
path;
1469 marker[
"aux_item_sheet_path"] =
path;
1471 nlohmann::json allPaths = document;
1473 BOOST_REQUIRE_EQUAL( allPaths[
"erc"][
"erc_exclusions"].size(), 1 );
1475 "pin_not_connected|123|-456|11111111-1111-1111-1111-111111111111|"
1476 "00000000-0000-0000-0000-000000000000|/22222222-2222-2222-2222-222222222222|"
1477 "/22222222-2222-2222-2222-222222222222|/22222222-2222-2222-2222-222222222222" );
1478 BOOST_CHECK( !pathReport.
IsLossy() );
1479 marker.erase(
"aux_item_sheet_path" );
1480 marker[
"error_type"] =
"ERCET_GENERIC_WARNING";
1481 marker[
"child"] = { {
"text_value",
"raw warning text" } };
1484 BOOST_REQUIRE_EQUAL( document[
"erc"][
"erc_exclusions"].size(), 1 );
1486 "generic-warning|123|-456|11111111-1111-1111-1111-111111111111|raw warning "
1487 "text|/22222222-2222-2222-2222-222222222222|/22222222-2222-2222-2222-222222222222|" );
1488 BOOST_CHECK( !report.
IsLossy() );
1497 for(
int invalid = 0; invalid < 4; ++invalid )
1500 auto& marker = document[
"erc"][
"erc_exclusions"][0][
"marker"];
1502 marker[
"error_type"] =
"ERCET_EMPTY_LABEL_NAME";
1503 else if( invalid == 1 )
1504 marker[
"items"][0][
"value"] =
"malformed-id";
1505 else if( invalid == 2 )
1506 marker[
"position"][
"x_nm"] =
"12301";
1509 marker[
"error_type"] =
"ERCET_GENERIC_WARNING";
1510 marker[
"child"] = { {
"text_value",
"cannot|encode" } };
1516 BOOST_CHECK( document[
"erc"][
"erc_exclusions"].
empty() );
1526 for(
int schema = 0; schema < 5; ++schema )
1530 document[
"meta"][
"version"] = 5;
1531 else if( schema == 1 )
1532 document[
"board"][
"design_settings"][
"meta"][
"version"] = 4;
1533 else if( schema == 2 )
1534 document[
"erc"][
"meta"][
"version"] = 2;
1535 else if( schema == 3 )
1536 document[
"tuning_profiles"][
"meta"][
"version"] = 3;
1538 document[
"net_settings"][
"meta"][
"version"] = 6;
1539 const nlohmann::json original = document;
1543 BOOST_CHECK( document == original );
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.
A temporary directory deleted when it goes out of scope.
const std::filesystem::path & GetPath() const
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.
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)
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.
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
wxString GetFieldText(const wxString &aFieldName, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) const
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 GetFieldText(const wxString &aFieldName, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) 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.
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)
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.
@ USER
The field ID hasn't been set yet; field is invalid.
@ 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_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
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")
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I