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

Go to the source code of this file.

Classes

class  EDA_SHAPE_MOCK
 
struct  SET_ANGLE_END_CASE
 
struct  SET_ARC_GEOMETRY_CASE
 
class  STROKE_TEST_RENDER_SETTINGS
 

Functions

static void checkVectorClose (const VECTOR2D &aActual, const VECTOR2D &aExpected, double aTolerance=1e-6)
 
static void checkVectorEqual (const VECTOR2I &aActual, const VECTOR2I &aExpected)
 
static void checkAngleClose (const EDA_ANGLE &aActual, double aExpectedDegrees, double aTolerance=1e-6)
 
static void checkAngleInRange (const EDA_ANGLE &aActual, double aMinDegrees, double aMaxDegrees)
 
static void deleteShapes (std::vector< SHAPE * > &aShapes)
 
 BOOST_AUTO_TEST_CASE (SetAngleAndEnd)
 
 BOOST_AUTO_TEST_CASE (SetArcGeometry)
 
 BOOST_AUTO_TEST_CASE (ArcEditKeepsSmallSchematicRadius)
 Editing a small eeschema arc must not snap its radius up to the PCB-scale 1 mil minimum.
 
 BOOST_AUTO_TEST_CASE (PolygonBehaviorSurvivesAssignment)
 Verify that EDA_POLYGON_POINT_EDIT_BEHAVIOR survives EDA_SHAPE assignment.
 
 BOOST_AUTO_TEST_CASE (PolygonBehaviorSignalsRebuildWhenShapeMorphs)
 
 BOOST_AUTO_TEST_CASE (GetPolyPointsPreservesOrderAcrossOutlines)
 
 BOOST_AUTO_TEST_CASE (EllipseBasicAccessors)
 
 BOOST_AUTO_TEST_CASE (EllipseArcIsOpenCurve)
 
 BOOST_AUTO_TEST_CASE (EllipsePerimeterForCircleCase)
 
 BOOST_AUTO_TEST_CASE (EllipseMakeEffectiveShapesNonEmpty)
 
 BOOST_AUTO_TEST_CASE (ShortenSegmentForEndingsTrimsStartAndEnd)
 
 BOOST_AUTO_TEST_CASE (SegmentOpenArrowLeavesBody)
 
 BOOST_AUTO_TEST_CASE (SegmentShorteningRejectsOverrun)
 
 BOOST_AUTO_TEST_CASE (SegmentEndingTangentsPointOutward)
 
 BOOST_AUTO_TEST_CASE (OpenArrowBezierTangentsUseDepth)
 
 BOOST_AUTO_TEST_CASE (LineEndingEndpointsUseShapeOwnedSources)
 
 BOOST_AUTO_TEST_CASE (LineEndingEndpointsRejectInvalidPolys)
 
 BOOST_AUTO_TEST_CASE (EffectiveShapesIncludeClosedEnding)
 
 BOOST_AUTO_TEST_CASE (EffectiveShapesIncludeOpenArrowLegs)
 
 BOOST_AUTO_TEST_CASE (BBoxIncludesCenteredEnding)
 
 BOOST_AUTO_TEST_CASE (BBoxUsesRotatedEndingGeometry)
 
 BOOST_AUTO_TEST_CASE (PolygonConversionAppendsEndings)
 
 BOOST_AUTO_TEST_CASE (EffectiveShapesShortenArrowBody)
 
 BOOST_AUTO_TEST_CASE (StrokingShapesShortenArrowBodyOnly)
 
 BOOST_AUTO_TEST_CASE (StrokingShapesRejectConsumedSegmentBody)
 
 BOOST_AUTO_TEST_CASE (EffectiveShapesHitEndpointSquare)
 
 BOOST_AUTO_TEST_CASE (PolygonConversionShortensArrowBody)
 
 BOOST_AUTO_TEST_CASE (ShortenArcForEndingsKeepsPositiveSweep)
 
 BOOST_AUTO_TEST_CASE (ShortenArcForEndingsKeepsNegativeSweep)
 
 BOOST_AUTO_TEST_CASE (ArcShorteningRejectsOverrun)
 
 BOOST_AUTO_TEST_CASE (BezierNoEndingsReturnsSource)
 
 BOOST_AUTO_TEST_CASE (BezierCurveTrimsBothEnds)
 
 BOOST_AUTO_TEST_CASE (BezierCurveRejectsOverrun)
 
 BOOST_AUTO_TEST_CASE (ShortenedBezierPolylineUsesShortenedCurve)
 
 BOOST_AUTO_TEST_CASE (BezierPolylineRejectsOverrun)
 
 BOOST_AUTO_TEST_CASE (StrokingShortenedBezierDashes)
 
 BOOST_AUTO_TEST_CASE (PolyShorteningTrimsEnds)
 
 BOOST_AUTO_TEST_CASE (ShortenPolyForEndingsLeavesOpenArrowBody)
 
 BOOST_AUTO_TEST_CASE (PolyShorteningRejectsOverrun)
 
 BOOST_AUTO_TEST_CASE (BodyPolyPointsShortenFirstOpenOutline)
 

