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

Test suite for import of Altium PCB files. More...

#include <pcbnew_utils/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/altium/pcb_io_altium_designer.h>
#include <pcbnew/pcb_io/altium/altium_parser_pcb.h>
#include <board.h>
#include <board_design_settings.h>
#include <board_stackup_manager/board_stackup.h>
#include <common.h>
#include <core/utf8.h>
#include <eda_text.h>
#include <netinfo.h>
#include <netclass.h>
#include <pcb_track.h>
#include <project.h>
#include <project/net_settings.h>
#include <settings/settings_manager.h>
#include <zone.h>
#include <map>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  ALTIUM_PCB_IMPORT_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (BoardLoadNoAssertions)
 Test basic board loading - verifies that the Altium import doesn't trigger any assertions during the load process.
 
 BOOST_AUTO_TEST_CASE (NetclassAssignment)
 Test that netclass pattern assignments result in direct netclass assignments on nets.
 
static void checkAllCopperFillZonesHaveClearance (PCB_IO_ALTIUM_DESIGNER &aPlugin, const std::string &aRelativePath)
 Verify that copper zones in imported Altium boards have non-zero local clearance values derived from rules whose scope expressions match polygons.
 
 BOOST_AUTO_TEST_CASE (ZoneClearances_eDP)
 
 BOOST_AUTO_TEST_CASE (ZoneClearances_HiFive)
 
 BOOST_AUTO_TEST_CASE (ScopeExprMatchesPolygon)
 Test altiumScopeExprMatchesPolygon utility function.
 
 BOOST_AUTO_TEST_CASE (SelectAltiumPolygonRule_PriorityOrder)
 Verify selectAltiumPolygonRule honours Altium priority order (1 = highest).
 
 BOOST_AUTO_TEST_CASE (Via_HoleReferencedMaskTenting)
 Regression test for https://gitlab.com/kicad/code/kicad/-/issues/24458.
 
 BOOST_AUTO_TEST_CASE (StackupDielectricLossTangent)
 Verify that the dielectric loss tangent is imported from the modern Altium physical stackup (LAYER_V8_/V9_STACK_LAYER keys).
 
 BOOST_AUTO_TEST_CASE (ProjectParametersToTextVars)
 Test that Altium project parameters (special strings) are imported as KiCad project text variables so that board text such as ".PCB_Revision" resolves to its value.
 
 BOOST_AUTO_TEST_CASE (ProjectParametersPreserveExisting)
 Test that importing project parameters does not overwrite text variables that already exist on the project, and that names reserved for KiCad's contextual resolution are not imported.
 

Detailed Description

Test suite for import of Altium PCB files.

Definition in file test_altium_pcb_import.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/10]

BOOST_AUTO_TEST_CASE ( BoardLoadNoAssertions )

Test basic board loading - verifies that the Altium import doesn't trigger any assertions during the load process.

This catches regressions in layer mapping and other import issues.

Definition at line 70 of file test_altium_pcb_import.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_REQUIRE(), and KI_TEST::GetPcbnewTestDataDir().

◆ BOOST_AUTO_TEST_CASE() [2/10]

BOOST_AUTO_TEST_CASE ( NetclassAssignment )

Test that netclass pattern assignments result in direct netclass assignments on nets.

This is a regression test for https://gitlab.com/kicad/code/kicad/-/issues/15584

Validates that when an Altium board with netclasses is imported, the nets are directly assigned to their netclasses (not just through pattern resolution).

Definition at line 95 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), NETCLASS::Default, NETCLASS::GetName(), and KI_TEST::GetPcbnewTestDataDir().

◆ BOOST_AUTO_TEST_CASE() [3/10]

BOOST_AUTO_TEST_CASE ( ProjectParametersPreserveExisting )

Test that importing project parameters does not overwrite text variables that already exist on the project, and that names reserved for KiCad's contextual resolution are not imported.

Definition at line 492 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_EQUAL(), KI_TEST::GetPcbnewTestDataDir(), SETTINGS_MANAGER::LoadProject(), SETTINGS_MANAGER::Prj(), and project.

◆ BOOST_AUTO_TEST_CASE() [4/10]

BOOST_AUTO_TEST_CASE ( ProjectParametersToTextVars )

Test that Altium project parameters (special strings) are imported as KiCad project text variables so that board text such as ".PCB_Revision" resolves to its value.

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

Definition at line 431 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), ExpandTextVars(), KI_TEST::GetPcbnewTestDataDir(), SETTINGS_MANAGER::LoadProject(), SETTINGS_MANAGER::Prj(), project, and text.

◆ BOOST_AUTO_TEST_CASE() [5/10]

BOOST_AUTO_TEST_CASE ( ScopeExprMatchesPolygon )

Test altiumScopeExprMatchesPolygon utility function.

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

Validates that the scope expression matching correctly identifies polygon-related Altium rule scope expressions used for zone clearance rules.

Definition at line 223 of file test_altium_pcb_import.cpp.

References altiumScopeExprMatchesPolygon().

◆ BOOST_AUTO_TEST_CASE() [6/10]

BOOST_AUTO_TEST_CASE ( SelectAltiumPolygonRule_PriorityOrder )

Verify selectAltiumPolygonRule honours Altium priority order (1 = highest).

Regression guard for selecting a less-specific polygon rule when multiple polygon-scoped rules exist alongside default (All/All) rules.

Definition at line 255 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), ARULE6::clearanceGap, ARULE6::priority, ARULE6::scope1expr, ARULE6::scope2expr, and selectAltiumPolygonRule().

◆ BOOST_AUTO_TEST_CASE() [7/10]

BOOST_AUTO_TEST_CASE ( StackupDielectricLossTangent )

Verify that the dielectric loss tangent is imported from the modern Altium physical stackup (LAYER_V8_/V9_STACK_LAYER keys).

The legacy LAYER<n> records used to build the stackup do not carry the loss tangent, so it must be backfilled from the modern keys.

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

Definition at line 373 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), BS_ITEM_TYPE_DIELECTRIC, BOARD_STACKUP::GetList(), and KI_TEST::GetPcbnewTestDataDir().

◆ BOOST_AUTO_TEST_CASE() [8/10]

BOOST_AUTO_TEST_CASE ( Via_HoleReferencedMaskTenting )

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

The Fastino board references every via's solder mask expansion from the hole edge. KiCad vias cannot represent a hole-referenced opening, so when the resulting opening does not clear the via land the importer must tent the side instead of leaving the copper exposed. Before the fix these vias were imported untented, so verify the imported board tents both sides of every via.

This is the same board used by the issue 24456 stackup test.

Definition at line 304 of file test_altium_pcb_import.cpp.

References altiumViaSideIsTented(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), KI_TEST::GetPcbnewTestDataDir(), PCB_VIA_T, TENTED, and via.

◆ BOOST_AUTO_TEST_CASE() [9/10]

BOOST_AUTO_TEST_CASE ( ZoneClearances_eDP )

◆ BOOST_AUTO_TEST_CASE() [10/10]

BOOST_AUTO_TEST_CASE ( ZoneClearances_HiFive )

◆ checkAllCopperFillZonesHaveClearance()

static void checkAllCopperFillZonesHaveClearance ( PCB_IO_ALTIUM_DESIGNER & aPlugin,
const std::string & aRelativePath )
static

Verify that copper zones in imported Altium boards have non-zero local clearance values derived from rules whose scope expressions match polygons.

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

Definition at line 169 of file test_altium_pcb_import.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), KI_TEST::GetPcbnewTestDataDir(), and PCB_IO_ALTIUM_DESIGNER::LoadBoard().

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().