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" ) );
140 BOOST_CHECK_MESSAGE( drawRotation.
IsVertical(),
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 ) ) );
312 BOOST_CHECK_MESSAGE( heightRatio < 2.0,
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() ) ) );
338 fn.AppendDir( wxS(
"issue16538" ) );
339 fn.SetName( wxS(
"issue16538" ) );
344 SCH_SYMBOL* symbol = GetSymbolByRef( wxS(
"R1" ) );
361 wxString::Format( wxS(
"Horizontal justification %d set from center "
362 "reads back as %d" ),
363 static_cast<int>( justify ),
378 wxString::Format( wxS(
"Vertical justification %d set from center "
379 "reads back as %d" ),
380 static_cast<int>( justify ),
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
bool IsHorizontal() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
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
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetEffectiveHorizJustify(GR_TEXT_H_ALIGN_T)
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
bool IsVertJustifyFlipped() const
EDA_ANGLE GetDrawRotation() const override
Adjusters to allow EDA_TEXT to draw/print/etc.
void SetEffectiveVertJustify(GR_TEXT_V_ALIGN_T)
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
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()
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.