Variables

static const std::vector< SET_ANGLE_END_CASEset_angle_end_cases
 
static const std::vector< SET_ARC_GEOMETRY_CASEset_arc_geometry_cases
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/40]

BOOST_AUTO_TEST_CASE ( ArcEditKeepsSmallSchematicRadius )

Editing a small eeschema arc must not snap its radius up to the PCB-scale 1 mil minimum.

The edit helpers used to hard-code pcbIUScale, which in schematic IUs (1 IU = 100 nm) is a 25400 IU == 100 mil floor. See https://gitlab.com/kicad/code/kicad/-/issues/24396.

Definition at line 225 of file test_eda_shape.cpp.

References ARC, arc2(), center, KI_ARC_EDIT::EditArcEndpointKeepCenter(), KI_ARC_EDIT::EditArcMidKeepCenter(), end, EDA_SHAPE::GetRadius(), KiROUND(), radius, schIUScale, and EDA_SHAPE::SetArcGeometry().

◆ BOOST_AUTO_TEST_CASE() [2/40]

◆ BOOST_AUTO_TEST_CASE() [3/40]

◆ BOOST_AUTO_TEST_CASE() [4/40]

◆ BOOST_AUTO_TEST_CASE() [5/40]

◆ BOOST_AUTO_TEST_CASE() [6/40]

◆ BOOST_AUTO_TEST_CASE() [7/40]

◆ BOOST_AUTO_TEST_CASE() [8/40]

◆ BOOST_AUTO_TEST_CASE() [9/40]

◆ BOOST_AUTO_TEST_CASE() [10/40]

◆ BOOST_AUTO_TEST_CASE() [11/40]

◆ BOOST_AUTO_TEST_CASE() [12/40]

◆ BOOST_AUTO_TEST_CASE() [13/40]

◆ BOOST_AUTO_TEST_CASE() [14/40]

◆ BOOST_AUTO_TEST_CASE() [15/40]

◆ BOOST_AUTO_TEST_CASE() [16/40]

◆ BOOST_AUTO_TEST_CASE() [17/40]

◆ BOOST_AUTO_TEST_CASE() [18/40]

BOOST_AUTO_TEST_CASE ( GetPolyPointsPreservesOrderAcrossOutlines )

◆ BOOST_AUTO_TEST_CASE() [19/40]

BOOST_AUTO_TEST_CASE ( LineEndingEndpointsRejectInvalidPolys )

◆ BOOST_AUTO_TEST_CASE() [20/40]

◆ BOOST_AUTO_TEST_CASE() [21/40]

◆ BOOST_AUTO_TEST_CASE() [22/40]

◆ BOOST_AUTO_TEST_CASE() [23/40]

BOOST_AUTO_TEST_CASE ( PolygonBehaviorSurvivesAssignment )

