Fix some issues (but not all) in qa tests for eeschema

The main fix is for errors in SCH_TEXT and derived:
qa test expects 4 rotations is an identity transform:
This is false if the item has autoplaced fields.
The fix clears autoplaced flags.
This commit is contained in:
jean-pierre charras 2022-01-02 14:54:27 +01:00
parent 1455227447
commit 797de9d327
4 changed files with 17 additions and 7 deletions

View File

@ -59,7 +59,7 @@ void EDA_ANGLE::normalize( bool n720 )
int EDA_ANGLE::normalize( int aValue, ANGLE_TYPE aAngleType, bool n720 ) const
{
int full_circle_upper;
int full_circle_upper = DEGREES_FULL_CIRCLE;
switch( aAngleType )
{
@ -93,7 +93,7 @@ int EDA_ANGLE::normalize( int aValue, ANGLE_TYPE aAngleType, bool n720 ) const
double EDA_ANGLE::normalize( double aValue, ANGLE_TYPE aAngleType, bool n720 ) const
{
double full_circle_upper;
double full_circle_upper = DEGREES_FULL_CIRCLE;
switch( aAngleType )
{

View File

@ -765,7 +765,12 @@ wxString SCH_FIELD::GetCanonicalName() const
}
else
{
wxFAIL_MSG( "Unhandled field owner type." );
if( m_parent )
{
wxFAIL_MSG( wxString::Format( "Unhandled field owner type (id %d, parent type %d).",
m_id, m_parent->Type() ) );
}
return m_name;
}
}

View File

@ -114,7 +114,7 @@ int runDRCProto( PROJECT_CONTEXT project, std::shared_ptr<KIGFX::VIEW_OVERLAY> a
drcEngine->SetProgressReporter( new CONSOLE_PROGRESS_REPORTER ( &consoleLog ) );
drcEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer )
{
// fixme
} );

View File

@ -202,6 +202,7 @@ BOOST_AUTO_TEST_CASE( Rotate )
BOOST_TEST_CONTEXT( "Class: " << item->GetClass() )
{
// Four equivalent 90 degree rotations are an identity.
// (warning: only for items having no autoplaced fields).
if( item->GetClass() == "SCH_SHEET_PIN" )
{
@ -212,6 +213,7 @@ BOOST_AUTO_TEST_CASE( Rotate )
if( schItem != nullptr )
{
schItem->ClearFieldsAutoplaced();
// Only rotating pins around the center of parent sheet works.
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
@ -286,10 +288,11 @@ BOOST_AUTO_TEST_CASE( MirrorHorizontally )
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
// Two mirrorings are an identity.
// Two mirrorings are an identity
// (warning: only for text items having no autoplaced fields).
if( schItem != nullptr )
{
schItem->ClearFieldsAutoplaced();
schItem->MirrorHorizontally( aRef.x );
schItem->MirrorHorizontally( aRef.x );
}
@ -329,10 +332,12 @@ BOOST_AUTO_TEST_CASE( MirrorVertically )
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
// Two mirrorings are an identity.
// Two mirrorings are an identity
// (warning only for text items having no autoplaced fields).
if( schItem != nullptr )
{
schItem->ClearFieldsAutoplaced();
schItem->MirrorVertically( aRef.y );
schItem->MirrorVertically( aRef.y );
}