38 const int courtyardEpsilon =
pcbIUScale.mmToIU( 0.005 );
64 const int courtyardH =
pcbIUScale.mmToIU( 1.0 );
65 const int courtyardW =
pcbIUScale.mmToIU( 2.0 );
67 const std::vector<VECTOR2I> courtyardPoints = {
70 { courtyardW, courtyardH },
98 std::unique_ptr<PCB_SHAPE> courtyardPoly = std::make_unique<PCB_SHAPE>( &fp,
SHAPE_T::POLY );
99 courtyardPoly->SetLayer(
F_CrtYd );
100 courtyardPoly->SetPolyPoints( courtyardPoints );
101 courtyardPoly->SetWidth( lineW );
103 fp.
Add( courtyardPoly.release() );
113 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
119 fp.
Move( moveVector );
120 expectedCourtyard.
Move( moveVector );
121 expectedHull.
Move( moveVector );
125 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
127 assertHullMatch( expectedHull );
136 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
138 assertHullMatch( expectedHull );
149 assertCourtyardMatches(
B_CrtYd, expectedCourtyard );
151 assertHullMatch( expectedHull );
167 file->name = wxS(
"model.step" );
172 std::string payload( 4096,
'k' );
173 file->decompressedData.assign( payload.begin(), payload.end() );
176 hash.
add( file->decompressedData );
188 std::vector<std::unique_ptr<FOOTPRINT>> clones;
190 for(
int ii = 0; ii < 4; ++ii )
194 clones.back()->GetEmbeddedFile( wxS(
"model.step" ) );
201 BOOST_CHECK( fp.
HasFile( wxS(
"model.step" ) ) );
213 const int shapeSize =
pcbIUScale.mmToIU( 3.0 );
216 std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( &fp,
SHAPE_T::RECTANGLE );
217 shape->SetLayer(
F_Cu );
218 shape->SetStart(
VECTOR2I( 0, 0 ) );
219 shape->SetEnd(
VECTOR2I( shapeSize, shapeSize ) );
222 fp.
Add( shape.release() );
234 std::unique_ptr<PCB_FIELD> field( fp.
GetField(
id ) );
247 wxString token = wxS(
"VALUE" );
249 BOOST_CHECK( token.IsEmpty() );
265 userField->
SetText( wxS(
"PESD5V0S1BL" ) );
266 fp->
Add( userField );
275 std::vector<PCB_FIELD> newFields;
280 newFields.push_back( *fp->
GetField(
id ) );
283 newFields[1].SetText( wxS(
"new value" ) );
286 std::vector<PCB_FIELD*> added;
287 std::vector<PCB_FIELD*> detached;
296 BOOST_REQUIRE_EQUAL( added.size(), 1 );
298 BOOST_CHECK( added.front()->GetParent() == fp );
300 BOOST_REQUIRE_EQUAL( detached.size(), 1 );
301 BOOST_CHECK( detached.front() == userField );
309 BOOST_CHECK( board.
ResolveItem( referenceId,
true ) == reference );
310 BOOST_CHECK( added.front()->IsIndexedInBoard() );
311 BOOST_CHECK( board.
ResolveItem( userFieldId,
true ) ==
nullptr );
331 std::vector<PCB_FIELD> newFields;
334 newFields.push_back( *field );
342 std::vector<PCB_FIELD*> added;
343 std::vector<PCB_FIELD*> detached;
360 std::vector<PCB_FIELD> newFields;
365 newFields.push_back( *fp.
GetField(
id ) );
369 fp.
Remove( orphan.get() );
372 std::vector<PCB_FIELD*> added;
373 std::vector<PCB_FIELD*> detached;
377 BOOST_CHECK( detached.empty() );
378 BOOST_REQUIRE_EQUAL( added.size(), 1 );
379 BOOST_CHECK( added.front() == std::as_const( fp ).GetField(
FIELD_T::VALUE ) );
380 BOOST_CHECK( added.front() != orphan.get() );
constexpr EDA_IU_SCALE pcbIUScale
BOARD_ITEM_CONTAINER * GetParent() const
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.
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
static constexpr BOX2< VECTOR2I > ByCorners(const VECTOR2I &aCorner1, const VECTOR2I &aCorner2)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
bool HasFile(const wxString &name) const
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
static RETURN_CODE CompressAndEncode(EMBEDDED_FILE &aFile)
Take data from the #decompressedData buffer and compresses it using ZSTD into the #compressedEncodedD...
A streaming C++ equivalent for MurmurHash3_x64_128.
FORCE_INLINE void add(const std::string &input)
FORCE_INLINE HASH_128 digest()
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void Mirror(const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection)
Mirror the line points about y or x (or both).
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID
A quick note on layer IDs:
@ LEFT_RIGHT
Flip left to right (around the Y axis)
bool ChainsAreCyclicallyEqual(const SHAPE_LINE_CHAIN &aChainA, const SHAPE_LINE_CHAIN &aChainB, int aTol)
Check that two chains are cyclically equal.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Utility functions for working with shapes.
std::string ToString() const
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
BOOST_CHECK_PREDICATE(ArePolylineEndPointsNearCircle,(chain)(c.m_geom.m_center_point)(radius)(accuracy+epsilon))
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I