81 Commits

Author SHA1 Message Date
Mark Roszko
03b3b642b0 Another qa header fix 2025-09-04 21:33:27 -04:00
Mark Roszko
4254673be5 Fix windows build, missing wx header 2025-09-04 19:54:21 -04:00
Seth Hillbrand
9ffb0c8b96 wxString explicit conv 2025-09-04 14:57:16 -07:00
Seth Hillbrand
a857ea77d9 ADDED: Text expression evaluation
Arbitrary text strings now support full evaluation with a rich
functional language

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6643
2025-09-04 14:57:16 -07:00
Seth Hillbrand
77a2330a33 Fix QA result based on updated behavior 2025-08-31 15:52:38 -07:00
Seth Hillbrand
4af585c531 Revert "Remove the forced ancillary grid"
This reverts commit 29dc45d584a882866f2f3f27a7257481043ecc84.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21535
2025-08-31 07:54:12 -07:00
Alex Shvartzkop
1dc278488d REPORTER's HasMessage indicates that any message got reported, not stored. 2025-08-23 00:24:58 +03:00
Jeff Young
6f389fd320 Tighten parent/child undo/redo architecture.
Always look for pre-existing undo/redo record.  Checking for IsNew()
is less robust and should be avoided.  Also moves the checking to a
location where it will be easier to ensure that it's uniform.

Push get-undo-level-item processing down a level so it is uniformly
called.

Make sure tables & labels are uniformly handled.

