43 std::filesystem::path dir = std::filesystem::temp_directory_path( ec )
44 / (
"kicad_qa_scratch_doc_live_" + std::to_string( wxGetProcessId() ) );
46 std::filesystem::remove_all( dir, ec );
47 std::filesystem::create_directories( dir, ec );
49 std::filesystem::path proPath = dir /
"live.kicad_pro";
50 std::filesystem::path schPath = dir /
"live.kicad_sch";
53 std::ofstream proFile( proPath );
54 proFile << R
"({ "meta": { "filename": "live.kicad_pro", "version": 3 } })";
55 std::ofstream schFile( schPath );
56 schFile << "(kicad_sch)";
62 struct ACTIVE_PROJECT_RESET
65 std::filesystem::path dir;
67 ~ACTIVE_PROJECT_RESET()
69 std::error_code ignored;
71 std::filesystem::remove_all( dir, ignored );
78 BOOST_REQUIRE_EQUAL( live, mgr.
GetProject( wxString( proPath.string() ) ) );
85 mgr, wxString( schPath.string() ),
86 [&handed, &scratchPath](
PROJECT* aProject )
89 scratchPath = aProject->GetProjectFullName();
90 return std::make_unique<int>( 1 );
96 BOOST_CHECK_MESSAGE( handed != live,
"the live project was handed to the loader" );
98 BOOST_CHECK( scratchPath.StartsWith( wxFileName::GetTempDir() ) );
102 BOOST_CHECK( mgr.
GetProject( scratchPath ) ==
nullptr );
113 std::filesystem::path dir = std::filesystem::temp_directory_path( ec )
114 / (
"kicad_qa_scratch_doc_other_" + std::to_string( wxGetProcessId() ) );
116 std::filesystem::remove_all( dir, ec );
117 std::filesystem::create_directories( dir, ec );
119 std::filesystem::path schPath = dir /
"other.kicad_sch";
122 std::ofstream schFile( schPath );
123 schFile <<
"(kicad_sch)";
130 wxString proPath = wxString( ( dir /
"other.kicad_pro" ).
string() );
135 mgr, wxString( schPath.string() ),
139 return std::make_unique<int>( 1 );
145 BOOST_CHECK( handed != &mgr.
Prj() );
148 BOOST_CHECK( mgr.
GetProject( proPath ) ==
nullptr );
149 std::filesystem::remove_all( dir, ec );
SCRATCH_DOC< DOC > LoadScratchDoc(SETTINGS_MANAGER &aMgr, const wxString &aDocPath, Loader aLoader, ClearFn aClearFn)
Construct a SCRATCH_DOC by loading a project non-active and then handing it to the caller's document ...
BOOST_CHECK_EQUAL(result, "25.4")