Files
test2/tests/python/bl_object.py
Sean Kim 335b9b0388 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
2025-03-04 17:32:02 +01:00

26 lines
821 B
Python

# SPDX-FileCopyrightText: 2025 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later */
import unittest
import bpy
from mathutils import Vector
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)))
self.assertTrue(ret_val[0])
self.assertEqual(ret_val[1], Vector((0.0, 0.0, 1.0)))
if __name__ == '__main__':
import sys
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
unittest.main()