21#include <boost/test/unit_test.hpp>
26#include <google/protobuf/any.pb.h>
28#include <api/board/board_types.pb.h>
49template<
typename ProtoClass,
typename KiCadClass,
typename ParentClass>
52 BOOST_TEST_CONTEXT( aInput->GetFriendlyName() <<
": " << aInput->m_Uuid.AsStdString() )
54 google::protobuf::Any
any;
55 BOOST_REQUIRE_NO_THROW( aInput->Serialize(
any ) );
60 BOOST_REQUIRE_MESSAGE(
any.UnpackTo( &proto ),
61 "Any message did not unpack into the requested type" );
63 std::unique_ptr<KiCadClass> output;
66 output = std::make_unique<KiCadClass>( aParent );
68 output = std::make_unique<KiCadClass>( *
static_cast<KiCadClass*
>( aInput->Clone() ) );
70 bool deserializeResult =
false;
71 BOOST_REQUIRE_NO_THROW( deserializeResult = output->Deserialize(
any ) );
72 BOOST_REQUIRE_MESSAGE( deserializeResult,
"Deserialize failed" );
75 google::protobuf::Any outputAny;
76 BOOST_REQUIRE_NO_THROW( output->Serialize( outputAny ) );
79 if( !( outputAny.SerializeAsString() ==
any.SerializeAsString() ) )
81 BOOST_TEST_FAIL(
"Round-tripped protobuf does not match" );
85 if( !( *output == *aInput ) )
87 BOOST_TEST_FAIL(
"Round-tripped object does not match" );
97 for(
PCB_TRACK* track : m_board->Tracks() )
99 switch( track->Type() )
115 m_board.get(),
false );
123 for(
FOOTPRINT* footprint : m_board->Footprints() )
126 for(
ZONE* zone : m_board->Zones() )
131 switch( item->Type() )
173 for(
PCB_TRACK* track : m_board->Tracks() )
175 switch( track->Type() )
182 m_board.get(),
false );
190 for(
FOOTPRINT* footprint : m_board->Footprints() )
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
For better understanding of the points that make a dimension:
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
A radial dimension indicates either the radius or diameter of an arc or circle.
Handle a list of polygons defining a copper zone.
A type-safe container of any type.
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
void testProtoFromKiCadObject(KiCadClass *aInput, ParentClass *aParent, bool aStrict=true)
BOOST_FIXTURE_TEST_CASE(BoardTypes, PROTO_TEST_FIXTURE)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension