KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_eagle_board_import.cpp File Reference

Test suite for import of Eagle *.brd board files. More...

#include <pcbnew_utils/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/eagle/pcb_io_eagle.h>
#include <board.h>
#include <footprint.h>
#include <pcb_shape.h>
#include <netinfo.h>
#include <pcb_text.h>
#include <pcb_track.h>
#include <map>
#include <vector>
#include <wx/filename.h>

Go to the source code of this file.

Classes

struct  EAGLE_BOARD_IMPORT_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (ViaNetAssignment)
 Verify that vias imported from an Eagle board are assigned to the correct nets.
 
 BOOST_AUTO_TEST_CASE (TextJustification)
 Verify that text justification is correct after importing an Eagle board with rotated footprints and silkscreen text annotations.
 
 BOOST_AUTO_TEST_CASE (UserLayerMapping)
 Verify that Eagle user-layer numbers 160-163 and 170-178 map to the expected KiCad layers when importing footprints from a library.
 

Detailed Description

Test suite for import of Eagle *.brd board files.

Definition in file test_eagle_board_import.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( TextJustification )

Verify that text justification is correct after importing an Eagle board with rotated footprints and silkscreen text annotations.

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23016

The test board has 4-pin connectors (I2C0, I2C1) rotated R90 with pin label text "G SDA SCL V+" on the top silkscreen. A bug in orientFPText() had dead code (abs(degrees) <= -180, which can never be true) that prevented text justification from being flipped for footprints rotated 180 or 270 degrees. The board also exercises the layer enable fix by having unmapped Eagle layers (53, 54, 100+) whose sentinel values previously caused std::bad_alloc in LSET::set().

Definition at line 138 of file test_eagle_board_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), DEGREES_T, F_SilkS, EDA_TEXT::GetHorizJustify(), KI_TEST::GetPcbnewTestDataDir(), EDA_TEXT::GetVertJustify(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_TOP, PCB_IO_EAGLE::LoadBoard(), PCB_TEXT_T, text, IO_ERROR::What(), and IO_ERROR::what().

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( UserLayerMapping )

Verify that Eagle user-layer numbers 160-163 and 170-178 map to the expected KiCad layers when importing footprints from a library.

Test for https://gitlab.com/kicad/code/kicad/-/issues/18766

The test library contains a footprint with wires on Eagle layers 160-161 (existing Eco1/Eco2 mapping), 162 (User.Drawings), 163 (Margin), and 170-178 (User.1-User.9). Each wire is at a distinct Y-offset so we can match which Eagle layer mapped to which KiCad layer by checking the line's position.

Definition at line 244 of file test_eagle_board_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), Dwgs_User, Eco1_User, Eco2_User, PCB_IO_EAGLE::FootprintLoad(), EDA_SHAPE::GetEnd(), PCB_SHAPE::GetLayer(), KI_TEST::GetPcbnewTestDataDir(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), FOOTPRINT::GraphicalItems(), Margin, PCB_SHAPE_T, SEGMENT, User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, User_9, IO_ERROR::What(), IO_ERROR::what(), and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( ViaNetAssignment )

Verify that vias imported from an Eagle board are assigned to the correct nets.

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/21243 and https://gitlab.com/kicad/code/kicad/-/issues/23016

The Adafruit AHT20 board has vias on SDA, SCL, GND, VCC, and VDD nets. A previous bug caused netCode to not increment for signals with only polygons (no pads), which shifted all subsequent net assignments.

Definition at line 62 of file test_eagle_board_import.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), NETINFO_ITEM::GetNetname(), KI_TEST::GetPcbnewTestDataDir(), PCB_IO_EAGLE::LoadBoard(), PCB_VIA_T, IO_ERROR::What(), and IO_ERROR::what().