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" );
60 const wxString target = wxS(
"KiCad 10.0" );
64 BOOST_CHECK(
text.Contains( wxS(
"\nApproximate: 5\n Ellipses (5)\n Converted to polygons.\n" ) ) );
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" ) ) );
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" ) ) );
101 wxString
text = report.
ToText( wxS(
"KiCad 9.0" ) );
104 BOOST_CHECK(
text.Contains( wxS(
"\nDrop: 2\n Barcodes (2)\n Omitted by the selected export policy.\n" ) ) );
113 const wxString feature = wxString::FromUTF8(
"Réglages Ω" );
114 const wxString
detail = wxString::FromUTF8(
"日本語\nSecond line: 50%" );
117 const wxString target = wxS(
"Target 100%" );
129 wxString
path = wxString::FromUTF8( ( dir.
Path() /
"report.txt" ).string() );
133 for(
const wxString& target : { wxS(
"KiCad 9.0" ), wxS(
"KiCad 10.0" ) } )
136 wxScopedCharBuffer
utf8 =
text.ToUTF8();
142 wxFFile file(
path, wxS(
"rb" ) );
151 std::distance( std::filesystem::directory_iterator( dir.
Path() ), 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
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
@ 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.
std::string utf8(const wxString &aText)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(TextReportIncludesTargetAndAllActions)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()