21#include <boost/test/unit_test.hpp>
44 std::hash<EDA_TEXT> hasher;
52 BOOST_CHECK_GT( a, b );
53 BOOST_CHECK_NE( hasher( a ), hasher( b ) );
56 BOOST_CHECK_LT( a, b );
57 BOOST_CHECK_NE( hasher( a ), hasher( b ) );
61 BOOST_CHECK_GT( a, b );
64 BOOST_CHECK_LT( a, b );
68 BOOST_CHECK_LT( a, b );
71 BOOST_CHECK_GT( a, b );
88 BOOST_CHECK( !t.
IsBold() );
127 normal.SetTextThickness( 32 );
128 normal.MigrateLegacyBoldStrokeWidth();
168 t.
SetText( wxS(
"plain text" ) );
177 t.
SetText( wxS(
"${VALUE} - ${U1:MPN}" ) );
182 BOOST_REQUIRE_EQUAL( refs.size(), 2u );
186 return std::any_of( refs.begin(), refs.end(),
188 { return ref.kind == k && ref.primary == p && ref.secondary == s; } );
199 t.
SetText( wxS(
"${VALUE}" ) );
202 t.
SetText( wxS(
"${REFERENCE}" ) );
204 BOOST_REQUIRE_EQUAL( refs.size(), 1u );
205 BOOST_CHECK( refs[0].primary == wxS(
"REFERENCE" ) );
215 t.
SetText( wxS(
"${X} and ${Y}" ) );
220 BOOST_REQUIRE_EQUAL( first.size(), 2u );
221 BOOST_CHECK( &first == &second );
231 t.
SetText( wxS(
"literal: \\${VAR}" ) );
constexpr EDA_IU_SCALE unityScale
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const std::vector< TEXT_VAR_REF_KEY > & GetTextVarReferences() const
Return the set of ${...} references extracted from the source text.
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual void SetTextPos(const VECTOR2I &aPoint)
virtual int GetTextWidth() const
void SetBoldFlag(bool aBold)
Set only the bold flag, without changing the font.
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
void MigrateLegacyBoldStrokeWidth()
Migrate a pre-v11 bold stroke text so its stored thickness holds the base (non-bold) width.
virtual void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
void SetAutoThickness(bool aAuto)
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual int GetTextThickness() const
virtual void SetText(const wxString &aText)
int GetPenSizeForBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
Identifies a single resolvable source that a text item's ${...} reference depends on.
KIND
Categorizes a reference by the source that will produce its value.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static EDA_TEXT makeText200()
BOOST_AUTO_TEST_CASE(Compare)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I