Commit Graph

313 Commits

Author SHA1 Message Date
Sean Kim
f77b1e871d Tests: Add UI tests that verify loading all default workspaces
While individual modes have UI tests related to undo, this new set of
tests in this new file is intended to be a set of very broad sanity
tests that catch the most egregious errors that cause crashing on start
up, whether due to python errors, UI rendering issues, or otherwise.

Running these tests takes approximately 4 seconds currently as it adds
and verifies the loading of each of the workspaces available "out of
the box" to a blender user.

Pull Request: https://projects.blender.org/blender/blender/pulls/139318
2025-06-12 20:27:38 +02:00
Sean Kim
98739b6b53 Tests: Add Sculpt tests that verify each brush strength curve preset
This commit adds 9 tests that check each of the default brush curve
strength preset options to ensure that none of them cause NaN
propagation. In total this takes approximately 0.7s to run to run.

By design, these tests are very broad and are not a replacement for
other testing, but they should help in reducing the chance of potential
regressions.

Related to #140162

Pull Request: https://projects.blender.org/blender/blender/pulls/140242
2025-06-12 06:26:05 +02:00
Alaska
e71a1bbf70 Tests: Allow OptiX to run tests in the OSL folder
In the render test suite there is an OSL folder that contains tests that
need OSL to function.

Previously due to some missed logic, the OptiX OSL test suite would not run
tests in that folder because part of the test code assumed that if you aren't
testing on a CPU, then your device doesn't support OSL.

This commit fixes this issue.

Along with this change, some logic was changed in preparation for allowing
OptiX OSL camera tests to run without OSL shading enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/139433
2025-06-03 14:46:32 +02:00
Sean Kim
de454c3329 Tests: Add dyntopo brush stroke and toggle undo test
Tests that mixing dyntopo and normal mesh sculpting works as well as
manually toggling dyntopo on and off while undoing / redoing.

Pull Request: https://projects.blender.org/blender/blender/pulls/139315
2025-05-27 17:44:28 +02:00
Sean Kim
f6abef2aaf Tests: Add undo test for Sculpt trim tool
For Sculpt Undo, certain operators will modify the topology count of the
mesh. These operators are handled separately from normal brush strokes,
and so having tests for an operator that uses this functionality is
beneficial in detecting regressions.

Pull Request: https://projects.blender.org/blender/blender/pulls/139249
2025-05-22 05:48:07 +02:00
Alaska
1c1e2f1371 Fix: Render test failures when building without fluid modifier
When building Blender WITH_MOD_FLUID=OFF, the OpenVDB render tests
would fail as some of them make use of the WITH_MOD_FLUID features.

This commit fixes this by disabling OpenVDB render tests unless
WITH_MOD_FLUID is active.

Pull Request: https://projects.blender.org/blender/blender/pulls/138728
2025-05-13 05:07:45 +02:00
Jacques Lucke
18365a88bd Geometry Nodes: initial Import node regression tests
This adds some basic tests for the Import OBJ/STL/PLY nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138700
2025-05-10 07:24:33 +02:00
Sergey Sharybin
bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00
Clément Foucault
877abbe9f7 Cleanup: EEVEE: Remove next from EEVEE-Next from tests suite
It makes no sense to keep this suffix now that eevee-next is default.

Pull Request: https://projects.blender.org/blender/blender/pulls/138271
2025-05-01 17:54:22 +02:00
Jesse Yurkovich
ba60868477 USD: Animated camera property import
Imports in the following animated data from UsdGeomCameras:
- Focal length
- DOF distance
- DOF fstop
- Clip start, Clip end
- Tilt shift x, Tilt shift y
- Aperture sizes (with caveats)

Implementation wise, it's more complicated than I'd like due to needing
to read in both non-animated and animated data for each property. And
because I've tried to reduce the duplication of various transforms we
have to do on each value. E.g. scaling values by "tenth of scene units"
or the extraction of the USD clipping range from a GfVec2f into 2
separate properties, and 2 separate fcurves, in Blender etc. The current
approach was the best I could come up with so far.

Aperture sizes remain problematic for import, with animation data and
without, due to how Blender selects the largest sensor dimension to base
downstream calculations on and for which there's no concept in USD to
strictly dictate which dimension to use. Additionally, changing the
sensor size will impact the Tilt values as well. This means that if the
Aperture sizes are animated, we must also animate the tilt values; leads
to more fcurves being created than perhaps expected.

