KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_aperture_macro.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <aperture_macro.h>
#include <dcode.h>
#include <gerber_draw_item.h>
#include <gerber_file_image.h>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (EmptyMacroProducesNoOutlines)
 Regression tests for aperture macro shape generation.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( EmptyMacroProducesNoOutlines )

Regression tests for aperture macro shape generation.

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

When an aperture macro has invalid or missing parameters (as reported during Gerber file load), GetApertureMacroShape() returns an empty SHAPE_POLY_SET. GBR_TO_PCB_EXPORTER previously crashed by calling Outline(0) on the empty set without checking OutlineCount() first.

Verifies that GetApertureMacroShape() and ConvertShapeToPolygon() handle macros that produce no geometry without crashing.

Definition at line 50 of file test_aperture_macro.cpp.

References APT_MACRO, BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), D_CODE::ConvertShapeToPolygon(), GBR_SPOT_MACRO, APERTURE_MACRO::GetApertureMacroShape(), image, APERTURE_MACRO::m_AmName, D_CODE::m_ApertType, GERBER_DRAW_ITEM::m_DCode, D_CODE::m_Polygon, GERBER_DRAW_ITEM::m_ShapeType, SHAPE_POLY_SET::OutlineCount(), and D_CODE::SetMacro().