X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-CustomActor.cpp;h=c32c8e7c024a362e679aabaf4661a3236b1e7404;hb=refs%2Fchanges%2F35%2F100235%2F2;hp=00da4c1147752084463de62bf9a43b75dd00f301;hpb=a86ae47738c5baf9707e366912e1f52dbba39129;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-CustomActor.cpp b/automated-tests/src/dali/utc-Dali-CustomActor.cpp index 00da4c1..c32c8e7 100644 --- a/automated-tests/src/dali/utc-Dali-CustomActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CustomActor.cpp @@ -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. @@ -61,7 +61,8 @@ struct TestCustomActor : public CustomActorImpl mDaliProperty( Property::INVALID_INDEX ), mSizeSet( Vector3::ZERO ), mTargetSize( Vector3::ZERO ), - mNego( false ) + mNego( false ), + mDepth(0u) { } @@ -119,9 +120,10 @@ struct TestCustomActor : public CustomActorImpl } // From CustomActorImpl - virtual void OnStageConnection() + virtual void OnStageConnection( int depth ) { AddToCallStacks("OnStageConnection"); + mDepth = depth; } virtual void OnStageDisconnection() { @@ -253,6 +255,7 @@ struct TestCustomActor : public CustomActorImpl Vector3 mSizeSet; Vector3 mTargetSize; bool mNego; + unsigned int mDepth; }; /** @@ -269,10 +272,10 @@ struct TestCustomActorVariant1 : public TestCustomActor } // From CustomActorImpl - virtual void OnStageConnection() + virtual void OnStageConnection( int depth ) { // Chain up first - TestCustomActor::OnStageConnection(); + TestCustomActor::OnStageConnection( depth ); // Add the child Self().Add( mChildToAdd ); @@ -294,10 +297,10 @@ struct TestCustomActorVariant2 : public TestCustomActor } // From CustomActorImpl - virtual void OnStageConnection() + virtual void OnStageConnection( int depth ) { // Chain up first - TestCustomActor::OnStageConnection(); + TestCustomActor::OnStageConnection( depth ); // Remove all the children for( unsigned int i=0, num=Self().GetChildCount(); iOnPropertySet( 0, 0 ); DALI_TEST_CHECK( true ); - delete impl; END_TEST; } @@ -1949,3 +1964,56 @@ int UtcDaliCustomActorGetExtensionP(void) END_TEST; } + +int UtcDaliCustomActorOnConnectionDepth(void) +{ + TestApplication application; + tet_infoline("Testing Dali::CustomActor::OnStageConnection() hierarchy depth"); + + Stage stage = Stage::GetCurrent(); + + /* Build tree of actors: + * + * Depth + * + * A (parent) 1 + * / \ + * B C 2 + * / \ \ + * D E F 3 + * + * OnStageConnection should return 1 for A, 2 for B and C, and 3 for D, E and F. + */ + + TestCustomActor actorA = TestCustomActor::New(); + stage.Add( actorA ); + + TestCustomActor actorB = TestCustomActor::New(); + actorA.Add( actorB ); + + TestCustomActor actorC = TestCustomActor::New(); + actorA.Add( actorC ); + + TestCustomActor actorD = TestCustomActor::New(); + actorB.Add( actorD ); + + TestCustomActor actorE = TestCustomActor::New(); + actorB.Add( actorE ); + + TestCustomActor actorF = TestCustomActor::New(); + actorC.Add( actorF ); + + // Excercise the message passing to Update thread + application.SendNotification(); + application.Render(); + application.Render(); + + DALI_TEST_EQUALS( 1u, actorA.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 2u, actorB.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 2u, actorC.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 3u, actorD.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 3u, actorE.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 3u, actorF.GetDepth(), TEST_LOCATION ); + + END_TEST; +}