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 <am_primitive.h>
#include <am_param.h>
#include <dcode.h>
#include <gerber_draw_item.h>
#include <gerber_file_image.h>
#include <geometry/shape_poly_set.h>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (CirclePrimitiveTessellationScalesWithSize)
 
 BOOST_AUTO_TEST_CASE (EmptyMacroProducesNoOutlines)
 Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23816.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( CirclePrimitiveTessellationScalesWithSize )

Definition at line 78 of file test_aperture_macro.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( EmptyMacroProducesNoOutlines )

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 105 of file test_aperture_macro.cpp.

References APT_MACRO, 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().