The `projection` attribute (perspective and orthographic) remains
unchanged (non animated only) due to differences in how USD<>Blender
interoperate with the Orthographic projection method. Note: Blender only
exports perspective cameras due to the same reason.

Pull Request: https://projects.blender.org/blender/blender/pulls/137487
2025-04-25 19:57:12 +02:00
Sean Kim
e27be7cfc6 CMake: Rename and expose 'USE_EXPERIMENTAL_TESTS' option
The `USE_EXPERIMENTAL_TESTS` variable was not exposed as an option, so
the two tests that use the option to check whether tests should be run
had to be manually enabled by changing `tests/python/CMakeLists.txt`.

This commit renames the variable to `WITH_TESTS_EXPERIMENTAL`, defaults
the option to `OFF`, and marks it as an advanced option.

Pull Request: https://projects.blender.org/blender/blender/pulls/133831
2025-04-24 06:11:30 +02:00
Clément Foucault
dde18802a5 GPU: Remove WITH_GPU_RENDER_TESTS_SILENT option
This was introduced during EEVEE-next developement
cycle to not make the buildbot fail because of EEVEE
render tests.

These have stabilized now and we can remove this option.

Pull Request: https://projects.blender.org/blender/blender/pulls/137545
2025-04-15 17:56:16 +02:00
Jacques Lucke
c11055c1cf Geometry Nodes: enable closure regression tests
Some special care had to be taken because these tests require an experimental
feature to be turned on to work.

Pull Request: https://projects.blender.org/blender/blender/pulls/137414
2025-04-13 13:55:23 +02:00
Sean Kim
898e6f3687 Paint: Ensure brushes are loaded when requested while in background mode
Depending on internal details of how Blender is run, attempting to load
elements from the asset library may either execute as synchronous &
blocking or asynchronously.

When executing a script in background mode, prior to this commit,
operators that are dependent on the asset system will not execute
correctly due to the loading not being complete.

Busy-waiting for this by repeatedly calling the operator over and over
again in python does not resolve. To match behavior of other operators
when called from python scripts such as the quadriflow remesh, this
commit changes the `brush.asset_activate` operator and dependent code to
force a blocking call instead of optionally using the wmJob background
abstraction system.

Related to #117399

Pull Request: https://projects.blender.org/blender/blender/pulls/134203
2025-04-10 22:09:06 +02:00
Brecht Van Lommel
4970bac061 Tests: Properly disable tests when data directory is missing
And clean up cmake output to be less verbose.
2025-04-07 16:29:14 +02:00
Campbell Barton
f48b4e3abf Cleanup: wrap long lines for CMake 2025-04-05 20:30:37 +11:00
Campbell Barton
f89cf19ba6 Cleanup: indentation for CMake files, strip trailing space 2025-04-02 03:01:59 +00:00
Christoph Lendenfeld
e4d3a52ed6 Anim: Unit Tests for baking code
No functional changes.

This patch adds unit tests for the animation baking code in `anim_utils.py`.
It is by no means exhaustive but it is a start to figure out what this function
is actually doing.
With the usage of the legacy python API I was worried things might not work as
expected but all added tests pass.
Also, the tests document the current behavior without any attempt of declaring
that behavior as good or correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/135583
2025-03-27 12:56:46 +01:00
Sean Kim
38870d17e6 Build: Allow UI tests to run locally on all platforms
This commit allows the `WITH_UI_TESTS` CMake option to be used on all
platforms, not only Linux. The existing functionality to use the Weston
compositor was moved into the `WITH_UI_TESTS_HEADLESS` option. When
these tests are run with only `WITH_UI_TESTS`, a visible instance of
Blender is opened up for testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/135889
2025-03-14 22:27:50 +01:00
Sean Kim
956a0fad80 Sculpt: Expose location parameter for sculpt.mask_by_color
Currently, there is no way to call the sculpt.mask_by_color operator
from the python API without simulating mouse events. This makes writing
python tests harder than it needs to be.

This commit does the following:
* Adds an exec callback for the mask_by_color operator.
* Adds new `location` property, an int array defined in region space
  coordinates to represent the mouse location.
* Extracts logic into a helper function so that the `invoke` and `exec`
  paths are functionally equivalent.

Pull Request: https://projects.blender.org/blender/blender/pulls/134964
2025-02-26 01:28:24 +01:00
Sean Kim
8fef9214a7 Tests: Move sculpting render tests out of WITH_GPU_RENDER_TESTS
Adds a new CMake option so that these tests can be run independently of
other tests, and so that existing tests that use WITH_GPU_RENDER_TESTS
are not forced to run these sculpt tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/134893
2025-02-21 20:31:57 +01:00
Miguel Pozo
9f003ee722 Merge branch 'blender-v4.4-release' 2025-02-20 17:21:53 +01:00
Miguel Pozo
ba3749ad47 Overlay: Add tests
This adds support for Overlay tests.

