35struct BLOCK_DRAG_VALIDATION_FIXTURE
39 KI_TEST::DUMMY_TOOL* tool;
41 BLOCK_DRAG_VALIDATION_FIXTURE() :
42 tool( new KI_TEST::DUMMY_TOOL() )
44 mgr.SetEnvironment( &board,
nullptr,
nullptr,
nullptr,
nullptr );
45 mgr.RegisterTool( tool );
48 ZONE* makeSquareZone()
50 ZONE* zone =
new ZONE( &board );
63 ZONE* zone = makeSquareZone();
83 PCB_SHAPE* makeClosedOutline()
85 PCB_SHAPE* first = makeEdgeSegment(
VECTOR2I( 0, 0 ),
VECTOR2I( 1000000, 0 ) );
96BOOST_FIXTURE_TEST_SUITE( BlockDragValidationTests, BLOCK_DRAG_VALIDATION_FIXTURE )
101 ZONE* zone = makeSquareZone();
103 std::vector<VECTOR2I> original;
105 for(
int ii = 0; ii < zone->
Outline()->TotalVertices(); ++ii )
125 for(
int ii = 0; ii < zone->
Outline()->TotalVertices(); ++ii )
137 ZONE* zone = makeHoledZone();
150 ZONE* zone = makeHoledZone();
164 ZONE* zone = makeHoledZone();
178 ZONE* zone = makeSquareZone();
183 for(
int ii = 0; ii < zone->
Outline()->TotalVertices(); ++ii )
194 ZONE* zone = makeSquareZone();
264 for(
int ii = 0; ii < zone->
Outline()->TotalVertices(); ++ii )
275 PCB_SHAPE* untouched = makeClosedOutline();
276 ZONE* zone = makeSquareZone();
@ INVALID_OUTLINE
The board outline was closed before the drag and the moved Edge.Cuts broke it.
@ INVALID_ZONE
A zone that came along lost its valid outline.
Checks a Block Drag's result at release and says whether it may be kept.
void CaptureBaseline(const std::vector< BOARD_ITEM * > &aCarriedItems)
Note whether the zones coming along, and the board outline, were valid to start with.
BLOCK_DRAG_VALIDATION_RESULT Validate() const
void Revert() override
Revert the commit by restoring the modified items state.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, bool aInferOutlineIfNecessary, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void Move(const VECTOR2I &aVector) override
void SetPoint(int aIndex, const VECTOR2I &aPos)
Move a point to a specific location.
void Remove(int aStartIndex, int aEndIndex)
Remove the range of points [start_index, end_index] from the line chain.
Represent a set of closed polygons.
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
int TotalVertices() const
Return total number of vertices stored in the 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)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the reference to aHole-th hole in the aIndex-th outline.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
int NewHole(int aOutline=-1)
Creates a new hole in a given outline.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
void Move(const VECTOR2I &aVector) override
bool IsSelfIntersecting() const
Check whether any of the polygons in the set is self intersecting.
Handle a list of polygons defining a copper zone.
SHAPE_POLY_SET * Outline()
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(InvalidZoneRestoresStagedGeometry)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I