36#include <wx/filename.h>
42const char* kMinimalSymbolLib =
43 "(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)\n"
44 " (symbol \"TestResistor\" (in_bom yes) (on_board yes)\n"
45 " (property \"Reference\" \"R\" (at 0 0 0)\n"
46 " (effects (font (size 1.27 1.27)))\n"
48 " (property \"Value\" \"TestResistor\" (at 0 0 0)\n"
49 " (effects (font (size 1.27 1.27)))\n"
51 " (property \"Footprint\" \"\" (at 0 0 0)\n"
52 " (effects (font (size 1.27 1.27)) hide)\n"
54 " (property \"Datasheet\" \"\" (at 0 0 0)\n"
55 " (effects (font (size 1.27 1.27)) hide)\n"
57 " (symbol \"TestResistor_0_1\"\n"
58 " (rectangle (start -1.27 -1.27) (end 1.27 1.27)\n"
59 " (stroke (width 0) (type default))\n"
60 " (fill (type background))\n"
63 " (symbol \"TestResistor_1_1\"\n"
64 " (pin passive line (at -3.81 0 0) (length 2.54)\n"
65 " (name \"PIN\" (effects (font (size 1.27 1.27))))\n"
66 " (number \"1\" (effects (font (size 1.27 1.27))))\n"
73wxString writeTempSymbolLib()
75 wxString
path = wxFileName::CreateTempFileName( wxS(
"qa_remote_sym" ) );
76 wxFFile file(
path, wxS(
"wb" ) );
78 file.Write( kMinimalSymbolLib, strlen( kMinimalSymbolLib ) );
90 const wxString tempPath = writeTempSymbolLib();
91 std::unique_ptr<LIB_SYMBOL> symbol;
97 LIB_SYMBOL* loaded = plugin->LoadSymbol( tempPath, wxS(
"TestResistor" ) );
102 symbol = std::make_unique<LIB_SYMBOL>( *loaded );
107 BOOST_CHECK( symbol );
108 BOOST_CHECK( symbol->GetName() == wxS(
"TestResistor" ) );
110 wxRemoveFile( tempPath );
116 const wxString tempPath = writeTempSymbolLib();
121 LIB_SYMBOL* loaded = plugin->LoadSymbol( tempPath, wxS(
"NonExistentSymbol" ) );
122 BOOST_CHECK( loaded ==
nullptr );
124 wxRemoveFile( tempPath );
Define a library symbol object.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(CopiedSymbolSurvivesPluginDestruction)