Remove incorrect usage of Get/SetGroupId() for storing lastPin
(which we don't use anyway).

Lists of deleted and changed items MUST include the screen pointer.
An item could be changed on one screen but not on another.

Also tightens handling of PCB_NETINFO_T items, which are not in the
view.

Also fixes a bug where there is no increment parameter if you assign
the base increment command to a hotkey.
(This was discovered while testing the above changes.)

Also fixes a bug where delete during a move in PCB Editor did an
undo instead of a delete.
(Again, found while testing above.)

An experiment was also run to collapse shared parts of SCH_EDIT_FRAME
and SYMBOL_EDITOR_FRAME into SCH_BASE_EDIT_FRAME.  However, sharing the
undo code actually increased complexity, and there was very little else
of value in SCH_BASE_EDIT_FRAME (other than the Increment() routines).
2025-08-18 19:20:09 +01:00
John Beard
c5d5a718aa Altium: handle '.var' concatenated special strings
The ST MB2046 reference board, for example, has all the
assembly-layer ref-des text in the format '.R42' even though
they're not concatenated.

Enable the existing but commented-out text.
2025-08-16 05:51:12 +08:00
Seth Hillbrand
58c9893a3f Add QA for COMMMIT/SCH_COMMIT/BOARD_COMMIT 2025-08-08 21:28:54 -07:00
jean-pierre charras
d7cf008397 Try to fix a QA test. 2025-08-06 16:20:55 +02:00
Seth Hillbrand
29eee9f126 Refactor grid_helper to allow testing
Make view and tool manager optional so that we can implement QA on the
actual snapping
2025-08-05 16:10:17 -07:00
Seth Hillbrand
321b5793a2 Add some QA tests
Created basic tests for:
- Notification Manager
- Clipboard
- File history
- Filename Resolver
- Hotkey store
- Collector
- Reporters
2025-08-04 11:36:43 -07:00
Seth Hillbrand
43a9c760b1 Add some QA tests for FILE_HISTORY, SEARCH_PATH and FILENAME_RESOLVER 2025-08-04 09:59:30 -07:00
Seth Hillbrand
bf16dcfbe8 Make all windows remember their preferences
Hook into DIALOG_SHIM to remember stylistic preferences for windows such
as position, size, sash position, notebook selection, etc.

Dialogs and controls can opt out of this by setting a client data user
property "persist" to false.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19992

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10756

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21108
2025-08-03 20:22:30 -07:00
Seth Hillbrand
11d0bb466b ADDED: PROPERTY_HOLDER class
Useful for attaching arbitrary properties to userdata
2025-08-03 20:22:30 -07:00
jean-pierre charras
82ea895ed9 Fix qa test compil issue due to my previous (e1c56c71) commit 2025-08-03 17:10:29 +02:00
Mark Roszko
1ab8a5944b Add tiny test for IsCopperLayerLowerThan 2025-07-06 11:10:39 -04:00
Michal Suchanek
df33ec79f7 test_ki_any: Add missing cstdint include
This is probably pulled in by some of the other includes for some build
configurations, but not always.
2025-05-11 15:50:10 +00:00
John Beard
4c8b971021 Eeschema: Symbol editor: pin table CSV interchange
This adds the ability to export the pin table content to a CSV file
or the clipboard as CSV, then re-import it from CSV or TSV. This allows:

* to round-trip pin table data via a spreadsheet program, so that the pin
  data can be manipulated in a richer/more familiar editing environment
* an import method to bring in tabular pin data from other formats
  "semi-automatically", without having to write a full-blown symbol generator.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19207
2025-05-03 23:22:35 +08:00
Jeff Young
9856cb2210 An arbitrary layer flip can not be done without the board.
(User-defined layers can be sided or not.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20169
2025-03-05 17:59:22 +00:00
Jeff Young
f951497a4f Code brevity. 2025-03-01 21:58:31 +00:00
Jeff Young
5edae8250d Finish eradication of visibility flag on text items.
Import/read previously-hidden symbol/footprint
text items as hidden fields.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19875
2025-02-19 23:43:52 +00:00
Jeff Young
2a1b93a254 Fix bugs in library existence checking, and add for symbol libs. 2025-02-19 23:43:52 +00:00
John Beard
30affcd7a1 QA: side-step wxSize printer not working for some
Not sure what it is that caused it to break (reported by
Seth on Linux, but works for me and on the CI).

Rather than trying to be clever at this point, just do the dumb
thing (and remove the boost_test_print_type for wxSize to prevent
someone using it for the time being).
2025-02-01 00:35:13 +08:00
John Beard
636c6c4efb Eeschema/pcbnew: fix pasted image saving
The m_imageData buffer in the BITMAP_BASE is an
internal implementation - the public API to persist the
data to a stream appears to be SaveImageData - so use that,
which hides the implementation (and generates the image data
"live" when needed).

Remove the public access to the m_imageData buffer as it isn't
needed for public use, and also is misleading.

Also break out the formatting of the data into KICAD_FORMAT,
as it's currently replicated in eeschema/pcb/pagelayout
formatting code.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19772
2025-01-31 23:01:07 +08:00
Seth Hillbrand
6c2a559cbe Set base user layer count
Default colors cycle through repetition for unknown layers.  Allows
importing from complex Altium/CADSTAR boards with more than 10
documentation layers
2025-01-28 12:22:39 -08:00
Jon Evans
975fe32fa7 Add a mechanism for using a mock config dir for QA tests 2025-01-18 13:40:38 -05:00
jean-pierre charras
7243281756 QA test: ensure qa_common uses the "C" locale to convert doubles to strings. 2025-01-17 15:44:04 +01:00
Seth Hillbrand
452e69de85 Move thread pool into true singleton
Thread pool needs to be stored in a single location for all of KiCad
otherwise each kiface will spin up its own pool of persistent threads
2025-01-09 09:03:08 -08:00
JamesJCode
7e1d10a019 Remove ill-formed ki_any test 2025-01-07 00:37:06 +00:00
Marek Roszko
02b3d03c23 Fix ctest for windows with env shim that is disabled for non windows, for now.
Also stuff a dummy fontconfig file to silence the dumb error on stdout, which interferes with testing
2025-01-04 22:08:58 -05:00
Jon Evans
722ffa1c66 Update magic_enum to v0.9.7 2025-01-04 13:40:11 -05:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
JamesJCode
5ff21f9c2d Add ki::any and ki::any_cast for any_casts across translation units
ki::any is a standards-compliant implementation, based on the GCC
standard library. However, it uses type_info::hash_code() to check
the validitiy of a ki:any_cast, rather than comparing the type_info
objects directly. This comparison, used in the standard
implementations, is fragile across translation unit boundaries when
built with Clang.
2024-12-27 17:28:27 +00:00
Jon Evans
603c793f7e Fix off-by-one in LSET::Flip
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19265
2024-12-08 08:26:40 -05:00
John Beard
ed9e66399e Pcbnew: negative layers are not copper layers, even or not
UNDEFINED_LAYER is -2, so simple checking evenness isn't
enough to check if it's copper or not. Notciable when the
FABMASTER import puts things on UNDEFINED_LAYER while it's
processing items.
2024-11-28 04:36:12 +08:00
Alex Shvartzkop
0581423d50 Show failing strings in HTMLEscape test. 2024-10-30 09:38:18 +03:00
Alex Shvartzkop
19af37a143 Fix/improve HTML unescape function.
Also adds some tests.

(cherry picked from commit 6ae334a7517f41498f395004444b8fbb5423ce17)
2024-10-30 08:24:43 +03:00
John Beard
2c2ff64911 Allow incrementing different parts of strings with modifiers
Primary increment is the right most bit, secondary is the next
rightmost. So you can increment 'A1' to 'A2' or 'B1' with
Shift-Alt-Scroll and Ctrl-Alt-Scroll respectively.
2024-10-26 16:01:07 +08:00
John Beard
215533f31a Unify flip direction handling
There was a gentle mish-mash of booleans, some with
true being left/right and some up/down, and some functions that
can flip in both axes (which is never actually done, and doesn't
really make geometric sense).

Replace all this with the FLIP_DIRECTION enum class, which makes
the intention completely unambiguous.

This also then allows a small scattering of simplifications,
because everything takes the same type and you don't have to
fiddle booleans to fit.
2024-09-27 17:13:13 +01:00
John Beard
653d85f9fc Abstract LIB_TABLE IO to allow non-file-based tables
Mostly intended right now for allowing testing of library tables
to help with testing chained loading, but it also decouples the
idea of a library table from on-disk files in general.

All current (real) lib table implementations continue to use the
file-based IO.

This could be made more general (not just for tables) if really
needed.
2024-09-19 06:35:43 +01:00
John Beard
f47d9edf2e KIID: add test that the hashes do change 2024-09-08 22:42:30 +01:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Seth Hillbrand
5ba50c26a9 Update embedded files hash to use Murmur3
SHA256 is fine for one-offs but for large libraries where we might be
running the hash on hundreds of files, the speed difference is
appreciable.  We don't require crytographic hashing, just a check that
the original file hasn't been corrupted so Murmur3 satisfies our basic
requirement.
2024-09-06 09:57:23 -07:00
Marek Roszko
b101c1a0c3 Enum class ELEM. 2024-08-18 21:09:37 -04:00
Marek Roszko
58e3c5bb6b Rename Type() to ProjectElementType() for _ELEM children 2024-08-18 20:30:45 -04:00
John Beard
5b772dde13 QA: Use modern Boost test print customisation point
Since Boost 1.64, you can use the boost_test_print_type
customisation point to provide test printing for types.
Move all test printing functions to this, and scrap the
fiddly Boost version handling to deal with older Boosts
(KiCad is now at minver 1.71).
2024-08-14 11:24:26 +01:00
Seth Hillbrand
433677fc21 Replace std::lexicographical_compare_three_way
On platforms that don't yet support the std:: version, we implement our
own, possibly slower, version of the 3-way compare
2024-07-24 18:03:29 +02:00
Alex Shvartzkop
5f5e54f3d8 Fix QA for 60-bit LSET. 2024-07-23 21:50:04 +03:00