21#include <boost/test/unit_test.hpp>
26#include <google/protobuf/any.pb.h>
28#include <api/board/board_types.pb.h>
50template<
typename ProtoClass,
typename KiCadClass,
typename ParentClass>
53 BOOST_TEST_CONTEXT( aInput->GetFriendlyName() <<
": " << aInput->m_Uuid.AsStdString() )
55 google::protobuf::Any
any;
56 BOOST_REQUIRE_NO_THROW( aInput->Serialize(
any ) );
61 BOOST_REQUIRE_MESSAGE(
any.UnpackTo( &proto ),
62 "Any message did not unpack into the requested type" );
64 std::unique_ptr<KiCadClass> output;
67 output = std::make_unique<KiCadClass>( aParent );
69 output = std::make_unique<KiCadClass>( *
static_cast<KiCadClass*
>( aInput->Clone() ) );
71 bool deserializeResult =
false;
72 BOOST_REQUIRE_NO_THROW( deserializeResult = output->Deserialize(
any ) );
73 BOOST_REQUIRE_MESSAGE( deserializeResult,
"Deserialize failed" );
76 google::protobuf::Any outputAny;
77 BOOST_REQUIRE_NO_THROW( output->Serialize( outputAny ) );
80 if( !( outputAny.SerializeAsString() ==
any.SerializeAsString() ) )
82 BOOST_TEST_FAIL(
"Round-tripped protobuf does not match" );
86 if( !( *output == *aInput ) )
88 BOOST_TEST_FAIL(
"Round-tripped object does not match" );
98 for(
PCB_TRACK* track : m_board->Tracks() )
100 switch( track->Type() )
116 m_board.get(),
false );
124 for(
FOOTPRINT* footprint : m_board->Footprints() )
127 for(
ZONE* zone : m_board->Zones() )
132 switch( item->Type() )
174 for(
PCB_TRACK* track : m_board->Tracks() )
176 switch( track->Type() )
183 m_board.get(),
false );
191 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