Commit Graph

583 Commits

Author SHA1 Message Date
Roberto Fernandez Bautista 3b3af5327f CADSTAR PCB Archive Importer: Move code into common/plugins and pcbnew/plugins folders 2020-09-08 21:21:20 +00:00
Roberto Fernandez Bautista 632d45e833 CADSTAR PCB Archive Importer: Parse PARTS section 2020-09-08 21:21:20 +00:00
Roberto Fernandez Bautista 4c2f38f1ad CADSTAR PCB Archive Importer: Parse LIBRARY section + code refactoring
code refactoring:
- Renamed CADSTAR_COMMON to CADSTAR_ARCHIVE_COMMON
- Renamed CPA_FILE to CADSTAR_PCB_ARCHIVE_PARSER
- Made CADSTAR_PCB_ARCHIVE_PARSER a derived class of CADSTAR_ARCHIVE_COMMON
- Moved all structures in cadstar_pcb_archive_parser.h/.cpp to be defined inside CADSTAR_PCB_ARCHIVE_PARSER class
2020-09-08 21:21:20 +00:00
Roberto Fernandez Bautista 86bf592bac ADDED: CADSTAR PCB Archive Importer
Initial commit
- Imports directly mappable layer stackup (only physical board fabrication layers for now)
2020-09-08 21:21:20 +00:00
Seth Hillbrand 459cc326e0 Remove errant header
Fixes https://gitlab.com/kicad/code/kicad/issues/5553
2020-09-08 06:44:56 -07:00
Seth Hillbrand 02a5d47de9 Avoid passing references in EESchema
This returns the connection list by value.  This allows easier Python
use

Also renames m_End() to GetEnd()
2020-09-08 06:29:27 -07:00
Tomasz Wlostowski 1cd349c8f6 drc_proto: report rule hits only for rule-driven tests 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 0ef6d85a1f drc_proto: added rule hit accounting in various tests 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 0f015aeb59 drc_proto: add dummy default constraint for courtyard clearance 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski e1af46d099 qa: temporarily disable test_gal_pixel_aligmnent due to unfinished changes in PCB_TEST_FRAME_BASE 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 7aefe6fdb4 qa_utils: PCB_TEST_FRAME compiles again... 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 91860dae2d drc_proto: use GetLayer() in disabled layer tests 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski b53d753796 drc_proto: don't stitch together multiple rules's microcode 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 9176062d0f drc_proto: return 'safe' null constraint if no matching rule found. To be fixed 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski fc58c4a20e drc_proto: netclass wip 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 8a5297180e drc_proto: initial version of legacy rule import (without overrides yet) 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 05b88acf16 drc_proto: wip adding accessors to DRC_RULE/DRC_RULE_CONDITION 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 8e4a3f5e65 drc_proto: nicer logging on the console 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski b107c4a025 drc_proto: working on progress reporting 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski 466cbe2f00 libeval_compiler: fixhandling of method calls with empty argument list (e.g. 'A.method()' ) 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski adbd94553d drc_proto: all tests now supported in drc_proto. Not tested yet! 2020-09-08 01:31:42 +02:00
qu1ck 3dbebda168 Fix GetCustomShapeAsPolygon and add a unit test
Fixes #5497
2020-09-04 20:30:54 -07:00
Seth Hillbrand 3095d0e335 DRC_TREE: Allow indexing on triangulated zones
Also move to BOARD_ITEM* as we might want to run DRC on non-copper items
2020-09-04 15:53:49 -07:00
Jeff Young e6f4e156b6 Fix the SCH_PINs test to be more reflective of the codebase. 2020-09-01 15:25:49 +01:00
Jeff Young 9e12ea9bb6 Cleanup some dead code and make better use of iterators.
Also applies coding style around auto and lambdas.
2020-08-28 11:05:58 +01:00
Seth Hillbrand 0d65d76a9a Add modified qa project 2020-08-25 10:40:44 -07:00
Thomas Pointhuber a03fb7a9a8 Altium: Refactor and add initial structure for schematic importer
altium: move pcbnew/altium2kicadpcb_plugin -> pcbnew/plugins/altium

See: https://gitlab.com/kicad/code/kicad/-/issues/4412
2020-08-23 19:01:08 +00:00
Seth Hillbrand a3fc028c9b CHANGED: locked parameter explictly written
Removed the bitmap status field that saved internal states into the
file, creating rcs churn.  Also removed the unneeded count variables at
the start of the file as these created merge conflicts for every board
that had multiple revisions

Fixes https://gitlab.com/kicad/code/kicad/issues/1850
2020-08-19 03:51:30 +00:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Tomasz Wlostowski 8c94d88c78 qa: fix incorrect cast error on OSX/MSVC 2020-08-14 09:48:40 +02:00
Tomasz Wlostowski f582783b27 qa/drc_proto: updated DRC rule file format to the last version, post-rebase fixes too 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski e0ffdc8fe7 drc_proto: update file format, get the thing to compile again 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski 52fefd15e0 common: include drc_proto keywords in the main DRC parser 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski d937fadd6f Migrate RC_ITEM to use shared_ptr 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski 2b6ef6964a qa/pcbnew: test introspected properties in the expression compiler 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski 7c15c788b8 qa/pcbnew: boost test fixture for libeval_compiler 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski 35e45c5917 drc_proto: edge clearance wip 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski e38796396f qa/drc_proto: default values for fields in DRC_RULE 2020-08-13 14:50:59 +02:00
Tomasz Wlostowski 782fcc6139 qa/drc_proto: fix regressions in DRC_RULE_PARSER 2020-08-13 14:50:59 +02:00
Jeff Young 393bb0fd83 Fix assert where geometry routine wasn't ready to handle layers.
This introduces layer handling to a lot of the geometry routines.
Many of them don't do much with it now, but it does help multi-layer
zones and will help when padstacks are implemented.
2020-08-12 22:20:08 +01:00
Jeff Young 463100d67f Remove a long-standing hack to keep divots out of adjacent zones.
The new algorithm unions any adjacent zones before doing the
chamfer/fillet and then subtracts the other zones back out afterwards.

Fixes https://gitlab.com/kicad/code/kicad/issues/3812
2020-08-12 22:20:08 +01:00
Qbort b41892e4da Rename class GROUP in pcbnew to PCB_GROUP
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5156
2020-08-12 15:36:08 +01:00
Seth Hillbrand 7c455f2357 First pass at DRC RTree functionality
This implements a copper-layer RTree with functions for iterating over
the elements in a copper layer and providing Nearest Neighbor returns
for BOARD_CONNECTED_ITEMS
2020-08-11 16:52:29 -07:00
Joshua Redstone ee428876ec ADDED: Group/Ungroup function
This implements the group/ungroup functions to mark a set of EDA_ITEMs as a unit, allowing them to be moved and rotated as a unit
2020-08-11 19:37:07 +00:00
Seth Hillbrand 41edf5c5bf Updating DRC to handle vias with differing layers 2020-08-10 03:27:27 +00:00
Jeff Young 4317881012 Improve delete-unused-layers to better handle multi-layer items.
Fixes https://gitlab.com/kicad/code/kicad/issues/5116
2020-08-09 15:39:51 +01:00
Mark Roszko c6e388db14 Implement an app progress indicator in the taskbar
ADDED: Progress indicator in the taskbar

