29#include <wx/filename.h>
58 m_textbox.SetText( wxT(
"Hello World" ) );
81 VECTOR2I minSizeShort = m_textbox.GetMinSize();
83 m_textbox.SetText( wxT(
"Hello World\nSecond Line\nThird Line" ) );
84 m_textbox.ClearBoundingBoxCache();
85 m_textbox.ClearRenderCache();
86 VECTOR2I minSizeLong = m_textbox.GetMinSize();
88 BOOST_CHECK_GT( minSizeLong.
y, minSizeShort.
y );
94 m_textbox.SetText( wxT(
"A" ) );
95 m_textbox.SetMarginLeft( 0 );
96 m_textbox.SetMarginRight( 0 );
97 m_textbox.SetMarginTop( 0 );
98 m_textbox.SetMarginBottom( 0 );
99 m_textbox.ClearBoundingBoxCache();
100 m_textbox.ClearRenderCache();
102 VECTOR2I minSizeNoMargin = m_textbox.GetMinSize();
105 m_textbox.SetMarginTop( margin );
106 m_textbox.SetMarginBottom( margin );
107 m_textbox.ClearBoundingBoxCache();
108 m_textbox.ClearRenderCache();
110 VECTOR2I minSizeWithMargin = m_textbox.GetMinSize();
114 BOOST_CHECK_GT( minSizeWithMargin.
y, minSizeNoMargin.
y );
120 m_textbox.SetText( wxT(
"A" ) );
121 m_textbox.ClearBoundingBoxCache();
122 m_textbox.ClearRenderCache();
125 BOOST_CHECK_GE(
minSize.y, m_textbox.GetTextSize().y );
131 m_textbox.SetText( wxT(
"" ) );
132 m_textbox.ClearBoundingBoxCache();
133 m_textbox.ClearRenderCache();
145 m_textbox.SetText( wxT(
"Wide Text" ) );
146 m_textbox.ClearBoundingBoxCache();
147 m_textbox.ClearRenderCache();
149 VECTOR2I minSize0 = m_textbox.GetMinSize();
152 m_textbox.ClearBoundingBoxCache();
153 m_textbox.ClearRenderCache();
155 VECTOR2I minSize90 = m_textbox.GetMinSize();
158 BOOST_CHECK_GT( minSize0.
y, 0 );
159 BOOST_CHECK_GT( minSize90.
x, 0 );
166 m_textbox.SetText( wxT(
"This is a very long line of text that should exceed the box width" ) );
167 m_textbox.ClearBoundingBoxCache();
168 m_textbox.ClearRenderCache();
173 BOOST_CHECK_GT(
minSize.y, 0 );
181 for(
int i = 0; i < 3; ++i )
184 BOOST_REQUIRE_CLOSE( m_textbox.GetTextAngle().AsDegrees(), 90.0, 1e-6 );
186 std::vector<VECTOR2I> corners = m_textbox.GetCorners();
187 BOOST_REQUIRE_EQUAL( corners.size(), 4u );
196 "visual width " << visual.
GetWidth() <<
" expected " << origH );
198 "visual height " << visual.
GetHeight() <<
" expected " << origW );
208 std::vector<VECTOR2I> corners = m_textbox.GetCorners();
209 BOOST_REQUIRE_EQUAL( corners.size(), 4u );
215 BOOST_CHECK_GT( bbox.
GetWidth(), 0 );
218 BOOST_CHECK_NO_THROW( m_textbox.GetDrawPos() );
224 VECTOR2I origStart = m_textbox.GetStart();
225 VECTOR2I origEnd = m_textbox.GetEnd();
229 for(
int i = 0; i < 4; ++i )
269 wxString gbrPath = wxFileName::CreateTempFileName( wxT(
"kicad_gbr_knockout" ) );
281 wxRemoveFile( gbrPath );
284 "expected one plotted polygon, got " << plotter.
m_plottedPolys.size() );
constexpr EDA_IU_SCALE pcbIUScale
virtual void SetIsKnockout(bool aKnockout)
Information pertinent to a Pcbnew printed circuit board.
constexpr size_type GetWidth() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
virtual void SetText(const wxString &aText)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
virtual bool StartPlot(const wxString &pageNumber) override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
LSET is a set of PCB_LAYER_IDs.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void SetBorderEnabled(bool enabled)
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
void SetRenderSettings(RENDER_SETTINGS *aSettings)
std::vector< SHAPE_LINE_CHAIN > m_plottedPolys
void PlotPoly(const SHAPE_LINE_CHAIN &aPoly, FILL_T aFill, int aWidth, void *aData) override
Draw a polygon ( filled or not ).
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Minimal concrete render settings suitable for plotters in tests.
const int minSize
Push and Shove router track width and via size dialog.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot copper or technical layers.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
KIBIS top(path, &reporter)
BOOST_AUTO_TEST_CASE(GetMinSizeReturnsHeightOnly)
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I