Button Upgrade to use Text Visual
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ImageView.cpp
index bd04f56..2ff700b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -23,7 +23,7 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/scripting/scripting.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
 
 #include <test-native-image.h>
 #include <sstream>
@@ -351,10 +351,10 @@ int UtcDaliImageViewSetGetProperty03(void)
   int destFactorRgb   = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
   int srcFactorAlpha  = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
   int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
-  DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::ONE );
-  DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
-  DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
-  DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
+  DALI_TEST_CHECK( srcFactorRgb == BlendFactor::ONE );
+  DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+  DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+  DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE );
 
   value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
   DALI_TEST_CHECK( value.Get( enable ) );
@@ -384,7 +384,7 @@ int UtcDaliImageViewAsyncLoadingWithoutAltasing(void)
   END_TEST;
 }
 
-int UtcDaliImageViewAsyncLoadingWithAltasing(void)
+int UtcDaliImageViewAsyncLoadingWithAtlasing(void)
 {
   ToolkitTestApplication application;
 
@@ -397,8 +397,6 @@ int UtcDaliImageViewAsyncLoadingWithAltasing(void)
 
   // By default, Aysnc loading is used
   // loading is not started if the actor is offStage
-  BitmapLoader loader = BitmapLoader::GetLatestCreated();
-  DALI_TEST_CHECK( !loader );
 
   Stage::GetCurrent().Add( imageView );
   application.SendNotification();
@@ -406,19 +404,8 @@ int UtcDaliImageViewAsyncLoadingWithAltasing(void)
   application.Render(16);
   application.SendNotification();
 
-  // loading started
-  loader = BitmapLoader::GetLatestCreated();
-  DALI_TEST_CHECK( loader );
-
-  // worker thread is created
-  EventThreadCallback* eventTrigger = EventThreadCallback::Get();
-  DALI_TEST_CHECK( eventTrigger );
-
-  loader.WaitForLoading();// waiting until the image to be loaded
-  DALI_TEST_CHECK( loader.IsLoaded() );
-
-  CallbackBase* callback = eventTrigger->GetCallback();
-  CallbackBase::Execute( *callback );
+  // loading started, this waits for the loader thread for max 30 seconds
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   application.SendNotification();
   application.Render(16);
@@ -442,9 +429,10 @@ int UtcDaliImageViewSyncLoading(void)
 
   // Sync loading, no atlasing for big size image
   {
-    ImageView imageView = ImageView::New( gImage_600_RGB );
+    ImageView imageView = ImageView::New();
 
     // Sync loading is used
+    syncLoadingMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
     // BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
@@ -461,9 +449,9 @@ int UtcDaliImageViewSyncLoading(void)
 
     ImageView imageView = ImageView::New( );
     // Sync loading is used
-    syncLoadingMap[ "url" ] = gImage_34_RGBA;
-    syncLoadingMap[ "desiredHeight" ] = 34;
-    syncLoadingMap[ "desiredWidth" ] = 34;
+    syncLoadingMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+    syncLoadingMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+    syncLoadingMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
     // loading is started even if the actor is offStage
@@ -993,7 +981,6 @@ int UtcDaliImageViewSetImageNativeImageWithCustomShader(void)
   customShader.Insert( "hints", shaderHints );
 
   Property::Map map;
-  map.Insert( "rendererType", "image" );
   map.Insert( "shader", customShader );
 
   TestNativeImagePointer nativeImageInterface = TestNativeImage::New( width, height );
@@ -1003,8 +990,6 @@ int UtcDaliImageViewSetImageNativeImageWithCustomShader(void)
   imageView.SetProperty( ImageView::Property::IMAGE, map );
   Stage::GetCurrent().Add( imageView );
 
-  imageView.SetProperty( ImageView::Property::IMAGE, map );
-
   TestGlAbstraction& gl = application.GetGlAbstraction();
   gl.EnableTextureCallTrace( true );
 
@@ -1045,7 +1030,6 @@ int UtcDaliImageViewSetImageBufferImageWithCustomShaderToNativeImage(void)
   customShader.Insert( "hints", shaderHints );
 
   Property::Map map;
-  map.Insert( "rendererType", "image" );
   map.Insert( "shader", customShader );
 
   BufferImage image = CreateBufferImage( width, height, Color::WHITE );
@@ -1054,8 +1038,6 @@ int UtcDaliImageViewSetImageBufferImageWithCustomShaderToNativeImage(void)
   imageView.SetProperty( ImageView::Property::IMAGE, map );
   Stage::GetCurrent().Add( imageView );
 
-  imageView.SetProperty( ImageView::Property::IMAGE, map );
-
   TestGlAbstraction& gl = application.GetGlAbstraction();
   gl.EnableTextureCallTrace( true );