This adds a progress indicator to the Windows and macOS taskbar
icons to display the progress of some operations.

Note, this requires wxWidgets 3.1+
2020-08-09 10:55:00 +00:00
Jeff Young e5b50d90a7 Update DRC rules to new layer and disallow grammars.
Also adds support for hooking rules up to named zones.

Fixes https://gitlab.com/kicad/code/kicad/issues/2041
2020-08-07 21:49:36 +01:00
Qbort 9977299340 Fix compile errors in drc_engine.cpp and panel_setup_rules.cpp 2020-07-31 21:47:01 +00:00
Tomasz Wlostowski 23e834fdb5 qa: fixed test fixture name collision causing test failures 2020-07-31 20:01:15 +02:00
Ian McInerney 268dec5c19 Cleanup some build and Coverity warnings 2020-07-31 02:46:05 +01:00
Jeff Young fdb23d1a2d Add DRC check for items (pads for now) shorting two nets.
Fixes https://gitlab.com/kicad/code/kicad/issues/4955
2020-07-30 21:42:23 +01:00
Jeff Young 577c1be391 Report all DRC rule errors, not just the first. 2020-07-30 14:27:42 +01:00
Tomasz Wlostowski b06c158764 drc_proto: thou shalt count rule hits from 1, not 0 2020-07-30 00:02:36 +02:00
Tomasz Wlostowski 8de484eff3 drc_proto: follow up Jeff's changes 2020-07-30 00:02:15 +02:00
Tomasz Wlostowski faf469bd23 drc_proto: follow up Jeff's changes to libeval_compiler 2020-07-29 23:15:19 +02:00
Tomasz Wlostowski 9401165e6c qa: temporarily disable libeval_compiler_test 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski e32c38ef81 drc_proto: simple test cases for copper clearance and hole clearance tests 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski 128ae8b49e drc_proto: working on hole size/track width checker 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski ff1872379d drc_proto: report rule hit statistics 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski 7fc532df2e drc_proto: import new error reporting code from Jeff 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski 6615397541 drc_proto: DRC_RULE now uses new libeval API 2020-07-29 23:14:34 +02:00
Tomasz Wlostowski a504bd0795 drc_proto: don't launch DRC providers with empty/incomplete rule sets 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski cf0bb60fbb drc_proto: migrated GetEffectiveShape(s) to SHAPE_COMPOUND 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski 1a2e02040a qa/libs/kimath: simple test suite for collisions of SHAPE_COMPOUNDs 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski 8d9d3ff795 qa/drc_proto: debug level settable by env var 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski 91b68e4578 drc_proto: follow up Jeff's changes in legacy DRC/board model 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski abe6ccf97e common: re-enable libeval_compiler and DRC proto test (fixed missing file issues) 2020-07-29 23:14:03 +02:00
Jeff Young 0fecb5f277 Be more explicit about string/character conversions.
This *may* fix the bug where a layer name isn't displayed correctly
in the error dialog.  But probably not.
2020-07-28 20:44:40 +01:00
Seth Hillbrand 1374d82114 Adding QA project files 2020-07-28 10:44:51 -07:00
Jeff Young 552dde8976 Fix return value going out of scope.
(From Coverity report.)
2020-07-26 13:41:43 +01:00
Jeff Young bf445c1a95 Performance enhancements.
1) cache pad polygon outlines
   huge improvement in connectivity performance and a decent
   improvement in DRC performance
2) don't pre-allocate CONTEXT stack
   significant improvement in DRC rule performance
2) don't keep re-encoding strings
   decent improvement in DRC rule performance
2020-07-25 13:03:33 +01:00
Jeff Young 6529e339a9 Don't store context in the uCode. (It's not thread-safe.)
Although it does give some pretty funny results when filling zones.
2020-07-23 22:21:13 +01:00
Jeff Young a6b6084a60 Add preflighting for DRC rule function calls. 2020-07-22 14:33:32 +01:00
Jeff Young c52df811ae Add expression eval to constraint min/max/opt values.
Also adds error reporting for above.
2020-07-21 23:43:10 +01:00
Jeff Young 095937563b Hook libeval compiler up to rule parser
- convert expression string tokens to single-quote-delimited
- fix bug where netclass assignments weren't getting updated after
  board setup dialog
- move property manager rebuild to lazy evaluation
- improve performance with wider use of const&
- retire DRC_SELECTOR stuff
- use wxString for GUI stuff (particularly translated stuff)
- fix EqualTo() to return false instead of asserting when op types
  don't match
- fix buffer overruns with fixed-size string buffers
- make expression function calls case-insensitive
- integrate expression errors into rule parser
- produce more and better error messages
- keep BOARD_ITEM ptrs const as long as possible
- fix a couple of uninitialized variables
2020-07-20 22:11:53 +01:00
jean-pierre charras 6d8fb94d86 Fix a few Coverity warnings. 2020-07-20 16:19:19 +02:00
Seth Hillbrand 69d75b90b1 Adding failed arc test
This test implements a case where the current arc calculations fail
2020-07-18 13:03:22 -07:00
Ian McInerney 7b705af038 Refactor common QA components to create a single common library
This moves the program-specific code (e.g. BIU files) into
the program tests.

Also, create title_block.cpp to break a dependency that pulled
in eda_text.cpp when using the TITLE_BLOCK object.
2020-07-18 16:21:15 +01:00
Ian McInerney 019313711a Move geometry tests into the kimath qa test 2020-07-18 16:19:01 +01:00
Jeff Young d1da053d2e Update test to prettier file extension wildcard syntax. 2020-07-17 21:22:28 +01:00
Jeff Young 7340c97ef9 Undo for schematic-wide operations.
Editing value/footprint fields of multi-unit components.
Find/Change.
Annotation.
Back annotation.

Fixes https://gitlab.com/kicad/code/kicad/issues/2122

Fixes https://gitlab.com/kicad/code/kicad/issues/4869

Fixes https://gitlab.com/kicad/code/kicad/issues/3933

Fixes https://gitlab.com/kicad/code/kicad/issues/4871

