8#include <boost/test/unit_test.hpp>
36 const wxString expectedSections = wxS(
"\nKeep: 4\n"
37 " Supported setting (4)\n"
38 " Written unchanged.\n"
41 " Converted to polygons.\n"
44 " Chain constraints are omitted.\n"
45 "\nCannot export: 1\n"
47 " Cannot represent this notation.\n" );
49 const wxString target = wxS(
"KiCad 9.0" );
65 const wxString target = wxS(
"KiCad 10.0" );
69 BOOST_CHECK(
text.Contains( wxS(
"\nApproximate: 5\n Ellipses (5)\n Converted to polygons.\n" ) ) );
80 wxString
text = report.
ToText( wxS(
"KiCad 9.0" ) );
82 BOOST_CHECK(
text.Contains( wxS(
"\nKeep: 0\n\nApproximate: 0\n\nDrop: 0\n\nCannot export: 0\n" ) ) );
93 wxString
text = report.
ToText( wxS(
"KiCad 10.0" ) );
95 BOOST_CHECK(
text.Contains( wxS(
"\nKeep: 1\n Supported setting (1)\n\nApproximate: 0\n" ) ) );
106 wxString
text = report.
ToText( wxS(
"KiCad 9.0" ) );
109 BOOST_CHECK(
text.Contains( wxS(
"\nDrop: 2\n Barcodes (2)\n Omitted by the selected export policy.\n" ) ) );
118 const wxString feature = wxString::FromUTF8(
"Réglages Ω" );
119 const wxString
detail = wxString::FromUTF8(
"日本語\nSecond line: 50%" );
122 const wxString target = wxS(
"Target 100%" );
134 wxString
path = wxString::FromUTF8( ( dir.
Path() /
"report.txt" ).string() );
138 for(
const wxString& target : { wxS(
"KiCad 9.0" ), wxS(
"KiCad 10.0" ) } )
141 wxScopedCharBuffer
utf8 =
text.ToUTF8();
147 wxFFile file(
path, wxS(
"rb" ) );
156 std::distance( std::filesystem::directory_iterator( dir.
Path() ), std::filesystem::directory_iterator() ),
174 std::optional<int> value = aSettings.Get<
int>(
"meta.version" );
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
COMPONENT_CLASS_SETTINGS stores data for component classes, including rules for automatic generation ...
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
NET_SETTINGS stores various net-related settings in a project context.
The backing store for a PROJECT, in JSON format.
TUNING_PROFILES stores the configuration for impedance / delay tuning profiles.
@ 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)
The settings schemas the project downgrade rules were written against.
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()