29#include <boost/test/unit_test.hpp>
33#include <wx/filename.h>
34#include <wx/wfstream.h>
42void removeIfPresent(
const wxFileName& aFile )
44 if( aFile.FileExists() )
45 wxRemoveFile( aFile.GetFullPath() );
62 wxFileName settings( wxFileName::CreateTempFileName(
"kicad_qa_issue24297_" ) );
63 wxRemoveFile( settings.GetFullPath() );
64 settings.SetExt(
"kicad_httplib" );
67 wxFFileOutputStream out( settings.GetFullPath() );
71 " \"meta\": { \"version\": 1.0 },\n"
72 " \"name\": \"Test HTTP Library\",\n"
74 " \"type\": \"REST_API\",\n"
75 " \"api_version\": \"v1\",\n"
76 " \"root_url\": \"http://localhost:1/\",\n"
80 out.WriteAll(
json, std::strlen(
json ) );
84 SCH_IO_MGR::SCH_HTTP );
86 wxFileName outLib( settings );
87 outLib.SetExt(
"kicad_sym" );
88 removeIfPresent( outLib );
92 outLib.GetFullPath() ) );
95 BOOST_CHECK( !outLib.Exists() );
97 wxRemoveFile( settings.GetFullPath() );
98 removeIfPresent( outLib );
105 wxFileName settings( wxFileName::CreateTempFileName(
"kicad_qa_issue24297_db_" ) );
106 wxRemoveFile( settings.GetFullPath() );
107 settings.SetExt(
"kicad_dbl" );
110 wxFFileOutputStream out( settings.GetFullPath() );
114 " \"meta\": { \"version\": 0 },\n"
115 " \"name\": \"Test DB\",\n"
116 " \"source\": { \"type\": \"odbc\", \"dsn\": \"\", \"username\": \"\","
117 " \"password\": \"\", \"connection_string\": \"\" },\n"
118 " \"libraries\": []\n"
120 out.WriteAll(
json, std::strlen(
json ) );
124 SCH_IO_MGR::SCH_DATABASE );
126 wxFileName outLib( settings );
127 outLib.SetExt(
"kicad_sym" );
128 removeIfPresent( outLib );
131 outLib.GetFullPath() ) );
132 BOOST_CHECK( !outLib.Exists() );
134 wxRemoveFile( settings.GetFullPath() );
135 removeIfPresent( outLib );
143 wxFileName
table( wxFileName::CreateTempFileName(
"kicad_qa_issue23291_sym_" ) );
146 wxFFileOutputStream out(
table.GetFullPath() );
148 const char* contents =
151 " (lib (name \"Device\") (type \"KiCad\")"
152 " (uri \"${KICAD9_SYMBOL_DIR}/Device.kicad_sym\") (options \"\") (descr \"\"))\n"
154 out.WriteAll( contents, std::strlen( contents ) );
158 SCH_IO_MGR::SCH_NESTED_TABLE );
160 wxFileName outLib(
table );
161 outLib.SetExt(
"kicad_sym" );
162 removeIfPresent( outLib );
165 BOOST_CHECK( !outLib.Exists() );
167 wxRemoveFile(
table.GetFullPath() );
168 removeIfPresent( outLib );
static bool ConvertLibrary(std::map< std::string, UTF8 > *aOldFileProps, const wxString &aOldFilePath, const wxString &aNewFilepath, REPORTER *aReporter=nullptr)
Convert a schematic symbol library to the latest KiCad format.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a symbol library using the file extension of aLibPath.
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(HttpLibraryRejectedByConvertLibrary)
A .kicad_httplib config (HTTP source) is not migratable to a .kicad_sym snapshot.