48#include <wx/filename.h>
49#include <wx/stdpaths.h>
56 wxString tempDir = wxStandardPaths::Get().GetTempDir();
57 wxString projectPath = tempDir + wxFileName::GetPathSeparator() + wxT(
"test_issue24858.kicad_pro" );
61 m_schematic = std::make_unique<SCHEMATIC>(
nullptr );
69 if( wxFileExists( file ) )
78 wxString dir = wxStandardPaths::Get().GetTempDir();
79 wxString
name = wxFileName::CreateTempFileName( dir + wxFileName::GetPathSeparator() +
"issue24858" );
97 m_libSym = std::make_unique<LIB_SYMBOL>(
"R",
nullptr );
100 pin->SetNumber(
"1" );
118 wxFile f( fileName );
120 f.ReadAll( &contents );
171 wxString variantName = wxS(
"Ghost" );
173 m_symbol->SetDNP( m_symbol->GetDNP(), &m_path, variantName );
174 m_symbol->SetExcludedFromSim( m_symbol->GetExcludedFromSim(), &m_path, variantName );
175 m_symbol->SetExcludedFromBOM( m_symbol->GetExcludedFromBOM(), &m_path, variantName );
176 m_symbol->SetExcludedFromPosFiles( m_symbol->GetExcludedFromPosFiles(), &m_path, variantName );
178 BOOST_CHECK( !m_symbol->GetVariant( m_path, variantName ).has_value() );
193 m_symbol->AddVariant( m_path, ghost );
195 wxString contents = saveAndRead();
197 BOOST_CHECK( !contents.Contains( wxS(
"(variant" ) ) );
210 loaded.
m_DNP = !m_symbol->GetDNP();
211 m_symbol->AddVariant( m_path, loaded );
213 wxString contents = saveAndRead();
215 BOOST_CHECK( contents.Contains( wxS(
"(variant" ) ) );
216 BOOST_CHECK( contents.Contains( wxS(
"(name \"Loaded\")" ) ) );
217 BOOST_CHECK( contents.Contains( wxS(
"dnp" ) ) );
230 wxString variantName = wxS(
"Ghost" );
233 m_symbol->SetDNP( !m_symbol->GetDNP(), &m_path, variantName );
234 BOOST_REQUIRE( m_symbol->GetVariant( m_path, variantName ).has_value() );
236 m_symbol->DeleteVariant( m_path, variantName );
237 BOOST_REQUIRE( !m_symbol->GetVariant( m_path, variantName ).has_value() );
240 m_symbol->SetDNP( m_symbol->GetDNP( &m_path, variantName ), &m_path, variantName );
248 BOOST_CHECK( !instance.m_Variants.contains( variantName ) );
250 std::set<wxString> variantNames = m_sheet->GetScreen()->GetVariantNames();
251 BOOST_CHECK( !variantNames.contains( variantName ) );
EE_TYPE OfType(KICAD_T aType) const
A SCH_IO derivation for loading schematic files using the new s-expression file format.
void SaveSchematicFile(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aSchematic to a storage file in a format that this SCH_IO implementation knows about,...
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_SCREEN * GetScreen() const
Variant information for a schematic symbol.
void InitializeAttributes(const SCH_SYMBOL &aSymbol)
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Regression tests for issue 24858, deleted design variants reappear after reload.
std::vector< wxString > m_tempFiles
std::unique_ptr< SCHEMATIC > m_schematic
std::unique_ptr< LIB_SYMBOL > m_libSym
void placeSymbol()
Place a one-pin symbol on a fresh top sheet and set m_sheet, m_path and m_symbol.
SETTINGS_MANAGER m_settingsManager
A simple container for schematic symbol instance information.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(BaseValueSetCreatesNoEntry)
Setting a variant attribute to the value it already resolves to must not create an instance variant e...
VECTOR2< int32_t > VECTOR2I