* 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>
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>
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.
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.
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.
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.
* [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.
* 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>
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.
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.
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.
Refactor Units making it constexpr, immutable, with repetition reduced.
Separate data from code.
Constexpr constructed units allow constructing predefined Quantities
from predefined unit types.
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.
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.