KiCad PCB EDA Suite
TEST_EE_ITEM_FIXTURE Class Reference

Public Member Functions

 TEST_EE_ITEM_FIXTURE ()
 
EDA_ITEMInstantiate (KICAD_T aType)
 

Static Public Member Functions

static void CompareItems (EDA_ITEM *aItem, EDA_ITEM *aOriginalItem)
 

Public Attributes

SCH_SHEET m_sheet
 
LIB_SYMBOL m_symbol
 
LIB_PIN m_pin
 
std::shared_ptr< ERC_ITEMm_ercItem
 

Detailed Description

Definition at line 54 of file test_ee_item.cpp.

Constructor & Destructor Documentation

◆ TEST_EE_ITEM_FIXTURE()

TEST_EE_ITEM_FIXTURE::TEST_EE_ITEM_FIXTURE ( )
inline

Definition at line 62 of file test_ee_item.cpp.

62 :
63 m_sheet(),
64 m_symbol( "test symbol" ),
65 m_pin( &m_symbol ),
67 {
68 m_sheet.SetPosition( wxPoint( schIUScale.mmToIU( 5 ), schIUScale.mmToIU( 10 ) ) );
69 m_sheet.SetSize( wxSize( schIUScale.mmToIU( 50 ), schIUScale.mmToIU( 100 ) ) );
70 }
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
Definition: erc_item.cpp:202
void SetSize(const wxSize &aSize)
Definition: sch_sheet.h:106
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_sheet.cpp:890
std::shared_ptr< ERC_ITEM > m_ercItem
@ ERCE_DRIVER_CONFLICT
Conflicting drivers (labels, etc) on a subgraph.
Definition: erc_settings.h:57
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References m_sheet, EDA_IU_SCALE::mmToIU(), schIUScale, SCH_SHEET::SetPosition(), and SCH_SHEET::SetSize().

Member Function Documentation

◆ CompareItems()

static void TEST_EE_ITEM_FIXTURE::CompareItems ( EDA_ITEM aItem,
EDA_ITEM aOriginalItem 
)
inlinestatic

Definition at line 127 of file test_ee_item.cpp.

128 {
129 BOOST_CHECK_EQUAL( aItem->GetPosition(), aOriginalItem->GetPosition() );
130 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetTop(),
131 aOriginalItem->GetBoundingBox().GetTop() );
132 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetLeft(),
133 aOriginalItem->GetBoundingBox().GetLeft() );
134 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetBottom(),
135 aOriginalItem->GetBoundingBox().GetBottom() );
136 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetRight(),
137 aOriginalItem->GetBoundingBox().GetRight() );
138 }
coord_type GetTop() const
Definition: box2.h:194
coord_type GetRight() const
Definition: box2.h:189
coord_type GetLeft() const
Definition: box2.h:193
coord_type GetBottom() const
Definition: box2.h:190
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74

References BOX2< Vec >::GetBottom(), EDA_ITEM::GetBoundingBox(), BOX2< Vec >::GetLeft(), EDA_ITEM::GetPosition(), BOX2< Vec >::GetRight(), and BOX2< Vec >::GetTop().

◆ Instantiate()

EDA_ITEM * TEST_EE_ITEM_FIXTURE::Instantiate ( KICAD_T  aType)
inline

Definition at line 72 of file test_ee_item.cpp.