There are some differences with how we handle tests for other engines:
- The renders are captured using `bpy.ops.render.opengl()`, but this
  won't work on our GPU build bots.
- A single blend file can run multiple tests by outputting a txt list
  with the test names.
- Each overlay test blend file requires a matching script file with
  the same name inside `tests/python/overlay/`.
- To reproduce a specific test state you can run
  `blender "(...)/tests/data/overlay/<test>.blend" -P "(...)/tests/python/overlay/<test>.py" -- --test <test-number>`.

Note:
The current test permutations are WIP, so reference images are not
committed to the data repo for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/133879
2025-02-20 17:18:59 +01:00
Campbell Barton
5087246f39 Cleanup: strip trailing space, sort file lists 2025-02-16 20:42:16 +11:00
Habib Gahbiche
bf4af64809 Cleanup: Tests: remove unnecessary --gpu argument
Pull Request: https://projects.blender.org/blender/blender/pulls/134582
2025-02-14 18:02:31 +01:00
Habib Gahbiche
0db8710df7 Compositor: Regression tests for File Output Node
The patch adds a simple framework to test the File Output Node in the compositor. The main difference to the existing `render_test.py` framework is that multiple output images are supported. Edge cases such as empty output or too many outputs are supported as well.

Tests can be run like other compositor tests, e.g. `ctest -R compositor_cpu_file_output --verbose` or `BLENDER_TEST_UPDATE=1 ctest -R compositor_cpu_file_output` to update failing tests.

Sample output:
```
...
119: [ RUN      ] Running test single_color...
119: [  PASSED  ] Passed
119: [ RUN      ] Running test png_passes...
119: [  PASSED  ] Passed
119: [ RUN      ] Running test mixed...
119: [  FAILED  ] Test directory /home/guest/blender-git/blender/tests/data/compositor/file_output/mixed does not exist
119: [ RUN      ] Updating test mixed...
119: [ RUN      ] Running test no_files...
119: [  PASSED  ] Passed
...
```

Parent task: https://projects.blender.org/blender/blender/issues/125893

Pull Request: https://projects.blender.org/blender/blender/pulls/133663
2025-02-14 16:17:18 +01:00
Sean Kim
9d930c3b0f Tests: Add initial sculpt mesh render test
* Adds new entry into python CMakeLists.txt for running these tests
* Adds `sculpt_brush_render_tests.py` as the report runner and
  test data initializer for the sculpt tests.

This commit adds the ability to do render tests with the Draw brush in
Sculpt mode on a specified mesh by specifying and performing a stroke in
area-space coordinates.

Like other render tests, these tests map a single .blend file to a
single reference image. Currently we test the following cases:

* A "base" mesh.
* A mesh with a Subdiv modifier added but not applied to it.
* A mesh with a basis & relative shape key added.
* A mesh with the multiresolution modifier added.

The associated reference image used is 200x200 pixels, in testing
with the draw brush, even this small resolution was able to detect
differences in detail caused by major regressions.

In total, the new files in the associated assets repository sum up
to roughly 4.5 MB.

Other than the mesh and modifiers, each of the files also contains a
scene with a camera, with workbench settings set to use a matcap for
the final rendering to better highlight curvature differences.

Part of #130772

Pull Request: https://projects.blender.org/blender/blender/pulls/133602
2025-02-14 07:36:00 +01:00
Iliya Katueshenock
a6b394d23b Tests: Add attributes category for render tests
Pull Request: https://projects.blender.org/blender/blender/pulls/134306
2025-02-12 21:54:12 +01:00
Sean Kim
a2b75c87c8 Merge branch 'blender-v4.4-release' 2025-02-11 14:10:10 -08:00
Sean Kim
312579ce82 Fix #134366: object.closest_point_on_mesh always returns no result
Introduced in 024d7d12e2

Pull Request: https://projects.blender.org/blender/blender/pulls/134377
2025-02-11 23:09:20 +01:00
Bastien Montagne
4b996baa76 Merge branch 'blender-v4.4-release' 2025-02-10 14:16:47 +01:00
Sergey Sharybin
5437f22faf Fix unknown Cycles test device silently pass
Prevents situation when requested device is HIPRT (while the expected
spelling is HIP-RT).

