← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Further QA consolidation


Hi Wayne,

On Tue, Jan 29, 2019 at 4:56 PM Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
> Fair enough but I cannot see how the polygon changes could have broken
> the common_eeschema tests.

The common tests were recently replicated three times, one for each of
the units defines, with each replication containing *every* common
unit test. See commit 90ad2406607606187b2d2eb629ce764dbb46d965.
Despite being named _pcbnew, etc, there is no such linkage.

SHAPE_POLY_SET is a libcommon class, so the tests are now in
qa_common_{pcbnew,eeschem,gerbview}, with the other generic geometry
stuff (the contents of qa/common/geometry).

> I merged your patch set.  Hopefully test
> failures will get resolved in the not too distant future.

Here is a patch to fix the tests (the point on an outline edge is NOT
supposed to collide according the docs).

There could still be a defect in the SHAPE_POLY_SET implementation WRT
the hole edges: currently these edges *do* count as collisions. For
now, code and tests are consistent. If the SHAPE_POLY_SET is changed,
whoever does it should ensure the tests are updated.

This test is a bit fiddly, I think it could be improved, but I don't
want to mess with it right now if the class its testing is having work
done on it!


From b8494711bf7c8dd1ec41863d58486651117c1e8d Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Tue, 29 Jan 2019 17:38:31 +0000
Subject: [PATCH] QA: Fix faulty test of SHAPE_POLY_SET Collision

This test assumed points on a edge are counted as colliding.
This is not true: points on an edge are NOT counted at inside
the poly_set.

THe test does still consider points on a *hole* edge as collisions.
The API to SHAPE_POLY_SET is unclear on if this is correct.
 qa/common/geometry/test_shape_poly_set_collision.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/qa/common/geometry/test_shape_poly_set_collision.cpp b/qa/common/geometry/test_shape_poly_set_collision.cpp
index 46de3db4b..828679d25 100644
--- a/qa/common/geometry/test_shape_poly_set_collision.cpp
+++ b/qa/common/geometry/test_shape_poly_set_collision.cpp
@@ -57,11 +57,11 @@ struct CollisionFixture
         // On a hole edge => inside the polygon
         collidingPoints.push_back( VECTOR2I( 40, 25 ) );
-        // On the outline edge => inside the polygon
-        collidingPoints.push_back( VECTOR2I( 0, 10 ) );
         // Create points not colliding with the poly set.
+        // On the outline edge => outside the polygon
+        nonCollidingPoints.push_back( VECTOR2I( 0, 10 ) );
         // Completely outside of the polygon
         nonCollidingPoints.push_back( VECTOR2I( 200, 200 ) );

Follow ups