73 {
74 if( !IsEeschemaType( aType ) )
75 return nullptr;
76
77 if( !IsInstantiableType( aType ) )
78 return nullptr;
79
80 switch( aType )
81 {
82 case SCH_MARKER_T: return new SCH_MARKER( m_ercItem, wxPoint( 0, 0 ) );
83 case SCH_JUNCTION_T: return new SCH_JUNCTION();
84 case SCH_NO_CONNECT_T: return new SCH_NO_CONNECT();
86 case SCH_BUS_BUS_ENTRY_T: return new SCH_BUS_BUS_ENTRY();
87 case SCH_LINE_T: return new SCH_LINE();
88 case SCH_SHAPE_T: return new SCH_SHAPE( SHAPE_T::ARC );
89 case SCH_BITMAP_T: return new SCH_BITMAP();
90 case SCH_TEXT_T: return new SCH_TEXT( wxPoint( 0, 0 ), "test text" );
91 case SCH_TEXTBOX_T: return new SCH_TEXTBOX( 0, FILL_T::NO_FILL, "test textbox" );
92 case SCH_LABEL_T: return new SCH_LABEL( wxPoint( 0, 0 ), "test label" );
93 case SCH_DIRECTIVE_LABEL_T: return new SCH_DIRECTIVE_LABEL( wxPoint( 0, 0 ) );
94 case SCH_GLOBAL_LABEL_T: return new SCH_GLOBALLABEL();
95 case SCH_HIER_LABEL_T: return new SCH_HIERLABEL();
96 case SCH_FIELD_T: return new SCH_FIELD( wxPoint( 0, 0 ), 0, nullptr );
97 case SCH_SYMBOL_T: return new SCH_SYMBOL();
98
99 case SCH_SHEET_PIN_T:
100 // XXX: m_sheet pins currently have to have their initial positions calculated manually.
101 return new SCH_SHEET_PIN( &m_sheet,
102 wxPoint( m_sheet.GetPosition().x,
104 "test aPin" );
105
106 case SCH_SHEET_T: return new SCH_SHEET();
107 case LIB_SHAPE_T: return new LIB_SHAPE( &m_symbol, SHAPE_T::ARC );
108 case LIB_TEXT_T: return new LIB_TEXT( &m_symbol );
109 case LIB_TEXTBOX_T: return new LIB_TEXTBOX( &m_symbol, 0, FILL_T::NO_FILL, "test" );
110 case LIB_PIN_T: return new LIB_PIN( &m_symbol );
111 case LIB_FIELD_T: return new LIB_FIELD( &m_symbol );
112
113 case SCHEMATIC_T:
114 case SCH_PIN_T:
115 case LIB_SYMBOL_T:
116 case LIB_ALIAS_T: return nullptr;
117
118 default:
119 BOOST_FAIL( wxString::Format(
120 "Unhandled type: %d "
121 "(if you created a new type you need to handle it in this switch statement)",
122 aType ) );
123 return nullptr;
124 }
125 }
Field object used in symbol libraries.
Definition: lib_field.h:60
Define a symbol library graphical text item.
Definition: lib_text.h:40
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:41
Class for a bus to bus entry.
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:55
VECTOR2I GetPosition() const override
Definition: sch_sheet.h:365
Schematic symbol object.
Definition: sch_symbol.h:79
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ SCH_LINE_T
Definition: typeinfo.h:145
@ LIB_SYMBOL_T
Definition: typeinfo.h:197
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:142
@ LIB_TEXT_T
Definition: typeinfo.h:200
@ LIB_ALIAS_T
Definition: typeinfo.h:198
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ LIB_TEXTBOX_T
Definition: typeinfo.h:201
@ SCH_FIELD_T
Definition: typeinfo.h:154
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:153
@ SCH_LABEL_T
Definition: typeinfo.h:150
@ SCH_SHEET_T
Definition: typeinfo.h:157
@ LIB_SHAPE_T
Definition: typeinfo.h:199
@ SCH_MARKER_T
Definition: typeinfo.h:140
@ SCH_SHAPE_T
Definition: typeinfo.h:146
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:152
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:144
@ LIB_PIN_T
Definition: typeinfo.h:202
@ SCHEMATIC_T
Definition: typeinfo.h:187
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:156
@ SCH_TEXT_T
Definition: typeinfo.h:149
@ LIB_FIELD_T
Definition: typeinfo.h:208
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:143
@ SCH_BITMAP_T
Definition: typeinfo.h:147
@ SCH_TEXTBOX_T
Definition: typeinfo.h:148
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:151
@ SCH_JUNCTION_T
Definition: typeinfo.h:141
@ SCH_PIN_T
Definition: typeinfo.h:158
constexpr bool IsInstantiableType(const KICAD_T aType)
Definition: typeinfo.h:310
constexpr bool IsEeschemaType(const KICAD_T aType)
Definition: typeinfo.h:364

References ARC, Format(), SCH_SHEET::GetPosition(), IsEeschemaType(), IsInstantiableType(), LIB_ALIAS_T, LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_SYMBOL_T, LIB_TEXT_T, LIB_TEXTBOX_T, m_ercItem, m_sheet, m_symbol, EDA_IU_SCALE::mmToIU(), NO_FILL, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SHAPE_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_TEXTBOX_T, SCHEMATIC_T, schIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Member Data Documentation

◆ m_ercItem

std::shared_ptr<ERC_ITEM> TEST_EE_ITEM_FIXTURE::m_ercItem

Definition at line 60 of file test_ee_item.cpp.

Referenced by Instantiate().

◆ m_pin

LIB_PIN TEST_EE_ITEM_FIXTURE::m_pin

Definition at line 59 of file test_ee_item.cpp.

◆ m_sheet

SCH_SHEET TEST_EE_ITEM_FIXTURE::m_sheet

Definition at line 57 of file test_ee_item.cpp.

Referenced by Instantiate(), and TEST_EE_ITEM_FIXTURE().

◆ m_symbol

LIB_SYMBOL TEST_EE_ITEM_FIXTURE::m_symbol

Definition at line 58 of file test_ee_item.cpp.

Referenced by Instantiate().


The documentation for this class was generated from the following file: