Add Operator tests #84999

Open
opened 2021-01-23 20:12:17 +01:00 by Himanshi Kalra · 27 comments
Member

Introduction

This task tracks progress of regression tests for mesh operators. A regression takes a test mesh, applies an operator on it and compares the result with a reference mesh (typically called expected object).
Note: Multiple developers can work on this task after discussing with other subscribers/assignee for clarification.

Adding a new test

  1. Define the test case in the python file blender/tests/python/operators.py
  2. Create a test mesh and an expected mesh in lib/tests/modeling/operators.blend
  3. Make sure the test case can fail.
    The wiki explains the steps in much more details: Python Tests

Style Guidelines to Follow for the Blend file:

  • Collection Name should be same as Operator Name
  • Add tests in alphabetical order (Collection Names).
  • Keep the test objects in sync with respect to their relative alphabetical positioning between other objects.

Some examples:
D10218 (remove doubles)
22a8a3b214 (Deform tests)
8373f497b (Curve tests)

Test cases

First screening of operators can be find in this sheet link for insights.
Add new tests for operators from the list below, they can be accessed by bpy.ops.mesh in the python console in Blender. For documentation, please refer here

Operator Typical case Further cases Comments
average_normals D10865
beautify_fill D10865
bevel x tests are in bevel_regression.blend and bevel_operator.py
bisect x TODO: #87863 Add test case from the bug file itself
blend_from_shape x
bridge_edge_loops x
colors_reverse
colors_rotate
convex_hull D11200
customdata_custom_splitnormals_add
customdata_custom_splitnormals_clear
customdata_mask_clear
customdata_skin_add
customdata_skin_clear
decimate x
delete x delete Faces/Verts/Edges
delete_edgeloop x delete Verts/Edges
delete_loose x
dissolve_degenerate x
dissolve_edges x
dissolve_faces x
dissolve_limited D15187
dissolve_mode D15187
dissolve_verts x
dupli_extrude_cursor Requires user input, cannot test.
duplicate x
duplicate_move
edge_collapse
edge_face_add x
edge_rotate x
edge_split x
edgering_select Requires user input, cannot test.
edges_select_sharp D10400
extrude_context Requires user input, cannot test.
extrude_context_move Requires user input, cannot test.
extrude_edges_indiv Requires user input, cannot test.
extrude_edges_move Requires user input, cannot test.
extrude_faces_indiv Requires user input, cannot test.
extrude_faces_move Requires user input, cannot test.
extrude_region Requires user input, cannot test.
extrude_region_move Requires user input, cannot test.
extrude_region_shrink_fatten Requires user input, cannot test.
extrude_repeat Requires user input, cannot test.
extrude_vertices_move Requires user input, cannot test.
extrude_verts_indiv Requires user input, cannot test.
face_make_planar x
face_split_by_edges x
faces_mirror_uv
faces_select_linked_flat x
faces_shade_flat D10893 Not a real test, appearance can't be tested
faces_shade_smooth D10893 Not a real test, appearance can't be tested
fill x
fill_grid x
fill_holes x
flip_normals D11802
hide D11798
inset x
intersect x
intersect_boolean x x See boolean_operator.py
knife_project
knife_tool
loop_multi_select D10400
loop_select
loop_to_region
loopcut
loopcut_slide
mark_freestyle_edge
mark_freestyle_face
mark_seam D10893
mark_sharp
merge D11083
merge_normals D15187
mod_weighted_strength
normals_make_consistent
normals_tools
offset_edge_loops
offset_edge_loops_slide
paint_mask_extract
paint_mask_slice
point_normals
poke D11200
polybuild_delete_at_cursor
polybuild_dissolve_at_cursor
polybuild_extrude_at_cursor_move
polybuild_face_at_cursor
polybuild_face_at_cursor_move
polybuild_split_at_cursor
polybuild_split_at_cursor_move
polybuild_transform_at_cursor
polybuild_transform_at_cursor_move
quads_convert_to_tris
region_to_loop
remove_doubles D10218
reveal D10723 Operator does not change mesh
rip D11200
rip_edge
rip_edge_move
rip_move
screw
select_all D10400
select_axis Cannot be tested. Needs active vert selection
select_face_by_sides D10400
select_interior_faces D10400
select_less D10400
select_linked D10400
select_linked_pick Cannot be tested. Needs user input
select_loose D10839
select_mirror D10839
select_mode x Used by framework, so implicitly tested with all other operators
select_more D10839
select_next_item
select_non_manifold
select_nth D10893
select_prev_item
select_random
select_similar
select_similar_region
select_ungrouped
separate
set_normals_from_faces
shape_propagate_to_all
shortest_path_pick
shortest_path_select
smoothen_normals
solidify D11200
sort_elements D10865
spin D10865
split D11200
split_normals
subdivide D10865
subdivide_edgering D11798 Cannot be tested. Does not produce reproducible results
symmetrize D11083
symmetry_snap D11798
tris_convert_to_quads D11798
unsubdivide D10893 Added test cases for the bug #87259
uv_texture_add D11798
uv_texture_remove D11798
uvs_reverse D11798
uvs_rotate D11798
vert_connect D11200
vert_connect_concave D11798
vert_connect_nonplanar D11798
vert_connect_path D10893
vertex_color_add D11798
vertex_color_remove D11798
vertices_smooth D11200
vertices_smooth_laplacian D11798
wireframe D11798
## Introduction This task tracks progress of regression tests for mesh operators. A regression takes a test mesh, applies an operator on it and compares the result with a reference mesh (typically called expected object). **Note**: Multiple developers can work on this task after discussing with other subscribers/assignee for clarification. ## Adding a new test 1) Define the test case in the python file `blender/tests/python/operators.py` 2) Create a test mesh and an expected mesh in `lib/tests/modeling/operators.blend` 3) Make sure the test case can fail. The wiki explains the steps in much more details: [Python Tests ](https://wiki.blender.org/wiki/Tools/Tests) Style Guidelines to Follow for the Blend file: * Collection Name should be same as Operator Name * Add tests in alphabetical order (Collection Names). * Keep the test objects in sync with respect to their relative alphabetical positioning between other objects. **Some examples:** [D10218](https://archive.blender.org/developer/D10218) (remove doubles) 22a8a3b214 (Deform tests) 8373f497b (Curve tests) ## Test cases First screening of operators can be find in this sheet [link](https://docs.google.com/spreadsheets/d/10uSeZiZxvIq4PRMvv-6nmiyHH9UYxcUXf6vmCZQ0P7M/edit#gid=104937915) for insights. Add new tests for operators from the list below, they can be accessed by `bpy.ops.mesh` in the python console in Blender. For documentation, please refer [here ](https://docs.blender.org/api/current/bpy.ops.mesh.html) | Operator | Typical case | Further cases | Comments | -- | -- | -- | -- | |average_normals |[D10865](https://archive.blender.org/developer/D10865) | | | |beautify_fill |[D10865](https://archive.blender.org/developer/D10865) | | | |bevel |x| | tests are in `bevel_regression.blend` and `bevel_operator.py` | |bisect |x|TODO: #87863 Add test case from the bug file itself | | |blend_from_shape |x| | | |bridge_edge_loops |x| | | |colors_reverse | | | | |colors_rotate | | | | |convex_hull |[D11200](https://archive.blender.org/developer/D11200) | | | |customdata_custom_splitnormals_add | | | | |customdata_custom_splitnormals_clear | | | | |customdata_mask_clear | | | | |customdata_skin_add | | | | |customdata_skin_clear | | | | |decimate |x| | | |delete |x| delete Faces/Verts/Edges| | |delete_edgeloop |x| delete Verts/Edges| | |delete_loose |x| | | |dissolve_degenerate |x| | | |dissolve_edges |x| | | |dissolve_faces |x| | | |dissolve_limited | [D15187](https://archive.blender.org/developer/D15187) | | | |dissolve_mode | [D15187](https://archive.blender.org/developer/D15187) | | | |dissolve_verts |x| | | |dupli_extrude_cursor | | |Requires user input, cannot test. |duplicate |x| | | |duplicate_move | | | | |edge_collapse | | | | |edge_face_add |x| | | |edge_rotate |x| | | |edge_split |x| | | |edgering_select | | |Requires user input, cannot test. |edges_select_sharp |[D10400](https://archive.blender.org/developer/D10400) | | | |extrude_context | | |Requires user input, cannot test. |extrude_context_move | | |Requires user input, cannot test. |extrude_edges_indiv | | |Requires user input, cannot test. |extrude_edges_move | | |Requires user input, cannot test. |extrude_faces_indiv | | |Requires user input, cannot test. |extrude_faces_move | | |Requires user input, cannot test. |extrude_region | | |Requires user input, cannot test. |extrude_region_move | | |Requires user input, cannot test. |extrude_region_shrink_fatten | | |Requires user input, cannot test. |extrude_repeat | | |Requires user input, cannot test. |extrude_vertices_move | | |Requires user input, cannot test. |extrude_verts_indiv | | |Requires user input, cannot test. |face_make_planar |x| | | |face_split_by_edges |x| | | |faces_mirror_uv | | | | |faces_select_linked_flat |x| | | |faces_shade_flat |[D10893](https://archive.blender.org/developer/D10893) |Not a real test, appearance can't be tested | | |faces_shade_smooth |[D10893](https://archive.blender.org/developer/D10893) |Not a real test, appearance can't be tested | | |fill |x| | | |fill_grid |x| | | |fill_holes |x| | | |flip_normals |[D11802](https://archive.blender.org/developer/D11802) | | | |hide |[D11798](https://archive.blender.org/developer/D11798) | | | |inset |x| | | |intersect |x| | | |intersect_boolean |x|x| See `boolean_operator.py`| |knife_project | | | | |knife_tool | | | | |loop_multi_select |[D10400](https://archive.blender.org/developer/D10400) | | | |loop_select | | | | |loop_to_region | | | | |loopcut | | | | |loopcut_slide | | | | |mark_freestyle_edge | | | | |mark_freestyle_face | | | | |mark_seam |[D10893](https://archive.blender.org/developer/D10893) | | | |mark_sharp | | | | |merge |[D11083](https://archive.blender.org/developer/D11083) | | | |merge_normals | [D15187](https://archive.blender.org/developer/D15187) | | | |mod_weighted_strength | | | | |normals_make_consistent | | | | |normals_tools | | | | |offset_edge_loops | | | | |offset_edge_loops_slide | | | | |paint_mask_extract | | | | |paint_mask_slice | | | | |point_normals | | | | |poke |[D11200](https://archive.blender.org/developer/D11200) | | | |polybuild_delete_at_cursor | | | | |polybuild_dissolve_at_cursor | | | | |polybuild_extrude_at_cursor_move | | | | |polybuild_face_at_cursor | | | | |polybuild_face_at_cursor_move | | | | |polybuild_split_at_cursor | | | | |polybuild_split_at_cursor_move | | | | |polybuild_transform_at_cursor | | | | |polybuild_transform_at_cursor_move | | | | |quads_convert_to_tris | | | | |region_to_loop | | | | |remove_doubles |[D10218](https://archive.blender.org/developer/D10218) | | | |reveal |[D10723](https://archive.blender.org/developer/D10723) | | Operator does not change mesh | |rip | [D11200](https://archive.blender.org/developer/D11200)| | | |rip_edge | | | | |rip_edge_move | | | | |rip_move | | | | |screw | | | | |select_all |[D10400](https://archive.blender.org/developer/D10400) | | | |select_axis | | | Cannot be tested. Needs active vert selection | |select_face_by_sides |[D10400](https://archive.blender.org/developer/D10400) | | | |select_interior_faces |[D10400](https://archive.blender.org/developer/D10400) | | | |select_less |[D10400](https://archive.blender.org/developer/D10400) | | | |select_linked |[D10400](https://archive.blender.org/developer/D10400) | | | |select_linked_pick | | | Cannot be tested. Needs user input| |select_loose |[D10839](https://archive.blender.org/developer/D10839) | | | |select_mirror |[D10839](https://archive.blender.org/developer/D10839) | | | |select_mode |x | | Used by framework, so implicitly tested with all other operators | |select_more |[D10839](https://archive.blender.org/developer/D10839) | | | |select_next_item | | | | |select_non_manifold | | | | |select_nth |[D10893](https://archive.blender.org/developer/D10893) | | | |select_prev_item | | | | |select_random | | | | |select_similar | | | | |select_similar_region | | | | |select_ungrouped | | | | |separate | | | | |set_normals_from_faces | | | | |shape_propagate_to_all | | | | |shortest_path_pick | | | | |shortest_path_select | | | | |smoothen_normals | | | | |solidify |[D11200](https://archive.blender.org/developer/D11200) | | | |sort_elements |[D10865](https://archive.blender.org/developer/D10865) | | | |spin |[D10865](https://archive.blender.org/developer/D10865) | | | |split |[D11200](https://archive.blender.org/developer/D11200) | | | |split_normals | | | | |subdivide |[D10865](https://archive.blender.org/developer/D10865) | | | |subdivide_edgering |[D11798](https://archive.blender.org/developer/D11798) | |Cannot be tested. Does not produce reproducible results | |symmetrize |[D11083](https://archive.blender.org/developer/D11083) | | | |symmetry_snap |[D11798](https://archive.blender.org/developer/D11798) | | | |tris_convert_to_quads |[D11798](https://archive.blender.org/developer/D11798) | | | |unsubdivide |[D10893](https://archive.blender.org/developer/D10893) | Added test cases for the bug #87259 | | |uv_texture_add |[D11798](https://archive.blender.org/developer/D11798) | | | |uv_texture_remove |[D11798](https://archive.blender.org/developer/D11798) | | | |uvs_reverse | [D11798](https://archive.blender.org/developer/D11798) | | | |uvs_rotate | [D11798](https://archive.blender.org/developer/D11798) | | | |vert_connect | [D11200](https://archive.blender.org/developer/D11200)| | | |vert_connect_concave |[D11798](https://archive.blender.org/developer/D11798) | | | |vert_connect_nonplanar |[D11798](https://archive.blender.org/developer/D11798) | | | |vert_connect_path |[D10893](https://archive.blender.org/developer/D10893) | | | |vertex_color_add |[D11798](https://archive.blender.org/developer/D11798) | | | |vertex_color_remove |[D11798](https://archive.blender.org/developer/D11798) | | | |vertices_smooth |[D11200](https://archive.blender.org/developer/D11200) | | | |vertices_smooth_laplacian |[D11798](https://archive.blender.org/developer/D11798) | | | |wireframe |[D11798](https://archive.blender.org/developer/D11798) | | |
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @Calra

