From bc6692f932e02d213224602baedab9886cc795e0 Mon Sep 17 00:00:00 2001 From: Voldivh Date: Tue, 1 Aug 2023 11:53:48 -0500 Subject: [PATCH] Remove test for setters methods Signed-off-by: Voldivh --- python/test/light_TEST.py | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/python/test/light_TEST.py b/python/test/light_TEST.py index 5c1792cee66..673f497de27 100755 --- a/python/test/light_TEST.py +++ b/python/test/light_TEST.py @@ -24,6 +24,9 @@ iterations = 0 pre_iterations = 0 +# This class test the Light class API created with pybind11. Since the setters methods +# require other systems to work (eg. Rendering sensors), those methods will not be fully +# tested, just verifying the method is being called. class TestLight(unittest.TestCase): def test_light(self): @@ -60,72 +63,47 @@ def on_pre_udpate_cb(_info, _ecm): # Pose Test self.assertEqual(Pose3d(0, 2, 2, 0, 0, 0), light_point.pose(_ecm)) light_point.set_pose(_ecm, Pose3d(4, 2, 2, 0, 0, 0)) - self.assertEqual(Pose3d(0, 2, 2, 0, 0, 0), light_point.pose(_ecm)) # Type Test self.assertEqual('point', light_point.type(_ecm)) self.assertEqual('directional', light_directional.type(_ecm)) self.assertEqual('spot', light_spot.type(_ecm)) - # Diffuse Color Test + ## Diffuse Color Test self.assertEqual(Color(1, 0, 0, 1), light_point.diffuse_color(_ecm)) light_point.set_diffuse_color(_ecm, Color(1, 1, 0, 1)) - self.assertEqual(Color(1, 1, 0, 1), light_point.diffuse_color(_ecm)) - light_point.set_diffuse_color(_ecm, Color(1, 0, 0, 1)) # Specular Color Test self.assertEqual(Color(0.2, 0, 0, 1), light_point.specular_color(_ecm)) light_point.set_specular_color(_ecm, Color(0.2, 0.2, 0, 1)) - self.assertEqual(Color(0.2, 0.2, 0, 1), light_point.specular_color(_ecm)) - light_point.set_specular_color(_ecm, Color(0.2, 0, 0, 1)) # Cast Shadows Test self.assertTrue(light_point.cast_shadows(_ecm)) light_point.set_cast_shadows(_ecm, False) - self.assertFalse(light_point.cast_shadows(_ecm)) - light_point.set_cast_shadows(_ecm, True) # Intensity Test self.assertEqual(2, light_point.intensity(_ecm)) light_point.set_intensity(_ecm, 5) - self.assertEqual(5, light_point.intensity(_ecm)) - light_point.set_intensity(_ecm, 2) # Direction Test self.assertEqual(Vector3d(0.5, 0.5, -1), light_directional.direction(_ecm)) light_directional.set_direction(_ecm, Vector3d(1, 0, -1)) - self.assertEqual(Vector3d(1, 0, -1), light_directional.direction(_ecm)) - light_directional.set_direction(_ecm, Vector3d(0.5, 0.5, -1)) # Attenuation Range Test self.assertEqual(20, light_point.attenuation_range(_ecm)) light_point.set_attenuation_range(_ecm, 30) - self.assertEqual(30, light_point.attenuation_range(_ecm)) - light_point.set_attenuation_range(_ecm, 20) # Attenuation Constant Test self.assertEqual(0.8, light_point.attenuation_constant(_ecm)) light_point.set_attenuation_constant(_ecm, 1.2) - self.assertEqual(1.2, light_point.attenuation_constant(_ecm)) - light_point.set_attenuation_constant(_ecm, 0.8) # Attenuation Linear Test self.assertEqual(0.2, light_point.attenuation_linear(_ecm)) light_point.set_attenuation_linear(_ecm, 0.5) - self.assertEqual(0.5, light_point.attenuation_linear(_ecm)) - light_point.set_attenuation_linear(_ecm, 0.2) # Attenuation Quadratric Test self.assertEqual(0.01, light_point.attenuation_quadratic(_ecm)) light_point.set_attenuation_quadratic(_ecm, 0.05) - self.assertEqual(0.05, light_point.attenuation_quadratic(_ecm)) - light_point.set_attenuation_quadratic(_ecm, 0.01) # Spot Inner Angle Test self.assertEqual(Angle(10), light_spot.spot_inner_angle(_ecm)) light_spot.set_spot_inner_angle(_ecm, Angle(15)) - self.assertEqual(Angle(15), light_spot.spot_inner_angle(_ecm)) - light_spot.set_spot_inner_angle(_ecm, Angle(10)) # Spot Outer Angle Test self.assertEqual(Angle(5), light_spot.spot_outer_angle(_ecm)) light_spot.set_spot_outer_angle(_ecm, Angle(10)) - self.assertEqual(Angle(10), light_spot.spot_outer_angle(_ecm)) - light_spot.set_spot_outer_angle(_ecm, Angle(5)) # Spot Falloff Test self.assertEqual(2, light_spot.spot_falloff(_ecm)) light_spot.set_spot_falloff(_ecm, 4) - self.assertEqual(4, light_spot.spot_falloff(_ecm)) - light_spot.set_spot_falloff(_ecm, 2) - + def on_udpate_cb(_info, _ecm): global iterations iterations += 1