Skip to content

Commit

Permalink
Remove test for setters methods
Browse files Browse the repository at this point in the history
Signed-off-by: Voldivh <[email protected]>
  • Loading branch information
Voldivh committed Aug 1, 2023
1 parent 4e72d74 commit bc6692f
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions python/test/light_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bc6692f

Please sign in to comment.