Cleanup: Minor formatting changes for recently added python tests
* Adds docstrings to `bl_object.py` and `bl_sculpt.py` tests so that failure output is more helpful. * Renames `bl_object.py` class and function to be more inline with other test naming Pull Request: https://projects.blender.org/blender/blender/pulls/135417
This commit is contained in:
@@ -8,8 +8,10 @@ import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
class TestObjectApi(unittest.TestCase):
|
||||
def test_closest_point_on_mesh_of_default_cube(self):
|
||||
class ClosestPointOnMeshTest(unittest.TestCase):
|
||||
def test_function_finds_closest_point_successfully(self):
|
||||
"""Test that attempting to find the closest point succeeds and returns the correct location."""
|
||||
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.ops.mesh.primitive_cube_add()
|
||||
ret_val = bpy.context.scene.objects[0].closest_point_on_mesh(Vector((0.0, 0.0, 2.0)))
|
||||
|
||||
@@ -42,6 +42,8 @@ class MaskByColorTest(unittest.TestCase):
|
||||
bpy.ops.ed.undo_push()
|
||||
|
||||
def test_off_grid_returns_cancelled(self):
|
||||
"""Test that operator does not run when the cursor is not on the mesh."""
|
||||
|
||||
with bpy.context.temp_override(**self.context_override):
|
||||
location = (0, 0)
|
||||
ret_val = bpy.ops.sculpt.mask_by_color(location=location)
|
||||
@@ -52,6 +54,8 @@ class MaskByColorTest(unittest.TestCase):
|
||||
self.assertFalse('.sculpt_mask' in mesh.attributes.keys(), "Mesh should not have the .sculpt_mask attribute!")
|
||||
|
||||
def test_on_circle_masks_red_vertices(self):
|
||||
"""Test that the operator only masks red vertices on the mesh."""
|
||||
|
||||
with bpy.context.temp_override(**self.context_override):
|
||||
location = (int(self.context_override['area'].width / 2), int(self.context_override['area'].height / 2))
|
||||
ret_val = bpy.ops.sculpt.mask_by_color(location=location)
|
||||
@@ -86,6 +90,8 @@ class MaskFromCavityTest(unittest.TestCase):
|
||||
bpy.ops.ed.undo_push()
|
||||
|
||||
def test_operator_masks_low_vertices(self):
|
||||
"""Test that the operator applies a full mask value to any elements that are part of the cavity."""
|
||||
|
||||
ret_val = bpy.ops.sculpt.mask_from_cavity()
|
||||
|
||||
self.assertEqual({'FINISHED'}, ret_val)
|
||||
|
||||
Reference in New Issue
Block a user