KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue25869_variant_lib_symbols.cpp
Go to the documentation of this file.
1/*
2 * Regression test for https://gitlab.com/kicad/code/kicad/-/issues/25869
3 *
4 * A variant's alternate symbol must be saved in lib_symbols so the schematic does not depend on
5 * the project's symbol libraries to draw it.
6 */
7
10
12#include <locale_io.h>
13#include <pgm_base.h>
15#include <schematic.h>
17
18#include <wx/ffile.h>
19#include <wx/filename.h>
20
21
22BOOST_AUTO_TEST_CASE( Issue25869_VariantAlternateInLibSymbols )
23{
24 LOCALE_IO locale;
25 SETTINGS_MANAGER settingsManager;
26 std::unique_ptr<SCHEMATIC> schematic;
27
28 KI_TEST::LoadSchematic( settingsManager, "issue25869/issue25869", schematic );
29 BOOST_REQUIRE( schematic );
30
32 wxString::FromUTF8( KI_TEST::GetEeschemaTestDataDir() ) + wxS( "issue25869" ),
34
35 wxString saved = wxFileName::CreateTempFileName( wxS( "kicad_issue25869" ) );
36 SCH_IO_KICAD_SEXPR().SaveSchematicFile( saved, schematic->GetTopLevelSheets()[0], schematic.get() );
37
38 wxString contents;
39 wxFFile( saved ).ReadAll( &contents );
40 wxRemoveFile( saved );
41
42 BOOST_CHECK( contents.Contains( wxS( "(symbol \"vo_lib:R_ALT\"" ) ) );
43}
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
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:125
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,...
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_CASE(Issue25869_VariantAlternateInLibSymbols)