Fixes https://gitlab.com/kicad/code/kicad/issues/3899
2020-07-13 12:32:17 +01:00
Jeff Young 1872d05f72 Fix netlist test golden file to include proper escaping. 2020-07-07 11:18:52 +01:00
Ian McInerney 6672efdf2c Disable DRC prototype by default 2020-07-06 00:55:36 +01:00
Tomasz Wlostowski 0a4c8cd45c drc_proto: import latest Jeff & Jon's changes + update copyright headers 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski e9d37dd7ce drc_proto: implement QueryWorstConstraint 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski bc86ea7682 drc_proto: use separate lexer for rule file from current pcbnew DRC 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski 0e0cf5dff8 drc_proto: moving to GetEffectiveShapes() 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski 1cabc1bc0f qa/drc_proto: rework common clearance code into base class, start working on hole clearance test refactor 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski b3ce23f0e2 PCB_EXPR_EVALUATOR: implement isPlated virtual property 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski d57d5d73b2 qa: clearance test works and reports. about to do board outline clearance test 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski bd19892cd0 qa/drc_proto: clearance test seems to work with conditional rules, need to clean up & add reporting 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski 6bddc4bdd6 qa: more tests for libeval_compiler 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski 085698d17c drc_proto: wip 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski aaa91655aa libeval_compiler: integrated in common/ 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski b82ec2161f libeval_compiler: initial version 2020-07-05 22:44:38 +02:00
Tomasz Wlostowski bff209b07c qa: disable single test in PROPERTY test suite due to boost incompatibility 2020-07-05 22:44:38 +02:00
Maciej Suminski f084a86601 Properties replacement method
Adds a possibility to replace properties inherited from base types with
a more specific ones. For example, such properties may have:

- different meaning which should be reflected in property name
  (e.g. TRACK::{G,S}etWidth() sets actual track width, but
  VIA::{G,S}etWidth() modifies the diameter)

- different set of possible values (e.g. BOARD_CONNECTED_ITEM::SetLayer()
  should accept any copper layer, but MODULE::SetLayer() works only with
  F.Cu and B.Cu)
2020-07-05 22:44:38 +02:00
Maciej Suminski cbd5004fd4 Properties (introspection)
Introduces classes:
- INSPECTED: base class for types taking advantage of
  generic properties system.
- PROPERTY*: meta-data storing information about properties
- PROPERTY_MANAGER: singleton class to get properties data
2020-07-05 22:44:38 +02:00
Jon Evans 4dbbe1cf68 Project settings fixes from review
- Fix file extension for new project
- Fixes for exceptions on MSW
- Fix some ASAN issues
- Allow SETTINGS_MANAGER to run headless
- Don't flag schematic as modified after schematic setup is closed
- Don't automatically unload projects when LoadProject is called
- Don't unload project if it's the same as the current one
- Make sure to properly init/de-init template field names
2020-07-02 22:08:54 -04:00
Jon Evans 12b4a55ae8 Port Eeschema to new project settings
DRC/ERC error serialization changed to use explicit tokens
Old stored severities and ignored errors are discarded
2020-07-02 22:08:54 -04:00
Jon Evans c0aa6965de Migrate PcbNew project settings to new framework
Various architecture upgrades to support this.
Creating a BOARD now requires a valid PROJECT, which caused
some (mostly transparent) changes to the Python API internals.

ADDED: Project local settings file
CHANGED: Board design settings are no longer stored in PCB file
CHANGED: Net classes are no longer stored in PCB file
CHANGED: Importing board settings now reads boards, not just projects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2578
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4070
2020-07-02 22:08:54 -04:00
Jon Evans a4fadfcdf2 Begin moving project file load to new system 2020-07-02 22:08:54 -04:00
Jon Evans a7708fa6dc Add PROJECT_FILE and basic load/unload methods 2020-07-02 22:08:54 -04:00
Jeff Young eb1ff80d57 SHAPE collision fixes.
1) An actual distance of 0 is still a collision, even if the allowed
distance is 0.
2) Be consitent about edges and interiors.  Everyone expect the edge
of a RECT to be part of the RECT; same with a CIRCLE.  SHAPE_POLY_SET
shouldn't be any different.  (And SHAPE_LINE_CHAIN was a split-
personality with the edge considered part of it for Collide() but not
for PointInside()).
2020-07-02 21:38:37 +01:00
Jon Evans 0d4ee39f75 CHANGED: Copper zones can be on more than one layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1963
2020-06-28 08:52:37 -04:00
Jon Evans e91b9f6dfb Rip out the unused leftovers of the old color system 2020-06-18 22:32:14 -04:00
Seth Hillbrand a8ab668122 Move SHAPE_ARC to start->mid->end format
The arc shapes need to connect with their adjacent points.  By storing
the relevant points, we allow exact point matching on both ends of the
arc as well as localize point storage.
2020-06-13 11:23:14 -07:00
Jeff Young f84406009b Push a couple of layers of indirection out of grid settings. 2020-06-13 11:35:56 +01:00
Wayne Stambaugh 52078a4b1b Allow setting mandatory derived symbol field properties.
CHANGED: All mandatory fields in derived symbols can be edited.  This
not only includes the field value but also all text properties.

Kill the dual datasheet variable storage which caused many datasheet
bugs over the years.  The datasheet is now always stored in the data
sheet field.
2020-06-02 14:21:11 +00:00
Jon Evans a52435bbb0 ADDED: New mouse settings panel, expanded mouse settings
You can now choose the behavior of dragging with the
middle and right mouse buttons.

You can also choose which modifier keys to use for
panning and zooming with the scroll wheel or trackpad.

You can also customize the zoom speed, which makes
it possible to have a good zoom experience on a wider
range of input devices.

You can also now zoom by dragging with the right or
middle button if desired.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3885
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4348
2020-05-24 14:38:28 -04:00
Jon Evans e934f8b459 Remove python netlist QA facilities 2020-05-23 22:48:09 -04:00
Jon Evans f730aa7834 Update netlist testcases 2020-05-23 22:48:03 -04:00
Jon Evans f7578eb038 Implement new native netlist QA test 2020-05-23 21:04:11 -04:00
Jon Evans de9520d65e Finish porting netlisters to use CONNECTION_GRAPH 2020-05-23 12:45:24 -04:00
Jon Evans 7c7b7f41da Move SCH_SCREEN project access to SCHEMATIC
SCH_SCREEN no longer needs to be a KIWAY_HOLDER
2020-05-20 22:27:48 -04:00
Jon Evans b36b7d5a5d Update video QA project with proper junctions 2020-05-20 18:51:32 -04:00
Jon Evans 52ae0df7a4 Convert video QA project to new format 2020-05-20 00:03:27 -04:00
Jon Evans 9e79dfdb25 Update netlist QA testcases to new file format 2020-05-18 22:40:28 -04:00
Jon Evans d7bd4c9b04 Move Eeschema globals to new SCHEMATIC object
Set up a new lineage for SCH_ITEMS to get back to the SCHEMATIC
they live on: Items will all be parented to the SCH_SCREEN that
they are added to, and each SCH_SCREEN will point back to the
SCHEMATIC that it is part of.  Note that this hierarchy is not
the same as the actual schematic hierarchy, which continues to
be managed through SCH_SHEETs and SCH_SHEET_PATHS.
2020-05-18 13:04:56 -04:00
Jeff Young 75b139c7b4 Move hole testing to DRC client and improve performance. 2020-05-17 15:49:02 +01:00
Jeff Young 8efa8af8cc Add persistence of DRC error severities. 2020-05-07 17:51:27 +01:00
Jon Evans 920f5f4ada Update netlist qa files for new format 2020-05-05 21:58:08 -04:00
Wayne Stambaugh 7183e9f97e Make the new schematic and symbol library file formats the default.
This is a very large and potentially disruptive change so this will be an
unusually long and detailed commit message.

The new file formats are now the default in both the schematic and symbol
library editors.  Existing symbol libraries will be saved in their current
format until new features are added to library symbols.  Once this happens,
both the legacy schematic and symbol file formats will be no longer be
savable and existing libraries will have to be converted.  Saving to the
legacy file formats is still available for round robin testing and should
not be used for normal editing.

When loading the legacy schematic file, it is imperative that the schematic
library symbols are rescued and/or remapped to valid library identifiers.
Otherwise, there will be no way to link to the original library symbol and
the user will be required manually set the library identifier.  The cached
symbol will be saved in the schematic file so the last library symbol in
the cache will still be used but there will be no way to update it from the
original library.

The next save after loading a legacy schematic file will be converted to
the s-expression file format.  Schematics with hierarchical sheets will
automatically have all sheet file name extensions changed to .kicad_sym
and saved to the new format as well.

Appending schematics requires that the schematic to append has already been
converted to the new file format.  This is required to ensure that library
symbols are guaranteed to be valid for the appended schematic.

The schematic symbol library symbol link resolution has been moved out of
the SCH_COMPONENT object and move into the SCH_SCREEN object that owns the
symbol.  This was done to ensure that there is a single place where the
library symbol links get resolved rather than the dozen or so different
code paths that previously existed.  It also removes the necessity of the
SCH_COMPONENT object of requiring any knowledge of the symbol library table
and/or the cache library.

When opening an s-expression schematic, the legacy cache library is not
loaded so any library symbols not rescued cannot be loaded.  Broken library
symbol links will have to be manually resolved by adding the cache library
to the symbol library table and changing the links in the schematic symbol.

Now that the library symbols are embedded in the schematic file, the
SCH_SCREEN object maintains the list of library symbols for the schematic
automatically.  No external manipulation of this library cache should ever
occur.

ADDED: S-expression schematic and symbol library file formats.
2020-05-04 12:40:03 +00:00
Jeff Young 058108dd6d There are 3 courtyard DRC checks, not 2. 2020-05-01 18:49:42 +01:00
Jeff Young d17664c519 Fix bug in testcase. 2020-05-01 18:49:42 +01:00
Jeff Young dfe4a00d43 Add distance reporting for copper item DRC tests.
Also adds some performance improvements.
2020-05-01 18:49:42 +01:00
Jeff Young 1535c83b88 Lay some groundwork for adding distances to DRC errors.
modified:   eeschema/lib_rectangle.cpp
2020-04-24 14:46:22 +01:00
Jeff Young 7f1b409305 Remove dead legacy print code. 2020-04-20 17:03:38 +01:00
Jon Evans d7d1ea33ac Check for conflicts before promoting sheet pins to be strong drivers
Fixes https://gitlab.com/kicad/code/kicad/issues/4201
2020-04-19 19:13:24 -04:00
Jon Evans 7df3df3381 Add basic netlist QA test 2020-04-19 19:13:24 -04:00
Jon Evans b802a3e776 Add command-line option to generate netlist and exit 2020-04-19 19:13:24 -04:00
Ian McInerney 7bda8178d1 Move library includes to main CMake file
Placing them behind the SYSTEM directive tells CMake to tell
the compiler they are system libraries, so it shouldn't show
warnings created from them.
2020-04-19 01:11:56 +01:00
Ian McInerney d44a252182 Clean up spice tests in qa_eeschema
* Guard their inclusion with the KICAD_SPICE flag
* Code cleanup inside actual testing function

Fixes https://gitlab.com/kicad/code/kicad/issues/4220
2020-04-18 00:47:40 +01:00
Sylwester Kocjan fdccdd5cb9 Eeschema: adding .op SPICE simulation support
ADDED new tab on simulation settings dialog, which allows to run .op analysis.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2368
2020-04-15 01:51:58 +00:00
jean-pierre charras 4a2a5a9403 qa_eeschema: fix a crash due to LIB_PIN ctor that was using default config values,
but in QA tests, we do not have config values available.
2020-04-14 18:12:15 +02:00
Thomas Pointhuber b707c84b62 Use Record handling for parsing
Now, we know how big a record is, and should be able to parse all boards without missing bytes?
2020-04-03 23:22:24 +00:00
Jeff Young 4990d1e7b2 Variable substitution framework.
This implements editing of variables and moving SCH_FIELDs,
TEXTE_MODULEs, TEXTE_PCB and worksheet items over to the new
framework.
2020-03-30 14:15:59 +01:00
Jeff Young cee973dc04 Move ERC error reporting over to the new framework.
Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-16 11:06:15 +00:00
Jeff Young 085d80e3f3 Remove duplicated settings from preferences.
These have now moved to project-specific settings.
2020-03-13 17:28:53 +00:00
Wayne Stambaugh 8cc80e3b35 Add unit test for testing LIB_ARC objects.
Added tests for calculating radius angles and arc mid point.
2020-03-10 11:04:05 -04:00
Jon Evans 8660b4c144 ADDED: New color theme editor and multi-theme support 2020-03-06 00:01:03 -05:00
Wayne Stambaugh bc7df3239c Start unit tests for math library trigonometry functions.
This only tests the InterceptsPositiveX() and InterceptsNegativeX() used
for finding the midpoint of an arc.

Tidy up some of the trigo.h header Doxygen comments.
2020-03-05 07:34:26 -05:00
jean-pierre charras b7cd0c54c2 Fix compil issues, especially on Windows:
Replace SEVERITY_ERROR by RPT_SEVERITY_ERROR to avoid collision with a system definition.
Replace other SEVERITY_XXX by RPT_SEVERITY_XX for consistency.
Fix compil warnings and some other compil issues.
2020-03-04 10:48:18 +01:00
Jeff Young 85c2e0d23a Add user-defined severities, exclusions and colors to DRC markers.
Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-04 00:39:28 +00:00
Wayne Stambaugh abb8088695 Fix QA test failure due to changes to FormatInternalUnits() function. 2020-03-03 08:06:23 -05:00
Wayne Stambaugh e1900161a7 Eeschema: implement new symbol library file s-expression formatter.
CHANGES: Symbol library file format has been converted to s-expressions.

Add support code for picking apart symbols at some future junction that
will allow full inheritance conversion of existing symbol libraries.  For
now, symbols arranged by unit and body style numbers are nested for round
robin testing of symbol libraries once the parser is complete.
2020-03-03 08:06:22 -05:00
Ian McInerney aa95ff10df Add build dependency on pcbcommon in qa test
The qa_pcbnew_util needs the pcb_lexer header that is generated
as part of pcbcommon, so it must be built after pcbcommon.
2020-03-01 17:03:12 +00:00
Simon Richter 866aac9737 Clean up a few unused names of caught exceptions 2020-03-01 00:33:45 +00:00
Jeff Young 149d34fbe1 Add missing files from last commit. 2020-02-28 22:37:53 +00:00
Jeff Young 9ded76bcad Update tests to UUIDs.
Fixes https://gitlab.com/kicad/code/kicad/issues/3939

Fixes https://gitlab.com/kicad/code/kicad/issues/3958
2020-02-28 22:06:14 +00:00
Jeff Young 7fdb74569f Attempt to fix test expectation.
I'm pretty sure this will fix it, but I've never been able to
build the tests on my Mac so I'm not sure.

Fixes https://gitlab.com/kicad/code/kicad/issues/3928
2020-02-24 23:19:17 +00:00
Jeff Young c68b554c8e Promote PathsAndReferences from wxArrayString to first-class-citizen.
Keeping the data in an un-serialized format greatly simplifies usage,
and should make it more robust.
2020-02-24 23:19:17 +00:00
jean-pierre charras a8e905a1e8 QA: fix a python test issue due to code changes in board.h
FindModule() does not exist anymore. Use FindModuleByReference() instead.

Fixes #3927
https://gitlab.com/kicad/code/kicad/issues/3927
2020-02-23 20:18:06 +01:00
Seth Hillbrand 8c19b4b6ae pcbnew: Adding arcs to PNS
This is allows ARCs in tracks to be synchronized with
the PNS router.  Note this does not yet include the UI components
to route curved traces
2020-02-21 16:11:41 -08:00
Jeff Young 490f39a671 Remove obsolete code requiring unique sheet names. 2020-02-20 22:56:11 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
jean-pierre charras 625249322e Pcbnew: regroup drc files to the already existing drc folder. 2020-02-19 10:31:32 +01:00
jean-pierre charras fb19d83b69 QA test: fix a missing change related to commit 2ca16c0. 2020-02-17 08:10:04 +01:00
Ian McInerney 34e5b76c5f Add virtual constructors to some classes that should have them
This is more for safety from undefined deletion behavior than
anything else (it also silences the Clang -Wnon-virtual-dtor warning).
2020-02-05 22:19:14 +00:00
Ian McInerney 06c979dfaa Convert all CMake paths to absolute instead of relative
It is cleaner and safer to handle the include and source paths
as absolute from the source directory instead of relative to every
path.
2020-01-22 23:27:20 +00:00
Fabien Corona 183bbf6914 3d-viewer : synchronise colours with board stackup.
ADDED: 3d-viewer can now look up colours defined in board properties

Fixes https://gitlab.com/kicad/code/kicad/issues/2261
2020-01-22 22:38:30 +00:00
Mark Roszko 70908043a3 Convert enums inside eeschema and the symbol editor to be scoped
Scope: NETLIST_ITEM, CONNECTION_TYPE, ELECTRICAL_PINTYPE,
       NET_CONNECTION, NETLIST_ITEM, GRAPHIC_PINSHAPE

Note, the pin type enum had PT_ added to the front to prevent
shadowing of the INPUT symbol on msys2 (see discussion at
c17c9960d8)
2020-01-18 20:51:28 +00:00
Seth Hillbrand 6a47d0f507 RTree: Fix iterator in single branch trees
In a single branch tree, we need to verify that all leaves do not match
the input search before returning.

Fixes #3764 | https://gitlab.com/kicad/code/kicad/issues/3764
2020-01-14 10:42:04 -08:00
Jeff Young 9e8a66a0a3 Don't try to clear memory if the bitmap has an invalid size. 2020-01-13 00:18:49 +00:00
Jeff Young 8d0f31f6f4 Clean a bunch of legacy code out of the Filter Selection dialog. 2020-01-12 20:53:56 +00:00
Jeff Young 127c66285b Rename old DIALOG_BLOCK_OPTIONS to DIALOG_FILTER_SELECTION....
... which is what it has done for some time now.
2020-01-12 20:30:58 +00:00
Jeff Young 836c1ea56e Fix a bunch of un-caught boost::bad_pointer exceptions.
This also removes vector cover types which do nothing except obfuscate
the underlying implementation.

