← Back to team overview

kicad-developers team mailing list archive

[RFC] pcbnew internals refactoring for testing

 

Hi all,

Here's a patch set [1] that refactors some internal PCBnew stuff (mostly
GAL & tool framework related), focusing on testability. The goal is to
be able to use the BOARD class, GAL view and tools without the
GUI-related code for the purpose of developing automated tests and
easier development of new tools, which could be then tested outside
pcbnew environment.


The changes include:
- replaced boost::optional with leaner STL-based implementation
- replace CLASS_MIRE with CLASS_PCB_TARGET for naming clarity
- implemented SELECTION_TOOL's own GetCollectorsGuide() to avoid
dependency on PCB_BASE_FRAME
- implemented BOARD-specific view Add()/Remove()/Update() methods in
PCB_VIEW, moved to libpcbcommon
- split BOARD_ITEM::SwapData to use polymorphic per-item methods
- remove PNS router dependency on PCB_EDIT_FRAME
- make BOARD_COMMIT independent from pcbnew
- remove link-time dependency between PCB_BASE_FRAME and EDA_3D_VIEWER
- allow to run TOOL_MANAGER and SELECTION_TOOL without a host wxFrame
- moved BOARD_COMMIT, PCB_GENERAL_SETTINGS and
TransformShapeWithClearanceToPolygon() to libpcbcommon
- replaced manual plugin registration with link-time plugin binding
- derive PCB-specific PCB_VIEW from VIEW with the intention of moving
PCB_EDIT_FRAME entries used by the tools (e.g. GetActiveLayer) there
- renamed pcbstruct.h to pcb_display_options.h,
DISPLAY_OPTIONS->PCB_DISPLAY_OPTIONS
- removed dependency of libpcbcommon on 3d-viewer.

After these changes, one can use a PCB GAL canvas with any GAL tools in
a simple test program. I included an example in qa/pcb_test_window.
I'm considering this approach for the development of eeschema's GAL
support: - factoring out schematic model code independent from
eeschema's current GUI
- implement sch painter/view
- implement the tools
- merge when done.

Let me know what you think about these patches (test builds will be
greatly appreciated!). I would like to merge them as soon as possible to
avoid tedious rebasing.

Cheers
Tom

[1] https://github.com/twlostow/kicad-dev/tree/tom-refactor-oct31-rebase


Follow ups