21#include <boost/test/unit_test.hpp>
26#include <api/schematic/schematic_types.pb.h>
43#include <wx/filename.h>
54 for(
SCH_ITEM* item : m_schematic->RootScreen()->Items() )
56 switch( item->Type() )
63 return std::make_unique<SCH_JUNCTION>();
72 return std::make_unique<SCH_NO_CONNECT>();
81 return std::make_unique<SCH_BUS_WIRE_ENTRY>();
90 return std::make_unique<SCH_BUS_BUS_ENTRY>();
99 return std::make_unique<SCH_LINE>();
108 return std::make_unique<SCH_SHAPE>();
117 return std::make_unique<SCH_BITMAP>();
126 return std::make_unique<SCH_TEXT>();
135 return std::make_unique<SCH_TEXTBOX>();
144 return std::make_unique<SCH_LABEL>();
153 return std::make_unique<SCH_GLOBALLABEL>();
162 return std::make_unique<SCH_HIERLABEL>();
171 return std::make_unique<SCH_DIRECTIVE_LABEL>();
180 return std::make_unique<SCH_GROUP>( m_schematic->RootScreen() );
189 return std::make_unique<SCH_SHEET>( m_schematic->RootScreen() );
200 kiapi::schematic::types::SchematicSymbolInstance symbolProto;
202 BOOST_REQUIRE_MESSAGE(
result,
"Serialization failed" );
204 std::unique_ptr<SCH_SYMBOL>
output = std::make_unique<SCH_SYMBOL>();
207 BOOST_REQUIRE_MESSAGE(
result,
"Deserialization failed" );
209 kiapi::schematic::types::SchematicSymbolInstance outputProto;
211 BOOST_REQUIRE_MESSAGE(
result,
"Second serialization failed" );
213 if( !( outputProto.SerializeAsString() == symbolProto.SerializeAsString() ) )
217 BOOST_TEST_FAIL(
"Round-tripped protobuf does not match" );
220 if( !
output->operator==( *symbol ) )
221 BOOST_TEST_FAIL(
"Round-tripped object does not match" );
bool PackSymbol(kiapi::schematic::types::SchematicSymbolInstance *aOutput, const SCH_SYMBOL *aInput, const SCH_SHEET_PATH &aPath)
bool UnpackSymbol(SCH_SYMBOL *aOutput, const kiapi::schematic::types::SchematicSymbolInstance &aInput)
void testProtoFromKiCadObject(KiCadClass *aInput, Factory &&aCreateOutput)
std::string AsStdString() const
A generic fixture for loading schematics and associated settings for qa tests.
Object to handle a bitmap image that can be inserted in a schematic.
Class for a bus to bus entry.
Class for a wire to bus entry.
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
Segment description base class to describe items which have 2 end points (track, wire,...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
Class to handle a set of SCH_ITEMs.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_TEST_CONTEXT("Test Clearance")
wxString result
Test unit parsing edge cases and error handling.