mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Pcbnew: negative layers are not copper layers, even or not
UNDEFINED_LAYER is -2, so simple checking evenness isn't enough to check if it's copper or not. Notciable when the FABMASTER import puts things on UNDEFINED_LAYER while it's processing items.
This commit is contained in:
parent
a3f239ce5e
commit
ed9e66399e
@ -243,7 +243,7 @@ enum GAL_LAYER_ID: int
|
||||
LAYER_SHAPES = GAL_LAYER_ID_START + 41, ///< Copper graphic shape opacity/visibility (color ignored)
|
||||
|
||||
LAYER_DRC_SHAPE1 = GAL_LAYER_ID_START + 42, ///< Custom shape for DRC marker
|
||||
LAYER_DRC_SHAPE2 = GAL_LAYER_ID_START + 43, ///< Custom shape for DRC marker
|
||||
LAYER_DRC_SHAPE2 = GAL_LAYER_ID_START + 43, ///< Custom shape for DRC marker
|
||||
// Add layers below this point that do not have visibility controls, so don't need explicit
|
||||
// enum values
|
||||
|
||||
@ -530,7 +530,7 @@ inline bool IsPcbLayer( int aLayer )
|
||||
*/
|
||||
inline bool IsCopperLayer( int aLayerId )
|
||||
{
|
||||
return !( aLayerId & 1 ) && aLayerId <= PCB_LAYER_ID_COUNT;
|
||||
return !( aLayerId & 1 ) && aLayerId <= PCB_LAYER_ID_COUNT && aLayerId >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,5 +43,15 @@ BOOST_AUTO_TEST_CASE( LseqTestLayers )
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
BOOST_AUTO_TEST_CASE( CopperLayers )
|
||||
{
|
||||
BOOST_TEST( IsCopperLayer( PCB_LAYER_ID::F_Cu ) );
|
||||
BOOST_TEST( IsCopperLayer( PCB_LAYER_ID::B_Cu ) );
|
||||
BOOST_TEST( IsCopperLayer( PCB_LAYER_ID::In1_Cu ) );
|
||||
BOOST_TEST( !IsCopperLayer( PCB_LAYER_ID::UNSELECTED_LAYER ) );
|
||||
BOOST_TEST( !IsCopperLayer( PCB_LAYER_ID::UNDEFINED_LAYER ) );
|
||||
BOOST_TEST( !IsCopperLayer( PCB_LAYER_ID::F_SilkS ) );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user