81 fn.AppendDir( wxS(
"issue16538" ) );
82 fn.SetName( wxS(
"issue16538" ) );
87 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
92 BOOST_CHECK( transform.
y1 != 0 );
108 wxString::Format(
"Expected vertical bounding box (height > width) "
109 "for rotated symbol. Got width=%lld, height=%lld",
110 static_cast<long long>( bbox.
GetWidth() ),
111 static_cast<long long>( bbox.
GetHeight() ) ) );
122 fn.AppendDir( wxS(
"issue16538" ) );
123 fn.SetName( wxS(
"issue16538" ) );
128 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
141 wxString::Format(
"Expected vertical draw rotation for 90-degree "
142 "rotated symbol with horizontal field angle. "
143 "Got %f degrees", drawRotation.
AsDegrees() ) );
158 fn.AppendDir( wxS(
"issue16538" ) );
159 fn.SetName( wxS(
"issue16538" ) );
165 SCH_SYMBOL* rotatedSymbol = GetSymbolByRef( wxS(
"C1" ) );
177 wxString::Format( wxS(
"Rotated symbol with VERTICAL field angle "
178 "should display horizontally. Got %f degrees" ),
182 SCH_SYMBOL* normalSymbol = GetSymbolByRef( wxS(
"R1" ) );
194 wxString::Format( wxS(
"Non-rotated symbol with HORIZONTAL field angle "
195 "should display horizontally. Got %f degrees" ),
210 fn.AppendDir( wxS(
"issue16538" ) );
211 fn.SetName( wxS(
"issue16538" ) );
216 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"C1" ) );
233 wxString::Format( wxS(
"HORIZONTAL angle bbox should be taller than "
234 "wide. Got width=%lld, height=%lld" ),
235 static_cast<long long>( hBox.
GetWidth() ),
236 static_cast<long long>( hBox.
GetHeight() ) ) );
239 wxString::Format( wxS(
"VERTICAL angle bbox should be wider than "
240 "tall. Got width=%lld, height=%lld" ),
241 static_cast<long long>( vBox.
GetWidth() ),
242 static_cast<long long>( vBox.
GetHeight() ) ) );
260 fn.AppendDir( wxS(
"issue16538" ) );
261 fn.SetName( wxS(
"issue16538" ) );
267 SCH_SYMBOL* normalSymbol = GetSymbolByRef( wxS(
"R1" ) );
271 SCH_SYMBOL* rotatedSymbol = GetSymbolByRef( wxS(
"C1" ) );
293 wxString::Format( wxS(
"Normal symbol with HORIZONTAL angle should have "
294 "width > height. Got width=%lld, height=%lld" ),
295 static_cast<long long>( normalBBox.
GetWidth() ),
296 static_cast<long long>( normalBBox.
GetHeight() ) ) );
299 wxString::Format( wxS(
"Rotated symbol with VERTICAL angle should have "
300 "width > height (native dims). Got width=%lld, "
302 static_cast<long long>( rotatedBBox.
GetWidth() ),
303 static_cast<long long>( rotatedBBox.
GetHeight() ) ) );
309 double heightRatio =
static_cast<double>( std::max( normalH, rotatedH ) )
310 /
static_cast<double>( std::max( 1, std::min( normalH, rotatedH ) ) );
313 wxString::Format( wxS(
"Field height ratio should be < 2.0. "
314 "Normal=%d, Rotated=%d, Ratio=%.2f" ),
315 normalH, rotatedH, heightRatio ) );
323 wxString::Format( wxS(
"HORIZONTAL angle on rotated symbol should swap "
324 "dims (height > width). Got width=%lld, "
326 static_cast<long long>( wrongBBox.
GetWidth() ),
327 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()
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")