Should help finding regressions in modifier related UI operations and UI
drawing.
This test:
1. Creates test objects of different types (Mesh, Curve, Grease Pencil,
Lattice, Volume, Armature).
2. Adds all available modifiers to the objects dynamically.
3. Switches the Properties editor to the Modifiers tab for each object
type and redraws.
4. Adds all available constraints to the objects and bones.
5. Switches the Properties editor to the Constraints tab and redraws.
Pull Request: https://projects.blender.org/blender/blender/pulls/161642
Command line overrides now define the default "Trusted Source"
for drop and the file-selector.
This is done so the default matches the behavior of opening
files in contexts where the option to trust source isn't shown.
"Recover Last Session" run without setting "use_scripts"
(from Python for e.g.) now disables auto-execution
unless a command line override is passed in,
as the path being recovered isn't known until the file is read.
This includes a refactor & tests.
Details:
- `bpy.path.is_autoexec(..., skip_overrides=False)`:
Can be used to check if the current environment would trust a file.
- Expose: `bpy.app.autoexec_override`,
set when `--enable-autoexec` & `--disable-autoexec` are passed in.
- `BKE_autoexec_default_trust_source`:
new function to more conveniently access the default trust for a file.
- Show when "Auto Run Python Scripts" preference is overridden.
- Add tests for the file selector, dropping & the command line.
Ref !163894
This adds UI tests for the Info Editor report functionality to improve
automated coverage of report-related operators and settings.
Tests cover report selection/deselection, deletion and operator polling
to ensure Info Editor operators are available in the expected context.
Pull Request: https://projects.blender.org/blender/blender/pulls/161091
Open a blend file from a trusted & an excluded directory using the file
selector & the popup shown when dropping a file, checking
bpy.app.autoexec once the file is open.
Dropping can't be simulated yet, so bind the drop operator to a key.
Ref !163785
This adds a more generalized way to operators to activate text buttons in
regions; this first tries to activate the text button in the region, and
if it fails it tags to rebuild the layout so there is a second chance to
the button to become available for activation.
This refactors how some operators activate text buttons, most of them
assumed the button were visible, and others immediately redrew the
region so the buttons can be made available. This instead makes the
button activation part of the block layout build.
This will affect Preferences, Properties, Space Text and Outliner.
Pull Request: https://projects.blender.org/blender/blender/pulls/161477
The test opens the Preferences window, switches through every value of
``preferences.active_section``, expands dynamic sections like Add-ons,
and yields after each change so the UI can redraw.
This lets us find UI errors in the many navigation sections of the
Preferences.
Pull Request: https://projects.blender.org/blender/blender/pulls/161693
---------
Co-authored-by: Pratik Borhade <25420+pratikpb2123@noreply.localhost>
Tests for Blender's drop handler system across the 3D Viewport, UI,
Scene, Window, and File Browser.
Does not cover OS-level drag and drop. Blender's `EVT_DROP` events are
generated internally by the window manager and cannot be produced
through `event_simulate`. As a result, these tests do not simulate the
complete physical workflow of dragging data from an external application
or the operating system into Blender.
Instead, the tests invoke the registered drop operators directly through
their `exec` or `invoke`-related paths and provide the context and drop
properties that Blender's internal drop handlers would normally supply.
This allows the tests to validate the drop-handler behavior and
resulting state changes while remaining deterministic and independent of
OS-level drag-and-drop support. Where an operator requires
cursor-position information from the actual drop event, the tests are
limited to verifying registration or poll behavior rather than
reproducing the complete interaction.
Pull Request: https://projects.blender.org/blender/blender/pulls/162949
- Add a regression test verifying operator search respects poll() and
only exposes an operator when its poll condition is satisfied.
- Add a poll sweep test that checks registered operators across
supported editor types and verifies poll() always returns a `bool`
without raising exceptions.
- Add a `poll_sweep()` helper that reuses a single area while switching
editor types and runs each operator's `poll()` under the
appropriate window, area, and region context.
Pull Request: https://projects.blender.org/blender/blender/pulls/162764
Editor initialization by dynamically constructing a grid layout,
iterating through all settable editor variants, applying editor-specific
modes/subtypes, and validating successful initialization of each editor
instance.
These tests already proved themselves useful, we already found and fixed
a number of issues during development.
Pull Request: https://projects.blender.org/blender/blender/pulls/158780
Address a long standing limitation with undo: where edit-mode often
prevented edits in other areas from being tracked by undo.
Allows properties in the object/scene to be adjusted while in edit-mode
supporting undo for both edit-mode and global undo steps to co-exist.
Details:
- This works by encoding undo with a "hint"
that the change includes MEMFILE undo changes.
- This hint can be created from property edits -
where we know which kind of property is being edited.
- It can also be calculated before adding a generic undo step,
to check if other data needs a global undo step
(editing a scene or object while in edit-mode for e.g.).
- The undo system checks for this hint and adds a hidden "pre"
MEMFILE undo step in these cases
(the initial MEMFILE undo step is already done at times,
we make use of that).
- Eventually the mode-specific undo step creation can be skipped,
this has been left out as it's a larger change which impacts
each undo system.
- Added tests to support mixing edit-mode mesh and 3d text
with MEMFILE undo.
- When pushing undo steps a check for changes outside
the mode is performed (in parallel, per ID type),
in my own tests the ID scanning overhead is negligible,
even on heavy files.
Resolves: #50423, #75013, #153282.
Ref !161566
Entering Edit Mode on a mesh with shape keys could copy the final
mesh component after it had already been shared with the edit cage.
The generic component copy did not preserve all
runtime state required by the Edit Mode BMesh wrapper.
The copied final result was subsequently handled by
`MeshRenderData` through the regular `MeshExtractType::Mesh` path,
as though it were an array-backed mesh.
Viewport extraction then attempted to access mesh arrays that
were not available and asserted in `Mesh::faces()`.
Assign the evaluated shape key before sharing the final mesh
component with either the explicit or fallback cage. In Object Mode,
retrieve the final mesh pointer after potential writable
access so copy-on-write cannot leave a stale pointer.
Also add an undo test that would have caught this regression.
Ref !161986
The Sequencer Compositor modifier UI checked whether the node group had
at least one interface input before accessing the second input used for
the optional mask.
A node group with exactly one input therefore caused an out-of-bounds
access when an ID mask was assigned and the Strip Modifiers panel was
redrawn.
Require at least two interface inputs before validating the mask input.
Pull Request: https://projects.blender.org/blender/blender/pulls/162031
Activates all tools in the 3D view, sequencer, node editor and image
editor. This can help finding regressions in tool activation, drawing
code or other related code.
Note that the sequencer test fails on Windows AMD64 Intel buildbot
workers. This same failure is already present in another test and seems
related to either a driver issue or the GPU module.
Pull Request: https://projects.blender.org/blender/blender/pulls/161585
This adds a `WindowManager::try_activate_rna_button` method for
activating RNA buttons with an specific state (only `Highlight`,
`WaitKeyEvent`,`NumEditing`, `TextEditing` are support by now) and
returns the center point of the button in window coordinates when
successfully activated (or just highlighted). Any other active button
would be deactivated when activating a button.
This also adds tests for text buttons interactions.
Note: `Ctrl + mouse wheel up/down` string value cycling was not tested
since is not supported in side panels.
Pull Request: https://projects.blender.org/blender/blender/pulls/152910
Avoid comparing against exact numbers for gesture based tools, as there
may be slight differences in the viewport based on movement and initial
positioning that make these test too flakey to compare for exact values.
Pull Request: https://projects.blender.org/blender/blender/pulls/161925
RenderStats::infostr can legitimately be null for render-stat updates
that only refresh timing and UI information.
The Python render stats callback added in f7aeda7c0f forwarded this
null value to BKE_callback_exec_string, causing a crash during
animation rendering when a bpy.app.handlers.render_stats handler was
registered.
Skip Python callback dispatch when no render stats string is available.
This matches the existing behavior of the background render callback and
avoids generating an artificial empty-string event.
Pull Request: https://projects.blender.org/blender/blender/pulls/161786
Particle Edit undo restored its mode by calling
`ED_object_particle_edit_mode_enter_ex()` directly.
When the undo step was decoded while Texture Paint was active, the
previous mode was not exited first. Since Particle Edit mode entry adds
its mode bit with `|=`, the object ended up with the invalid combined
mode `48` (`TEXTURE_PAINT | PARTICLE_EDIT`).
Exit the current mode through its normal lifecycle before restoring
Particle Edit, following the same pattern used by sculpt undo.
Files that were already saved with mode `48` crashed during editor
initialization because `object_mode_op_string()` returned `nullptr`.
Unsupported saved modes are now rejected safely, leaving the object in
Object Mode while preserving its particle and hair data so the file can
be resaved.
Pull Request: https://projects.blender.org/blender/blender/pulls/161542
These tests validate pie menu interactions triggered through simulated
keyboard + cursor drag events across several editors and modes.
This should help find plenty of regressions as it covers a lot of cases
touching many modules.
Covers pies in the 3D View, Graph Editor, Dope Sheet, Sequencer, NLA,
Image Editor, File Browser, Node Editor and Clip Editor.
Pull Request: https://projects.blender.org/blender/blender/pulls/160761
Unregistered classes could be still referenced in active popups and as
soon they get focused they will likely crash after trying to access
freed data.
This avoid any crash by refreshing any active popup when a class
is unregistered, if the popup can't be refreshed and is referencing
the class to be unregistered it will be closed instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/157524
These tend to break when there are bugs somewhere else, as such they are
a good case to cover in higher level testing.
Rather than testing the quick effects themselves (like, testing that
they do exactly the right thing), just make sure that adding them
doesn't crash, and does roughly the right thing.
When building without fluids support, the Quick Liquid and Quick Smoke
tests won't run, but print an error. I think that is better than
failing, because it's common to build without these and the failures
would be annoying.
Pull Request: https://projects.blender.org/blender/blender/pulls/156808
This commit introduces a new `WM_event_handling_break` API, that allows
some code executed during event handling (e.g. operators etc.) to
request the `WM_main` main event loop to stop processing the event
queues and to do a full loop (including redraw step) before resuming
handling of the events.
`test_undo.py` undo tests had to be modified to add a small delay when
batch-triggering undo/redo events, to give Blender enough time to
process all the relevant events and reach the expected state.
Co-authored-by: Campbell Barton <ideasman42@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/156375
This commit exposes the Add Mesh tools of Object and Edit Mode to
Sculpt Mode.
This functionality only works when Multires or Dyntopo are disabled.
At a high level, the mesh drawn by the gizmo in the 3D viewport is
created as a `BMesh`, converted to a `Mesh`, and then joined to the
existing geometry.
No new functionality or defaults are changed compared to the existing
tools. Further changes are planned for future PRs.
Addresses the first point of #149216
Pull Request: https://projects.blender.org/blender/blender/pulls/152856
Adds basic tests for the following types of operations:
* Hide
* Mask
* Face Set
* Trim
With the following types of gesture / selection modes:
* Box
* Lasso
* Line
Note that "Polyline" is not explicitly tested for now, since it is
primarily a form of the lasso tool that requires clicks to define the
area.
A new helper method is also added to `ui_test_utils.py` for drawing
the path of a circle.
Pull Request: https://projects.blender.org/blender/blender/pulls/153790
This commit adds the environment variable
`BLENDER_TEST_IGNORE_VENDOR_BLOCKLIST` to the GTest and Python tests.
In contrast to `BLENDER_TEST_IGNORE_BLOCKLIST`, this only ignores the
blocklists for tests that are blocked for individual hardware vendors.
When a test fails in Blender due to driver issues, the test is blocked
for the hardware vendor until a fixed driver is available for the CI
workers. This means that hardware vendors need to manually remove the
blocklists when they check the state of test failures.
The new environment variable gives an easy option to also run these
tests in case where seeing these failures (but not general failures,
e.g., due to issues in Blender) is preferrable.
Pull Request: https://projects.blender.org/blender/blender/pulls/153549
This PR adds separate Vulkan backend tests for Storm Hydra/USD and UI.
The new tests are called:
- storm_hydra_[backend]_*
- storm_usd_[backend]_*
- ui_[backend]_*
The Vulkan tests are not yet enabled by default due to open issues.
For enabling them, the CMake options WITH_STORM_TESTS_VULKAN and
WITH_UI_TESTS_VULKAN can be turned on.
Pull Request: https://projects.blender.org/blender/blender/pulls/149142
* Cycles and EEVEE 3D viewport rendering while adding and deleting
objects, undo and redo, assigning and unassigning materials,
and editign shader nodes.
* Final animation render and viewport animation render, and check
that animation player launches without errors.
These do not verify that the resulting render is correct, but should
at least catch 3D viewport rendering and animation player crashes
that slipped through recently.
Pull Request: https://projects.blender.org/blender/blender/pulls/153159
* Some functions were copied between tests, now import a common
module for these.
* Merge _test_vars and _test_window into a single function, and
use the window index instead of excluding windows.
* Rename idle_until to not be a hack, and explain that it can be
used for testing operator jobs while keeping the disclaimer that
it should not typically be used.
Pull Request: https://projects.blender.org/blender/blender/pulls/153159
This test exercises a common pair of mask operations in sculpt mode, a
dense mesh is created, the sculpt expand operator is used to mask a
region starting from the center, and then this region is inverted.
Pull Request: https://projects.blender.org/blender/blender/pulls/151875
When in Texture Paint mode or in the image editor, certain actions do
not push undo steps (e.g. changing the active texture) that users would
expect. Additionally, some actions that *do* push undo steps (e.g.
changing face selection) have no effect when undone.
To fix the former, remove the code preventing property changes from
pushing undo steps while in Texture Paint mode.
To fix the latter, remove the poll function from `image_undo.cc`. This
prevents global undo steps from being tagged as image undo steps.
This works because the `poll` function is only needed when creating the
undo step to identify steps that do not have a `step_init` defined.
This is similar to, but notably different from !139871:
Image Undo (and Sculpt Undo) store deltas encoded as part of the undo
step and require explicit tagging of the begin and end state (see
`ED_image_undo_push_begin` and `ED_image_undo_push_end`). This allows
us to use memfile undo in the general case and image undo when
explicitly requested, avoiding the memory concerns of the previously
linked PR.
Addresses: #69346, #62520, #71895
Pull Request: https://projects.blender.org/blender/blender/pulls/151399