/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
END_TEST;
}
+
+int UtcDaliPathPropertyPoints(void)
+{
+ TestApplication application;
+
+ Dali::Path path = Dali::Path::New();
+
+ Dali::Property::Array points;
+ points.Add( Vector3( 100.0f, 100.0f, 100.0f ) )
+ .Add( Vector3( 200.0f, 200.0f, 200.0f ) )
+ .Add( Vector3( 300.0f, 300.0f, 300.0f ) );
+ path.SetProperty( Dali::Path::Property::POINTS, points );
+
+ {
+ Property::Value value = path.GetProperty( Dali::Path::Property::POINTS );
+ Property::Array* array = value.GetArray();
+ DALI_TEST_CHECK( array );
+
+ const unsigned int noOfPoints = points.Size();
+ for( unsigned int i = 0; i < noOfPoints; ++i )
+ {
+ DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ }
+ }
+
+ {
+ Property::Value value = path.GetCurrentProperty( Dali::Path::Property::POINTS );
+ Property::Array* array = value.GetArray();
+ DALI_TEST_CHECK( array );
+
+ const unsigned int noOfPoints = points.Size();
+ for( unsigned int i = 0; i < noOfPoints; ++i )
+ {
+ DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ }
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPathPropertyControlPoints(void)
+{
+ TestApplication application;
+
+ Dali::Path path = Dali::Path::New();
+
+ Dali::Property::Array points;
+ points.Add( Vector3( 0.1f, 0.1f, 0.1f ) )
+ .Add( Vector3( 0.2f, 0.2f, 0.2f ) )
+ .Add( Vector3( 0.3f, 0.3f, 0.3f ) );
+ path.SetProperty( Dali::Path::Property::CONTROL_POINTS, points );
+
+ {
+ Property::Value value = path.GetProperty( Dali::Path::Property::CONTROL_POINTS );
+ Property::Array* array = value.GetArray();
+ DALI_TEST_CHECK( array );
+
+ const unsigned int noOfPoints = points.Size();
+ for( unsigned int i = 0; i < noOfPoints; ++i )
+ {
+ DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ }
+ }
+
+ {
+ Property::Value value = path.GetCurrentProperty( Dali::Path::Property::CONTROL_POINTS );
+ Property::Array* array = value.GetArray();
+ DALI_TEST_CHECK( array );
+
+ const unsigned int noOfPoints = points.Size();
+ for( unsigned int i = 0; i < noOfPoints; ++i )
+ {
+ DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ }
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPathRegisterProperty(void)
+{
+ TestApplication application;
+
+ Dali::Path path = Dali::Path::New();
+
+ Property::Index index = path.RegisterProperty( "sceneProperty", 0.f );
+ DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+ DALI_TEST_EQUALS( path.GetProperty< float >( index ), 0.f, TEST_LOCATION );
+
+ path.SetProperty( index, -1 );
+ DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+
+ using Dali::Animation;
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateTo( Property( path, index ), 100.f );
+
+ DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+ // Start the animation
+ animation.Play();
+
+ application.SendNotification();
+ application.Render( 1000 /* 100% progress */);
+ DALI_TEST_EQUALS( path.GetProperty< float >( index ), 100.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+