Fix SHAPE_LINE_CHAIN::Replace at end of chain

This commit is contained in:
Jon Evans 2021-08-13 16:52:11 -04:00
parent e5586fb974
commit 80355f04a9
3 changed files with 13 additions and 3 deletions

View File

@ -1057,6 +1057,12 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_ARC& aArc )
void SHAPE_LINE_CHAIN::Insert( size_t aVertex, const VECTOR2I& aP )
{
if( aVertex == m_points.size() )
{
Append( aP );
return;
}
wxCHECK( aVertex < m_points.size(), /* void */ );
if( aVertex > 0 && IsPtOnArc( aVertex ) )

View File

@ -646,7 +646,6 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadR
bool skipLocked = m_ExcludeLocked->GetValue();
int errorcount = 0;
unsigned int backstartrefdes;
size_t firstnum = 0;
m_frontFootprints.clear();

View File

@ -317,6 +317,11 @@ BOOST_AUTO_TEST_CASE( ReplaceChain )
baseChain.Replace( 1, 23, replaceChain );
BOOST_CHECK_EQUAL( baseChain.PointCount(), linePts.size() - ( 23 - 1 ) );
// Replacing the last point in a chain is special-cased
baseChain.Replace( baseChain.PointCount() - 1, baseChain.PointCount() - 1, VECTOR2I( -1, -1 ) );
BOOST_CHECK_EQUAL( baseChain.CLastPoint(), VECTOR2I( -1, -1 ) );
}