Make do not caching pixelBuffer in texture-manager.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-VisualFactory.cpp
index 2818d87..db708c1 100644 (file)
@@ -984,7 +984,7 @@ int UtcDaliVisualFactoryGetNPatchVisual7(void)
   END_TEST;
 }
 
-int UtcDaliNPatchVisualAuxiliaryImage(void)
+int UtcDaliNPatchVisualAuxiliaryImage01(void)
 {
   ToolkitTestApplication application;
   tet_infoline( "NPatchVisual with aux image" );
@@ -1034,6 +1034,38 @@ int UtcDaliNPatchVisualAuxiliaryImage(void)
   END_TEST;
 }
 
+int UtcDaliNPatchVisualAuxiliaryImage02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Multiple NPatchVisual with aux image coincidentally" );
+
+  const Property::Value NPATCH_TEST{
+    {ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME},
+    {DevelImageVisual::Property::AUXILIARY_IMAGE, TEST_AUX_IMAGE}};
+
+  ImageView imageView1 = ImageView::New();
+  imageView1[ImageView::Property::IMAGE] = NPATCH_TEST;
+  application.GetScene().Add( imageView1 );
+
+  ImageView imageView2 = ImageView::New();
+  imageView2[ImageView::Property::IMAGE] = NPATCH_TEST;
+  application.GetScene().Add( imageView2 );
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  Renderer renderer1 = imageView1.GetRendererAt( 0 );
+  auto textureSet1 = renderer1.GetTextures();
+
+  Renderer renderer2 = imageView2.GetRendererAt( 0 );
+  auto textureSet2 = renderer2.GetTextures();
+  DALI_TEST_EQUALS( textureSet1 == textureSet2, true, TEST_LOCATION );
+
+  END_TEST;
+}
+
 
 int UtcDaliVisualFactoryGetNPatchVisualN1(void)
 {
@@ -1131,12 +1163,9 @@ int UtcDaliVisualFactoryGetSvgVisual(void)
   application.GetScene().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
@@ -1170,12 +1199,9 @@ int UtcDaliVisualFactoryGetSvgVisualLarge(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   application.GetScene().Add( actor );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
@@ -1216,12 +1242,10 @@ int UtcDaliVisualFactoryGetSvgVisualAtlas(void)
   application.GetScene().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
@@ -2098,7 +2122,7 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual1(void)
   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
   textureTrace.Reset();
 
-  // Test SetOffStage().
+  // Test SetOffScene().
   actor.Unparent();
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );