|
KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>#include <cmath>#include <base_units.h>#include <eda_shape.h>#include <math/util.h>#include <tool/point_editor_behavior.h>#include <qa_utils/geometry/geometry.h>#include <geometry/shape_arc.h>Go to the source code of this file.
Classes | |
| class | EDA_SHAPE_MOCK |
| struct | SET_ANGLE_END_CASE |
| struct | SET_ARC_GEOMETRY_CASE |
Functions | |
| 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 (EllipseBasicAccessors) | |
| BOOST_AUTO_TEST_CASE (EllipseArcIsOpenCurve) | |
| BOOST_AUTO_TEST_CASE (EllipsePerimeterForCircleCase) | |
| BOOST_AUTO_TEST_CASE (EllipseMakeEffectiveShapesNonEmpty) | |
Variables | |
| static const std::vector< SET_ANGLE_END_CASE > | set_angle_end_cases |
| static const std::vector< SET_ARC_GEOMETRY_CASE > | set_arc_geometry_cases |
| 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 184 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 | ( | EllipseArcIsOpenCurve | ) |
Definition at line 274 of file test_eda_shape.cpp.
References EDA_ANGLE::AsDegrees(), DEGREES_T, ELLIPSE_ARC, EDA_SHAPE::GetEllipseEndAngle(), EDA_SHAPE::GetEllipseStartAngle(), EDA_SHAPE::GetShape(), EDA_SHAPE::IsClosed(), EDA_SHAPE::SetEllipseCenter(), EDA_SHAPE::SetEllipseEndAngle(), EDA_SHAPE::SetEllipseMajorRadius(), EDA_SHAPE::SetEllipseMinorRadius(), EDA_SHAPE::SetEllipseRotation(), and EDA_SHAPE::SetEllipseStartAngle().
| BOOST_AUTO_TEST_CASE | ( | EllipseBasicAccessors | ) |
Definition at line 253 of file test_eda_shape.cpp.
References EDA_ANGLE::AsDegrees(), BOOST_CHECK_EQUAL(), DEGREES_T, ELLIPSE, EDA_SHAPE::GetEllipseCenter(), EDA_SHAPE::GetEllipseMajorRadius(), EDA_SHAPE::GetEllipseMinorRadius(), EDA_SHAPE::GetEllipseRotation(), EDA_SHAPE::GetShape(), EDA_SHAPE::IsClosed(), EDA_SHAPE::SetEllipseCenter(), EDA_SHAPE::SetEllipseMajorRadius(), EDA_SHAPE::SetEllipseMinorRadius(), EDA_SHAPE::SetEllipseRotation(), VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | EllipseMakeEffectiveShapesNonEmpty | ) |
Definition at line 310 of file test_eda_shape.cpp.
References DEGREES_T, ELLIPSE, EDA_SHAPE::MakeEffectiveShapes(), EDA_SHAPE::SetEllipseCenter(), EDA_SHAPE::SetEllipseMajorRadius(), EDA_SHAPE::SetEllipseMinorRadius(), and EDA_SHAPE::SetEllipseRotation().
| BOOST_AUTO_TEST_CASE | ( | EllipsePerimeterForCircleCase | ) |
Definition at line 295 of file test_eda_shape.cpp.
References DEGREES_T, ELLIPSE, expected, EDA_SHAPE::GetLength(), M_PI, EDA_SHAPE::SetEllipseCenter(), EDA_SHAPE::SetEllipseMajorRadius(), EDA_SHAPE::SetEllipseMinorRadius(), and EDA_SHAPE::SetEllipseRotation().
| BOOST_AUTO_TEST_CASE | ( | PolygonBehaviorSurvivesAssignment | ) |
Verify that EDA_POLYGON_POINT_EDIT_BEHAVIOR survives EDA_SHAPE assignment.
EDA_SHAPE::operator= replaces m_poly with a new unique_ptr. The behavior must resolve GetPolyShape() on each call rather than caching a reference that goes stale. See https://gitlab.com/kicad/code/kicad/-/issues/23648
Definition at line 224 of file test_eda_shape.cpp.
References SHAPE_POLY_SET::Append(), BOOST_CHECK_EQUAL(), copy, EDA_SHAPE::GetPolyShape(), EDA_POLYGON_POINT_EDIT_BEHAVIOR::MakePoints(), SHAPE_POLY_SET::NewOutline(), EDIT_POINTS::PointsSize(), POLY, and EDA_POLYGON_POINT_EDIT_BEHAVIOR::UpdatePoints().
| BOOST_AUTO_TEST_CASE | ( | SetAngleAndEnd | ) |
Definition at line 72 of file test_eda_shape.cpp.
References ARC, BOOST_CHECK_EQUAL(), BOOST_CHECK_PREDICATE(), SHAPE_ARC::DefaultAccuracyForPCB(), DEGREES_T, EDA_SHAPE::EndsSwapped(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), KI_TEST::IsVecWithinTol(), set_angle_end_cases, EDA_SHAPE::SetArcAngleAndEnd(), EDA_SHAPE::SetCenter(), and EDA_SHAPE::SetStart().
| BOOST_AUTO_TEST_CASE | ( | SetArcGeometry | ) |
Definition at line 136 of file test_eda_shape.cpp.
References ARC, EDA_ANGLE::AsDegrees(), BOOST_CHECK_EQUAL(), BOOST_CHECK_PREDICATE(), center, SHAPE_ARC::DefaultAccuracyForPCB(), EDA_SHAPE::EndsSwapped(), EDA_SHAPE::GetArcAngle(), EDA_SHAPE::getCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetStart(), KI_TEST::IsVecWithinTol(), KI_TEST::IsWithin(), KI_TEST::IsWithinWrapped(), radius, set_arc_geometry_cases, and EDA_SHAPE::SetArcGeometry().
|
static |
Definition at line 51 of file test_eda_shape.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 108 of file test_eda_shape.cpp.
Referenced by BOOST_AUTO_TEST_CASE().