24#include <boost/test/unit_test.hpp>
35ITEM_CHANGE MakeChange(
const wxString& aType,
CHANGE_KIND aKind, std::optional<wxString> aRefdes = std::nullopt )
41 c.
refdes = std::move( aRefdes );
46std::array<bool, CATEGORY_COUNT> AllVisible()
48 std::array<bool, CATEGORY_COUNT> out{};
125 BOOST_CHECK( groups.empty() );
137 BOOST_REQUIRE_EQUAL( groups.size(), 2u );
155 diff.
changes.push_back( std::move( fp ) );
158 BOOST_REQUIRE_EQUAL( groups.size(), 2u );
179 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
180 BOOST_REQUIRE_EQUAL( groups[0].entries.size(), 2u );
181 BOOST_CHECK( groups[0].entries[0].itemLabel == wxS(
"NET [GND]" ) );
182 BOOST_CHECK( groups[0].entries[1].itemLabel == wxS(
"NET [Net-(U1-Pad1)]" ) );
192 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
193 BOOST_REQUIRE_EQUAL( groups[0].entries.size(), 1u );
194 BOOST_CHECK( groups[0].entries[0].itemLabel == wxS(
"FOOTPRINT [U7]" ) );
204 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
205 BOOST_CHECK( groups[0].entries[0].itemLabel == wxS(
"ZONE" ) );
216 std::array<bool, CATEGORY_COUNT> visible{};
217 visible.fill(
true );
218 visible[
static_cast<std::size_t
>( CATEGORY::ADDED )] =
false;
221 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
234 std::array<bool, CATEGORY_COUNT> visible{};
235 visible.fill(
true );
236 visible[
static_cast<std::size_t
>( CATEGORY::CONFLICT )] =
false;
239 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
253 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
254 BOOST_REQUIRE_EQUAL( groups[0].entries.size(), 1u );
255 BOOST_CHECK( groups[0].entries[0].change->typeName == wxS(
"PCB_TRACK" ) );
269 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
282 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
284 BOOST_CHECK( groups[0].groupLabel.EndsWith( wxS(
"(3)" ) ) );
297 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
298 BOOST_CHECK( groups[0].groupLabel.EndsWith( wxS(
"(1/3)" ) ) );
311 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
312 BOOST_CHECK( groups[0].groupLabel.EndsWith( wxS(
"(2)" ) ) );
325 BOOST_REQUIRE_EQUAL( groups.size(), 1u );
CHANGE_KIND
Coarse classification of a single item-level change between two documents.
bool ChangeMatchesSearchFilter(const ITEM_CHANGE &aChange, const wxString &aLowercaseFilter)
Predicate: does this item change match the active search filter?
std::vector< CHANGE_TREE_GROUP > BuildChangeTreeGroups(const DOCUMENT_DIFF &aDiff, const wxString &aSearchFilter, const std::array< bool, CATEGORY_COUNT > &aVisibleCategories)
Group the changes in a DOCUMENT_DIFF by kind, apply category and search filters, and return the resul...
wxString ChangeKindLabel(CHANGE_KIND aKind)
Human-readable label for a CHANGE_KIND (e.g.
_OUT_STRING AsString(const std::string &aString)
The full set of changes between two parsed documents of one type.
std::vector< ITEM_CHANGE > changes
One change record on a single item.
std::optional< wxString > refdes
std::vector< ITEM_CHANGE > children
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(ChangeKindLabel_AllKinds)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")