46 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
47 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
52 parent->GetValueField().SetText(
"10k" );
56 parent->AddField( mfg );
58 BOOST_CHECK( child->GetValueField().GetText().IsEmpty() );
64 child->SyncFieldsFromParent( options );
68 SCH_FIELD* childMfg = child->GetField( wxString(
"Manufacturer" ) );
79 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
83 parent->AddField( mfg );
87 parent->AddField( mpn );
89 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
96 child->SyncFieldsFromParent( options );
98 BOOST_REQUIRE( child->GetField( wxString(
"Manufacturer" ) ) );
99 BOOST_CHECK_EQUAL( child->GetField( wxString(
"Manufacturer" ) )->GetText(), wxString(
"ACME" ) );
113 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
114 parent->GetValueField().SetText(
"10k" );
116 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
123 child->SyncFieldsFromParent( options );
134 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
135 parent->GetValueField().SetText(
"10k" );
139 parent->AddField( mfg );
141 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
147 child->SyncFieldsFromParent( options );
149 BOOST_CHECK( child->GetValueField().GetText().IsEmpty() );
159 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
160 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
164 child->AddField( extra );
168 child->SyncFieldsFromParent( keep );
174 child->SyncFieldsFromParent( strip );
184 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
189 parent->AddField( mfg );
191 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
196 child->SyncFieldsFromParent( add );
198 SCH_FIELD* childMfg = child->GetField( wxString(
"Manufacturer" ) );
204 child->SyncFieldsFromParent( vis );
206 BOOST_CHECK( child->GetField( wxString(
"Manufacturer" ) )->IsVisible() );
215 std::unique_ptr<LIB_SYMBOL> root = std::make_unique<LIB_SYMBOL>(
"root" );
216 root->GetValueField().SetText(
"orig" );
222 root->SyncFieldsFromParent( options );
235 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>(
"parent" );
236 std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>(
"child", parent.get() );
238 BOOST_CHECK( !parent->CanUpdateFieldsFromParent() );
239 BOOST_CHECK( child->CanUpdateFieldsFromParent() );
virtual void SetVisible(bool aVisible)
virtual const wxString & GetText() const override
Return the string associated with the text object.
void SetText(const wxString &aText) override
Options controlling how a derived symbol's fields are reconciled with its parent.
bool m_removeExtraFields
Drop fields not present in the parent.
bool m_resetVisibility
Copy parent visibility and name-shown flags.
bool m_updateAllFields
Reconcile every field. When false only the names in m_updateFields are touched.
std::set< wxString > m_updateFields
Field names to reconcile when m_updateAllFields is false.
bool m_resetText
Copy parent text when the parent value is non-empty.
@ USER
The field ID hasn't been set yet; field is invalid.
@ VALUE
Field Value of part, i.e. "3.3K".
wxString GetCanonicalFieldName(FIELD_T aFieldType)
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_AUTO_TEST_CASE(PullsValueAndNewFieldFromParent)
A parent value change and a brand-new parent field both propagate to the derived child.
BOOST_CHECK_EQUAL(result, "25.4")