KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_sch_api_hittest.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <api/api_utils.h>
#include <api/common/types/base_types.pb.h>
#include <base_units.h>
#include <sch_line.h>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (UnpackVector2RoundTripsThroughSchIuScale)
 Regression tests for the IU-scale handling in API_HANDLER_EDITOR::handleHitTest.
 
 BOOST_AUTO_TEST_CASE (UnpackVector2WithWrongScaleYieldsWrongPosition)
 
 BOOST_AUTO_TEST_CASE (HitTestHitsWhenPositionUnpackedWithSchIuScale)
 
 BOOST_AUTO_TEST_CASE (ToleranceScalesFromNanometersToSchIu)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( HitTestHitsWhenPositionUnpackedWithSchIuScale )

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( ToleranceScalesFromNanometersToSchIu )

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( UnpackVector2RoundTripsThroughSchIuScale )

Regression tests for the IU-scale handling in API_HANDLER_EDITOR::handleHitTest.

Wire coordinates are always in nanometers. Prior to the fix, the schematic handler inherited the base class default of pcbIUScale, so positions sent in nanometers were decoded as pcb-IU (1 nm/IU) and then handed to schematic items whose native IU is 100 nm. Every position was therefore 100x too large, and every HitTest missed.

Definition at line 39 of file test_sch_api_hittest.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), kiapi::common::PackVector2(), schIUScale, kiapi::common::UnpackVector2(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( UnpackVector2WithWrongScaleYieldsWrongPosition )