KiCad PCB EDA Suite
test_shape_compound_collision.cpp File Reference

Go to the source code of this file.

Classes

struct  ShapeCompoundCollisionFixture
 Fixture for the Collision test suite. More...
 

Functions

 BOOST_AUTO_TEST_CASE (ShapeCompoundCollide)
 Declares the CollisionFixture as the boost test suite fixture. More...
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( ShapeCompoundCollide  )

Declares the CollisionFixture as the boost test suite fixture.

This test checks basic behaviour of PointOnEdge, testing if points on corners, outline edges and hole edges are detected as colliding.

Definition at line 86 of file test_shape_compound_collision.cpp.

87 {
88  int actual;
89  // Check points on corners
90  BOOST_CHECK( compoundA->Collide( compoundB, 0, &actual ) );
91  BOOST_CHECK( actual == 0 );
92 
93  BOOST_CHECK( !compoundA->Collide( compoundC, 0, &actual ) );
94  BOOST_CHECK( actual == 0 );
95 
96  BOOST_CHECK( compoundA->Collide( compoundC, 100, &actual ) );
97  BOOST_CHECK( actual == 80 );
98 
99  BOOST_CHECK( shapesA[0]->Collide( compoundB, 0 ) );
100  BOOST_CHECK( shapesA[1]->Collide( compoundB, 0 ) );
101  BOOST_CHECK( compoundB->Collide( shapesA[0], 0 ) );
102  BOOST_CHECK( compoundB->Collide( shapesA[1], 0 ) );
103 
104  BOOST_CHECK( shapesB[0]->Collide( compoundA, 0 ) );
105  BOOST_CHECK( shapesB[1]->Collide( compoundA, 0 ) );
106  BOOST_CHECK( compoundA->Collide( shapesB[0], 0 ) );
107  BOOST_CHECK( compoundA->Collide( shapesB[1], 0 ) );
108 
109  BOOST_CHECK( ! shapesC[0]->Collide( compoundA, 0 ) );
110  BOOST_CHECK( ! shapesC[1]->Collide( compoundA, 0 ) );
111  BOOST_CHECK( ! compoundA->Collide( shapesC[0], 0 ) );
112  BOOST_CHECK( ! compoundA->Collide( shapesC[1], 0 ) );
113 
114  BOOST_CHECK( ! shapesA[0]->Collide( compoundC, 0 ) );
115  BOOST_CHECK( ! shapesA[1]->Collide( compoundC, 0 ) );
116  BOOST_CHECK( ! compoundC->Collide( shapesA[0], 0 ) );
117  BOOST_CHECK( ! compoundC->Collide( shapesA[1], 0 ) );
118 
119  BOOST_CHECK( shapesC[0]->Collide( compoundA, 100, &actual ) );
120  BOOST_CHECK( actual == 80 );
121  BOOST_CHECK( shapesC[1]->Collide( compoundA, 100, &actual ) );
122  BOOST_CHECK( actual == 80 );
123  BOOST_CHECK( compoundA->Collide( shapesC[0], 100, &actual ) );
124  BOOST_CHECK( actual == 80 );
125  BOOST_CHECK( compoundA->Collide( shapesC[1], 100, &actual ) );
126  BOOST_CHECK( actual == 80 );
127 }
BOOST_CHECK(v2.Cross(v1)==1)
static bool Collide(const SHAPE_CIRCLE &aA, const SHAPE_CIRCLE &aB, int aClearance, int *aActual, VECTOR2I *aLocation, VECTOR2I *aMTV)

References BOOST_CHECK(), and Collide().