Migrate Altium pcblib test to BOOST_DATA_TEST_CASE and use FootprintNeedsUpdate for equality checking
This commit is contained in:
parent
21b6b5efbb
commit
a44c106f62
|
@ -319,6 +319,10 @@ void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp )
|
|||
}
|
||||
|
||||
// TODO: Groups
|
||||
|
||||
// Use FootprintNeedsUpdate as sanity check (which should do the same thing as our manually coded checks)
|
||||
// If we get the reporter working, and COMPARE_FLAGS::DRC is enough for us, we can remove the old code
|
||||
BOOST_CHECK( !const_cast<FOOTPRINT*>(expected)->FootprintNeedsUpdate(fp, BOARD_ITEM::COMPARE_FLAGS::DRC, nullptr) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
#include <pcbnew_utils/board_test_utils.h>
|
||||
#include <pcbnew_utils/board_file_utils.h>
|
||||
#include <qa_utils/wx_utils/unit_test_utils.h>
|
||||
#include <boost/test/data/test_case.hpp>
|
||||
|
||||
#include <pcbnew/pcb_io/altium/pcb_io_altium_designer.h>
|
||||
#include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
|
||||
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <zone.h>
|
||||
|
@ -52,26 +54,24 @@ struct ALTIUM_PCBLIB_IMPORT_FIXTURE
|
|||
*/
|
||||
BOOST_FIXTURE_TEST_SUITE( AltiumPcbLibImport, ALTIUM_PCBLIB_IMPORT_FIXTURE )
|
||||
|
||||
static const std::vector<std::tuple<wxString, wxString>> altium_to_kicad_footprint_property = {
|
||||
{ "Tracks.v5.PcbLib", "Tracks.pretty" },
|
||||
{ "Tracks.v6.PcbLib", "Tracks.pretty" },
|
||||
{ "Espressif ESP32-WROOM-32.PcbLib", "Espressif ESP32-WROOM-32.pretty" }
|
||||
};
|
||||
|
||||
/**
|
||||
* Compare all footprints declared in a *.PcbLib file with their KiCad reference footprint
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
|
||||
BOOST_DATA_TEST_CASE( AltiumPcbLibImport2,
|
||||
boost::unit_test::data::make(altium_to_kicad_footprint_property),
|
||||
altiumLibraryName,
|
||||
kicadLibraryName )
|
||||
{
|
||||
// clang-format off
|
||||
std::vector<std::pair<wxString, wxString>> tests = {
|
||||
{ "Tracks.v5.PcbLib", "Tracks.pretty" },
|
||||
{ "Tracks.v6.PcbLib", "Tracks.pretty" },
|
||||
{ "Espressif ESP32-WROOM-32.PcbLib", "Espressif ESP32-WROOM-32.pretty" }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
std::string dataPath = KI_TEST::GetPcbnewTestDataDir() + "plugins/altium/pcblib/";
|
||||
|
||||
for( const std::pair<wxString, wxString>& libName : tests )
|
||||
{
|
||||
wxString altiumLibraryPath = dataPath + libName.first;
|
||||
wxString kicadLibraryPath = dataPath + libName.second;
|
||||
wxString altiumLibraryPath = dataPath + altiumLibraryName;
|
||||
wxString kicadLibraryPath = dataPath + kicadLibraryName;
|
||||
|
||||
wxArrayString altiumFootprintNames;
|
||||
wxArrayString kicadFootprintNames;
|
||||
|
@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
|
|||
wxString footprintName = altiumFootprintNames[i];
|
||||
|
||||
BOOST_TEST_CONTEXT( wxString::Format( wxT( "Import '%s' from '%s'" ), footprintName,
|
||||
libName.first ) )
|
||||
altiumLibraryName ) )
|
||||
{
|
||||
FOOTPRINT* altiumFp = altiumPlugin.FootprintLoad( altiumLibraryPath, footprintName,
|
||||
false, nullptr );
|
||||
|
@ -102,8 +102,6 @@ BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
|
|||
KI_TEST::CheckFootprint( kicadFp, altiumFp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
Loading…
Reference in New Issue