Revert "[Tizen] Move DevelHandle::GetCurrentProperty to public"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-CameraActor.cpp
index 5100ac0..0f700bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <cmath>
 #include <dali/public-api/dali-core.h>
+#include <dali/devel-api/object/handle-devel.h>
 
 #include "dali-test-suite-utils/dali-test-suite-utils.h"
 
@@ -223,10 +224,8 @@ int UtcDaliCameraActorSetGetTypeP(void)
   actor.SetType( Dali::Camera::LOOK_AT_TARGET );
   DALI_TEST_EQUALS( actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION );
 
-  std::string sValue;
-  actor.GetProperty( CameraActor::Property::TYPE ).Get( sValue );
-  std::string result( "LOOK_AT_TARGET");
-  DALI_TEST_EQUALS( result, sValue, TEST_LOCATION );
+  DALI_TEST_EQUALS( "LOOK_AT_TARGET", actor.GetProperty< std::string >( CameraActor::Property::TYPE ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "LOOK_AT_TARGET", DevelHandle::GetCurrentProperty< std::string >( actor, CameraActor::Property::TYPE ), TEST_LOCATION );
   END_TEST;
 }
 
@@ -349,7 +348,6 @@ int UtcDaliCameraActorGetFieldOfViewN(void)
   END_TEST;
 }
 
-//todor
 int UtcDaliCameraActorSetAspectRatioP(void)
 {
   TestApplication application;
@@ -1275,7 +1273,7 @@ int UtcDaliCameraActorModelView(void)
 
   BufferImage image = CreateBufferImage();
 
-  ImageActor actor = ImageActor::New( image );
+  Actor actor = CreateRenderableActor(image);
   actor.SetSize( 100.0f, 100.0f );
   actor.SetPosition( 20.0f, 30.0f, 40.0f );
   actor.SetParentOrigin( ParentOrigin::CENTER );
@@ -1311,9 +1309,9 @@ int UtcDaliCameraActorReadProjectionMatrix(void)
   application.Render();
   application.SendNotification();
   Image image = CreateBufferImage();
-  ImageActor imageActor = ImageActor::New( image );
-  imageActor.SetSize( 100.0f, 100.0f );
-  Stage::GetCurrent().Add( imageActor );
+  Actor actor = CreateRenderableActor( image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE );
+  actor.SetSize( 100.0f, 100.0f );
+  Stage::GetCurrent().Add( actor );
 
   Matrix projectionMatrix;
   Matrix viewMatrix;
@@ -1321,18 +1319,15 @@ int UtcDaliCameraActorReadProjectionMatrix(void)
   camera.GetProperty( CameraActor::CameraActor::Property::PROJECTION_MATRIX ).Get( projectionMatrix );
   camera.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( viewMatrix );
 
-  ShaderEffect shaderEffect = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE );
-  imageActor.SetShaderEffect( shaderEffect );
-
-  shaderEffect.SetUniform( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
-  shaderEffect.SetUniform( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
+  actor.RegisterProperty( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
+  actor.RegisterProperty( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
 
-  Property::Index projectionMatrixPropertyIndex = shaderEffect.GetPropertyIndex( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME );
-  Property::Index viewMatrixPropertyIndex = shaderEffect.GetPropertyIndex( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME );
+  Property::Index projectionMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME );
+  Property::Index viewMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME );
 
-  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( shaderEffect, projectionMatrixPropertyIndex, EqualToConstraint() );
+  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( actor, projectionMatrixPropertyIndex, EqualToConstraint() );
   projectionMatrixConstraint.AddSource( Source( camera, CameraActor::Property::PROJECTION_MATRIX ) );
-  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( shaderEffect, viewMatrixPropertyIndex, EqualToConstraint() );
+  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( actor, viewMatrixPropertyIndex, EqualToConstraint() );
   viewMatrixConstraint.AddSource( Source( camera, CameraActor::Property::VIEW_MATRIX ) );
 
   projectionMatrixConstraint.Apply();