[dali_2.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-scene3d / utc-Dali-Light.cpp
index 01bb4b0..88b0f56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -599,3 +599,657 @@ int UtcDaliLightModelAddAndRemove(void)
 
   END_TEST;
 }
+
+// Enable Shadow and add the light to SceneView.
+int UtcDaliLightEnableShadowOnScene01(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  sceneView.Add(light);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Add the light to SceneView and Enable Shadow.
+int UtcDaliLightEnableShadowOnScene02(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  sceneView.Add(light);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Add the light to SceneView and Add Model.
+int UtcDaliLightEnableShadowOnScene03(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+  sceneView.Add(light);
+
+  application.SendNotification();
+  application.Render();
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliLightEnableShadowOnScene04(void)
+{
+  tet_infoline("Test when shader language version is low\n");
+  ToolkitTestApplication application;
+
+  auto originalShaderVersion = application.GetGlAbstraction().GetShaderLanguageVersion();
+
+  // Change the shader language version forcely!
+  application.GetGlAbstraction().mShaderLanguageVersion = 200;
+
+  try
+  {
+    Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+    sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+    sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+    application.GetScene().Add(sceneView);
+
+    Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+    sceneView.Add(model);
+
+    application.SendNotification();
+    application.Render();
+    DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+    application.SendNotification();
+    application.Render();
+
+    // Light is added on layer when on scene
+    DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+    Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+    DALI_TEST_CHECK(renderer);
+    Shader shader = renderer.GetShader();
+    DALI_TEST_CHECK(shader);
+
+    auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+    DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+    DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+    Scene3D::Light light = Scene3D::Light::New();
+    light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+    Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+    sceneView.Add(light);
+
+    DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+    DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+    light.EnableShadow(true);
+
+    DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+    DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+    light.EnableShadow(true);
+
+    DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+    DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(false);
+  }
+
+  // Revert shader version. We should revert it even if UTC failed.
+  application.GetGlAbstraction().mShaderLanguageVersion = originalShaderVersion;
+
+  END_TEST;
+}
+
+int UtcDaliLightEnableShadowOnScene05(void)
+{
+  tet_infoline("Test when shader language version is low\n");
+  ToolkitTestApplication application;
+
+  auto originalShaderVersion = application.GetGlAbstraction().GetShaderLanguageVersion();
+
+  // Change the shader language version forcely!
+  application.GetGlAbstraction().mShaderLanguageVersion = 200;
+
+  try
+  {
+    Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+    sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+    sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+    application.GetScene().Add(sceneView);
+
+    Scene3D::Light light = Scene3D::Light::New();
+    light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+    Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+    light.EnableShadow(true);
+    sceneView.Add(light);
+
+    application.SendNotification();
+    application.Render();
+
+    Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+    sceneView.Add(model);
+
+    application.SendNotification();
+    application.Render();
+    DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+    application.SendNotification();
+    application.Render();
+
+    // Light is added on layer when on scene
+    DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+    Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+    DALI_TEST_CHECK(renderer);
+    Shader shader = renderer.GetShader();
+    DALI_TEST_CHECK(shader);
+
+    auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+    DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+    DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+    // Change material information, for line coverage.
+    auto modelNode = model.FindChildModelNodeByName("node2");
+    DALI_TEST_CHECK(modelNode);
+    DALI_TEST_GREATER(modelNode.GetModelPrimitiveCount(), 0u, TEST_LOCATION);
+    auto modelPrimitive = modelNode.GetModelPrimitive(0u);
+    DALI_TEST_CHECK(modelPrimitive);
+    auto material = modelPrimitive.GetMaterial();
+    DALI_TEST_CHECK(material);
+
+    auto originBaseColorFactor = material.GetProperty<Dali::Vector4>(Dali::Scene3D::Material::Property::BASE_COLOR_FACTOR);
+    auto expectBaseColorFactor = Vector4(originBaseColorFactor.r + 0.05f, originBaseColorFactor.g - 0.05f, originBaseColorFactor.b, originBaseColorFactor.a);
+    material.SetProperty(Dali::Scene3D::Material::Property::BASE_COLOR_FACTOR, expectBaseColorFactor);
+
+    application.SendNotification();
+    application.Render();
+
+    DALI_TEST_EQUALS(material.GetProperty<Dali::Vector4>(Dali::Scene3D::Material::Property::BASE_COLOR_FACTOR), expectBaseColorFactor, TEST_LOCATION);
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(false);
+  }
+
+  // Revert shader version. We should revert it even if UTC failed.
+  application.GetGlAbstraction().mShaderLanguageVersion = originalShaderVersion;
+
+  END_TEST;
+}
+
+// Disable Shadow
+int UtcDaliLightDisableShadow01(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+  sceneView.Add(light);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(false);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.Unparent();
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Disable Shadow
+int UtcDaliLightDisableShadow02(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+  sceneView.Add(light);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(false);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  Scene3D::Light newLight = Scene3D::Light::New();
+  newLight.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(newLight, Vector3(1.0f, 0.0f, 0.0f));
+  newLight.EnableShadow(true);
+  sceneView.Add(newLight);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  // Disable light's shadow, the shadow of newLight is rendered
+  light.EnableShadow(false);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  // Enable light's shadow, but newLight's shadow is rendered.
+  light.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  // Disable newLight's shadow, light's shadow is rendered.
+  newLight.Unparent();
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  // Every shadow is disabled.
+  light.Unparent();
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Make a light EnableShadow that is not enabled on scene
+int UtcDaliLightEnableShadowOfNotEnabledLight(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  uint32_t                    maxLightCount = Scene3D::Light::GetMaximumEnabledLightCount();
+  std::vector<Scene3D::Light> lights;
+  for(uint32_t i = 0; i < maxLightCount; ++i)
+  {
+    Scene3D::Light light = Scene3D::Light::New();
+    light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+    Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+    sceneView.Add(light);
+    lights.push_back(light);
+  }
+
+  Scene3D::Light shadowLight = Scene3D::Light::New();
+  shadowLight.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(shadowLight, Vector3(1.0f, 0.0f, 0.0f));
+  sceneView.Add(shadowLight);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  auto shadowEnabledIndex = shader.GetPropertyIndex("uIsShadowEnabled");
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  shadowLight.EnableShadow(true);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  lights[0].Enable(false);
+
+  DALI_TEST_CHECK(shadowEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Set/Get Shadow Properties
+int UtcDaliLightSetGetProperty(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+  sceneView.Add(light);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  DALI_TEST_EQUALS(0.001f, light.GetShadowBias(), TEST_LOCATION);
+  light.SetShadowBias(0.1f);
+  DALI_TEST_EQUALS(0.1f, light.GetShadowBias(), TEST_LOCATION);
+
+  DALI_TEST_EQUALS(0.5f, light.GetShadowIntensity(), TEST_LOCATION);
+  light.SetShadowIntensity(0.1f);
+  DALI_TEST_EQUALS(0.1f, light.GetShadowIntensity(), TEST_LOCATION);
+
+  END_TEST;
+}
+
+// Enable PCF for soft shadow edge.
+int UtcDaliLightShadowSoftFiltering(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+  sceneView.Add(model);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+  sceneView.Add(light);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  application.SendNotification();
+  application.Render();
+
+  // Light is added on layer when on scene
+  DALI_TEST_EQUALS(true, model.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE), TEST_LOCATION);
+
+  Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
+  DALI_TEST_CHECK(renderer);
+  Shader shader = renderer.GetShader();
+  DALI_TEST_CHECK(shader);
+
+  DALI_TEST_EQUALS(false, light.IsShadowSoftFilteringEnabled(), TEST_LOCATION);
+  auto shadowFilteringEnabledIndex = shader.GetPropertyIndex("uEnableShadowSoftFiltering");
+  DALI_TEST_CHECK(shadowFilteringEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowFilteringEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadowSoftFiltering(true);
+  DALI_TEST_EQUALS(true, light.IsShadowSoftFilteringEnabled(), TEST_LOCATION);
+
+  DALI_TEST_CHECK(shadowFilteringEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(shadowFilteringEnabledIndex), TEST_LOCATION);
+
+  light.EnableShadowSoftFiltering(false);
+  DALI_TEST_EQUALS(false, light.IsShadowSoftFilteringEnabled(), TEST_LOCATION);
+  DALI_TEST_CHECK(shadowFilteringEnabledIndex != DALI_KEY_INVALID);
+  DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(shadowFilteringEnabledIndex), TEST_LOCATION);
+
+  END_TEST;
+}
+
+namespace
+{
+constexpr int32_t SCENE_ORDER_INDEX = 100;
+constexpr int32_t SHADOW_ORDER_INDEX = 99;
+}
+
+int UtcDaliLightShadowRenderTask(void)
+{
+  ToolkitTestApplication application;
+  RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+
+  uint32_t baseRenderTaskCount = application.GetScene().GetRenderTaskList().GetTaskCount();
+
+  Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+  sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  sceneView.SetProperty(Dali::Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
+  application.GetScene().Add(sceneView);
+
+  DALI_TEST_EQUALS(baseRenderTaskCount + 1u, taskList.GetTaskCount(), TEST_LOCATION);
+
+  sceneView.UseFramebuffer(true);
+
+  DALI_TEST_EQUALS(baseRenderTaskCount + 1u, taskList.GetTaskCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0, taskList.GetTask(baseRenderTaskCount - 1u).GetOrderIndex(), TEST_LOCATION);
+  DALI_TEST_EQUALS(SCENE_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount).GetOrderIndex(), TEST_LOCATION);
+
+  Scene3D::Light light = Scene3D::Light::New();
+  light.SetProperty(Dali::Actor::Property::COLOR, Color::BLUE);
+  Dali::DevelActor::LookAt(light, Vector3(1.0f, 0.0f, 0.0f));
+  light.EnableShadow(true);
+
+  tet_printf("Do not create rendertask until light is scene on");
+  DALI_TEST_EQUALS(baseRenderTaskCount + 1u, taskList.GetTaskCount(), TEST_LOCATION);
+
+  sceneView.Add(light);
+
+  tet_printf("Create shadowmap rendertask after light is scene on");
+  DALI_TEST_EQUALS(baseRenderTaskCount + 2u, taskList.GetTaskCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0, taskList.GetTask(baseRenderTaskCount - 1u).GetOrderIndex(), TEST_LOCATION);
+  DALI_TEST_EQUALS(SCENE_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount).GetOrderIndex(), TEST_LOCATION);
+  DALI_TEST_EQUALS(SHADOW_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount + 1u).GetOrderIndex(), TEST_LOCATION);
+
+  application.SendNotification();
+
+  tet_printf("Check render task list sorted");
+  DALI_TEST_EQUALS(SHADOW_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount).GetOrderIndex(), TEST_LOCATION);
+  DALI_TEST_EQUALS(SCENE_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount + 1u).GetOrderIndex(), TEST_LOCATION);
+
+  light.EnableShadow(false);
+
+  tet_printf("Check shadowmap rendertask removed");
+  DALI_TEST_EQUALS(baseRenderTaskCount + 1u, taskList.GetTaskCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0, taskList.GetTask(baseRenderTaskCount - 1u).GetOrderIndex(), TEST_LOCATION);
+  DALI_TEST_EQUALS(SCENE_ORDER_INDEX, taskList.GetTask(baseRenderTaskCount).GetOrderIndex(), TEST_LOCATION);
+
+  END_TEST;
+}
\ No newline at end of file