Pull Request: https://projects.blender.org/blender/blender/pulls/134332
2025-02-10 14:13:42 +01:00
Habib Gahbiche
7a5de7143d Compositor: add test data for pixel nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/134323
2025-02-10 10:40:29 +01:00
Jeroen Bakker
78c6037741 Vulkan: Render and compositor tests
This PR does some changes to the render and compositor tests

- Compositor test will now test all GPU backends that are compiled
- EEVEE/Workbench render tests will move the GPU backend to the front of the
  test name (eevee_next_opengl_bsdf)
- Blacklist EEVEE render tests that fail on Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/133981
2025-02-06 14:39:15 +01:00
Christoph Lendenfeld
358a0479e8 Anim: create pose assets to different libraries
Similar to how brush assets are created and managed this
PR allows to export pose assets into a different library.
Because of this there is a limitation to this where each
asset is stored in a separate blend file.
This may be lifted in the future as there are planned changes in
the design phase: #122061

### Create Asset

Now available in the 3D viewport in the "Pose" menu: "Create Pose Asset".
The button in the Dope Sheet will now call this new operator as well.

Clicking either of those will open a popup in which you can:

* Choose the name of the asset, which library and catalog it goes into.
* Clicking "Create" will create a pose asset on disk in the given library.

It is possible to create files into an outside library or add it in the current file.
The latter option does a lot less since it basically just creates the
action and tags it as an asset.

If no Asset Shelf **AND** no Asset Browser is visible anywhere in Blender,
the Asset Shelf will be shown on the 3D viewport from which
the operator was called.

### Adjust Pose Asset

Right clicking a pose asset that has been created in the way described
before will have options to overwrite it.
Only the active object will be considered for updating a pose asset

Available Options (the latter 3 under the "Modify Pose Asset" submenu):
* Adjust Pose Asset: From the selected bones, update ONLY channels that
are also present in the asset. This is the default.
* Replace: Will completely replace the data in the Pose Asset from
the current selection
* Add: Adds the current selection to the Pose Asset. Any already existing
channels have their values updated
* Remove: Remove selected bones from the pose asset

Currently this refreshes the thumbnail. In the case of custom
thumbnails it might not be something want

### Deleting an existing Pose Asset

Right click on a Pose Asset and hit "Delete Pose Asset". Works in the shelf
and in the asset library. Doing so will pop up a confirmation dialog,
if confirming, the asset is gone forever. Deleting a local asset is basically the
same as clearing the asset. This is a bit confusing because you get
two options that basically do the same thing sometimes,
but "Delete" works in other cases as well.
I currently don't see a way around that.

Part of design #131840

Pull Request: https://projects.blender.org/blender/blender/pulls/132747
2025-02-04 11:29:05 +01:00
Sybren A. Stüvel
f97c54ff76 Anim: emit liboverride on slot handle when action is changed
Emit a 'diff' for the `animdata.slot_handle` property whenever the
`.action` property is changed through a library override.

The slot handle is only meaningful within the context of the assigned
action. So when a liboverride changes the assigned action, the slot
handle should also get an override.

This is necessary even when the numerical value of the slot handle
happens to be the same in both actions, as the newly chosen slot is
different from the slot that was chosen in the library file.

This applies to direct Action assignment, NLA strips, and Action
constraints.

Pull Request: https://projects.blender.org/blender/blender/pulls/133727
2025-01-31 15:43:34 +01:00
Sean Kim
0ca96421b9 Tests: Fix "opengl_draw" tests
The opengl_draw_tests.py render test had a number of issues when
running, likely due to test data restructuring:
* Invalid CMakeLists.txt specification preventing tests from being added
* Invalid parameters to the `screenshot` function

This commit fixes both issues as well as renames the related files and
folders to better indicate their usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/132838
2025-01-30 18:44:23 +01:00
Bastien Montagne
a3d9bdad6b Tests: Add simple script accessing (almost) all RNA properties.
Only runs on factory startup file, so not all possible paths are
covered. But should reduce likeliness of issues like #133551 in the
future.
2025-01-24 18:35:31 +01:00
Bastien Montagne
d251f8af30 Tests: Add 'with ASAN' knowledge to Linux release checks.
Builds with sanitizer will get addition asan/ubsan libraries linked in,
these need to be allowed in the static binaries check.

Pull Request: https://projects.blender.org/blender/blender/pulls/133319
2025-01-21 09:40:50 +01:00
Alaska
f85ff21ed0 Tests: Add render tests for texture nodes
Enable render tests in the `texture` folder.