Added subscriber: @Calra
Member

Added subscriber: @zazizizou

Added subscriber: @zazizizou
Habib Gahbiche self-assigned this 2021-02-14 14:13:31 +01:00

Added subscriber: @sagbede

Added subscriber: @sagbede

Added subscriber: @pjc7287

Added subscriber: @pjc7287

Added subscriber: @Rohan-cod

Added subscriber: @Rohan-cod

I hope everyone is safe and in good health in the wake of prevailing COVID-19.
My name is Rohan Gupta and I am a 3rd-year Computer Science undergraduate student at Shri Mata Vaishno Devi University. I have been working with Python for a couple of years now and have in-depth knowledge of it. I look forward to contributing to Blender Foundation as part of this year's GSoC.
My Linkedin Profile:- https://www.linkedin.com/in/rohang4837b4124/

I hope everyone is safe and in good health in the wake of prevailing COVID-19. My name is Rohan Gupta and I am a 3rd-year Computer Science undergraduate student at Shri Mata Vaishno Devi University. I have been working with Python for a couple of years now and have in-depth knowledge of it. I look forward to contributing to Blender Foundation as part of this year's GSoC. My Linkedin Profile:- https://www.linkedin.com/in/rohang4837b4124/
Member

Hi @Rohan-cod, thanks for interest. This task is not the right place to discuss GSoC, but feel free to discuss your ideas on blender.chat or devtalk.blender.org. You can also reach out to me directly if you are interested in contributing to this task or automated tests with Python in general.

