21#include <boost/test/unit_test.hpp>
26#include <google/protobuf/any.pb.h>
28#include <api/board/board_types.pb.h>
51template<
typename ProtoClass,
typename KiCadClass,
typename ParentClass>
54 BOOST_TEST_CONTEXT( aInput->GetFriendlyName() <<
": " << aInput->m_Uuid.AsStdString() )
56 google::protobuf::Any
any;
57 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;
67 output = std::make_unique<KiCadClass>( aParent );
71 std::unique_ptr<KiCadClass> cloned(
static_cast<KiCadClass*
>( aInput->Clone() ) );
72 output = std::make_unique<KiCadClass>( *cloned );
75 bool deserializeResult =
false;
76 BOOST_REQUIRE_NO_THROW( deserializeResult =
output->Deserialize(
any ) );
77 BOOST_REQUIRE_MESSAGE( deserializeResult,
"Deserialize failed" );
80 google::protobuf::Any outputAny;
81 BOOST_REQUIRE_NO_THROW(
output->Serialize( outputAny ) );
83 if( !( outputAny.SerializeAsString() ==
any.SerializeAsString() ) )
87 BOOST_TEST_FAIL(
"Round-tripped protobuf does not match" );
91 if( !( *
output == *aInput ) )
93 BOOST_TEST_FAIL(
"Round-tripped object does not match" );
103 int barcodeCount = 0;
104 int referenceImageCount = 0;
106 for(
PCB_TRACK* track : m_board->Tracks() )
108 switch( track->Type() )
124 m_board.get(),
false );
132 for(
FOOTPRINT* footprint : m_board->Footprints() )
135 for(
ZONE* zone : m_board->Zones() )
140 switch( item->Type() )
169 static_cast<PCB_BARCODE*
>( item ), m_board.get() );
176 ++referenceImageCount;
186 BOOST_CHECK_GT( barcodeCount, 0 );
187 BOOST_CHECK_GT( referenceImageCount, 0 );
195 for(
PCB_TRACK* track : m_board->Tracks() )
197 switch( track->Type() )
204 m_board.get(),
false );
212 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.
Object to handle a bitmap image that can be inserted in a PCB.
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)
BARCODE class definition.
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_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_TEST_CONTEXT("Test Clearance")
@ 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_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (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