55 m_mgr.LoadProject(
"" );
70 if( aFieldValue.has_value() )
103 std::vector<wxString> names;
104 names.reserve( dynamicProps.size() );
107 names.push_back( prop->Name() );
109 BOOST_CHECK( std::ranges::none_of( names,
110 [](
const wxString& n ) {
return n == wxS(
"Secret" ); } ) );
114 bool seenUser =
false;
116 std::vector<wxString> userNames;
118 for(
const wxString&
name : names )
124 BOOST_CHECK_MESSAGE( !seenUser,
"Mandatory field '" +
name +
"' appears after a user field" );
132 BOOST_CHECK_MESSAGE( lastUser.CmpNoCase(
name ) <= 0,
133 "User fields not sorted: " + lastUser +
" before " +
name );
136 userNames.push_back(
name );
141 const std::vector<wxString> expectedUser = { wxS(
"alpha" ), wxS(
"Mike" ), wxS(
"Zulu" ) };
142 BOOST_CHECK( userNames == expectedUser );
156 std::vector<wxString> names;
157 names.reserve( dynamicProps.size() );
160 names.push_back( prop->Name() );
162 bool seenUser =
false;
164 std::vector<wxString> userNames;
166 for(
const wxString&
name : names )
172 BOOST_CHECK_MESSAGE( !seenUser,
173 "Mandatory field '" +
name +
"' appears after a user field" );
179 BOOST_CHECK_MESSAGE( lastUser.CmpNoCase(
name ) <= 0,
180 "User fields not sorted: " + lastUser +
" before " +
name );
184 userNames.push_back(
name );
189 const std::vector<wxString> expectedUser = { wxS(
"Alpha" ), wxS(
"charlie" ), wxS(
"delta" ) };
190 BOOST_CHECK( userNames == expectedUser );
203 std::vector<wxString> staticNames;
206 staticNames.push_back( staticProp->Name() );
208 BOOST_CHECK_MESSAGE( std::ranges::find( staticNames, dynamic->Name() ) == staticNames.end(),
209 "Dynamic property '" + dynamic->Name() +
"' duplicates a statically-registered property" );
216 SCH_SYMBOL* symWith = makeSymbol( wxString( wxS(
"ACME" ) ) );
217 SCH_SYMBOL* symWithout = makeSymbol( std::nullopt );
230 SCH_SYMBOL* symA = makeSymbol( wxString( wxS(
"" ) ) );
231 SCH_SYMBOL* symB = makeSymbol( wxString( wxS(
"ACME" ) ) );
246 SCH_SYMBOL* symA = makeSymbol( std::nullopt );
247 SCH_SYMBOL* symB = makeSymbol( std::nullopt );
250 BOOST_CHECK( !
findDelta( deltas, wxS(
"Manufacturer" ) ) );
256 SCH_SYMBOL* symA = makeSymbol( wxString( wxS(
"" ) ) );
257 SCH_SYMBOL* symB = makeSymbol( wxString( wxS(
"" ) ) );
260 BOOST_CHECK( !
findDelta( deltas, wxS(
"Manufacturer" ) ) );
274 if( p->Name() == wxS(
"TempField" ) )
284 wxAny value( wxString( wxS(
"newval" ) ) );
285 BOOST_CHECK( symbol.
Set( prop, value ) );
295 SCH_SYMBOL* symA = makeSymbol( std::nullopt );
296 SCH_SYMBOL* symB = makeSymbol( wxString( wxS(
"ACME" ) ) );
326 if( p->Name() == wxS(
"MPN" ) )
332 wxAny v = symbol.
Get( mpn );
338 wxAny newVal( wxString( wxS(
"99999" ) ) );
339 BOOST_CHECK( symbol.
Set( mpn, newVal ) );
void SetCustomProperty(const wxString &aKey, const wxString &aValue)
const std::map< wxString, wxString > & GetCustomProperties() const
Custom user-defined string key/value properties attached to this item.
wxAny Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
Provide class metadata.Helper macro to map type hashes to names.
const std::vector< PROPERTY_BASE * > & GetProperties(TYPE_ID aType) const
Return all properties for a specific type.
static PROPERTY_MANAGER & Instance()
virtual const wxString & GetText() const override
Return the string associated with the text object.
void SetText(const wxString &aText) override
void SetPrivate(bool aPrivate)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
std::vector< PROPERTY_BASE * > GetDynamicProperties() const override
Return dynamically-computed properties specific to this object instance (e.g.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a @aField to the list of fields.
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
std::vector< PROPERTY_BASE * > GetDynamicProperties() const override
Return dynamically-computed properties specific to this object instance (e.g.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
std::vector< PROPERTY_DELTA > DiffItemProperties(const INSPECTABLE *aBefore, const INSPECTABLE *aAfter)
Enumerate the property deltas between two items of the same dynamic type.
Single (name, before, after) triple for one mutated property on an item.
SCH_SYMBOL * makeSymbol(const std::optional< wxString > &aFieldValue)
std::unique_ptr< SCHEMATIC > m_schematic
@ USER
The field ID hasn't been set yet; field is invalid.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(SymbolDynamicPropertyOrder)
static const PROPERTY_DELTA * findDelta(const std::vector< PROPERTY_DELTA > &aDeltas, const wxString &aName)
BOOST_CHECK_EQUAL(result, "25.4")