Ref #123012
2025-01-19 00:52:22 +01:00
Bastien Montagne
7fb3179c1f Add tests for bpy.data.user_map.
These are based on data generated for liblink tests, so part of this
code is also refactored to move data generation into `bl_blendfile_utils.py`.

NOTE: Work done also to add tests to upcoming filepath mapping utils
(see !127252).

Pull Request: https://projects.blender.org/blender/blender/pulls/133110
2025-01-15 18:13:32 +01:00
Aras Pranckevicius
1ad083dabf Tests: Add FBX import tests, switch OBJ/PLY/STL import tests to the same machinery
"Expected textual data output" comparison based tests for FBX,
OBJ, PLY, STL import.

- There's a tests/python/modules/io_report.py that can produce
  a "fairly short text description of the scene" (meshes, objects,
  curves, cameras, lights, materials, armatures, actions, images).
  About each object, it lists some basic information (e.g. number
  of vertices in the mesh), plus a small slice of "data" (e.g.
  first few values of each mesh attribute).
    - Custom import parameters, if needed, can be provided by
      having a sidecar .json file next to imported file (same
      basename, json extension), that would have a single json
      object with custom arguments.
- Add FBX test coverage, with 46 fairly small files (total size 3.8MB)
  covering various possible cases (meshes, animations, materials,
  hierarchies, cameras, etc. etc.).
- Switch OBJ/PLY/STL import tests to the above machinery, remove C++
  testing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/132624
2025-01-15 05:52:15 +01:00
Bastien Montagne
4032b853c3 RNA: Add basic tests for the path_from_id() function.
Simply load factory startup file, and recursively iterate over
all (valid) `POINTER` and `COLLECTION` properties of all IDs.

NOTE: A few cases are currently returning invalid rna paths (at least
from quick look), these are skipped for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/132809
2025-01-09 16:46:37 +01:00
Campbell Barton
bea3b41fc2 Cleanup: remove disabled IO tests
These have been disabled for years, in general checking the checksum on
exported files is too fragile and isn't a practical way to test IO.
2025-01-06 12:43:14 +11:00
Campbell Barton
33e38c605f Cleanup: correct indentation for CMake files, strip trailing space 2025-01-03 13:23:38 +11:00
Bastien Montagne
2c9ab53273 Add 'system python' validation for some py scripts.
The goal of this test is to try to import some critical py scripts with the
system python of the building machine.
The main target is to ensure that these py scripts remain usable by all
buildbot machines, as some of them are using fairly outdated python
versions.

Current status:
* Scripts in `build_files` and `docs` are checked.
* Some python scripts in `build_files` were 'reverted' to be compatible
  with older required python version currently (3.6).
* A few scripts are excluded from the test, mostly because they use Blender's
  `bpy` module, which means they are only intended to be ran with Blender's
  python anyway.
* The test is only enabled for Linux buildbots currently, as they use the
  oldest Python by far.

Notes:
* Some more scripts are likely to be moved around in the future.
* Whether these tests need to be enabled on windows or macos platforms remains
  an open question.

Pull Request: https://projects.blender.org/blender/blender/pulls/130746
2024-12-24 11:55:29 +01:00
Omar Emara
d764fd7200 Compositor: Disable anisotropic filtering tests on GPU
This patch disables compositor tests that rely on anisotropic filtering
for GPU testing. This is done until we make sure they pass universally
by not relying on hardware filtering.

Test files that rely on anisotropic filtering were moved to their own
tests to be able to disable them for GPU only.
2024-12-19 17:44:10 +02:00
Omar Emara
2a53debc73 Cleanup: Rename COMPOSITOR_REALTIME to GPU_COMPOSITOR
Pull Request: https://projects.blender.org/blender/blender/pulls/132118
2024-12-19 14:39:55 +01:00
Omar Emara
b4230d84dc Compositor: Unify references between CPU and GPU tests
This patch removes the references for the GPU tests and uses the CPU
references for both CPU and GPU, since they are expected to match. This
also unifies the tests scripts into a single script with an argument
for execution device.
2024-12-19 14:35:20 +02:00
Jeroen Bakker
28ea90f127 GPU: Split GPU backend and Draw manager unit tests
Both the draw manager and gpu backend used the same compilation
directive for enablement. This PR seperates them into
`WITH_GPU_DRAW_TESTS` for draw manager related tests and
`WITH_GPU_BACKEND_TESTS` for gpu backend related tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/132018
2024-12-17 13:28:21 +01:00