21#include <fmt/format.h>
43 if( !wxGetEnv( wxT(
"KICAD_CONFIG_HOME_IS_QA" ),
nullptr ) )
53 fn.AppendDir(
"libraries" );
54 fn.AppendDir(
"test_project" );
69 BOOST_REQUIRE( rows[0]->URI() ==
"${KIPRJMOD}/Device.kicad_sym" );
74 std::vector<LIB_SYMBOL*> symbols = adapter.
GetSymbols(
"Device" );
97 auto tstart = std::chrono::high_resolution_clock::now();
100 constexpr static int interval = 250;
101 constexpr static int timeLimit = 20000;
106 std::this_thread::sleep_for( std::chrono::milliseconds( interval ) );
108 if( std::optional<float> loadStatus = adapter.
AsyncLoadProgress(); loadStatus.has_value() )
110 BOOST_TEST_MESSAGE( fmt::format(
"Loading libraries: ({:.1f}%)", *loadStatus * 100 ) );
112 if( loadStatus >= 1 )
124 if( elapsed > timeLimit )
126 BOOST_TEST_FAIL(
"Exceeded timeout" );
131 auto duration = std::chrono::high_resolution_clock::now() - tstart;
134 fmt::format(
"took {}ms",
135 std::chrono::duration_cast<std::chrono::milliseconds>( duration ).count() ) );
141 BOOST_REQUIRE_GE( rows.size(), 2 );
145 wxString msg = nickname;
148 switch( status.load_status )
152 msg <<
": loaded OK";
158 msg <<
": error: " << status.error->message;
A generic fixture for loading schematics and associated settings for qa tests.
std::optional< float > AsyncLoadProgress() const
Returns async load progress between 0.0 and 1.0, or nullopt if load is not in progress.
void LoadProjectTables(const wxString &aProjectPath)
std::vector< LIBRARY_TABLE_ROW * > Rows(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH, bool aIncludeInvalid=false) const
Returns a flattened list of libraries of the given type.
void LoadGlobalTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the global library tables in the given list, or all tables if no list is given
virtual SETTINGS_MANAGER & GetSettingsManager() const
Container for project specific data.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
std::optional< LIB_STATUS > LoadOne(const wxString &aNickname)
Loads or reloads the given library, if it exists.
std::vector< std::pair< wxString, LIB_STATUS > > GetLibraryStatuses() const
Returns a list of all library nicknames and their status (even if they failed to load)
std::vector< LIB_SYMBOL * > GetSymbols(const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS)
void AsyncLoad() override
Loads all available libraries for this adapter type in the background.
std::string GetTestDataRootDir()
PGM_BASE & Pgm()
The global program "get" accessor.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_AUTO_TEST_CASE(ProjectLibraryTable)