KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_project_file.cpp File Reference

Tests for PROJECT_FILE class. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <project/project_file.h>
#include <settings/settings_manager.h>
#include <wildcards_and_files_ext.h>
#include <filesystem>
#include <fstream>

Go to the source code of this file.

Classes

class  PROJECT_FILE_TEST_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (SaveAsUpdatesTopLevelSheetNames)
 Test that SaveAs updates top-level sheet names when they match the old project name.
 
 BOOST_AUTO_TEST_CASE (LoadFixesStaleTopLevelSheetReferences)
 Test that LoadFromFile fixes stale top_level_sheets references after template copy.
 
 BOOST_AUTO_TEST_CASE (LoadPreservesValidTopLevelSheetReferences)
 Test that LoadFromFile does NOT modify top_level_sheets when references are already valid.
 

Detailed Description

Tests for PROJECT_FILE class.

Definition in file test_project_file.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( LoadFixesStaleTopLevelSheetReferences )

Test that LoadFromFile fixes stale top_level_sheets references after template copy.

When a project is created from a template, files are renamed to match the new project name, but the .kicad_pro content still references the template's filenames. LoadFromFile should detect and correct these stale references.

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/22951

Definition at line 126 of file test_project_file.cpp.

References BOOST_CHECK_EQUAL(), PROJECT_FILE::GetTopLevelSheets(), SETTINGS_MANAGER::LoadProject(), name, SETTINGS_MANAGER::Prj(), and project.

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( LoadPreservesValidTopLevelSheetReferences )

Test that LoadFromFile does NOT modify top_level_sheets when references are already valid.

Definition at line 183 of file test_project_file.cpp.

References BOOST_CHECK_EQUAL(), PROJECT_FILE::GetTopLevelSheets(), SETTINGS_MANAGER::LoadProject(), name, SETTINGS_MANAGER::Prj(), and project.

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( SaveAsUpdatesTopLevelSheetNames )