24#include <boost/test/unit_test.hpp>
60 bool StartPlot(
const wxString& )
override {
return true; }
72 void PlotPoly(
const std::vector<VECTOR2I>&,
FILL_T,
int,
void* )
override {}
84 const int halfWidth = std::min( aSize.
x, aSize.
y ) / 2;
99 void* aData )
override
107 void* aData )
override
109 Record( *aPolygons, aData );
113 void* aData )
override
118 for(
int i = 0; i < 4; ++i )
122 shape.
Append( point + aPos );
135 if( aData && !
static_cast<const GBR_METADATA*
>( aData )->m_NetlistMetadata.m_Cmpref.IsEmpty() )
145 const std::vector<std::string> paths = {
"api_kitchen_sink.kicad_pcb",
"connect/connect.kicad_pcb",
146 "odbpp/custom_pad_mask_split.kicad_pcb",
147 "odbpp/pad_margin_shapes.kicad_pcb" };
149 int comparedMargins = 0;
151 for(
const std::string&
path : paths )
155 const int maxError = board->GetDesignSettings().m_MaxError;
157 int boardCompared = 0;
175 for(
const FOOTPRINT* footprint : board->Footprints() )
177 for(
const PAD*
pad : footprint->Pads() )
179 if( !
pad->GetLayerSet().Contains( layer )
181 && ( !
pad->IsOnCopperLayer() || !
pad->FlashLayer(
LSET( { layer } ) ) ) ) )
198 const double tolerance = 1000000.0;
199 BOOST_CHECK_LE(
std::abs( missing.
Area() ), tolerance );
214 BOOST_CHECK_GT( boardCompared, 0 );
217 BOOST_CHECK_GT( compared, 100 );
218 BOOST_CHECK_GT( comparedMargins, 0 );
General utilities for PCB file IO for QA programs.
A color representation with 4 components: red, green, blue, alpha.
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
void SetViewport(const VECTOR2I &, double aIusPerDecimil, double, bool) override
Set the plot offset and scaling for the current plot.
void FlashRegularPolygon(const VECTOR2I &, int, int, const EDA_ANGLE &, void *) override
Flash a regular polygon.
bool StartPlot(const wxString &) override
void SetCurrentLineWidth(int, void *=nullptr) override
Set the line width for the next drawing.
void Record(const SHAPE_POLY_SET &aShape, void *aData)
PAD_CAPTURE_PLOTTER(int aMaxError)
void SetDash(int, LINE_STYLE) override
void FlashPadRoundRect(const VECTOR2I &aPos, const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aOrient, void *aData) override
std::vector< SHAPE_POLY_SET > m_padShapes
void Circle(const VECTOR2I &, int, FILL_T, int) override
void PenTo(const VECTOR2I &, char) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
void FlashPadRect(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
void FlashPadTrapez(const VECTOR2I &aPos, const VECTOR2I *aCorners, const EDA_ANGLE &aOrient, void *aData) override
Flash a trapezoidal pad.
void Rect(const VECTOR2I &, const VECTOR2I &, FILL_T, int, int=0) override
void SetColor(const COLOR4D &) override
void PlotPoly(const std::vector< VECTOR2I > &, FILL_T, int, void *) override
Draw a polygon ( filled or not ).
PLOT_FORMAT GetPlotterType() const override
Return the effective plot engine in use.
void FlashPadCircle(const VECTOR2I &aPos, int aDiameter, void *aData) override
void FlashPadCustom(const VECTOR2I &, const VECTOR2I &, const EDA_ANGLE &, SHAPE_POLY_SET *aPolygons, void *aData) override
void FlashPadOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
A pad's resolved artwork on one fabrication layer.
SHAPE_POLY_SET Polygon() const
Parameters and options when plotting/printing a board.
void SetPlotFPText(bool aFlag)
void SetRenderSettings(RENDER_SETTINGS *aSettings)
PLOTTER(const PROJECT *aProject=nullptr)
Represent a set of closed polygons.
double Area()
Return the area of this poly set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
Minimal concrete render settings suitable for plotters in tests.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
void TransformTrapezoidToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aDeltaX, int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle or trapezoid to a polygon.
PAD_LAYER_GEOMETRY ResolvePadLayer(const PAD &aPad, PCB_LAYER_ID aLayer, int aMaxError)
Artwork on one layer as plotted by PlotStandardLayer; keep the plotter independent as the parity orac...
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot copper or technical layers.
PLOT_FORMAT
The set of supported output plot formats.
LINE_STYLE
Dashed line types.
BOOST_AUTO_TEST_CASE(FabPadLayerMatchesPlotterOnRealBoards)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_CHECK_EQUAL(result, "25.4")
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I