Fix SHAPE_LINE_CHAIN::Slice when end is an arc followed by a point
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9770
This commit is contained in:
parent
ade8fe4333
commit
b4342d813b
|
@ -988,7 +988,7 @@ int SHAPE_LINE_CHAIN::NextShape( int aPointIndex, bool aForwards ) const
|
|||
|
||||
if( aPointIndex == lastIndex )
|
||||
{
|
||||
if( !m_closed )
|
||||
if( !m_closed && arcIndex( aPointIndex ) == currentArcIdx )
|
||||
return -1;
|
||||
else
|
||||
return lastIndex; // Segment between last point and the start
|
||||
|
|
|
@ -393,6 +393,15 @@ BOOST_AUTO_TEST_CASE( Slice )
|
|||
BOOST_CHECK_EQUAL( sliceResult.GetPoint( 8 ), targetSegment.B );
|
||||
BOOST_CHECK_EQUAL( sliceResult.GetPoint( 9 ), secondArc.GetP0() );
|
||||
}
|
||||
|
||||
BOOST_TEST_CONTEXT( "Case 5: Chain ends in arc and point" )
|
||||
{
|
||||
SHAPE_LINE_CHAIN chainCopy = chain;
|
||||
chainCopy.Append( VECTOR2I( 400000, 400000 ) );
|
||||
|
||||
SHAPE_LINE_CHAIN sliceResult = chainCopy.Slice( 11, -1 );
|
||||
BOOST_CHECK_EQUAL( sliceResult.GetPoint( -1 ), VECTOR2I( 400000, 400000 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue