20#include <boost/test/unit_test.hpp>
59 text->SetText( wxT(
"${U1:VALUE}" ) );
61 commit.
Push( wxT(
"add text" ), 0 );
87 text->SetText( wxT(
"${U1:Value}" ) );
90 commit.
Push( wxT(
"seed" ), 0 );
94 std::vector<std::pair<EDA_ITEM*, TEXT_VAR_REF_KEY>> invalidations;
97 { invalidations.emplace_back( dep, key ); } );
104 commit.
Push( wxT(
"edit value" ), 0 );
108 bool sawTextDependent = std::any_of( invalidations.begin(), invalidations.end(),
109 [](
const auto& pair )
110 { return pair.first && pair.first->Type() == PCB_TEXT_T; } );
112 BOOST_CHECK( sawTextDependent );
129 text->SetText( wxT(
"${X}" ) );
131 commit.
Push( wxT(
"add" ), 0 );
140 commit.
Push( wxT(
"remove" ), 0 );
157 text->SetText( wxT(
"${OP:1}" ) );
159 commit.
Push( wxT(
"add op" ), 0 );
183 text->SetText( wxT(
"${U1:Value}" ) );
186 commit.
Push( wxT(
"seed" ), 0 );
191 std::vector<EDA_ITEM*> invalidations;
199 bool sawPcbText = std::any_of( invalidations.begin(), invalidations.end(),
201 { return item && item->Type() == PCB_TEXT_T; } );
202 BOOST_CHECK( sawPcbText );
205 invalidations.clear();
207 BOOST_CHECK( invalidations.empty() );
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
TEXT_VAR_TRACKER & Tracker()
Information pertinent to a Pcbnew printed circuit board.
BOARD_TEXT_VAR_ADAPTER * GetTextVarAdapter() const
void SetCurrentVariant(const wxString &aVariant)
void AddVariant(const wxString &aVariantName)
const FOOTPRINTS & Footprints() const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
A base class for most all the KiCad significant classes used in schematics and boards.
Bidirectional index mapping TEXT_VAR_REF_KEY → dependent items and item → keys.
std::size_t ItemCount() const
ListenerHandle AddInvalidateListener(InvalidateCallback aCallback)
Register a listener that fires for every invalidation.
TEXT_VAR_DEPENDENCY_INDEX & Index()
Identifies a single resolvable source that a text item's ${...} reference depends on.
static TEXT_VAR_REF_KEY FromToken(const wxString &aToken)
Parse a raw token (the text between ${ and }) into a key using lexical classification only — no looku...
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
BOOST_AUTO_TEST_CASE(AdapterIsInstalledOnConstruction)
End-to-end reactive pipeline: BOARD commits + TEXT_VAR_TRACKER + BOARD_TEXT_VAR_ADAPTER together.