KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_schematic.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
25#include "eeschema_test_utils.h"
26
27#include <schematic.h>
29
30
32{
33protected:
34 wxFileName GetSchematicPath( const wxString& aRelativePath ) override;
35};
36
37
38wxFileName TEST_SCHEMATIC_FIXTURE::GetSchematicPath( const wxString& aRelativePath )
39{
40 wxFileName fn( KI_TEST::GetEeschemaTestDataDir() );
41
42 wxString path = fn.GetFullPath();
43 path += aRelativePath + wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
44
45 return wxFileName( path );
46}
47
48
49BOOST_FIXTURE_TEST_SUITE( Schematic, TEST_SCHEMATIC_FIXTURE )
50
51
52BOOST_AUTO_TEST_CASE( TestSchematicSharedByMultipleProjects )
53{
54 LoadSchematic( "schematic_object_tests/not_shared_by_multiple_projects/"
55 "not_shared_by_multiple_projects" );
56
57 std::set<const SCH_SCREEN*> sharedScreens = m_schematic.GetSchematicsSharedByMultipleProjects();
58
59 BOOST_CHECK( sharedScreens.empty() );
60
61 LoadSchematic( "schematic_object_tests/shared_by_multiple_projects/project_a/project_a" );
62
63 sharedScreens = m_schematic.GetSchematicsSharedByMultipleProjects();
64
65 BOOST_CHECK( !sharedScreens.empty() );
66}
67
68
69BOOST_AUTO_TEST_CASE( TestSchematicIsComplexHierarchy )
70{
71 LoadSchematic( "netlists/group_bus_matching/group_bus_matching" );
72
73 BOOST_CHECK( !m_schematic.IsComplexHierarchy() );
74
75 LoadSchematic( "netlists/complex_hierarchy/complex_hierarchy" );
76
77 BOOST_CHECK( m_schematic.IsComplexHierarchy() );
78}
79
80
A generic fixture for loading schematics and associated settings for qa tests.
wxFileName GetSchematicPath(const wxString &aRelativePath) override
static const std::string KiCadSchematicFileExtension
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestSchematicSharedByMultipleProjects)
Definition of file extensions used in Kicad.