|
KiCad PCB EDA Suite
|
Regression test for issue #24543: creepage DRC calculates an incorrect path from rectangular, chamfered-rectangular and trapezoidal pads placed at an arbitrary (non-orthogonal) rotation. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include <pcbnew_utils/board_test_utils.h>#include <board.h>#include <board_design_settings.h>#include <layer_ids.h>#include <drc/drc_item.h>#include <drc/drc_engine.h>#include <footprint.h>#include <pad.h>#include <pcb_marker.h>#include <settings/settings_manager.h>#include <widgets/report_severity.h>#include <geometry/shape_poly_set.h>#include <geometry/shape_line_chain.h>#include <geometry/shape_segment.h>Go to the source code of this file.
Classes | |
| struct | DRC_CREEPAGE_ROTATED_PAD_FIXTURE |
Functions | |
| BOOST_FIXTURE_TEST_CASE (CreepageRotatedRectPadIssue24543, DRC_CREEPAGE_ROTATED_PAD_FIXTURE) | |
Regression test for issue #24543: creepage DRC calculates an incorrect path from rectangular, chamfered-rectangular and trapezoidal pads placed at an arbitrary (non-orthogonal) rotation.
Rounded-rectangle pads are not affected.
The repro board has a capacitor footprint C4 with two THT rectangular pads straddling an NPTH oval slot. One pad is rotated by a non-orthogonal angle. For such a pad PAD::GetEffectiveShape() returns a SHAPE_SIMPLE (an arbitrary polygon) rather than the axis-aligned SHAPE_RECT used at orthogonal angles. CREEPAGE_GRAPH::Addshape() had no SH_SIMPLE case, so the rotated pad's copper outline was silently dropped from the creepage graph. With no copper anchor the path search snapped the violation to the nearest remaining feature - the pad's NPTH hole - so the reported creepage path started at the hole instead of the copper edge.
The geometric assertion below verifies that both endpoints of the reported creepage path lie on (or very near) the pad copper outlines, and crucially that neither endpoint snaps to the interior of an NPTH hole.
Definition in file test_drc_creepage_issue24543.cpp.
| BOOST_FIXTURE_TEST_CASE | ( | CreepageRotatedRectPadIssue24543 | , |
| DRC_CREEPAGE_ROTATED_PAD_FIXTURE | ) |
Definition at line 82 of file test_drc_creepage_issue24543.cpp.
References std::abs(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), DRC_ENGINE::ClearViolationHandler(), DRCE_CREEPAGE, DRCE_FIRST, DRCE_LAST, F_Cu, PAD::GetEffectivePolygon(), EDA_SHAPE::GetEnd(), PCB_MARKER::GetPath(), BOARD_DESIGN_SETTINGS::GetSeverity(), EDA_SHAPE::GetStart(), KI_TEST::LoadBoard(), BOARD_DESIGN_SETTINGS::m_DRCEngine, BOARD_DESIGN_SETTINGS::m_DRCSeverities, EDA_ITEM::m_Uuid, MM, NPTH, RPT_SEVERITY_ERROR, RPT_SEVERITY_IGNORE, DRC_ENGINE::RunTests(), DRC_ENGINE::SetViolationHandler(), SHAPE_LINE_CHAIN_BASE::SquaredDistance(), VECTOR2< T >::x, and VECTOR2< T >::y.