Commit Graph

30 Commits

Author SHA1 Message Date
John Beard d6f4f3aca0 Geom: Account for quadrant points in arc bbox calc
This means arcs that pass though quadrant points (multiple of
0, 90, 180, 270 degrees) include these points in the bbox.
2019-01-10 07:52:25 -05:00
John Beard dc71a73178 QA: Add unit test of SHAPE_ARC
Test a few "centre-point-angle" cases and add some
generic geom code for testing vectors and boxes are within
tolerance (since rounding often creeps in).

Much of the arc-checking code will be useful to other
construction methods (e.g. point-point-point).

There are expected failures for the bbox code when
the arc passes though, but does not end on, a quadrant point
(0, 90, 180, 270). This is due to a defective
implementation of SHAPE_ARC::BBox() that does not take
into account the quadrant points. This will be fixed
as a follow-up.
2019-01-10 07:52:25 -05:00
John Beard 658cc8fd96 Wildcards: unify handling of all files wildcards
Use the AddFileExtListToFilter() to also generate the
wildcard for "all files". This is because:

* Users can use AddFileExtListToFilter for the all files WC
  with the same interface as for any other extensions.
* Users do not need to worry about wxGetTranslation, as the
  _() is applied in the same way as the other *Wildcard() helpers,
  and it is a function just like the others, so it is consistent
* There is a testable interface to document the expected result.
  The test is added.
2019-01-09 08:57:42 -05:00
John Beard dd313d4d47 Wildcards: use vectors instead of varargs + tests
Varargs make it very hard to pass strings in flexibly
when they (and the number of them) are not known
at compile time.

For example, this allows up to now amalgamate the "single
ext" and "multiple ext" unit tests.
2019-01-09 08:57:35 -05:00
John Beard f86d953c80 QA: unit tests for file ext filters
This adds a unit test for the recent AddFileExtListToFilter
to demonstrate how to use it and the expected output.

The unit tests are a bit clunky, as the vararg approach cannot
work winth strings passed at runtime.
2019-01-09 08:57:29 -05:00
Seth Hillbrand 90ad240660 units: Move common units and add tests
Centralizing duplicate code from Eeschema and pcbnew and adding unit
tests
2019-01-08 09:29:32 -08:00
John Beard 157519d722 Libeval: leading + is a sign, not an operator
Due to (presumably) a different lemon version,
there are some formatting changes in the grammar,
and some manual debug left in has been removed.
2018-12-03 08:39:30 +01:00
John Beard 49c723fc83 QA: Add numeric evaluator tests
Remove obsolete and unbuildable common/libeval/main.cpp
test program.
2018-12-03 08:39:21 +01:00
John Beard 1eb0f70de5 Zoom: Use std::chrono for the timestamping
The reduces a little bit of WX dependency, and makes
the timing code a bit more type-safe.

Also adds a more testable interface for the accelerated
zoom controller.
2018-11-26 14:40:23 -05:00
John Beard d5248cced2 QA: Initialise WX for the libcommon tests
If this is not done, things like logging and trace don't work,
as they need WX to be set up first.
2018-11-26 14:40:16 -05:00
John Beard 5a0318968f Break zoom control into a self-contained controller
This is done to avoid a big chunk of conditionally-compiled code
in the middle of the event function.

Also separates the zoom logic from the WX_VIEW_CONTROLS object
and isolates it in a separate class behind a clearer interface.

Add some simple tests for sane steps on GTK+3-sized scroll
steps.
2018-11-26 14:40:09 -05:00
John Beard 4c355c32d3 Fix rounding in COLOR4D::ToColour
Due to the implicit floor of the cast from double to unsigned char,
there was a small rounding error in COLOUR4D's WX conversion function.

This fixes the failing tests.

Also make the cast to unsigned char explicit.
2018-11-08 14:40:42 -05:00
John Beard ee819216e2 QA: Make a separate unit test utils library, COLOR4D tests
This includes:

* Linkage against the Boost unit test libs
* Configuration of the Boost libs
* A place for common generics "extras" for unit test harnesses
  including
    * A simple way to allow "expected-failure" tests (without
      breaking Boost < 1.58, e.g. Ubuntu LTS)
    * Moving some simple numeric predicates from the geom tests
      to the utils library.

Expand unit test docs to describe the expected failures macro.