Hi @Rohan-cod, thanks for interest. This task is not the right place to discuss GSoC, but feel free to discuss your ideas on blender.chat or devtalk.blender.org. You can also reach out to me directly if you are interested in contributing to this task or automated tests with Python in general.

Hello, Habib. Sorry to bother,

I am interested in contributing to this task. I am still very new to this but I hope that I can still be of help. What is a good way to get started on this task?

Hello, Habib. Sorry to bother, I am interested in contributing to this task. I am still very new to this but I hope that I can still be of help. What is a good way to get started on this task?
Member

Hi Shinaola, https://wiki.blender.org/wiki/Developer_Intro/Overview is a good place to start. After going through that, the steps in the description should make more sense :) If not, you can ask more specific questions here

Hi Shinaola, https://wiki.blender.org/wiki/Developer_Intro/Overview is a good place to start. After going through that, the steps in the description should make more sense :) If not, you can ask more specific questions here
Habib Gahbiche removed their assignment 2021-03-30 19:31:01 +02:00

Added subscriber: @baka

Added subscriber: @baka

@zazizizou Hello Habib, I was trying to figure out how to add the test cases that require user inputs. After a little experimenting, I noticed that in operators like extrude we can take a set of two objects (mouse-pointer-aid-object, classic-old-object) as test and expected objects. The position of one (mouse-pointer-aid-object) will represent the final position of the mouse where the click was made and the other will serve as an object on which the operator should be applied. And then we can simply call bpy.ops.mesh.extrude_region_move like function with TRANSFORM_OT_translate={"value":(x, y, z), where (x, y, z) represents the value of of the mouse-pointer-object-position.

Please give on views on this (This is helping me write my gsoc proposal)!

@zazizizou Hello Habib, I was trying to figure out how to add the test cases that require user inputs. After a little experimenting, I noticed that in operators like extrude we can take a set of two objects (mouse-pointer-aid-object, classic-old-object) as test and expected objects. The position of one (mouse-pointer-aid-object) will represent the final position of the mouse where the click was made and the other will serve as an object on which the operator should be applied. And then we can simply call `bpy.ops.mesh.extrude_region_move` like function with `TRANSFORM_OT_translate={"value":(x, y, z), ` where (x, y, z) represents the value of of the mouse-pointer-object-position. Please give on views on this (This is helping me write my gsoc proposal)!
Member

Hi @baka, cool! It's nice to hear you're interested. There are indeed some similar workarounds for modifiers tests (see tests for deform modifiers in tests/modeling/modifiers.blend), so if it works, it's a good idea. I think it's better to continue GSoC discussion at blender.chat though, if that's ok for you.

Hi @baka, cool! It's nice to hear you're interested. There are indeed some similar workarounds for modifiers tests (see tests for deform modifiers in `tests/modeling/modifiers.blend`), so if it works, it's a good idea. I think it's better to continue GSoC discussion at blender.chat though, if that's ok for you.

Added subscriber: @himanshu_chauhan

Added subscriber: @himanshu_chauhan

Hey everyone, I am very new to whole open source thing and blender development, I have just built blender from source code, and now I would like to tackle my good first issue, and I have chosen this task, but I am not exactly sure what I have to do, can anyone guide me through. So far I have only understood the idea that we have to create two meshes, one is expected mesh, and one is test mesh on which we have to apply operators through python.

Hey everyone, I am very new to whole open source thing and blender development, I have just built blender from source code, and now I would like to tackle my good first issue, and I have chosen this task, but I am not exactly sure what I have to do, can anyone guide me through. So far I have only understood the idea that we have to create two meshes, one is expected mesh, and one is test mesh on which we have to apply operators through python.
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

Please read the wiki and the previous patches/commits linked. If there's a specific question/ part where you're stuck, let us know, here or at https://blender.chat

Please read the wiki and the previous patches/commits linked. If there's a specific question/ part where you're stuck, let us know, here or at https://blender.chat

Added subscriber: @MaorA

Added subscriber: @MaorA

I have added tests for symmetrize and merge. D11083 . Let me know if the diff is submitted properly.

I have added tests for symmetrize and merge. [D11083](https://archive.blender.org/developer/D11083) . Let me know if the diff is submitted properly.

Removed subscriber: @Rohan-cod

Removed subscriber: @Rohan-cod
Member

Added subscriber: @rdmo

Added subscriber: @rdmo

This issue was referenced by 7168a4fa5c

This issue was referenced by 7168a4fa5c785c29483947ce60ac797e4b9c1bfc
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123

Added subscriber: @rateeb-riyasat

Added subscriber: @rateeb-riyasat

Hey I was working on screw edge for testing and I realized the center parameter is in global coordinates, which might result in improper testing as the newly generated mesh after the operation is applied will be different depending on the position of the mesh, which could change as new operators are added.

Hey I was working on screw edge for testing and I realized the center parameter is in global coordinates, which might result in improper testing as the newly generated mesh after the operation is applied will be different depending on the position of the mesh, which could change as new operators are added.
Contributor

hi @Calra / @zazizizou would this issue still benefit from contribution? If so, I might be able to help out with these type of tests. Could you please let me know if this issue is active and if contribution here would be useful/welcome? Thanks

hi @Calra / @zazizizou would this issue still benefit from contribution? If so, I might be able to help out with these type of tests. Could you please let me know if this issue is active and if contribution here would be useful/welcome? Thanks
Member

@Dario-San I think it always makes sense to extend the automated testing framework with more test cases, so your contribution would definitely be useful. I am willing to help and review your patches :)

@Dario-San I think it always makes sense to extend the automated testing framework with more test cases, so your contribution would definitely be useful. I am willing to help and review your patches :)
Bart van der Braak added
Type
Bug
and removed
Type
Report
labels 2024-08-14 13:27:05 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
14 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#84999
No description provided.