34#include <nlohmann/json.hpp>
36#include <wx/filename.h>
50 fn.AppendDir( wxS(
"libraries" ) );
51 fn.AppendDir( wxS(
"Resistor_SMD.pretty" ) );
63 FP_LIB_DIFFER differ( mapA, mapB, wxS(
"Resistor_SMD.pretty" ) );
66 BOOST_CHECK(
result.Empty() );
77 mapB.erase( mapB.begin() );
82 BOOST_REQUIRE_EQUAL(
result.changes.size(), 1u );
93 FOOTPRINT* subject = ownersB.front().get();
99 BOOST_REQUIRE_EQUAL(
result.changes.size(), 1u );
101 BOOST_CHECK_GT(
result.changes[0].bbox.GetWidth(), 0 );
102 BOOST_CHECK_GT(
result.changes[0].bbox.GetHeight(), 0 );
114 BOOST_CHECK( !geometry.
Empty() );
125 mapB.erase( mapB.begin() );
130 nlohmann::json j =
result.ToJson();
144 BOOST_REQUIRE_EQUAL( a.size(), 1u );
145 BOOST_REQUIRE_EQUAL( b.size(), 1u );
146 BOOST_CHECK( a == b );
155 BOOST_CHECK( !( a == b ) );
166 BOOST_REQUIRE_GE( mapB.size(), 3u );
168 std::vector<wxString> victims;
170 for(
int i = 0; i < 3 && !mapB.empty(); ++i )
172 victims.push_back( mapB.begin()->first );
173 mapB.erase( mapB.begin() );
197 BOOST_REQUIRE_GE( mapB1.size(), 2u );
199 mapB1.erase( mapB1.begin() );
200 mapB2.erase( mapB2.begin() );
General utilities for PCB file IO for QA programs.
Diff two .pretty footprint library directories.
static std::pair< std::vector< std::unique_ptr< FOOTPRINT > >, FOOTPRINT_MAP > LoadLibrary(const wxString &aPrettyPath)
Load a .pretty directory into a FOOTPRINT_MAP.
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
A color representation with 4 components: red, green, blue, alpha.
A type-safe container of any type.
LSET GeometryLayerSet(const DOCUMENT_GEOMETRY &aGeometry)
Return the union of every non-empty layer set carried by the geometry.
KIID_PATH LibraryItemKiidPath(const wxString &aName)
Build a deterministic synthetic KIID_PATH from a library item name (symbol name or footprint name).
DOCUMENT_GEOMETRY ExtractFootprintGeometry(const FOOTPRINT &aFootprint, const KIGFX::COLOR4D &aColor)
Extract drawable context geometry from a single FOOTPRINT.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
The full set of changes between two parsed documents of one type.
nlohmann::json ToJson() const
static DOCUMENT_DIFF FromJson(const nlohmann::json &aJson)
std::vector< ITEM_CHANGE > changes
Aggregate of background geometry extracted from one source document.
One change record on a single item.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static wxString getFixturePath()
BOOST_AUTO_TEST_CASE(IdenticalLibrariesDiffEmpty)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static wxString getFixturePath()
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I