Add a few COLOR4D tests, including one with expected failures due
to a pre-existing bug. This will be fixed in a follow-up commit.
2018-11-08 14:40:42 -05:00
John Beard 5660ad86ea QA: Add TITLE_BLOCK tests
Add some unit tests on TITLE_BLOCK

This commit also requires some mocks so the libcommon stuff
can work:

* Needs a Kiface() function to be linkable
* Needs some stuff from common to be build specially
* Needs to define itself as one of the unit-having programs
  to appease the units defines.
2018-11-08 08:28:20 -05:00
Seth Hillbrand ea1bc4300d QA: Add unicode to test_utf8.cpp
Previous test strings did not utilize extended table unicode, so some
cases slipped through testing.  When initializing wxString, we need to
be careful to specify that we are initializing from a UTF-8 string
otherwise the system will utilize a locale-specific initialization.
2018-10-18 11:36:49 -07:00
John Beard 4f0166e064 Add some hotkey store tests
This also adds some mocks to the libcommon test executable, which
hopefully will allow it to work with more of libcommon.
2018-09-28 08:27:57 -04:00
John Beard 04a1084549 QA: Place UTF8 tests under Boost unit tests
This transfers the old #if'd-out tests in utf8.cpp into a
proper Boost unit test in /qa (run on `make test`).
2018-09-26 09:32:26 -04:00
John Beard 9c78ef5784 QA: Make a generic common test suite
* Renames /qa/common to /qa/qa_utils, as it is not to do with /common
* Renames /qa/geometry to /qa/common
* Put existing geometry tests into a subdirectory of /qa/common, to
  echo the layout of the main tree.

The intention is to provide a place to put tests of other libcommon
code in the /qa/common suite.
2018-09-26 09:32:18 -04:00
Seth Hillbrand 518b53f78c pcbnew: Cancel highlight with ESC
When editing the pcb, Ctrl-Click will highlight a net.  This allows
de-highlight with the ESC/cancel action from the selection tool.  Inside
the highlight tool, ESC reverts to the selection tool while keeping the
net highlighted.

Fixes: lp:1793842
* https://bugs.launchpad.net/kicad/+bug/1793842
2018-09-23 15:09:18 -07:00
Jeff Young fb28d45886 Silence compiler warning. 2018-08-04 11:37:18 +01:00
Andrzej Wolski ff3f229871 Decouple vias from tracks in selection filter 2018-03-21 17:21:08 -04:00
Jeff Young 1afbfad44a Use "..." uniformly in menus.
See the bug report for some wording changes and a couple of
menu restructurings that were also cleaned up.

Fixes: lp:1597827
* https://bugs.launchpad.net/kicad/+bug/1597827
2018-02-10 17:32:28 -05:00
jean-pierre charras be746a8e3d rename a few files related to the footprint viewer. 2018-01-31 13:37:36 +01:00
jean-pierre charras 8552f3fedf fix code after renaming files 2018-01-29 22:00:44 +01:00
Jeff Young 3f6af59cac Avoid selection disambiguation menu when possible.
Some actions, such as select trivial connection, don't need the
user to choose which trace at a corner to start from -- either
one will do.  Same for moving a simple trace corner.

Likewise, Edit in Footprint Editor shouldn't ask if you mean the
footprint or the pad.  Obviously it's the footprint.

This change adds a CLIENT_SELECTION_FILTER which allows clients
to do tool- or action-specific filtering of the selection before
the disambiguation menu is run.

It also removes some tool- and action-specific code which was
in the selection_tool and shouldn't have been.

Fixes: lp:1708869
* https://bugs.launchpad.net/kicad/+bug/1708869
2018-01-18 09:09:25 +01:00
jean-pierre charras c0a539959e Fix a few Coverity warnings 2017-12-04 12:46:11 +01:00
Tomasz Włostowski 00ad8f24a0 pcbnew: Minor changes in CONNECTIVITY_DATA interface:
- renamed connectivity.[h|cpp] to connectivity_data [.h|.cpp] so that the file name matches the main class name.
- GetNetItems() now returns a vector instead of a list
2017-11-15 18:34:08 +01:00
jean-pierre charras bf013f5b63 Fix minoe compil warnings (missing override) 2017-11-06 10:23:00 +01:00
Tomasz Włostowski 9932ff32ae refactoring: wrapped boost::optional in OPT<> class for the purpose of easier transition to C++17 in the future 2017-11-03 23:59:02 +01:00
Tomasz Włostowski 3292d622c1 qa: added simple GAL+Tool Framework test program 2017-11-03 20:02:06 +01:00