Mainly changes SCH_SHEET_PINS and CONFIG_PARAM_ARRAY (which will soon
be replaced by Jon's new stuff).
2020-01-12 19:55:00 +00:00
Seth Hillbrand ce5c63b368 Fix bitmap unit test
This was testing for bitmap dots per IU.  But IU changed, so we needed
to adjust how the bitmaps were scaled.  This brings the QA up to date.
2020-01-11 07:30:17 -08:00
Seth Hillbrand 6e5e453d0d Replace EESchema DLIST
This moves EESchema DLIST structures to rtree.  These changes are more
fundamental than the pcbnew changes from 9163ac543 888c01d11 d1877d7c1
and 961b22d60 as eeschema operations were more dependent on passing
drawing list references around with SCH_ITEM* objects.
2020-01-10 06:37:08 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
jean-pierre charras 5707e6eac8 Fix QA arc test according to the new arc bounding box calculation.
Previously, the arc center was included in the bounding box,
but this is incorrect.
In many cases it is not in the bbox, and can be very far away.
2020-01-04 10:16:30 +01:00
Seth Hillbrand 3fb085a0b4 eeschema: Move comparison for DANGLING_ENDS
The comparison functions belong inside the class if we are using them to
test the validity of the class.
2020-01-03 11:46:05 -08:00
Wayne Stambaugh aeb3281e27 Convert Schematic Internal Units to 100nm 2019-12-30 18:28:00 +00:00
jean-pierre charras 04aa45c25c qa_eeschema build: fix missing library in library link list.
The issue was created by my commit 19e92c9.
2019-12-29 14:07:17 +01:00
Ian McInerney 5c0656d97f Move potrace and libcontext into thirdparty directory
Part of the cleanup in #3637
2019-12-28 18:17:55 +00:00
Mark Roszko 5b75c6ea5f Add unit test though it's not great 2019-12-26 13:10:18 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Ian McInerney 116ac9aa75 Move dxflib, tinyspline and nanosvg into a thirdparty library directory
Part of fixing https://gitlab.com/kicad/code/kicad/issues/3637
2019-12-19 17:41:02 +00:00
Seth Hillbrand eb3d32f967 SHAPE_LINE_CHAIN: Unify constructors
Keeps the multi element SHAPE_LINE_CHAIN constructors in a single
routine using std::vector and implicit construction.
2019-12-12 13:54:48 +00:00
Seth Hillbrand c4d853c1e8 SHAPE_LINE_CHAIN: Remove element access
This is the first step to allowing non-segments in the line chain.
External routines cannot be allowed to change the line chain without
going through the internal routines.  To accomplish this, we remove the
Vertex() and Point() access routines and only leave the const versions.
Transformations are given for both points as well as the chain itself.
2019-12-12 13:54:48 +00:00
Seth Hillbrand 9b7d4e2742 Recleaning DLIST from pcbnew
This was re-introduced by 5d3e6e3d44

The crash happened b/c we have to manage list containers in each element
and minor adjustments cause the rest of the list to be lost.  This
commit re-implements it using std::iterators and deque

Fixes #2623 | https://gitlab.com/kicad/code/kicad/issues/2623
2019-12-10 09:52:07 -08:00
Wayne Stambaugh 54f066fed7 Implement simple inheritance for library symbols.
This change completely removes the LIB_ALIAS design pattern an replaces
it by allowing LIB_PART objects to inherit from other LIB_PART objects.
The initial implementation only allows for single inheritance and only
supports the mandatory fields in the derived part because that is all
that the current symbol library file format will support.  Once the new
file format is implemented and saving to the old file format is deprecated,
more complex inheritance will be added.  The LIB_ALIAS information saved
in the document files was move into the LIB_PART object.  This change
impacts virtually every part of the schematic and symbol library editor
code so this commit message is woefully incomplete.

REMOVE: Removed the symbol aliases concept from the schematic and symbol
editors and the symbol viewer.

NEW: Replace the symbol alias concept with simple inheritance that allows
a library symbol to be derived from another library symbol.
2019-12-06 11:33:52 -05:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand 4d2e953f42 Cleanup: Replace C-only deprecated headers
This replaces headers deprecated by C++14 with their equivalent
replacement
2019-12-05 11:03:15 -08:00
Seth Hillbrand a2edf9c442 Unified update to C++14 std::make_unique
This update replaces the existing uses of unique pointer creation with
the C++14 std::make_unique call that provides proper memory release in
event of an exception.
2019-12-05 10:43:55 -08:00
John Beard 1b124832fe QA: Remove deprecated boost headers
The test_case_template.hpp header is deprecated in Boost, and the
latest Boost version is now throwing warnings during the build.

In Boost 1.59 (at least), this header is included transitively by the main
Boost test header, so this header is not needed by any supported Boost
version.
2019-12-05 18:19:40 +01:00
Jeff Young 342c8941b5 More cleanup of dialog_find-base.fbp 2019-11-30 01:00:16 +00:00
Fabien Corona 5d3e6e3d44 pcbnew: search options
-Add a "wrap" option->Search results implemented as a nested list.
-Allow to go back with a "Find previous" button
-Remove the marker search option
-Fix a DLIST issue
-Add a result counter ("eg: hit(s): 1/3")
-Search history limited to 10
-Fix the search history order
-User can include or exclude references/values/texts from results

Fixes: lp:1845460
* https://bugs.launchpad.net/kicad/+bug/1845460
2019-11-29 17:55:01 +00:00
John Beard 1b1e514544 QA: Move to a self-registering plugin system for QA utils
This means that utility programs no longer have to be manually
added to the COMBINED_UTILITY, they self-register their
information at static init time. This is basically the same concept
as the Boost test registration.

All utilities need to do now is register their UTILITY_PROGRAM info
struct with the UTILITY_REGISTRY::Register method. No headers required.
2019-11-25 15:38:21 +08:00
Jeff Young 65e5adcd19 Update tests to match 2-space indenting.
(The indenting was changed from 4 spaces per level to 2 in order
to better match eeschema's netlist output and pcbnew's board file
output.)
2019-11-10 11:43:52 +00:00
jean-pierre charras d0f498dd10 Fix missing function in qa_utils 2019-10-05 14:03:02 +02:00
Ian McInerney b33c3a5ad8 pcbnew: Clean up extension handling in graphics plugins
* Fix wildcard display in the file selector dialog (on GTK
  it would show the regex to the user)
* Move the file extension comparison into a common function
2019-10-04 15:43:29 -04:00
Jeff Young d080c928a7 Fix up python test for new comment signatures.
Fixes: lp:1793148
* https://bugs.launchpad.net/kicad/+bug/1793148
2019-08-23 00:56:08 +01:00
Jeff Young a6b7d4f7f6 Support 9 comments in the page setting GUI.
Fixes: lp:1793148
* https://bugs.launchpad.net/kicad/+bug/1793148
2019-08-21 20:34:01 +01:00
Seth Hillbrand 5151cd0bfe C++14: Remove unused make_unique.h
Also removes header references now that we are in C++14, this is
built-in to the std
2019-08-07 09:27:31 -07:00
Jeff Young 3904d7ccfc Push some search stuff down into EDA_DRAW_FRAME so it can be shared.
Also rewrites the PCBNew Find dialog to make use of the above, including:
1) searching in user-defined footprint fields
2) searching in pcb text
3) a history list in the search popup
4) case sensitive searching
5) word sensitive searching
6) the ability to turn wildcard searching on/off
7) better placement of the result when the dialog obscures part of the
window

Fixes: lp:1838006
* https://bugs.launchpad.net/kicad/+bug/1838006
2019-07-26 17:53:32 -06:00
Simon Richter c8c3e1f96a Fix build order for generated headers and sources
This changes make_lexer() so that it no longer generates a custom target
but instead attaches the generated files to an existing one (so the first
argument now is the name of an existing library or executable, and it needs
to come after the add_library/add_executable call).

The generated source is no longer listed in the project sources, as it is
added by the function. The files are generated in the build tree rather
than the source tree, and the directory is added to the include path for
the respective project as well as exported to projects linking against it.

Generated files in subdirectories are somewhat supported, but need to be
referenced with the same name as they were generated (i.e. including the
subdirectory name).

Fixes: lp:1831643
* https://bugs.launchpad.net/kicad/+bug/1831643

Fixes: lp:1832357
* https://bugs.launchpad.net/kicad/+bug/1832357

Fixes: lp:1833851
* https://bugs.launchpad.net/kicad/+bug/1833851
2019-07-03 09:36:40 -04:00
Jeff Young 9effd24f3a Allow move tool to run on top of other tools.
Fixes: lp:1784480
* https://bugs.launchpad.net/kicad/+bug/1784480
2019-07-01 22:15:25 +01:00
Seth Hillbrand 172542cfc4 Enforce build order with qa system
The QA objects link to the direct kiface objects, which creates a second
dependency on the generated lexer files.  To ensure that the primary
apps are finished building them in a (potentially) different thread, we
set a false dependency on the final build product in the qa CMake.

Fixes: lp:1833851
* https://bugs.launchpad.net/kicad/+bug/1833851
2019-06-23 12:52:20 -07:00
Seth Hillbrand 1956c074ba Fix import graphics routines and tests
The returns of KiCad file extensions on GTK contain basic regex matching
case-insensitive file extensions.  We need to match these in the
provider and tests
2019-06-17 14:59:39 -07:00
Jeff Young e6d5110ccf Implement I18N for ACTIONs.
It's a bit of a hack because they're statically initialized and
so we can't make use of the _() macro.  We do still want it in the
code, however, because the string harvesting is based off of it.

