[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-VisualFactory.cpp
index 6291e50..726a7b8 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali-toolkit/internal/visuals/npatch-loader.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/adaptor-framework/shader-precompiler.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -1226,11 +1227,6 @@ int UtcDaliVisualFactoryGetNPatchVisual9(void)
   DALI_TEST_EQUALS(actor2.GetRendererCount(), 0u, TEST_LOCATION);
 
   application.GetScene().Add(actor2);
-
-  application.SendNotification();
-  application.Render();
-
-  application.SendNotification();
   application.Render();
 
   // Async loading is not finished yet.
@@ -1412,7 +1408,7 @@ int UtcDaliNPatchVisualAuxiliaryImage02(void)
   imageView2[ImageView::Property::IMAGE] = NPATCH_TEST;
   application.GetScene().Add(imageView2);
 
-  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
 
   application.SendNotification();
   application.Render();
@@ -1529,7 +1525,9 @@ int UtcDaliVisualFactoryGetSvgVisual(void)
   // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+  // Wait for loading & rasterization
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
 
   // renderer is added to actor
   DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
@@ -1565,7 +1563,9 @@ int UtcDaliVisualFactoryGetSvgVisualLarge(void)
   // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+  // Wait for loading & rasterization
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
 
   // renderer is added to actor
   DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
@@ -1609,7 +1609,9 @@ int UtcDaliVisualFactoryGetSvgVisualAtlas(void)
   DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
   application.SendNotification();
   application.Render();
-  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+  // Wait for loading & rasterization
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
 
   // renderer is added to actor
   DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
@@ -2787,3 +2789,41 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual2(void)
 
   END_TEST;
 }
+
+
+int UtcDaliVisualFactoryGetPreCompiler(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliVisualFactoryGetAnimatedImageVisual2: Request animated image visual with a Property::Map, test custom wrap mode and pixel area");
+
+
+  std::vector<RawShaderData> precompiledShaderList;
+  DALI_TEST_CHECK(precompiledShaderList.size() == 0u); // before Get Shader
+  ShaderPreCompiler::Get().GetPreCompileShaderList(precompiledShaderList);
+  DALI_TEST_CHECK(precompiledShaderList.size() == 0u); // after Get Shader
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  factory.UsePreCompiledShader();
+
+  ShaderPreCompiler::Get().GetPreCompileShaderList(precompiledShaderList);
+  DALI_TEST_CHECK(precompiledShaderList.size() != 0u); // after Get Shader
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New(true);
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+  actor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
+  application.GetScene().Add(actor);
+
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}