KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew_utils/board_construction_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <pcb_marker.h>
#include <drc/drc_item.h>
#include <drc/drc_engine.h>
#include <widgets/ui_common.h>
#include <pcbnew_utils/board_test_utils.h>
#include "drc_test_utils.h"
Go to the source code of this file.
Classes | |
struct | RECT_DEFINITION |
Simple definition of a rectangle, can be rounded. More... | |
struct | COURTYARD_TEST_FP |
struct | COURTYARD_COLLISION |
struct | COURTYARD_OVERLAP_TEST_CASE |
A complete courtyard overlap test case: a name, the board footprint list and the expected collisions. More... | |
struct | COURTYARD_TEST_FIXTURE |
Functions | |
std::ostream & | operator<< (std::ostream &os, const COURTYARD_COLLISION &aColl) |
void | AddRectCourtyard (FOOTPRINT &aFootprint, const RECT_DEFINITION &aRect) |
Add a rectangular courtyard outline to a footprint. | |
std::unique_ptr< FOOTPRINT > | MakeCourtyardTestFP (BOARD &aBoard, const COURTYARD_TEST_FP &aFPDef) |
Construct a FOOTPRINT to use in a courtyard test from a COURTYARD_TEST_FP definition. | |
std::unique_ptr< BOARD > | MakeBoard (const std::vector< COURTYARD_TEST_FP > &aFPDefs) |
Make a board for courtyard testing. | |
static bool | CollisionMatchesExpected (BOARD &aBoard, const PCB_MARKER &aMarker, const COURTYARD_COLLISION &aCollision) |
Check if a PCB_MARKER is described by a particular COURTYARD_COLLISION object. | |
static void | CheckCollisionsMatchExpected (BOARD &aBoard, const std::vector< std::unique_ptr< PCB_MARKER > > &aMarkers, const std::vector< COURTYARD_COLLISION > &aExpCollisions) |
Check that the produced markers match the expected. | |
static void | DoCourtyardOverlapTest (const COURTYARD_OVERLAP_TEST_CASE &aCase, const KI_TEST::BOARD_DUMPER &aDumper) |
Run a single courtyard overlap testcase. | |
BOOST_AUTO_TEST_CASE (OverlapCases) | |
Variables | |
static std::vector< COURTYARD_OVERLAP_TEST_CASE > | courtyard_cases |
void AddRectCourtyard | ( | FOOTPRINT & | aFootprint, |
const RECT_DEFINITION & | aRect | ||
) |
Add a rectangular courtyard outline to a footprint.
Definition at line 97 of file test_drc_courtyard_overlap.cpp.
References B_CrtYd, KI_TEST::DrawRect(), F_CrtYd, RECT_DEFINITION::m_centre, RECT_DEFINITION::m_corner_rad, RECT_DEFINITION::m_front, RECT_DEFINITION::m_size, EDA_IU_SCALE::mmToIU(), and pcbIUScale.
Referenced by MakeCourtyardTestFP().
BOOST_AUTO_TEST_CASE | ( | OverlapCases | ) |
Definition at line 479 of file test_drc_courtyard_overlap.cpp.
References courtyard_cases, and DoCourtyardOverlapTest().
|
static |
Check that the produced markers match the expected.
This does NOT check ordering, as that is not part of the contract of the DRC function.
aMarkers | list of markers produced by the DRC |
aCollisions | list of expected collisions |
Definition at line 418 of file test_drc_courtyard_overlap.cpp.
References KI_TEST::CheckUnorderedMatches(), CollisionMatchesExpected(), DRCE_OVERLAPPING_FOOTPRINTS, and KI_TEST::IsDrcMarkerOfType().
Referenced by DoCourtyardOverlapTest().
|
static |
Check if a PCB_MARKER is described by a particular COURTYARD_COLLISION object.
Definition at line 388 of file test_drc_courtyard_overlap.cpp.
References BOARD::GetItem(), MARKER_BASE::GetRCItem(), FOOTPRINT::GetReference(), COURTYARD_COLLISION::m_refdes_a, and COURTYARD_COLLISION::m_refdes_b.
Referenced by CheckCollisionsMatchExpected().
|
static |
Run a single courtyard overlap testcase.
aCase | The testcase to run. |
Definition at line 440 of file test_drc_courtyard_overlap.cpp.
References CheckCollisionsMatchExpected(), DRCE_MALFORMED_COURTYARD, DRCE_MISSING_COURTYARD, DRCE_OVERLAPPING_FOOTPRINTS, KI_TEST::BOARD_DUMPER::DumpBoardToFile(), DRC_ENGINE::InitEngine(), COURTYARD_OVERLAP_TEST_CASE::m_case_name, COURTYARD_OVERLAP_TEST_CASE::m_collisions, BOARD_DESIGN_SETTINGS::m_DRCSeverities, COURTYARD_OVERLAP_TEST_CASE::m_fpDefs, MakeBoard(), MILLIMETRES, RPT_SEVERITY_ERROR, RPT_SEVERITY_IGNORE, DRC_ENGINE::RunTests(), and DRC_ENGINE::SetViolationHandler().
Referenced by BOOST_AUTO_TEST_CASE().
std::unique_ptr< BOARD > MakeBoard | ( | const std::vector< COURTYARD_TEST_FP > & | aFPDefs | ) |
Make a board for courtyard testing.
aFPDefs | the list of footprint definitions to add to the board |
Definition at line 130 of file test_drc_courtyard_overlap.cpp.
References MakeCourtyardTestFP().
Referenced by DoCourtyardOverlapTest().
std::unique_ptr< FOOTPRINT > MakeCourtyardTestFP | ( | BOARD & | aBoard, |
const COURTYARD_TEST_FP & | aFPDef | ||
) |
Construct a FOOTPRINT to use in a courtyard test from a COURTYARD_TEST_FP definition.
Definition at line 110 of file test_drc_courtyard_overlap.cpp.
References AddRectCourtyard(), COURTYARD_TEST_FP::m_pos, COURTYARD_TEST_FP::m_rects, and COURTYARD_TEST_FP::m_refdes.
Referenced by MakeBoard().
std::ostream & operator<< | ( | std::ostream & | os, |
const COURTYARD_COLLISION & | aColl | ||
) |
Definition at line 75 of file test_drc_courtyard_overlap.cpp.
References COURTYARD_COLLISION::m_refdes_a, COURTYARD_COLLISION::m_refdes_b, and operator<<().
|
static |
Definition at line 154 of file test_drc_courtyard_overlap.cpp.
Referenced by BOOST_AUTO_TEST_CASE().