Fixes: lp:1833000
* https://bugs.launchpad.net/kicad/+bug/1833000
2019-06-17 10:45:23 +01:00
John Beard 781c5f7e1d Remove SCOPED_TIMER, use PROF_COUNTER
SCOPED_TIMER is a QA-only simpler version of PROF_COUNTER.

Extend PROF_COUNTER to allow access to the std::chrono::duration
for more flexibility.

Wrap PROF_COUNTER in SCOPED_PROF_COUNTER for RAII duration
output (for the same effect as SCOPED_TIMER).
2019-06-12 14:16:47 +01:00
Jeff Young 5e49517781 Move hotkeys to ACTION architecture. 2019-06-10 23:46:00 +01:00
Jeff Young 765606012f Convert separate-compilation of selection.cpp to polymorphism. 2019-06-10 23:46:00 +01:00
John Beard 7ebda0247f Common: Remove legacy_gal library, fold into common
Return the EDA_DRAW_FRAME class back to common, whence it came (before it was
duplicated into legacy_wx and legacy_gal). Now there is only one
implementation (the GAL one), it doesn't need to be in a separate library.

This simplifies the dependencies for common lib users.
2019-06-10 18:56:57 +01:00
Jeff Young 9f1e2e34b7 Move some dupicated tools to common tools. 2019-06-03 21:08:30 +01:00
Seth Hillbrand 95ab0b1813 pcbnew: Hide dynamic ratsnest after canceling edit
The dynamic ratsnest is shown while moving items but this needs to be
hidden after cancelling.  Previously this was handled by the
SelectionClear event but we've changed this to (correctly) keep the
previous selection when canceling.

Fixes: lp:1831350
* https://bugs.launchpad.net/kicad/+bug/1831350
2019-06-02 20:25:02 -07:00
Seth Hillbrand 6a45446496 pcbnew: Remove the last dlist from modules/pcbnew 2019-06-01 20:55:32 -07:00
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand 888c01d11b pcbnew: Move tracks to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand 961b22d603 pcbnew: Changing drawings from dlist to std::deque 2019-06-01 09:51:57 -07:00
Jeff Young c2662b0e11 Retire EDA_DRAW_PANEL and legacy_wx/EDA_DRAW_FRAME. 2019-05-31 21:55:30 +01:00
Jeff Young d6e9bdf07b Convert remaining legacy drawing code to print code. 2019-05-31 21:54:22 +01:00
John Beard 2ec4ceffbd Reinstate "QA: Tweak boost print helper macro""
This reverts commit 3afea91088.

This was actually not the issue, even though it seemed to trigger the
issue.
2019-05-24 13:23:51 +01:00
John Beard a88ac393bb QA: Remove helper function
The InOutString function is not really useful, in most cases it can
be done more simple with string operator+. This function is causing
issues on MSVC (perhaps the template param names) anyway.
2019-05-24 13:23:51 +01:00
John Beard 3afea91088 Revert "QA: Tweak boost print helper macro"
This reverts commit 593b7cd6a1.

This causes breakage on MSVC. I am not sure sure why, but
this is not that important, so just back it out.
2019-05-23 23:31:03 +01:00
John Beard 2c55091a74 QA: Adjust bitmap test bitmap
For some reason, older WXs on Linux (e.g. Ubuntu 16.04) would
segfault on loading the 4-tile test image. Change one tile to
a circle to fix this (presumably an old and fixed image library
function).
2019-05-23 18:59:20 +01:00
John Beard 2dd5757eb5 Common: Fix copy-construction of empty BITMAP_BASE
The bitmap pointer is not checked at copy construct. This is
an instant segfault if you copy an empty bitmap.

Fix the constructor and remove the expected test failure, from the
previous commit.
2019-05-23 16:58:08 +01:00
John Beard d642ac39ae Common: Bitmap base: catch copy segfault
Copying an empty image is not checked for nullity,
so it will segfault. Introduce a test for this case,
for fixing as a follow-up.
2019-05-23 16:58:08 +01:00
John Beard 94b46ce176 QA common: add some BITMAP_BASE tests
Also:

* Init wx image handlers for qa_common
* Break out COLOR4D test predicates
* Fix some bitmap_base.h headers/forwards
2019-05-23 15:19:51 +01:00
John Beard 593b7cd6a1 QA: Tweak boost print helper macro
By making the caller use the "namespace" keyword, the formatter
is given the right indentation hints.

Also makes it clearer synatactically. One day, this will be a
namespace alias (needs GCC 7).
2019-05-23 14:37:35 +01:00
John Beard 840e08fa78 QA eeschema: add some tests
This adds a few tests on:

* LIB_PART
* SCH_PIN
* SCH_SHEET
* SCH_SHEET_PATH

These tests exercise some of the basic code paths in these classes
and show some of the expected behaviours.

None of these tests are particularly ground-breaking, but they
provide a starting point to build out further tests, and to ensure
the already-covered behaviour is stable.

It does expose some places where SCH_SHEET could probably use const.
2019-05-23 11:29:28 +01:00
John Beard 0617bffce0 Eeschema: build with object libraries
This is done to allow access to the eeschema library
internals for purposes of test and script access, as the
DLL library has highly restrictive -fvisibility settings
that otherwise prevent the tests being able to access 99.9%
of the eeschema library functions (only a single function
is APIEXPORT'ed, therefore that's the only test we can do).

Using object libraries is a bit of a hack, and makes for
a slower link when done for multiple targets, but with the currently
supported CMake versions, it's about as good as we can get.

A better solution in the longer term may be to break eeschema_kiface(_objects)
into many smaller libraries, each of which has a much more defined scope,
rather than one big interlinked amorphous lump. This has the advantage that
each module is testable in isolation, and we get better organisation of
inter-dependencies in the codebase.

Then, the kiface DLL will gather these sub-libs and present what
is needed on the visible DLL API. Thus, we get both a testable
suite of library functions, and a restricted kiface DLL interface.
2019-05-23 11:29:28 +01:00
Seth Hillbrand ddc6079ceb Move remaining hard-coded segment counts
This removes the remaining hard-coded segments counts and replaces them
with the relative error calculation where the segments per arc is
determined by the maximum error we allow (smaller arcs = fewer segments)
2019-05-16 08:49:55 -07:00
John Beard 0eb8f92c69 Pcbnew: add a step field to the array tool
This is useful, for example, when arraying only one side
of a connector.

Fixes: lp:1809580
* https://bugs.launchpad.net/kicad/+bug/1809580
2019-05-16 11:20:52 +01:00
John Beard 2c1b970027 Arrays: isolate axis code in a new class
Remove the axis numbering code from ARRAY_OPTIONS
and place in a new class, ARRAY_AXIS. This keeps
the logic for the array item numbering separate from
the logic for the array item geometry.

