34std::shared_ptr<EDIT_POINTS> makeQuadCollection(
EDA_ITEM* aParent,
int aOffset = 0 )
36 std::shared_ptr<EDIT_POINTS> points = std::make_shared<EDIT_POINTS>( aParent );
38 points->AddPoint(
VECTOR2I( aOffset, 0 ) );
39 points->AddPoint(
VECTOR2I( aOffset + 100, 0 ) );
40 points->AddPoint(
VECTOR2I( aOffset + 100, 100 ) );
41 points->AddPoint(
VECTOR2I( aOffset, 100 ) );
42 points->AddLine( points->Point( 0 ), points->Point( 1 ) );
43 points->AddLine( points->Point( 1 ), points->Point( 2 ) );
89 std::shared_ptr<EDIT_POINTS> points = makeQuadCollection( shape );
117 std::shared_ptr<EDIT_POINTS> before = makeQuadCollection( shape );
126 std::shared_ptr<EDIT_POINTS> after = makeQuadCollection( shape, 50 );
128 EDIT_POINT* resolvedPoint = pointKey->Resolve( *after );
129 EDIT_POINT* resolvedLine = lineKey->Resolve( *after );
132 BOOST_CHECK( resolvedPoint == &after->Point( 2 ) );
148 std::shared_ptr<EDIT_POINTS> pointsA = makeQuadCollection( shapeA );
149 std::shared_ptr<EDIT_POINTS> pointsB = makeQuadCollection( shapeB );
153 std::optional<PCB_HANDLE_KEY> otherIndex =
PCB_HANDLE_KEY::Make( *pointsA, &pointsA->Point( 2 ) );
154 std::optional<PCB_HANDLE_KEY> otherKind =
PCB_HANDLE_KEY::Make( *pointsA, &pointsA->Line( 1 ) );
155 std::optional<PCB_HANDLE_KEY> otherParent =
PCB_HANDLE_KEY::Make( *pointsB, &pointsB->Point( 1 ) );
157 BOOST_REQUIRE( key1 && key2 && otherIndex && otherKind && otherParent );
164 std::set<PCB_HANDLE_KEY> picked;
165 picked.insert( *key1 );
166 picked.insert( *key2 );
167 picked.insert( *otherIndex );
168 picked.insert( *otherKind );
169 picked.insert( *otherParent );
183 std::shared_ptr<EDIT_POINTS> before = makeQuadCollection( shapeA );
192 std::shared_ptr<EDIT_POINTS> otherParent = makeQuadCollection( shapeB );
194 BOOST_CHECK( pointKey->Resolve( *otherParent ) ==
nullptr );
197 std::shared_ptr<EDIT_POINTS> fewerPoints = std::make_shared<EDIT_POINTS>( shapeA );
198 fewerPoints->AddPoint(
VECTOR2I( 0, 0 ) );
199 fewerPoints->AddPoint(
VECTOR2I( 100, 0 ) );
200 fewerPoints->AddPoint(
VECTOR2I( 100, 100 ) );
201 fewerPoints->AddLine( fewerPoints->Point( 0 ), fewerPoints->Point( 1 ) );
202 fewerPoints->AddLine( fewerPoints->Point( 1 ), fewerPoints->Point( 2 ) );
204 BOOST_CHECK( pointKey->Resolve( *fewerPoints ) ==
nullptr );
207 std::shared_ptr<EDIT_POINTS> fewerLines = std::make_shared<EDIT_POINTS>( shapeA );
208 fewerLines->AddPoint(
VECTOR2I( 0, 0 ) );
209 fewerLines->AddPoint(
VECTOR2I( 100, 0 ) );
210 fewerLines->AddPoint(
VECTOR2I( 100, 100 ) );
211 fewerLines->AddPoint(
VECTOR2I( 0, 100 ) );
212 fewerLines->AddLine( fewerLines->Point( 0 ), fewerLines->Point( 1 ) );
214 BOOST_CHECK( lineKey->Resolve( *fewerLines ) ==
nullptr );
224 std::shared_ptr<EDIT_POINTS> points = makeQuadCollection( shape );
229 points->AddPoint(
VECTOR2I( 50, 50 ) );
237 std::set<PCB_HANDLE_KEY> picked{ *before };
243 BOOST_CHECK( after->Resolve( *points ) == &points->Point( 0 ) );
244 BOOST_CHECK( before->Resolve( *points ) ==
nullptr );
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
A base class for most all the KiCad significant classes used in schematics and boards.
Represent a single point that can be used for modifying items.
void SetDependent(bool aDependent=true)
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
void SetHover(bool aHover=true)
void SetSelected(bool aSelected=true)
void SetActive(bool aActive=true)
static std::optional< PCB_HANDLE_KEY > Make(const EDIT_POINTS &aPoints, const EDIT_POINT *aPoint)
Build the key for a handle in a collection.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(PointSelectionFlagsAreIndependent)
VECTOR2< int32_t > VECTOR2I