Page MenuHome

Add Operator tests
Confirmed, NormalPublic

Description

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)
rB22a8a3b21497 (Deform tests)
rB8373f497b (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

OperatorTypical caseFurther casesComments
average_normalsD10865
beautify_fillD10865
bevelxtests are in bevel_regression.blend and bevel_operator.py
bisectxTODO: T87863 Add test case from the bug file itself
blend_from_shapex
bridge_edge_loopsx
colors_reverse
colors_rotate
convex_hullD11200
customdata_custom_splitnormals_add
customdata_custom_splitnormals_clear
customdata_mask_clear
customdata_skin_add
customdata_skin_clear
decimatex
deletexdelete Faces/Verts/Edges
delete_edgeloopxdelete Verts/Edges
delete_loosex
dissolve_degeneratex
dissolve_edgesx
dissolve_facesx
dissolve_limitedD15187
dissolve_modeD15187
dissolve_vertsx
dupli_extrude_cursorRequires user input, cannot test.
duplicatex
duplicate_move
edge_collapse
edge_face_addx
edge_rotatex
edge_splitx
edgering_selectRequires user input, cannot test.
edges_select_sharpD10400
extrude_contextRequires user input, cannot test.
extrude_context_moveRequires user input, cannot test.
extrude_edges_indivRequires user input, cannot test.
extrude_edges_moveRequires user input, cannot test.
extrude_faces_indivRequires user input, cannot test.
extrude_faces_moveRequires user input, cannot test.
extrude_regionRequires user input, cannot test.
extrude_region_moveRequires user input, cannot test.
extrude_region_shrink_fattenRequires user input, cannot test.
extrude_repeatRequires user input, cannot test.
extrude_vertices_moveRequires user input, cannot test.
extrude_verts_indivRequires user input, cannot test.
face_make_planarx
face_split_by_edgesx
faces_mirror_uv
faces_select_linked_flatx
faces_shade_flatD10893Not a real test, appearance can't be tested
faces_shade_smoothD10893Not a real test, appearance can't be tested
fillx
fill_gridx
fill_holesx
flip_normalsD11802
hideD11798
insetx
intersectx
intersect_booleanxxSee boolean_operator.py
knife_project
knife_tool
loop_multi_selectD10400
loop_select
loop_to_region
loopcut
loopcut_slide
mark_freestyle_edge
mark_freestyle_face
mark_seamD10893
mark_sharp
mergeD11083
merge_normalsD15187
mod_weighted_strength
normals_make_consistent
normals_tools
offset_edge_loops
offset_edge_loops_slide
paint_mask_extract
paint_mask_slice
point_normals
pokeD11200
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_doublesD10218
revealD10723Operator does not change mesh
ripD11200
rip_edge
rip_edge_move
rip_move
screw
select_allD10400
select_axisCannot be tested. Needs active vert selection
select_face_by_sidesD10400
select_interior_facesD10400
select_lessD10400
select_linkedD10400
select_linked_pickCannot be tested. Needs user input
select_looseD10839
select_mirrorD10839
select_modexUsed by framework, so implicitly tested with all other operators
select_moreD10839
select_next_item
select_non_manifold
select_nthD10893
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
solidifyD11200
sort_elementsD10865
spinD10865
splitD11200
split_normals
subdivideD10865
subdivide_edgeringD11798Cannot be tested. Does not produce reproducible results
symmetrizeD11083
symmetry_snapD11798
tris_convert_to_quadsD11798
unsubdivideD10893Added test cases for the bug T87259
uv_texture_addD11798
uv_texture_removeD11798
uvs_reverseD11798
uvs_rotateD11798
vert_connectD11200
vert_connect_concaveD11798
vert_connect_nonplanarD11798
vert_connect_pathD10893
vertex_color_addD11798
vertex_color_removeD11798
vertices_smoothD11200
vertices_smooth_laplacianD11798
wireframeD11798

Event Timeline

Himanshi Kalra (calra) changed the task status from Needs Triage to Confirmed.Jan 23 2021, 8:12 PM
Himanshi Kalra (calra) created this task.

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/

Hi @Rohan Gupta (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?

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

Himanshi Kalra (calra) added a project: Restricted Project.Mar 26 2021, 5:54 PM

@Habib Gahbiche (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)!

Hi @Akshat Dixit (:baka) (aaka), 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.

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.

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

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

Himanshi Kalra (calra) updated the task description. (Show Details)