X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Constrainer.cpp;h=33e6ec9f9b72c1600509092e979ad52c9a9c68d2;hb=462cbee2270984cdca45488f3733d664dcf49187;hp=c810b9be10766cdcd5b7c2c7747d63f28e278021;hpb=fd66f3513cb53a4151dca64563dcde63bc1d7886;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Constrainer.cpp b/automated-tests/src/dali/utc-Dali-Constrainer.cpp index c810b9b..33e6ec9 100644 --- a/automated-tests/src/dali/utc-Dali-Constrainer.cpp +++ b/automated-tests/src/dali/utc-Dali-Constrainer.cpp @@ -189,14 +189,14 @@ int UtcPathConstrainerApplyRange(void) Vector3 position, tangent; float tValue; - actor.GetProperty(index).Get(tValue); + DevelHandle::GetCurrentProperty( actor, index ).Get(tValue); float currentCursor = ( tValue - range.x ) / (range.y-range.x); path.Sample(currentCursor, position, tangent ); DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - actor.GetProperty(index).Get(tValue); + DevelHandle::GetCurrentProperty( actor, index ).Get(tValue); currentCursor = ( tValue - range.x ) / (range.y-range.x); path.Sample(currentCursor, position, tangent ); path.Sample(0.5, position, tangent ); @@ -223,6 +223,12 @@ int UtcPathConstrainerApplyRange(void) path.Sample(currentCursor, position, tangent ); DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); + // Ensure GetProperty also returns the final result + actor.GetProperty( index ).Get( tValue ); + currentCursor = ( tValue - range.x ) / (range.y-range.x); + path.Sample(currentCursor, position, tangent ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); + END_TEST; } @@ -312,6 +318,80 @@ int UtcPathConstrainerRemove(void) END_TEST; } +int UtcPathConstrainerProperties(void) +{ + TestApplication application; + Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); + + pathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3( 1.0f,0.0f,0.0f ) ); + DALI_TEST_EQUALS( pathConstrainer.GetProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( pathConstrainer, Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION ); + + Dali::Property::Array points; + points.Resize(3); + points[0] = Vector3( 30.0, 80.0, 0.0); + points[1] = Vector3( 70.0, 120.0, 0.0); + points[2] = Vector3(100.0, 100.0, 0.0); + pathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points ); + + { + Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::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 = DevelHandle::GetCurrentProperty( pathConstrainer, Dali::PathConstrainer::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 ); + } + } + + points.Resize(4); + points[0] = Vector3( 39.0, 90.0, 0.0); + points[1] = Vector3( 56.0, 119.0, 0.0); + points[2] = Vector3( 78.0, 120.0, 0.0); + points[3] = Vector3( 93.0, 104.0, 0.0); + pathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points ); + + { + Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::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 = DevelHandle::GetCurrentProperty( pathConstrainer, Dali::PathConstrainer::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; +} + //LinearConstrainer test cases int UtcLinearConstrainerDownCast(void) { @@ -545,3 +625,72 @@ int UtcLinearConstrainerRemove(void) END_TEST; } + +int UtcLinearConstrainerProperties(void) +{ + TestApplication application; + + Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); + + Dali::Property::Array points; + points.Resize(3); + points[0] = 0.0f; + points[1] = 1.0f; + points[2] = 0.0f; + linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points ); + + { + Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE ); + 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< float >(), points[i].Get< float >(), TEST_LOCATION ); + } + } + + { + Property::Value value = DevelHandle::GetCurrentProperty( linearConstrainer, Dali::LinearConstrainer::Property::VALUE ); + 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 ); + } + } + + points[0] = 0.0f; + points[1] = 0.25f; + points[2] = 1.0f; + linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points ); + + { + Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::PROGRESS ); + 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< float >(), points[i].Get< float >(), TEST_LOCATION ); + } + } + + { + Property::Value value = DevelHandle::GetCurrentProperty( linearConstrainer, Dali::LinearConstrainer::Property::PROGRESS ); + 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< float >(), points[i].Get< float >(), TEST_LOCATION ); + } + } + + END_TEST; +}