This simplifies the logic in the ARRAY_OPTIONS class, which
no longer has to deal with the numbering of each axis.
2019-05-16 11:20:52 +01:00
Jeff Young f602ccd814 Insert EE_TOOL_BASE under SchEdit and LibEdit tools, and fix errant rename scope which clobbered PCBNew's PICKER_TOOL. 2019-05-12 13:47:08 +01:00
Jeff Young ea0941cab3 Implement modern tools for LibEdit. 2019-05-10 16:11:57 +01:00
Jeff Young ed0e6af66d Move to direct tool registration.
It was confusing that the primary frames registered their tools
differently than the other frames.  In addition, since the other
frames also added their own tools, foo_actions::RegisterAllTools()
didn't really register all tool but rather those used by the
principal frame (PCB_EDIT_FRAME, SCH_EDIT_FRAME, etc.)
2019-05-05 17:14:30 +01:00
John Beard d89d0e6b74 SHAPE_ARC: Fix bug introduced in 5813164d1.
This fixes the bug exposed in the previous commit.
The tests which exposed it now pass and expected failures
removed.
2019-04-25 23:49:42 +01:00
John Beard 183f4fe9a5 SHAPE_ARC: Expose bug introduced by 5813164d1 in tests
The angle needs to be added to the start angle.

Add tests to cover this:

* Check end point is correct
* Check midpoints are within tolerance

This would have prevented the bug fixed in 5813164d1,
as well as the bug fixed in this commit.

As well as failed tests, this manifests when routing across
Edge.Cuts arcs (unless they happen to start at 0 degrees
staritng angle).

Expose as expected failure to prove tests catch it.
Fix to follow in separate commit.
2019-04-25 23:49:42 +01:00
John Beard f4ba3cd910 QA: Add build-time option to enable XML output from tests
This allows CI tools to get machine-readable test reports.

By default, this is off - when you test normally, you probably
want the regular console spew.

Boost tests use the in-built Boost test command line options.

The Python tests take an --xml parameter and output the tests
there.
2019-04-18 10:59:06 +01:00
John Beard 4214437d18 QA: Only build kicad2step tests if the lib exists
If neither OCC or OCE is available, the kicad2step_lib
target is not created, so the unit tests also cannot
be built. Detect missing libs and abort the test
target creation in that case.

Reverts (and fixes): 3a8ffd66c
2019-04-18 10:13:17 +01:00
Jeff Young 3a8ffd66ca Disable kicad2step test until compile issues are fixed.
(Is this perhaps because I don't have OCE enabled so the main
kicad2step files aren't being built?)
2019-04-17 23:59:10 +01:00
John Beard 45aa514591 QA: Allow to build tests manually if disabled
Add a new CMake target, qa_all, which builds all
tests, tools and their deps.

Then, when KICAD_BUILD_QA_TESTS is set OFF, remove tests
and tools from the ALL target, so `make all` doesn't include
these builds.

This means even when you turn the KICAD_BUILD_QA_TESTS option
off, you still have the option to:

* Build individual tests: `make qa_pcbnew`
* Build all tests: `make qa_all_tests`
* Build all tools: `make qa_all_tools`
* Build all QA executables: `make qa_all`

This also will provide a place to hang extra logic for test routine
wrangling (e.g. by CI tools)

Update the "Compiling KiCad" dev docs.

Also, CMakeModules .cmake files should not be excluded from git
2019-04-17 18:00:40 +01:00
John Beard c5effadb2a QA: Fix OPT::has_value error
boost::optional doesn't always have has_value, but it does always
have the bool operator.
2019-04-17 13:20:11 +01:00
John Beard 371149756d QA: Remove expected failure from fixed tests
Commit 55fcbddde8 fixed a couple of
failures in the SHAPE_POLY_SET tests, so these no longer
need the expected failure markers.
2019-04-17 11:47:42 +01:00
John Beard e312e2b286 SHAPE_ARC: fix polyline conversion when radius=0
Prevent a divide-by-zero bug in SHAPE_ARC::ConvertToPolyline.

When the radius is zero, just use the initial angle (it makes
no different anyway, the result is the centre point, which is
the start point.
2019-04-17 10:52:56 +01:00
John Beard ce84c19a38 QA: Test arc to polylines - this has a bug
Add unit test of SHAPE_ARC::ConvertToPolyline.

This function has a bug when the arc is of zero radius. This
test shows the bug, but does not fix it yet.
2019-04-17 10:52:56 +01:00
John Beard 427f0aed78 QA sexpr: add a common_tool to parse sexpr files
This allows to feed any data directly into the sexpr parser. This can be
used for:

* Benchmarking, profiling and optimisation
* Fuzz testing
* Debugging

As an example, it demonstrates that a 15MB kicad PCB file (the CIAA
motherboard project) takes 1.5s to parse, and uses 140MB of heap
allocation within the Parse() method (using Valgrind massif).
2019-04-17 10:52:56 +01:00
John Beard 4bd661add7 QA: Add test on GetLayerName function
This adds a test to the recent GetLayerName function, and moves
it to the base.h file for re-use for any code that needs a
layer name.

This test covers the case that caused lp:1824750 [1].

[1]: https://bugs.launchpad.net/kicad/+bug/1824750
2019-04-17 10:52:56 +01:00
John Beard 03214b5dea Sexpr/QA: Split out the sexpr classes into a reusable lib and test
The SEXPR class is a useful general-purpose S-Expression library
class and can (maybe) be used else where. It also should get
test coverage, as even if noone else uses it, it's critical for the
kicad2step exporter.

Also add some test coverage for some kicad2step routines. For now,
they're not useful outside kicad2step, but they are at least a useful
reference for S-Expression parsing.
2019-04-17 10:52:56 +01:00
Seth Hillbrand 2a00fc962b Fix error in contour check
Correct mistake in bool() that prevented checking correct contour for
end of vertex list.
2019-04-16 20:21:04 -07:00
Seth Hillbrand 9c00a7a5c3 Add missing header to qa 2019-04-08 12:33:49 -07:00
John Beard dd17f24c04 Libeval: consistent formatting for NaN
On some platforms like MSVC, NaN prints as "-nan(ind)". This
is a bit needlessly ugly, so print "NaN" on all platforms
consistently.

This fixes a test failure on MSVC.
2019-04-08 16:27:45 +01:00
John Beard 3f32dc9a64 QA: numeric evaluator: add a context to tests
This allows a failing test to report which case failed more clearly.

Add a quick helper to make an "in -> out" context string.
2019-04-08 15:56:19 +01:00
John Beard 9e240db80c QA: Use own unit test headers for eagle test
These include the appropriate "polyfills" for things like
Boost versions.
2019-04-02 23:32:00 +01:00
John Beard 88faac309f QA: Eagle test: look up test data in the source tree
Also provide a utility function to get this path, and
a way to override at run time to quickly sub in alternative
data.

The test itself is still broken, as this plugin won't accept
a call to Load() without a KiWay.
2019-04-02 18:26:33 +01:00
John Beard 4eb30f6b85 QA: Enable eeschema tests
Redesignate the eagle test as eeschema tests and build
more like the other unit tests.

Enable as a test in Ctest now that the test executes without
crashing.

The loading of the file with the hardocded part is still
not enabled, as this needs more infrastructure to support it.
2019-04-02 18:26:33 +01:00