8#include <boost/test/unit_test.hpp>
31 const wxString expectedSections = wxS(
"\nKeep: 4\n"
32 " Supported setting (4)\n"
33 " Written unchanged.\n"
36 " Converted to polygons.\n"
39 " Chain constraints are omitted.\n"
40 "\nCannot export: 1\n"
42 " Cannot represent this notation.\n" );
44 const wxString target = wxS(
"KiCad 9.0" );
47 BOOST_CHECK(
text.Contains( target + wxS(
"\n\n" ) ) );
48 BOOST_CHECK(
text.Contains( expectedSections ) );
50 BOOST_CHECK( report.
IsLossy() );
60 const wxString target = wxS(
"KiCad 10.0" );
63 BOOST_CHECK(
text.Contains( target + wxS(
"\n\n" ) ) );
64 BOOST_CHECK(
text.Contains( wxS(
"\nApproximate: 5\n Ellipses (5)\n Converted to polygons.\n" ) ) );
65 BOOST_CHECK( report.
IsLossy() );
67 BOOST_REQUIRE_EQUAL( report.
Entries().size(), 1 );
75 wxString
text = report.
ToText( wxS(
"KiCad 9.0" ) );
77 BOOST_CHECK(
text.Contains( wxS(
"\nKeep: 0\n\nApproximate: 0\n\nDrop: 0\n\nCannot export: 0\n" ) ) );
78 BOOST_CHECK( !report.
IsLossy() );
88 wxString
text = report.
ToText( wxS(
"KiCad 10.0" ) );
90 BOOST_CHECK(
text.Contains( wxS(
"\nKeep: 1\n Supported setting (1)\n\nApproximate: 0\n" ) ) );
91 BOOST_CHECK( !report.
IsLossy() );
101 wxString
text = report.
ToText( wxS(
"KiCad 9.0" ) );
103 BOOST_CHECK(
text.Contains( wxS(
"\nApproximate: 0\n" ) ) );
104 BOOST_CHECK(
text.Contains( wxS(
"\nDrop: 2\n Barcodes (2)\n Omitted by the selected export policy.\n" ) ) );
105 BOOST_CHECK( report.
IsLossy() );
113 const wxString feature = wxString::FromUTF8(
"Réglages Ω" );
114 const wxString
detail = wxString::FromUTF8(
"日本語\nSecond line: 50%" );
117 const wxString target = wxS(
"Target 100%" );
120 BOOST_CHECK(
text.Contains( target + wxS(
"\n\n" ) ) );
121 BOOST_CHECK(
text.Contains( feature ) );
129 wxString
path = wxString::FromUTF8( ( dir.
GetPath() /
"report.txt" ).string() );
133 for(
const wxString& target : { wxS(
"KiCad 9.0" ), wxS(
"KiCad 10.0" ) } )
136 wxScopedCharBuffer utf8 =
text.ToUTF8();
140 BOOST_CHECK( error.IsEmpty() );
142 wxFFile file(
path, wxS(
"rb" ) );
151 std::filesystem::directory_iterator() ),
What an export to a given target will keep, approximate, drop, or block.
wxString ToText(const wxString &aTargetName) const
A readable preview of the classified export, including counts and feature details.
void Add(DOWNGRADE_BUCKET aBucket, const wxString &aFeature, const wxString &aDetail=wxEmptyString, int aCount=1)
bool IsLossy() const
True if anything is approximated or dropped. This is what triggers the lossy warning.
bool IsBlocked() const
True if some feature makes the target impossible. The user cannot export anyway.
int Count(DOWNGRADE_BUCKET aBucket) const
const std::vector< COMPAT_ENTRY > & Entries() const
A temporary directory deleted when it goes out of scope.
const std::filesystem::path & GetPath() const
@ BLOCK
Cannot be represented at all, export to this target is not possible.
@ KEEP
Exists in the target, written unchanged.
@ LOWER
Approximated down to a simpler equivalent.
@ DROP
No equivalent, left out.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(TextReportIncludesTargetAndAllActions)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")