◆ BOOST_AUTO_TEST_CASE() [24/40]

◆ BOOST_AUTO_TEST_CASE() [25/40]

◆ BOOST_AUTO_TEST_CASE() [26/40]

◆ BOOST_AUTO_TEST_CASE() [27/40]

◆ BOOST_AUTO_TEST_CASE() [28/40]

BOOST_AUTO_TEST_CASE ( SegmentEndingTangentsPointOutward )

◆ BOOST_AUTO_TEST_CASE() [29/40]

BOOST_AUTO_TEST_CASE ( SegmentOpenArrowLeavesBody )

◆ BOOST_AUTO_TEST_CASE() [30/40]

BOOST_AUTO_TEST_CASE ( SegmentShorteningRejectsOverrun )

◆ BOOST_AUTO_TEST_CASE() [31/40]

◆ BOOST_AUTO_TEST_CASE() [32/40]

◆ BOOST_AUTO_TEST_CASE() [33/40]

◆ BOOST_AUTO_TEST_CASE() [34/40]

◆ BOOST_AUTO_TEST_CASE() [35/40]

◆ BOOST_AUTO_TEST_CASE() [36/40]

BOOST_AUTO_TEST_CASE ( ShortenPolyForEndingsLeavesOpenArrowBody )

◆ BOOST_AUTO_TEST_CASE() [37/40]

BOOST_AUTO_TEST_CASE ( ShortenSegmentForEndingsTrimsStartAndEnd )

◆ BOOST_AUTO_TEST_CASE() [38/40]

◆ BOOST_AUTO_TEST_CASE() [39/40]

◆ BOOST_AUTO_TEST_CASE() [40/40]

◆ checkAngleClose()

static void checkAngleClose ( const EDA_ANGLE & aActual,
double aExpectedDegrees,
double aTolerance = 1e-6 )
static

◆ checkAngleInRange()

static void checkAngleInRange ( const EDA_ANGLE & aActual,
double aMinDegrees,
double aMaxDegrees )
static

Definition at line 64 of file test_eda_shape.cpp.

References EDA_ANGLE::AsDegrees().

Referenced by BOOST_AUTO_TEST_CASE().

◆ checkVectorClose()

static void checkVectorClose ( const VECTOR2D & aActual,
const VECTOR2D & aExpected,
double aTolerance = 1e-6 )
static

◆ checkVectorEqual()

static void checkVectorEqual ( const VECTOR2I & aActual,
const VECTOR2I & aExpected )
static

◆ deleteShapes()

static void deleteShapes ( std::vector< SHAPE * > & aShapes)
static

Variable Documentation

◆ set_angle_end_cases

const std::vector<SET_ANGLE_END_CASE> set_angle_end_cases
static
Initial value:
=
{
{
"Issue 13626: clockwise semicircle",
{-428880000, 117229160 },
{-430060565, 113472820 },
180.0,
{-431241130, 109716480 },
false
},
{
"Issue 13626: anticlockwise arc",
{ -431241130, 109716480 },
{ -434923630, 112954230 },
-138.46654568595355,
{ -439827050, 112936200 },
true
}
}

Definition at line 92 of file test_eda_shape.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ set_arc_geometry_cases

const std::vector<SET_ARC_GEOMETRY_CASE> set_arc_geometry_cases
static
Initial value:
= {
{
"Issue 15694: clockwise arc",
{ 10000000, 0 },
{ 0, 10000000 },
{ -10000000, 0 },
{ 0, 0 },
10000000,
false,
{ -10000000, 0 },
180.0,
},
{
"Issue 15694: anticlockwise arc",
{ -10000000, 0 },
{ 0, 10000000 },
{ 10000000, 0 },
{ 0, 0 },
10000000,
true,
{ 10000000, 0 },
180.0,
},
}

Definition at line 149 of file test_eda_shape.cpp.

Referenced by BOOST_AUTO_TEST_CASE().