20#define BOOST_TEST_NO_MAIN
21#include <boost/test/unit_test.hpp>
36struct DefaultLayoutFixture
38 DefaultLayoutFixture()
48BOOST_FIXTURE_TEST_SUITE( DrawingSheetReactive, DefaultLayoutFixture )
66 return std::any_of( keys.begin(), keys.end(),
68 { return key.kind == k && key.primary == primary; } );
180 text->m_RepeatCount = 8;
181 text->m_IncrementLabel = 1;
210 text->m_RepeatCount = 100;
211 text->m_IncrementLabel = 1;
237 BOOST_REQUIRE_GT( insideCount, 1 );
244static std::vector<wxString>
repeatTexts(
const wxString& aBase,
int aCount,
int aLabelStep )
251 text->m_RepeatCount = aCount;
252 text->m_IncrementLabel = aLabelStep;
262 std::vector<wxString> out;
278 const std::vector<wxString> letters =
repeatTexts( wxT(
"y" ), 5, 1 );
279 const std::vector<wxString> expLetters = { wxT(
"y" ), wxT(
"z" ), wxT(
"aa" ), wxT(
"ab" ), wxT(
"ac" ) };
282 const std::vector<wxString> numbers =
repeatTexts( wxT(
"19" ), 3, 1 );
283 const std::vector<wxString> expNumbers = { wxT(
"19" ), wxT(
"20" ), wxT(
"21" ) };
288BOOST_AUTO_TEST_CASE( RepeatedLabelStepsPastNonAsciiCharacters, *boost::unit_test::timeout( 30 ) )
292 const std::vector<wxString> mixed =
repeatTexts( wxString(
L"1あ" ), 3, 1 );
293 const std::vector<wxString>
expMixed = { wxString(
L"1あ" ), wxString(
L"2あ" ),
constexpr EDA_IU_SCALE unityScale
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
DS_DRAW_ITEM_BASE * GetFirst()
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
DS_DRAW_ITEM_BASE * GetNext()
void AttachToTracker(TEXT_VAR_TRACKER *aTracker)
Register this proxy with aTracker as a dependent on every title-block source variable its current tem...
std::vector< TEXT_VAR_REF_KEY > CollectTextVarKeys() const
Walk the current drawing-sheet definition and collect every ${...} reference encountered in its text ...
A base class for most all the KiCad significant classes used in schematics and boards.
Describe the page size and margins of a paper page on which to eventually print or plot.
std::size_t ItemCount() const
std::size_t DependentCount(const TEXT_VAR_REF_KEY &aKey) const
Coordinates the dependency index with change notifications.
ListenerHandle AddInvalidateListener(InvalidateCallback aCallback)
Register a listener that fires for every invalidation.
TEXT_VAR_DEPENDENCY_INDEX & Index()
void InvalidateKey(const TEXT_VAR_REF_KEY &aKey)
Fan out invalidation for a single explicit key — used when a non-item source changes (e....
Hold the information shown in the lower right corner of a plot, printout, or editing view.
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...
KIND
Categorizes a reference by the source that will produce its value.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
static int repeatCountAtY(double aY)
const std::vector< wxString > expMixed
const std::vector< wxString > fullWidth
static std::vector< wxString > repeatTexts(const wxString &aBase, int aCount, int aLabelStep)
const std::vector< wxString > expFullWidth
BOOST_AUTO_TEST_CASE(CollectKeysFindsTitleBlockSources)
BOOST_CHECK_EQUAL_COLLECTIONS(mixed.begin(), mixed.end(), expMixed.begin(), expMixed.end())
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< double > VECTOR2D