Print logs if dali skip rendering 83/310583/3
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 2 May 2024 06:58:19 +0000 (15:58 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 3 May 2024 05:26:48 +0000 (14:26 +0900)
Change-Id: I9ddca01a172b742c60b4d01c3d997306b0710d5f
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-Scene.cpp
dali/internal/render/common/render-manager.cpp

index d98c869..9961461 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.
@@ -3078,8 +3078,8 @@ int UtcDaliSceneGetNativeId(void)
 {
   TestApplication application; // Initializes
 
-  Dali::Integration::Scene scene = application.GetScene();
-  int32_t nativeId = scene.GetNativeId();
+  Dali::Integration::Scene scene    = application.GetScene();
+  int32_t                  nativeId = scene.GetNativeId();
   DALI_TEST_EQUALS(nativeId, 0, TEST_LOCATION);
 
   // Test that setting native id
@@ -3088,3 +3088,111 @@ int UtcDaliSceneGetNativeId(void)
   DALI_TEST_EQUALS(nativeId, 1, TEST_LOCATION);
   END_TEST;
 }
+
+int UtcDaliSceneRemoveSceneObjectAndRender01(void)
+{
+  tet_infoline("Test that removing a scene object and rendering does not crash");
+
+  TestApplication application(
+    TestApplication::DEFAULT_SURFACE_WIDTH,
+    TestApplication::DEFAULT_SURFACE_HEIGHT,
+    TestApplication::DEFAULT_HORIZONTAL_DPI,
+    TestApplication::DEFAULT_VERTICAL_DPI,
+    true,
+    true);
+
+  auto defaultScene = application.GetScene();
+  DALI_TEST_CHECK(defaultScene);
+
+  Actor actor1 = CreateRenderableActor();
+  actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+  defaultScene.Add(actor1);
+
+  // Create a Scene
+  Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+  DALI_TEST_CHECK(scene);
+
+  application.AddScene(scene);
+
+  Actor actor2 = CreateRenderableActor();
+  actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+  scene.Add(actor2);
+
+  // Render and notify.
+  application.SendNotification();
+  application.Render(0);
+
+  scene.RemoveSceneObject(); // Scene's scene graph lifecycle is NOT managed by scene handle
+
+  // Partial Render and notify.
+  application.SendNotification();
+  application.RenderWithPartialUpdate(0, TEST_LOCATION);
+
+  // Render and notify.
+  application.SendNotification();
+  application.Render(0);
+
+  scene.Discard();
+  scene.Reset();
+
+  application.SendNotification();
+  application.Render(0);
+
+  END_TEST;
+}
+
+int UtcDaliSceneRemoveSceneObjectAndRender02(void)
+{
+  tet_infoline("Same UTC with UtcDaliSceneRemoveSceneObjectAndRender01, but let we make application doesn't use PartialUpdate");
+
+  TestApplication application(
+    TestApplication::DEFAULT_SURFACE_WIDTH,
+    TestApplication::DEFAULT_SURFACE_HEIGHT,
+    TestApplication::DEFAULT_HORIZONTAL_DPI,
+    TestApplication::DEFAULT_VERTICAL_DPI,
+    true,
+    false);
+
+  auto defaultScene = application.GetScene();
+  DALI_TEST_CHECK(defaultScene);
+
+  Actor actor1 = CreateRenderableActor();
+  actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+  defaultScene.Add(actor1);
+
+  // Create a Scene
+  Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+  DALI_TEST_CHECK(scene);
+
+  application.AddScene(scene);
+
+  Actor actor2 = CreateRenderableActor();
+  actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+  scene.Add(actor2);
+
+  // Render and notify.
+  application.SendNotification();
+  application.Render(0);
+
+  scene.RemoveSceneObject(); // Scene's scene graph lifecycle is NOT managed by scene handle
+
+  // Partial Render and notify.
+  application.SendNotification();
+  application.RenderWithPartialUpdate(0, TEST_LOCATION);
+
+  // Render and notify.
+  application.SendNotification();
+  application.Render(0);
+
+  scene.Discard();
+  scene.Reset();
+
+  application.SendNotification();
+  application.Render(0);
+
+  END_TEST;
+}
\ No newline at end of file
index 1747bcc..a74754a 100644 (file)
@@ -538,6 +538,14 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>&
   if(!sceneObject || sceneObject->IsRenderingSkipped())
   {
     // We don't need to calculate dirty rects
+    if(!sceneObject)
+    {
+      DALI_LOG_ERROR("Scene was empty handle. Skip pre-rendering\n");
+    }
+    else
+    {
+      DALI_LOG_RELEASE_INFO("RenderingSkipped was set true. Skip pre-rendering\n");
+    }
     return;
   }
 
@@ -782,6 +790,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
   SceneGraph::Scene* sceneObject = GetImplementation(scene).GetSceneObject();
   if(!sceneObject)
   {
+    DALI_LOG_ERROR("Scene was empty handle. Skip rendering\n");
     return;
   }
 
@@ -793,7 +802,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
 {
   if(mImpl->partialUpdateAvailable == Integration::PartialUpdateAvailable::TRUE && !renderToFbo && clippingRect.IsEmpty())
   {
-    // ClippingRect is empty. Skip rendering
+    DALI_LOG_DEBUG_INFO("ClippingRect was empty. Skip rendering\n");
     return;
   }
 
@@ -806,6 +815,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
   SceneGraph::Scene* sceneObject   = sceneInternal.GetSceneObject();
   if(!sceneObject)
   {
+    DALI_LOG_ERROR("Scene was empty handle. Skip rendering\n");
     return;
   }