74 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
75 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
82 BOOST_CHECK( plan.
actions.empty() );
84 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
85 std::unique_ptr<BOARD> merged = applier.
Apply();
90 m_ancestor->GetItemSet().size() );
100 m_ancestor->GetProject()->GetProjectFile().m_BoardDrawingSheetFile = wxS(
"ancestor.kicad_wks" );
101 m_ours->GetProject()->GetProjectFile().m_BoardDrawingSheetFile = wxS(
"ours.kicad_wks" );
102 m_theirs->GetProject()->GetProjectFile().m_BoardDrawingSheetFile = wxS(
"ancestor.kicad_wks" );
107 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
108 std::unique_ptr<BOARD> merged = applier.
Apply();
129 victim =
static_cast<PCB_TRACK*
>( item );
139 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
140 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
145 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
146 std::unique_ptr<BOARD> merged = applier.
Apply();
152 for(
BOARD_ITEM* item : merged->GetItemSet() )
154 if( item && item->m_Uuid == victimUuid )
161 BOOST_CHECK( found );
174 subject =
static_cast<PCB_TRACK*
>( item );
180 int originalWidth = subject->
GetWidth();
181 int newWidth = originalWidth + 75000;
185 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
186 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
191 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
192 std::unique_ptr<BOARD> merged = applier.
Apply();
198 for(
BOARD_ITEM* item : merged->GetItemSet() )
200 if( item && item->m_Uuid == subjectUuid && item->Type() ==
PCB_TRACE_T )
208 BOOST_CHECK( found );
218 for(
BOARD_ITEM* item : m_ours->GetItemSet() )
232 for(
BOARD_ITEM* item : m_theirs->GetItemSet() )
234 if( item && item->m_Uuid == victimUuid )
248 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
249 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
254 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
255 std::unique_ptr<BOARD> merged = applier.
Apply();
259 for(
BOARD_ITEM* item : merged->GetItemSet() )
261 BOOST_CHECK( !item || item->m_Uuid != victimUuid );
270 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
271 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
276 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
277 std::unique_ptr<BOARD> merged = applier.
Apply();
292 ZONE* victim =
nullptr;
294 for(
BOARD_ITEM* item : m_theirs->GetItemSet() )
298 victim =
static_cast<ZONE*
>( item );
317 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
318 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
322 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
323 std::unique_ptr<BOARD> merged = applier.
Apply();
328 for(
BOARD_ITEM* item : merged->GetItemSet() )
330 if( item && item->m_Uuid == subjectUuid && item->Type() ==
PCB_ZONE_T )
332 ZONE* z =
static_cast<ZONE*
>( item );
340 BOOST_CHECK( found );
354 for(
BOARD_ITEM* item : m_ours->GetItemSet() )
358 subject =
static_cast<PCB_TRACK*
>( item );
364 int oursWidth = subject->
GetWidth() + 50000;
365 int theirsWidth = subject->
GetWidth() + 75000;
373 for(
BOARD_ITEM* item : m_theirs->GetItemSet() )
375 if( item && item->m_Uuid == subjectUuid && item->Type() ==
PCB_TRACE_T )
382 PCB_DIFFER ourDiffer( m_ancestor.get(), m_ours.get() );
383 PCB_DIFFER theirDiffer( m_ancestor.get(), m_theirs.get() );
387 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
388 std::unique_ptr<BOARD> merged = applier.
Apply();
395 for(
BOARD_ITEM* item : merged->GetItemSet() )
397 if( item && item->m_Uuid == subjectUuid && item->Type() ==
PCB_TRACE_T )
399 int mergedWidth =
static_cast<PCB_TRACK*
>( item )->GetWidth();
400 BOOST_CHECK( mergedWidth == oursWidth || mergedWidth == theirsWidth );
417 for(
BOARD_ITEM* item : aBoard->GetItemSet() )
426 PCB_TRACK* ancTrack = firstTrack( m_ancestor.get() );
433 for(
BOARD_ITEM* item : aBoard->GetItemSet() )
435 if( item && item->Type() ==
PCB_TRACE_T && item->m_Uuid == subjectUuid )
442 PCB_TRACK* oursTrack = trackByUuid( m_ours.get() );
443 PCB_TRACK* theirsTrack = trackByUuid( m_theirs.get() );
449 const int oursWidth = ancTrack->
GetWidth() + 11000;
450 const int theirsStart = ancTrack->
GetStartX() + 22000;
451 const int ancEndX = ancTrack->
GetEndX();
452 const int customEndY = ancTrack->
GetEndY() + 33000;
462 action.
id.push_back( subjectUuid );
465 auto addProp = [&](
const wxString& aName,
PROP_RES aKind )
478 customRes.
name = wxS(
"End Y" );
481 action.
props.push_back( customRes );
486 plan.
actions.push_back( action );
488 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
489 std::unique_ptr<BOARD> merged = applier.
Apply();
494 for(
BOARD_ITEM* item : merged->GetItemSet() )
496 if( item && item->Type() ==
PCB_TRACE_T && item->m_Uuid == subjectUuid )
498 mergedTrack =
static_cast<PCB_TRACK*
>( item );
531 for(
FOOTPRINT* candidate : m_ours->Footprints() )
536 for(
PAD* candidatePad : candidate->Pads() )
538 if( candidatePad && candidatePad->IsOnCopperLayer() )
554 const KIID padUuid =
pad->m_Uuid;
557 const wxString oursPadNumber = wxS(
"QA_CHILD_RESOLVE" );
558 pad->SetNumber( oursPadNumber );
563 action.
id.push_back( fpUuid );
564 action.
id.push_back( padUuid );
568 numberRes.
name = wxS(
"Pad Number" );
570 action.
props.push_back( numberRes );
573 plan.
actions.push_back( action );
575 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
576 std::unique_ptr<BOARD> merged = applier.
Apply();
582 PAD* mergedPad =
nullptr;
584 for(
FOOTPRINT* mergedFp : merged->Footprints() )
586 if( !mergedFp || mergedFp->m_Uuid != fpUuid )
589 for(
PAD* candidate : mergedFp->Pads() )
591 if( candidate->m_Uuid == padUuid )
593 mergedPad = candidate;
613 PAD* victimPad =
nullptr;
615 for(
FOOTPRINT* candidate : m_ancestor->Footprints() )
617 if( candidate && !candidate->Pads().empty() )
620 victimPad = candidate->Pads().front();
637 action.
id.push_back( fpUuid );
638 action.
id.push_back( padUuid );
642 plan.
actions.push_back( action );
644 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
645 std::unique_ptr<BOARD> merged = applier.
Apply();
650 for(
FOOTPRINT* mergedFp : merged->Footprints() )
652 if( !mergedFp || mergedFp->m_Uuid != fpUuid )
655 for(
PAD*
pad : mergedFp->Pads() )
657 if(
pad &&
pad->m_Uuid == padUuid )
662 BOOST_CHECK( found );
675 for(
FOOTPRINT* candidate : m_ours->Footprints() )
680 for(
PAD* candidatePad : candidate->Pads() )
682 if( candidatePad && candidatePad->IsOnCopperLayer() )
698 const KIID padUuid =
pad->m_Uuid;
699 const wxString oursPadNumber = wxS(
"QA_CHILD_TAKE_OURS" );
700 pad->SetNumber( oursPadNumber );
703 action.
id.push_back( fpUuid );
704 action.
id.push_back( padUuid );
708 plan.
actions.push_back( action );
710 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
711 std::unique_ptr<BOARD> merged = applier.
Apply();
714 PAD* mergedPad =
nullptr;
716 for(
FOOTPRINT* mergedFp : merged->Footprints() )
718 if( !mergedFp || mergedFp->m_Uuid != fpUuid )
721 for(
PAD* candidate : mergedFp->Pads() )
723 if( candidate && candidate->m_Uuid == padUuid )
725 mergedPad = candidate;
744 PAD* victimPad =
nullptr;
746 for(
FOOTPRINT* candidate : m_ancestor->Footprints() )
748 if( candidate && !candidate->Pads().empty() )
751 victimPad = candidate->Pads().front();
763 action.
id.push_back( fpUuid );
764 action.
id.push_back( padUuid );
768 plan.
actions.push_back( action );
770 PCB_MERGE_APPLIER applier( m_ancestor.get(), m_ours.get(), m_theirs.get(), plan );
771 std::unique_ptr<BOARD> merged = applier.
Apply();
774 for(
FOOTPRINT* mergedFp : merged->Footprints() )
776 if( !mergedFp || mergedFp->m_Uuid != fpUuid )
779 for(
PAD*
pad : mergedFp->Pads() )
780 BOOST_CHECK( !
pad ||
pad->m_Uuid != padUuid );
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
static DIFF_VALUE FromInt(int aValue)
Three-way merge plan generator.
MERGE_PLAN Plan(const DOCUMENT_DIFF &aAncestorOurs, const DOCUMENT_DIFF &aAncestorTheirs) const
Plan the merge given the canonical pair of diffs.
Diff two already-parsed BOARDs and produce a DOCUMENT_DIFF.
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
Materialize a MERGE_PLAN into a real merged BOARD.
std::unique_ptr< BOARD > Apply()
Produce the merged board.
const REPORT & GetReport() const
const wxString & GetNumber() const
virtual void SetWidth(int aWidth)
virtual int GetWidth() const
Handle a list of polygons defining a copper zone.
bool GetDoNotAllowTracks() const
void SetDoNotAllowTracks(bool aEnable)
void SetAssignedPriority(unsigned aPriority)
unsigned GetAssignedPriority() const
PROP_RES
Resolution kind for a single property of a single item.
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
The full set of changes between two parsed documents of one type.
std::vector< PROPERTY_RESOLUTION > props
Result of planning a 3-way merge.
bool requiresConnectivityRebuild
std::vector< ITEM_RESOLUTION > actions
std::size_t propertiesFailed
std::size_t propertiesApplied
bool drcSeveritiesTouched
bool projectFileTouched
True iff the applier resolved state that lives in the .kicad_pro or a project sibling file.
std::size_t itemsTakenOurs
bool requiresConnectivityRebuild
wxString drawingSheetFile
Drawing sheet path the applier resolved (from a doc-level resolution).
Three-board fixture: ancestor, ours, theirs all start from the same fixture load.
std::unique_ptr< BOARD > m_ours
std::unique_ptr< BOARD > m_ancestor
std::unique_ptr< BOARD > m_theirs
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(IdenticalInputsProduceIdenticalOutput)
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)