85 fn.AppendDir( wxS(
"issue16538" ) );
86 fn.SetName( wxS(
"issue16538" ) );
91 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
96 BOOST_CHECK( transform.
y1 != 0 );
112 wxString::Format(
"Expected vertical bounding box (height > width) "
113 "for rotated symbol. Got width=%lld, height=%lld",
114 static_cast<long long>( bbox.
GetWidth() ),
115 static_cast<long long>( bbox.
GetHeight() ) ) );
126 fn.AppendDir( wxS(
"issue16538" ) );
127 fn.SetName( wxS(
"issue16538" ) );
132 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
144 BOOST_CHECK_MESSAGE( drawRotation.
IsVertical(),
145 wxString::Format(
"Expected vertical draw rotation for 90-degree "
146 "rotated symbol with horizontal field angle. "
147 "Got %f degrees", drawRotation.
AsDegrees() ) );
162 fn.AppendDir( wxS(
"issue16538" ) );
163 fn.SetName( wxS(
"issue16538" ) );
169 SCH_SYMBOL* rotatedSymbol = GetSymbolByRef( wxS(
"C1" ) );
181 wxString::Format( wxS(
"Rotated symbol with VERTICAL field angle "
182 "should display horizontally. Got %f degrees" ),
186 SCH_SYMBOL* normalSymbol = GetSymbolByRef( wxS(
"R1" ) );
198 wxString::Format( wxS(
"Non-rotated symbol with HORIZONTAL field angle "
199 "should display horizontally. Got %f degrees" ),
214 fn.AppendDir( wxS(
"issue16538" ) );
215 fn.SetName( wxS(
"issue16538" ) );
220 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
237 wxString::Format( wxS(
"HORIZONTAL angle bbox should be taller than "
238 "wide. Got width=%lld, height=%lld" ),
239 static_cast<long long>( hBox.
GetWidth() ),
240 static_cast<long long>( hBox.
GetHeight() ) ) );
243 wxString::Format( wxS(
"VERTICAL angle bbox should be wider than "
244 "tall. Got width=%lld, height=%lld" ),
245 static_cast<long long>( vBox.
GetWidth() ),
246 static_cast<long long>( vBox.
GetHeight() ) ) );
264 fn.AppendDir( wxS(
"issue16538" ) );
265 fn.SetName( wxS(
"issue16538" ) );
271 SCH_SYMBOL* normalSymbol = GetSymbolByRef( wxS(
"R1" ) );
275 SCH_SYMBOL* rotatedSymbol = GetSymbolByRef( wxS(
"C1" ) );
297 wxString::Format( wxS(
"Normal symbol with HORIZONTAL angle should have "
298 "width > height. Got width=%lld, height=%lld" ),
299 static_cast<long long>( normalBBox.
GetWidth() ),
300 static_cast<long long>( normalBBox.
GetHeight() ) ) );
303 wxString::Format( wxS(
"Rotated symbol with VERTICAL angle should have "
304 "width > height (native dims). Got width=%lld, "
306 static_cast<long long>( rotatedBBox.
GetWidth() ),
307 static_cast<long long>( rotatedBBox.
GetHeight() ) ) );
313 double heightRatio =
static_cast<double>( std::max( normalH, rotatedH ) )
314 /
static_cast<double>( std::max( 1, std::min( normalH, rotatedH ) ) );
316 BOOST_CHECK_MESSAGE( heightRatio < 2.0,
317 wxString::Format( wxS(
"Field height ratio should be < 2.0. "
318 "Normal=%d, Rotated=%d, Ratio=%.2f" ),
319 normalH, rotatedH, heightRatio ) );
327 wxString::Format( wxS(
"HORIZONTAL angle on rotated symbol should swap "
328 "dims (height > width). Got width=%lld, "
330 static_cast<long long>( wrongBBox.
GetWidth() ),
331 static_cast<long long>( wrongBBox.
GetHeight() ) ) );
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
bool IsHorizontal() const
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
EE_TYPE OfType(KICAD_T aType) const
A generic fixture for loading schematics and associated settings for qa tests.
std::unique_ptr< SCHEMATIC > m_schematic
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
EDA_ANGLE GetDrawRotation() const override
Adjusters to allow EDA_TEXT to draw/print/etc.
Base class for any item which can be embedded within the SCHEMATIC container class,...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
const TRANSFORM & GetTransform() const
SCH_SYMBOL * GetSymbolByRef(const wxString &aRef)
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static const std::string KiCadSchematicFileExtension
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
@ REFERENCE
Field Reference of part, i.e. "IC21".
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(RotatedSymbolFieldBoundingBox)
Test that field bounding boxes for rotated symbols have correct dimensions.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()