Files
create/src/Mod/Draft/drafttests
Roy-043 5b98a762d1 Draft: Improve layer functions
The current make_layer function has a `None` default for the shape color and the line color. With that value the current preference is used. This, and how the function is called, results in some confusing behaviors:
* Newly created layers will only use 2 values from the preferences when they might use 5. The latter makes more sense for the end-user IMO.
* Layers created during DXF import (for example) will have a different shape color depending on the current preferences.
* The make_layer function may reapply colors that have already been set by the view provider.

To solve this all view property related function parameter have been changed to a not None value. If a None value is supplied the view property as set by the view provider is not changed. The Layer Manager has been updated accordingly.
I realize that calling a function with 6 None values is not very convenient, but think it is the solution that is least likely to break other exiting code.

Additionally:
* Removed the makeLayer function. Layers were introduced in V0.19 when the naming scheme was changed to "make_*". Maybe it was created by mistake, or before the actual renaming operation started, but it is safe to remove it now.
* Removed overly verbose messages.
* gui_layers.py had a missing import (result of a previous V0.22 PR): `from draftutils import utils`.
2024-01-22 11:29:13 -06:00
..

General

2020 May

These files provide the unit tests classes based on the standard Python unittest module.

These files should be imported from the main TestDraft.py and TestDraftGui.py modules which are registered in the program in Init.py and InitGui.py depending on if they require the graphical interface or not.

Each module should define a class derived from unittest.TestCase, and the individual methods of the class correspond to the individual unit tests which try a specific function in the workbench.

The tests should be callable from the terminal.

# All tests that don't require the graphical interface
program --console -t TestDraft

# Only creation tests
program --console -t drafttests.test_creation

# A specific test inside a module and class
program --console -t drafttests.test_creation.DraftCreation.test_line

Where program is the name of the FreeCAD executable.

Most tests should be designed to pass even without the graphical interface, meaning that they should run in console mode.

The exception to this are particular tests that explicitly use the graphical interface.

# All tests that require the graphical interface
program -t TestDraftGui

For more information see the thread: New unit tests for Draft Workbench

To do

Not every single function in the workbench is tested, so new unit tests can be written. This will improve reliability of the workbench, making it easier to discover bugs and regressions.

See the individual modules to check what is missing.

In particular, unit tests for the import and export modules (SVG, DXF, DWG) are required.