Commit Graph

517 Commits

Author SHA1 Message Date
Chris Hennes
c00bf075e5 Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Weston Schmidt
87a4ce2e8d Add test causing crash and fix map sorting function. (#22889)
* Add test causing crash and fix map sorting function.

When opening a model from FreeCAD 0.7, the model would crash when I
changed some of the parameters.  This turned out to be due to the
ElementNameComparator::operator() not correctly sorting the items going
into the map, which caused the map to be invalid.

This change adds a test that represented the exact names causing the
crash as well as a fix for the problem.  Names are now sorted:

1. Empty names first
2. Identifier based names second.
3. Hex based names last.

Identifiers are sorted lexicographically for the name portion and
numerically for the number portion, smallest to largest.

Hex based names are sorted by the value of the hex number, smallest to
largest.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint issues.

* Add another test form to the mix.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-05 14:07:02 -05:00
Ladislav Michl
9f87add8cc Base: UnitsSchema: use basic imperial conversion constants
Use well defined basic constants for conversion of imperial units.
This makes code hopefully easily readable and verificable.
2025-09-05 17:31:55 +02:00
Ladislav Michl
fa98e178d1 Base: add back Imperial for Civil Engineering unit conversions
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-09-05 17:31:54 +02:00
Ladislav Michl
a5f039dd6a Base: QuantityFormat: avoid storing formatting defaults
User defined precision and fractional inch are stored on QuantityFormat
construction making changes persistent to object life time.
Change that so until not explicitely overriden, user defined values
are always returned.

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-09-05 17:31:54 +02:00
Chris Hennes
0206ebc1e3 Merge pull request #23503 from maxwxyz/issue-22123
Fix STEP import with bad string behavior
2025-08-31 23:23:25 -05:00
Chris Hennes
3ecdde8491 Base: Allow all valid Python 3 identifier characters
Note: Does not check for keywords, only character classes (not a change from the original code).
2025-08-31 21:39:49 +02:00
wmayer
a8c41df171 Test: Add test cases for Persistence::validateXMLString 2025-08-31 14:38:25 +02:00
Chris Hennes
fa98beb221 App: refactor to use unique_ptr
Also address other reviewer comments.
2025-08-27 11:51:22 -05:00
Chris Hennes
bce7ff8708 App: Add directory versioning for data and config
At the application level, support the existence of subdirectories inside
the original config and data paths for a specific version of the
software. For a new installation, create them, but for an existing
installation use the most recent available version, even if it's not the
current one (and even if it's not versioned at all). Any migration must
be done at the GUI level due to the amount of data that is potentially
being copied during that process.
2025-08-27 11:51:22 -05:00
PaddleStroke
679a072a4a PartDesign: Extrude 2 sides (#21794)
* PartDesign: extrude 2 sides

* Part: OpCodes XOR

* PartDesign: Remove deprecated generatePrism functions

* PartDesign: Extrude : Update Sides combobox strings

* Change "Sides" to "Mode"

* Use OpCodes::Extrude instead of Prism.
2025-08-25 17:17:23 +00:00
wmayer
96f6b6ce3c Tests: Add test case for ReaderOBJ 2025-08-25 18:13:59 +02:00
Chris Hennes
867708c3c0 App: Remove use of dangerous localtime() function 2025-08-18 17:44:34 +02:00
Kacper Donat
da03225f3b Gui: Add ParameterDefinition to Style Parameters
This adds a way to define parameters within code, that allows developers
to easily encapsulate the parameters and their default values.
2025-08-12 22:04:23 +02:00
Kacper Donat
bf856a1076 Gui: Make StyleParameterManager::resolve return optional result
This changes the resolve method of style parameter manager to return
optional intead of definitive result. In reality tokens may not be
defioned correctly and optionals provide a good way to nicely handle
defaults.
2025-08-12 22:04:23 +02:00
Kacper Donat
8072dcac34 Gui: Rename StyleParameters::Length to StyleParameters::Numeric
This change gives a better name to the parameter type that is used to
store numeric values. Before it was called length, but it can store
other quantities as well so the name is no longer fitting.
2025-08-12 21:25:41 +02:00
Kacper Donat
7e97d7fe5e Gui: StyleParameters - use Base::Color instead of QColor
If possible we should prefer using our own classess instead of ones
coming from frameworks. This changes Style Parameters to use Base::Color
class instead of QColor. Calculations are still done using QColor but
the data is always exposed as Base::Color.
2025-08-12 21:25:41 +02:00
Chris Hennes
dd4a477dce Merge pull request #22788 from pieterhijma/fix-func-expr-simplify
Core: Fix expression function simplify
2025-08-12 11:07:44 -05:00
Pieter Hijma
cc710ab71b Core: Add test for a prop rename with expression 2025-08-08 17:09:49 +02:00
Frank David Martínez M
d4c38502d8 [Core] Add Boolean Functions to expressions (AND, OR, NOT) (#22506)
* [Core] Add Boolean Functions to expressions (AND, OR, BOOL, NOT)

* [Core] Add `if` function to expressions to overcome ternary operator limitations

* [Core] Update expressions grammar to recognize relational operations as arguments

* [Core] The `if` function has been removed as no consensus was reached regarding its convenience or necessity. Its inclusion was considered potentially confusing or redundant.

* [Core] Make boolean cast based on Confusion threshold.
2025-08-05 03:50:13 +00:00
Chris Hennes
766a0eb835 Tests: Add tests for timestamp-based backups 2025-08-04 17:51:15 +02:00
Pieter Hijma
de17a4a820 Core: Add tests for expression simplify and eval 2025-08-04 16:51:11 +02:00
Chris Hennes
2259b8bf92 Tests: Save/restore Materials user prefs 2025-07-23 19:26:20 -05:00
Chris Hennes
216900bd5d Tests: Ensure tests use a fixture that inits app 2025-07-23 19:26:14 -05:00
tomate44
163a4a4a2d Part: Feature Offset2D fix #22563 2025-07-22 20:40:51 -05:00
Benjamin Nauck
8e871ca06f Sketcher: Add tests for ensuring accessing works for both old and new api 2025-07-21 18:03:14 +02:00
Chris Hennes
fd14f657e6 Merge pull request #22227 from kadet1090/refactor-tool-hints
Sketcher: Refactor Tool Hints
2025-07-20 12:05:15 -05:00
Chris Hennes
a89b4b76a0 Tests: Add tests for 'Standard' backup policy (#22566)
* Tests: Add tests for 'Standard' backup policy

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-20 00:34:07 +02:00
Kacper Donat
d9b4e25664 Gui: Add standardized HintsTable for InputHints
Input hints in various DrawSketchHandler were implemented independently
using declarative mechanism with searching over lookup table. This
results in a lot of duplicated code, this commit will create generic
mechanisms that can be used to replace them.
2025-07-19 10:05:08 +02:00
Benjamin Nauck
a071d8a808 Merge pull request #21995 from chennes/moveBackupPolicy
Extract BackupPolicy class into its own file to facilitate automated testing
2025-07-12 17:58:14 +02:00
FEA-eng
393edbcb3e Part: Enable solid creation by default for Loft and Sweep (#22098)
* Part: Update PartFeatures.cpp

* Part: Update DlgRevolution.ui

* Part: Update TaskLoft.ui

* Part: Update TaskSweep.ui

* Part: Update PartFeatures.cpp

* Update src/Mod/Part/Gui/DlgRevolution.ui

---------

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
2025-07-07 17:46:19 +02:00
Kacper Donat
8d3f41059f Gui: Add ThemeTokenManager class to contain theme parameters
This class aims to implement Design Token idea into FreeCAD themes. It
allows themes to use generic variables with generic values so we could
use one qss theme and change the style based on values from preference
packs.
2025-07-07 00:07:31 +02:00
Pieter Hijma
82aad7c104 Core: Fix property rename test 2025-07-02 15:36:56 -05:00
Chris Hennes
406ba22aa2 Merge pull request #21975 from pieterhijma/transaction-rename-property
Core: Add redo/undo to property rename
2025-06-30 10:36:26 -05:00
Pieter Hijma
c373c437ad Core: Add tests for undo/redo property rename 2025-06-16 17:58:33 +02:00
wmayer
13232cbc7b Base: Simplify Base::Matrix4D
As discussed in https://forum.freecad.org/viewtopic.php?t=65959 reduce code duplications
2025-06-16 10:05:43 +02:00
Chris Hennes
98eee8a563 Tests: Refactor tests with better names, etc.
The basic tests now run on Windows correctly without needing to manually
copy any files -- the executables are output in the same location as the
necessary DLLs. However, tests that require *.pyd files (all code in the
Mod subdirectory, basically) still do not work on Windows as the test
executables cannot find those files. This is a work in progress.
2025-06-15 17:31:19 -05:00
Chris Hennes
376b162239 Tests: Add test framework for BackupPolicy 2025-06-15 10:34:09 -05:00
bofdahof
2e0df80e84 Base: Units: refactor
Refactor Units making it constexpr, immutable, with repetition reduced.
Separate data from code.

Constexpr constructed units allow constructing predefined Quantities
from predefined unit types.
2025-06-03 09:31:38 +02:00
Ladislav Michl
a0917bcc7c Base: Units: introduce unit one
Dimensionless quantities have all exponents equal to zero.
Such quantities are simply numbers. The associated unit is
the unit one, symbol 1, although this is rarely explicitly
written.

See chapter 2.3.3 Dimensions of quantities, The International
System of Units, 9th edition.
2025-06-03 09:31:38 +02:00
Ladislav Michl
0c9584ab2d Base: Quantity: use isDimensionless whenever feasible
Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
2025-06-03 09:31:38 +02:00
wmayer
7c1ae09b7d Test: Add further test cases for quantities 2025-06-03 09:31:38 +02:00
wmayer
1830707464 Test: Add test case for UnitsSchemaMeterDecimal 2025-06-03 08:16:18 +02:00
David Carter
8b9f576538 Materials: Pass by reference instead of pointers
Refactoring topass by reference instead of using existing pointers.
2025-06-02 11:32:08 -05:00
Pieter Hijma
f114ad7afa Spreadsheet: Add tests for rename property 2025-05-26 18:11:27 +02:00
Pieter Hijma
3dde0c0480 Core: Add tests for renaming dynamic properties 2025-05-26 18:11:27 +02:00
Benjamin Nauck
0dc1e7f7ba Base: Add more tests for imperial building special function 2025-05-20 12:34:00 +02:00
Benjamin Nauck
d618efe2e7 Base: Skip test for units using GTEST_SKIP() instead of comments 2025-05-20 12:34:00 +02:00
bofdahof
d4a031583f Base: restore output format of imperial fraction units
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-19 12:15:51 +02:00
Chris Hennes
283d68aa2d Sketcher tests: Silence compiler warning with cast 2025-05-15 18:49:08 +02:00