X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-CustomActor.cpp;h=a51242d8e498332e0a0c70dbfce5936651423052;hb=128cea946c9d6d4a76ab7bda08bfdd532be549b7;hp=347ef0398eeeb587ed9c6ca132e332e8e6c77c15;hpb=7b4ff0da8b4fa2647c0abc34c03da61154de2038;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 347ef03..a51242d 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) 2021 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. @@ -15,798 +15,33 @@ * */ -#include -#include -#include - -#include -#include -#include -#include - -#include "dali-test-suite-utils/dali-test-suite-utils.h" - -using namespace Dali; - - -void custom_actor_test_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void custom_actor_test_cleanup(void) -{ - test_return_value = TET_PASS; -} - -namespace -{ - -std::vector< std::string > MasterCallStack; -bool gOnRelayout = false; - -} // anon namespace - -// TypeRegistry needs custom actor Implementations to have the same name (namespaces are ignored so we use one here) -namespace Impl -{ - -struct TestCustomActor : public CustomActorImpl -{ - /** - * Constructor - */ - TestCustomActor() - : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ), - mDaliProperty( Property::INVALID_INDEX ), - mSizeSet( Vector3::ZERO ), - mTargetSize( Vector3::ZERO ), - mNego( false ), - mDepth(0u) - { - } - - TestCustomActor(bool nego) - : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ), - mDaliProperty( Property::INVALID_INDEX ), - mSizeSet( Vector3::ZERO ), - mTargetSize( Vector3::ZERO ), - mNego( nego ) - { - } - /** - * Destructor - */ - virtual ~TestCustomActor() - { - } - - void Initialize( const char* name = NULL ) - { - mDaliProperty = Self().RegisterProperty( "Dali", std::string("no"), Property::READ_WRITE); - - OnInitialize( name ); - } - - virtual void OnInitialize( const char* name ) {} - - /** - * Resets the call stack - */ - void ResetCallStack() - { - mSizeSet = Vector3(); - mTargetSize = Vector3(); - mMethodsCalled.clear(); - } - - void AddToCallStacks( const char* method ) - { - mMethodsCalled.push_back( method ); - - // Combine Actor name with method string - std::string nameAndMethod( Self().GetName() ); - if ( 0 == nameAndMethod.size() ) - { - nameAndMethod = "Unknown: "; - } - else - { - nameAndMethod += ": "; - } - nameAndMethod += method; - - MasterCallStack.push_back( nameAndMethod ); - } - - // From CustomActorImpl - virtual void OnStageConnection( int depth ) - { - AddToCallStacks("OnStageConnection"); - mDepth = depth; - } - virtual void OnStageDisconnection() - { - AddToCallStacks("OnStageDisconnection"); - } - virtual void OnChildAdd(Actor& child) - { - AddToCallStacks("OnChildAdd"); - } - virtual void OnChildRemove(Actor& child) - { - AddToCallStacks("OnChildRemove"); - } - virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ) - { - AddToCallStacks("OnPropertySet"); - } - virtual void OnSizeSet(const Vector3& targetSize) - { - mSizeSet = targetSize; - AddToCallStacks("OnSizeSet"); - } - virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) - { - mTargetSize = targetSize; - AddToCallStacks("OnSizeAnimation"); - } - virtual bool OnTouchEvent(const TouchEvent& event) - { - AddToCallStacks("OnTouchEvent"); - return true; - } - virtual bool OnHoverEvent(const HoverEvent& event) - { - AddToCallStacks("OnHoverEvent"); - return true; - } - virtual bool OnWheelEvent(const WheelEvent& event) - { - AddToCallStacks("OnWheelEvent"); - return true; - } - virtual bool OnKeyEvent(const KeyEvent& event) - { - AddToCallStacks("OnKeyEvent"); - return true; - } - virtual void OnKeyInputFocusGained() - { - AddToCallStacks("OnKeyInputFocusGained"); - } - virtual void OnKeyInputFocusLost() - { - AddToCallStacks("OnKeyInputFocusLost"); - } - virtual Vector3 GetNaturalSize() - { - return Vector3( 0.0f, 0.0f, 0.0f ); - } - - virtual float GetHeightForWidth( float width ) - { - return 0.0f; - } - - virtual float GetWidthForHeight( float height ) - { - return 0.0f; - } - - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) - { - gOnRelayout = true; - } - - virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) - { - } - - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) - { - } - - virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) - { - return 0.0f; - } - - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) - { - } - - virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) - { - return false; - } - - void SetDaliProperty(std::string s) - { - Self().SetProperty(mDaliProperty, s); - } - void TestRelayoutRequest() - { - RelayoutRequest(); - } - - float TestGetHeightForWidthBase( float width ) - { - return GetHeightForWidthBase( width ); - } - - float TestGetWidthForHeightBase( float height ) - { - return GetWidthForHeightBase( height ); - } - - float TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) - { - return CalculateChildSizeBase( child, dimension ); - } - - bool TestRelayoutDependentOnChildrenBase( Dimension::Type dimension ) - { - return RelayoutDependentOnChildrenBase( dimension ); - } - - Property::Index mDaliProperty; - std::vector< std::string > mMethodsCalled; - Vector3 mSizeSet; - Vector3 mTargetSize; - bool mNego; - unsigned int mDepth; -}; - -/** - * Variant which adds a new child during OnStageConnection - */ -struct TestCustomActorVariant1 : public TestCustomActor -{ - /** - * Constructor - */ - TestCustomActorVariant1( Actor childToAdd ) - : mChildToAdd( childToAdd ) - { - } - - // From CustomActorImpl - virtual void OnStageConnection( int depth ) - { - // Chain up first - TestCustomActor::OnStageConnection( depth ); - - // Add the child - Self().Add( mChildToAdd ); - } - - Actor mChildToAdd; -}; - -/** - * Variant which removes children during OnStageConnection - */ -struct TestCustomActorVariant2 : public TestCustomActor -{ - /** - * Constructor - */ - TestCustomActorVariant2() - { - } - - // From CustomActorImpl - virtual void OnStageConnection( int depth ) - { - // Chain up first - TestCustomActor::OnStageConnection( depth ); - - // Remove all the children - for( unsigned int i=0, num=Self().GetChildCount(); iInitialize(); - - return custom; - } - - static TestCustomActor NewNegoSize() - { - Impl::TestCustomActor* impl = new Impl::TestCustomActor( true ); - TestCustomActor custom( *impl ); // takes ownership - custom.SetName( "SizeNegotiationActor" ); - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant1( Actor childToAdd ) - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1( childToAdd ); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant2() - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant2(); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant3( Actor childToAdd ) - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3( childToAdd ); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant4() - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant4(); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant5() - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant5(); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant6() - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant6(); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - static TestCustomActor NewVariant7( const char* name ) - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant7(); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize( name ); - - return custom; - } - - static TestCustomActor NewVariant8( Actor rival ) - { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8( rival ); - TestCustomActor custom( *impl ); // takes ownership - - impl->Initialize(); - - return custom; - } - - virtual ~TestCustomActor() - { - } - - Impl::TestCustomActor& GetImpl() - { - return static_cast(GetImplementation()); - } - - std::vector< std::string >& GetMethodsCalled() - { - return GetImpl().mMethodsCalled; - } - - void ResetCallStack() - { - GetImpl().ResetCallStack(); - } - - void SetDaliProperty(std::string s) - { - GetImpl().SetDaliProperty(s); - } - - Vector3 GetSize() - { - return GetImpl().mSizeSet; - } - - Vector3 GetTargetSize() - { - return GetImpl().mTargetSize; - } - - virtual Vector3 GetNaturalSize() - { - return Vector3( 0.0f, 0.0f, 0.0f ); - } - - virtual float GetHeightForWidth( float width ) - { - return 0.0f; - } - - virtual float GetWidthForHeight( float height ) - { - return 0.0f; - } - - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) - { - } - - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) - { - } - - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) - { - } - - void TestRelayoutRequest() - { - GetImpl().TestRelayoutRequest(); - } - - float TestGetHeightForWidthBase( float width ) - { - return GetImpl().TestGetHeightForWidthBase( width ); - } - - float TestGetWidthForHeightBase( float height ) - { - return GetImpl().TestGetWidthForHeightBase( height ); - } - - float TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) - { - return GetImpl().TestCalculateChildSizeBase( child, dimension ); - } - - bool TestRelayoutDependentOnChildrenBase( Dimension::Type dimension ) - { - return GetImpl().TestRelayoutDependentOnChildrenBase( dimension ); - } - - unsigned int GetDepth() - { - return GetImpl().mDepth; - } -private: - - TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl ) - { - } -}; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "dali-test-suite-utils/dali-test-suite-utils.h" +#include "test-custom-actor.h" using namespace Dali; -BaseHandle CreateActor() +void custom_actor_test_startup(void) { - return TestCustomActor::New(); + test_return_value = TET_UNDEF; } -Dali::TypeRegistration mType( typeid(TestCustomActor), typeid(Dali::CustomActor), CreateActor ); - -} // anon namespace +void custom_actor_test_cleanup(void) +{ + test_return_value = TET_PASS; +} +using namespace Dali; int UtcDaliCustomActorDestructor(void) { @@ -815,17 +50,17 @@ int UtcDaliCustomActorDestructor(void) CustomActor* actor = new CustomActor(); delete actor; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } int UtcDaliCustomActorImplDestructor(void) { - TestApplication application; - CustomActorImpl* actor = new Impl::TestCustomActor(); - delete actor; + TestApplication application; + CustomActorImpl* actor = new Test::Impl::TestCustomActor(); + CustomActor customActor(*actor); // Will automatically unref at the end of this function - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -835,20 +70,20 @@ int UtcDaliCustomActorDownCast(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::DownCast()"); - TestCustomActor custom = TestCustomActor::New(); + Test::TestCustomActor custom = Test::TestCustomActor::New(); Actor anActor = Actor::New(); - anActor.Add( custom ); + anActor.Add(custom); - Actor child = anActor.GetChildAt(0); - CustomActor customActor = CustomActor::DownCast( child ); - DALI_TEST_CHECK( customActor ); + Actor child = anActor.GetChildAt(0); + CustomActor customActor = CustomActor::DownCast(child); + DALI_TEST_CHECK(customActor); customActor = NULL; - DALI_TEST_CHECK( !customActor ); + DALI_TEST_CHECK(!customActor); - customActor = DownCast< CustomActor >( child ); - DALI_TEST_CHECK( customActor ); + customActor = DownCast(child); + DALI_TEST_CHECK(customActor); END_TEST; } @@ -858,41 +93,80 @@ int UtcDaliCustomActorDownCastNegative(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::DownCast()"); - Actor actor1 = Actor::New(); + Actor actor1 = Actor::New(); Actor anActor = Actor::New(); anActor.Add(actor1); - Actor child = anActor.GetChildAt(0); - CustomActor customActor = CustomActor::DownCast( child ); - DALI_TEST_CHECK( !customActor ); + Actor child = anActor.GetChildAt(0); + CustomActor customActor = CustomActor::DownCast(child); + DALI_TEST_CHECK(!customActor); Actor unInitialzedActor; - customActor = CustomActor::DownCast( unInitialzedActor ); - DALI_TEST_CHECK( !customActor ); + customActor = CustomActor::DownCast(unInitialzedActor); + DALI_TEST_CHECK(!customActor); + + customActor = DownCast(unInitialzedActor); + DALI_TEST_CHECK(!customActor); + END_TEST; +} + +int UtcDaliCustomActorMoveConstructor(void) +{ + TestApplication application; + + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_CHECK(custom); + DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION); + + int id = custom.GetProperty(Actor::Property::ID); + + Test::TestCustomActor moved = std::move(custom); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!custom); + + END_TEST; +} + +int UtcDaliCustomActorMoveAssignment(void) +{ + TestApplication application; + + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_CHECK(custom); + DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION); + + int id = custom.GetProperty(Actor::Property::ID); + + Test::TestCustomActor moved; + moved = std::move(custom); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!custom); - customActor = DownCast< CustomActor >( unInitialzedActor ); - DALI_TEST_CHECK( !customActor ); END_TEST; } -int UtcDaliCustomActorOnStageConnectionDisconnection(void) +int UtcDaliCustomActorOnSceneConnectionDisconnection(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnStageConnection() & OnStageDisconnection"); + tet_infoline("Testing Dali::CustomActor::OnSceneConnection() & OnSceneDisconnection"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); // add the custom actor to stage - Stage::GetCurrent().Add( custom ); + application.GetScene().Add(custom); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", custom.GetMethodsCalled()[0], TEST_LOCATION); - Stage::GetCurrent().Remove( custom ); + application.GetScene().Remove(custom); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", custom.GetMethodsCalled()[1], TEST_LOCATION); // Excercise the message passing to Update thread @@ -902,10 +176,10 @@ int UtcDaliCustomActorOnStageConnectionDisconnection(void) END_TEST; } -int UtcDaliCustomActorOnStageConnectionOrder(void) +int UtcDaliCustomActorOnSceneConnectionOrder(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnStageConnection() order"); + tet_infoline("Testing Dali::CustomActor::OnSceneConnection() order"); MasterCallStack.clear(); @@ -917,74 +191,87 @@ int UtcDaliCustomActorOnStageConnectionOrder(void) * / \ \ * D E F * - * OnStageConnection should be received for A, B, D, E, C, and finally F + * OnSceneConnection should be received for A, B, D, E, C, and finally F */ - TestCustomActor actorA = TestCustomActor::New(); - actorA.SetName( "ActorA" ); + Test::TestCustomActor actorA = Test::TestCustomActor::New(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - TestCustomActor actorC = TestCustomActor::New(); - actorC.SetName( "ActorC" ); - actorA.Add( actorC ); + Test::TestCustomActor actorC = Test::TestCustomActor::New(); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); - TestCustomActor actorD = TestCustomActor::New(); - actorD.SetName( "ActorD" ); - actorB.Add( actorD ); + Test::TestCustomActor actorD = Test::TestCustomActor::New(); + actorD.SetProperty(Actor::Property::NAME, "ActorD"); + actorB.Add(actorD); - TestCustomActor actorE = TestCustomActor::New(); - actorE.SetName( "ActorE" ); - actorB.Add( actorE ); + Test::TestCustomActor actorE = Test::TestCustomActor::New(); + actorE.SetProperty(Actor::Property::NAME, "ActorE"); + actorB.Add(actorE); - TestCustomActor actorF = TestCustomActor::New(); - actorF.SetName( "ActorF" ); - actorC.Add( actorF ); + Test::TestCustomActor actorF = Test::TestCustomActor::New(); + actorF.SetProperty(Actor::Property::NAME, "ActorF"); + actorC.Add(actorF); // add the custom actor to stage - Stage::GetCurrent().Add( actorA ); + application.GetScene().Add(actorA); - DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorC.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorC.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorC.GetMethodsCalled()[2], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorD.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorD.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorE.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorE.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorF.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorF.GetMethodsCalled()[1], TEST_LOCATION); // Check sequence is correct in MasterCallStack - DALI_TEST_EQUALS( 3+3+2+1+1+1, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(4 + 4 + 3 + 2 + 2 + 2, (int)(MasterCallStack.size()), TEST_LOCATION); + + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorD: OnPropertySet", MasterCallStack[5], TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnPropertySet", MasterCallStack[7], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[8], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnPropertySet", MasterCallStack[9], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnChildAdd", MasterCallStack[10], TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 5 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 6 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorD: OnStageConnection", MasterCallStack[ 7 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorE: OnStageConnection", MasterCallStack[ 8 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnStageConnection", MasterCallStack[ 9 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorF: OnStageConnection", MasterCallStack[ 10 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[11], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[12], TEST_LOCATION); + DALI_TEST_EQUALS("ActorD: OnSceneConnection", MasterCallStack[13], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnSceneConnection", MasterCallStack[14], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnSceneConnection", MasterCallStack[15], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnSceneConnection", MasterCallStack[16], TEST_LOCATION); // Excercise the message passing to Update thread @@ -994,12 +281,12 @@ int UtcDaliCustomActorOnStageConnectionOrder(void) END_TEST; } -int UtcDaliCustomActorOnStageDisconnectionOrder(void) +int UtcDaliCustomActorOnSceneDisconnectionOrder(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnStageDisconnection() order"); + tet_infoline("Testing Dali::CustomActor::OnSceneDisconnection() order"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); /* Build tree of actors: * @@ -1009,32 +296,32 @@ int UtcDaliCustomActorOnStageDisconnectionOrder(void) * / \ \ * D E F * - * OnStageDisconnection should be received for D, E, B, F, C, and finally A. + * OnSceneDisconnection should be received for D, E, B, F, C, and finally A. */ - TestCustomActor actorA = TestCustomActor::New(); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::New(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - TestCustomActor actorC = TestCustomActor::New(); - actorC.SetName( "ActorC" ); - actorA.Add( actorC ); + Test::TestCustomActor actorC = Test::TestCustomActor::New(); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); - TestCustomActor actorD = TestCustomActor::New(); - actorD.SetName( "ActorD" ); - actorB.Add( actorD ); + Test::TestCustomActor actorD = Test::TestCustomActor::New(); + actorD.SetProperty(Actor::Property::NAME, "ActorD"); + actorB.Add(actorD); - TestCustomActor actorE = TestCustomActor::New(); - actorE.SetName( "ActorE" ); - actorB.Add( actorE ); + Test::TestCustomActor actorE = Test::TestCustomActor::New(); + actorE.SetProperty(Actor::Property::NAME, "ActorE"); + actorB.Add(actorE); - TestCustomActor actorF = TestCustomActor::New(); - actorF.SetName( "ActorF" ); - actorC.Add( actorF ); + Test::TestCustomActor actorF = Test::TestCustomActor::New(); + actorF.SetProperty(Actor::Property::NAME, "ActorF"); + actorC.Add(actorF); // Excercise the message passing to Update thread @@ -1051,36 +338,36 @@ int UtcDaliCustomActorOnStageDisconnectionOrder(void) actorF.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); - DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorC.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorD.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorE.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorF.GetMethodsCalled()[0], TEST_LOCATION); // Check sequence is correct in MasterCallStack - DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorD: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorE: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorF: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorD: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnSceneDisconnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnSceneDisconnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1090,40 +377,44 @@ int UtcDaliCustomActorOnStageDisconnectionOrder(void) END_TEST; } -int UtcDaliCustomActorAddDuringOnStageConnection(void) +int UtcDaliCustomActorAddDuringOnSceneConnection(void) { TestApplication application; - tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageConnection() callback"); + tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneConnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); MasterCallStack.clear(); - /* The actorA is a special variant which adds a child to itself during OnStageConnection() + /* The actorA is a special variant which adds a child to itself during OnSceneConnection() * The actorB is provided as the child */ - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); - TestCustomActor actorA = TestCustomActor::NewVariant1( actorB ); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // Called from within OnStageConnection() + DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); // Called from within OnSceneConnection() - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(5, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnStageConnection() - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnStageConnection() + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); // Occurs during Actor::Add from within from within OnSceneConnection() + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); // Occurs after Actor::Add from within from within OnSceneConnection() // Excercise the message passing to Update thread @@ -1133,61 +424,65 @@ int UtcDaliCustomActorAddDuringOnStageConnection(void) // Check everything is ok after Actors are removed - stage.Remove( actorA ); + stage.Remove(actorA); application.SendNotification(); application.Render(); application.Render(); END_TEST; } -int UtcDaliCustomActorRemoveDuringOnStageConnection(void) +int UtcDaliCustomActorRemoveDuringOnSceneConnection(void) { TestApplication application; - tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageConnection() callback"); + tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneConnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); MasterCallStack.clear(); - /* The actorA is a special variant which removes its children during OnStageConnection() + /* The actorA is a special variant which removes its children during OnSceneConnection() * Actors B & C are provided as the children */ - TestCustomActor actorA = TestCustomActor::NewVariant2(); - actorA.SetName( "ActorA" ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant2(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - TestCustomActor actorC = TestCustomActor::New(); - actorC.SetName( "ActorC" ); - actorA.Add( actorC ); + Test::TestCustomActor actorC = Test::TestCustomActor::New(); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); - stage.Add( actorA ); + stage.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // Called from within OnStageConnection() - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnStageConnection() - - DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION ); - - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 4 ], TEST_LOCATION ); - - /* Actors B & C should be removed before the point where they could receive an OnStageConnection callback - * Therefore they shouldn't receive either OnStageConnection or OnStageDisconnection + DALI_TEST_EQUALS(6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // Called from within OnSceneConnection() + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[5], TEST_LOCATION); // Called from within OnSceneConnection() + + DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION); + + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[5], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION); + + /* Actors B & C should be removed before the point where they could receive an OnSceneConnection callback + * Therefore they shouldn't receive either OnSceneConnection or OnSceneDisconnection */ - DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); // Excercise the message passing to Update thread @@ -1197,30 +492,30 @@ int UtcDaliCustomActorRemoveDuringOnStageConnection(void) // Check everything is ok after last actor is removed - stage.Remove( actorA ); + stage.Remove(actorA); application.SendNotification(); application.Render(); application.Render(); END_TEST; } -int UtcDaliCustomActorAddDuringOnStageDisconnection(void) +int UtcDaliCustomActorAddDuringOnSceneDisconnection(void) { TestApplication application; - tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageDisonnection() callback"); + tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneDisonnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); - /* The actorA is a special variant which adds a child to itself during OnStageDisconnection() + /* The actorA is a special variant which adds a child to itself during OnSceneDisconnection() * The actorB is provided as the child */ - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); - TestCustomActor actorA = TestCustomActor::NewVariant3( actorB ); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); // Excercise the message passing to Update thread @@ -1233,21 +528,21 @@ int UtcDaliCustomActorAddDuringOnStageDisconnection(void) actorB.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); - // Child was added after parent disconnection, so should not receive OnStageConnection() - DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); + // Child was added after parent disconnection, so should not receive OnSceneConnection() + DALI_TEST_EQUALS(0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1257,24 +552,24 @@ int UtcDaliCustomActorAddDuringOnStageDisconnection(void) END_TEST; } -int UtcDaliCustomActorRemoveDuringOnStageDisconnection(void) +int UtcDaliCustomActorRemoveDuringOnSceneDisconnection(void) { TestApplication application; - tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageDisconnection() callback"); + tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneDisconnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); - /* The actorA is a special variant which removes its children during OnStageDisconnection() + /* The actorA is a special variant which removes its children during OnSceneDisconnection() * The actorB is provided as the child */ - TestCustomActor actorA = TestCustomActor::NewVariant4(); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant4(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); // Excercise the message passing to Update thread @@ -1287,22 +582,22 @@ int UtcDaliCustomActorRemoveDuringOnStageDisconnection(void) actorB.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[2], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1312,45 +607,49 @@ int UtcDaliCustomActorRemoveDuringOnStageDisconnection(void) END_TEST; } -int UtcDaliCustomActorRemoveParentDuringOnStageConnection(void) +int UtcDaliCustomActorRemoveParentDuringOnSceneConnection(void) { TestApplication application; - tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnStageConnection() callback"); + tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnSceneConnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene scene = application.GetScene(); MasterCallStack.clear(); /* The actorA is the parent of actorB - * The actorB is a special variant which removes its own parent during OnStageConnection() - * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnStageDisconnection() + * The actorB is a special variant which removes its own parent during OnSceneConnection() + * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnSceneDisconnection() */ - TestCustomActor actorA = TestCustomActor::New(); - actorA.SetName( "ActorA" ); + Test::TestCustomActor actorA = Test::TestCustomActor::New(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); - TestCustomActor actorB = TestCustomActor::NewVariant5(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant5(scene); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - stage.Add( actorA ); + scene.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1360,47 +659,51 @@ int UtcDaliCustomActorRemoveParentDuringOnStageConnection(void) END_TEST; } -int UtcDaliCustomActorAddParentDuringOnStageDisconnection(void) +int UtcDaliCustomActorAddParentDuringOnSceneDisconnection(void) { TestApplication application; - tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnStageDisconnection() callback"); + tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnSceneDisconnection() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene scene = application.GetScene(); MasterCallStack.clear(); /* The actorA is the parent of actorB - * The actorB is a special variant which (weirdly) adds its own parent during OnStageDisconnection() - * The child actor is interrupting the disconnection, such that parent should not get a OnStageDisconnection() + * The actorB is a special variant which (weirdly) adds its own parent during OnSceneDisconnection() + * The child actor is interrupting the disconnection, such that parent should not get a OnSceneDisconnection() */ - TestCustomActor actorA = TestCustomActor::New(); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::New(); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + scene.Add(actorA); - TestCustomActor actorB = TestCustomActor::NewVariant6(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant6(scene); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - stage.Remove( actorA ); + scene.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - // Disconnect was interrupted, so we should only get one OnStageConnection() for actorB + DALI_TEST_EQUALS(3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION); + // Disconnect was interrupted, so we should only get one OnSceneConnection() for actorB - DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1415,19 +718,19 @@ int UtcDaliCustomActorOnChildAddRemove(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); Actor aChild = Actor::New(); - custom.Add( aChild ); + custom.Add(aChild); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", custom.GetMethodsCalled()[0], TEST_LOCATION); - custom.Remove( aChild ); + custom.Remove(aChild); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", custom.GetMethodsCalled()[1], TEST_LOCATION); END_TEST; } @@ -1436,7 +739,7 @@ int UtcDaliCustomActorReparentDuringOnChildAdd(void) TestApplication application; tet_infoline("Testing Actor:Add (reparenting) behaviour during Dali::CustomActor::OnChildAdd() callback"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); MasterCallStack.clear(); @@ -1444,12 +747,12 @@ int UtcDaliCustomActorReparentDuringOnChildAdd(void) * The actorB is the child of actorA */ - TestCustomActor actorA = TestCustomActor::NewVariant7( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7("ActorA"); + stage.Add(actorA); - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); // Check hierarchy is as follows: // A @@ -1458,49 +761,53 @@ int UtcDaliCustomActorReparentDuringOnChildAdd(void) // | // B - DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorA.GetChildCount()), TEST_LOCATION); Actor container = actorA.GetChildAt(0); Actor containerChild; - DALI_TEST_CHECK( container ); - if ( container ) + DALI_TEST_CHECK(container); + if(container) { - DALI_TEST_EQUALS( "Container", container.GetName(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS("Container", container.GetProperty(Actor::Property::NAME), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(container.GetChildCount()), TEST_LOCATION); containerChild = container.GetChildAt(0); } - DALI_TEST_CHECK( containerChild ); - if ( containerChild ) + DALI_TEST_CHECK(containerChild); + if(containerChild) { - DALI_TEST_EQUALS( "ActorB", containerChild.GetName(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB", containerChild.GetProperty(Actor::Property::NAME), TEST_LOCATION); + DALI_TEST_EQUALS(0, (int)(containerChild.GetChildCount()), TEST_LOCATION); } // Check callback sequence - DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS(5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // mContainer will then receive OnChildAdd - DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 7, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(9, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 5 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 6 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[5], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[8], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1519,7 +826,7 @@ int UtcDaliCustomActorRemoveDuringOnChildRemove(void) TestApplication application; tet_infoline("Testing Actor:Remove behaviour during OnChildRemove() callback triggered when reparenting"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); MasterCallStack.clear(); @@ -1528,60 +835,64 @@ int UtcDaliCustomActorRemoveDuringOnChildRemove(void) * This should be a NOOP since the reparenting has not occured yet */ - TestCustomActor actorB = TestCustomActor::New(); - actorB.SetName( "ActorB" ); - stage.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + stage.Add(actorB); - TestCustomActor actorA = TestCustomActor::NewVariant8( actorB ); - actorA.SetName( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); Actor childActor = Actor::New(); - childActor.SetName( "Child" ); + childActor.SetProperty(Actor::Property::NAME, "Child"); // Reparent from actorA to actorB - actorA.Add( childActor ); - actorB.Add( childActor ); + actorA.Add(childActor); + actorB.Add(childActor); // Check hierarchy is as follows: // A B // | // Child - DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(actorA.GetChildCount()), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(actorB.GetChildCount()), TEST_LOCATION); + DALI_TEST_EQUALS(0, (int)(childActor.GetChildCount()), TEST_LOCATION); Actor child = actorB.GetChildAt(0); - DALI_TEST_CHECK( child ); - if ( child ) + DALI_TEST_CHECK(child); + if(child) { - DALI_TEST_EQUALS( "Child", child.GetName(), TEST_LOCATION ); + DALI_TEST_EQUALS("Child", child.GetProperty(Actor::Property::NAME), TEST_LOCATION); } // Check callback sequence - DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA // mContainer will then receive OnChildAdd - DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); // The derived class are always notified, no matter the child is successfully removed or not - DALI_TEST_EQUALS( "OnChildRemove", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS("OnChildRemove", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[5], TEST_LOCATION); // The derived class are always notified, no matter the child is successfully removed or not - DALI_TEST_EQUALS( "ActorB: OnChildRemove", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnChildRemove", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[7], TEST_LOCATION); // Excercise the message passing to Update thread @@ -1596,13 +907,13 @@ int UtcDaliCustomActorOnPropertySet(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::OnPropertySet()"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); custom.SetDaliProperty("yes"); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[0], TEST_LOCATION); END_TEST; } @@ -1611,21 +922,23 @@ int UtcDaliCustomActorOnSizeSet(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::OnSizeSet()"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - - custom.SetSize( Vector2( 9.0f, 10.0f ) ); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION ); - - custom.SetSize( Vector3( 4.0f, 5.0f, 6.0f ) ); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION ); - DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION ); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + + custom.SetProperty(Actor::Property::SIZE, Vector2(9.0f, 10.0f)); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS(9.0f, custom.GetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, custom.GetSize().height, TEST_LOCATION); + + custom.SetProperty(Actor::Property::SIZE, Vector3(4.0f, 5.0f, 6.0f)); + DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[3], TEST_LOCATION); + DALI_TEST_EQUALS(4.0f, custom.GetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(5.0f, custom.GetSize().height, TEST_LOCATION); + DALI_TEST_EQUALS(6.0f, custom.GetSize().depth, TEST_LOCATION); END_TEST; } @@ -1634,125 +947,69 @@ int UtcDaliCustomActorOnSizeAnimation(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - - Animation anim = Animation::New( 1.0f ); - anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) ); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliCustomActorOnTouchEvent(void) -{ - TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnTouchEvent()"); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + application.GetScene().Add(custom); - // set size for custom actor - custom.SetSize( 100, 100 ); - // add the custom actor to stage - Stage::GetCurrent().Add( custom ); - custom.ResetCallStack(); + Animation anim = Animation::New(1.0f); + anim.AnimateTo(Property(custom, Actor::Property::SIZE), Vector3(8.0f, 9.0f, 10.0f)); + anim.Play(); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); application.SendNotification(); - application.Render(); - - // simulate a touch event - Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 1, 1 ) ); - Dali::Integration::TouchEvent event; - event.AddPoint( point ); - application.ProcessEvent( event ); + application.Render(static_cast(1000.0f)); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnTouchEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS(8.0f, custom.GetTargetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(9.0f, custom.GetTargetSize().height, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, custom.GetTargetSize().depth, TEST_LOCATION); END_TEST; } -int UtcDaliCustomActorOnHoverEvent(void) +int UtcDaliCustomActorSizeComponentAnimation(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnHoverEvent()"); + tet_infoline("Testing Size component animation"); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + Test::TestCustomActor custom = Test::TestCustomActor::New(); + float intialWidth(10.0f); - // set size for custom actor - custom.SetSize( 100, 100 ); - // add the custom actor to stage - Stage::GetCurrent().Add( custom ); - custom.ResetCallStack(); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); + custom.SetProperty(Actor::Property::SIZE, Vector2(intialWidth, 10.0f)); // First method + application.GetScene().Add(custom); - // simulate a hover event - Dali::Integration::Point point; - point.SetState( PointState::MOTION ); - point.SetScreenPosition( Vector2( 1, 1 ) ); - Dali::Integration::HoverEvent event; - event.AddPoint( point ); - application.ProcessEvent( event ); + Animation anim = Animation::New(1.0f); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - END_TEST; -} + DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); -int UtcDaliCustomActorOnWheelEvent(void) -{ - TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnWheelEvent()"); + anim.AnimateTo(Property(custom, Actor::Property::SIZE_WIDTH), 20.0f); - TestCustomActor custom = TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - // set size for custom actor - custom.SetSize( 100, 100 ); - // add the custom actor to stage - Stage::GetCurrent().Add( custom ); - custom.ResetCallStack(); + anim.Play(); // Triggers second method ( OnSizeAnimation ) - // Render and notify a couple of times application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); + application.Render(static_cast(1000.0f)); + + DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - // simulate a wheel event - Vector2 screenCoordinates( 10.0f, 10.0f ); - Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u ); - application.ProcessEvent( event ); + DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); END_TEST; } int UtcDaliCustomActorImplOnPropertySet(void) { - TestApplication application; - CustomActorImpl* impl = new Impl::SimpleTestCustomActor(); + TestApplication application; + CustomActorImpl* impl = new Test::Impl::SimpleTestCustomActor(); + CustomActor customActor(*impl); // Will automatically unref at the end of this function - impl->OnPropertySet( 0, 0 ); + impl->OnPropertySet(0, 0); - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); - delete impl; END_TEST; } @@ -1760,15 +1017,15 @@ int UtcDaliCustomActorGetImplementation(void) { TestApplication application; - TestCustomActor custom = TestCustomActor::New(); - CustomActorImpl& impl = custom.GetImplementation(); - impl.GetOwner(); // Test + Test::TestCustomActor custom = Test::TestCustomActor::New(); + CustomActorImpl& impl = custom.GetImplementation(); + impl.GetOwner(); // Test - const TestCustomActor constCustom = TestCustomActor::New(); - const CustomActorImpl& constImpl = constCustom.GetImplementation(); - constImpl.GetOwner(); // Test + const Test::TestCustomActor constCustom = Test::TestCustomActor::New(); + const CustomActorImpl& constImpl = constCustom.GetImplementation(); + constImpl.GetOwner(); // Test - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -1777,7 +1034,7 @@ int UtcDaliCustomActorDoAction(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::DoAction()"); - TestCustomActor custom = TestCustomActor::New(); + Test::TestCustomActor custom = Test::TestCustomActor::New(); BaseHandle customActorObject = custom; @@ -1789,8 +1046,8 @@ int UtcDaliCustomActorDoAction(void) DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false); // Check that the custom actor is visible - custom.SetVisible(true); - DALI_TEST_CHECK(custom.IsVisible() == true); + custom.SetProperty(Actor::Property::VISIBLE, true); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == true); // Check the custom actor performed an action to hide itself DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true); @@ -1800,7 +1057,7 @@ int UtcDaliCustomActorDoAction(void) application.Render(); // Check that the custom actor is now invisible - DALI_TEST_CHECK(custom.IsVisible() == false); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == false); // Check the custom actor performed an action to show itself DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true); @@ -1810,17 +1067,40 @@ int UtcDaliCustomActorDoAction(void) application.Render(); // Check that the custom actor is now visible - DALI_TEST_CHECK(custom.IsVisible() == true); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == true); END_TEST; } int UtcDaliCustomActorCustomActor(void) { Dali::CustomActor customA; - Dali::CustomActor customB( customA ); + Dali::CustomActor customB(customA); + + DALI_TEST_CHECK(customA == customB); + + END_TEST; +} + +int UtcDaliCustomActorImplSetTransparent(void) +{ + TestApplication application; // Need the type registry + + Test::TestCustomActor actor = Test::TestCustomActor::New(); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::OPACITY, 0.1f); + actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400)); - DALI_TEST_CHECK( customA == customB ); + DALI_TEST_EQUALS(false, actor.IsTransparent(), TEST_LOCATION); + actor.SetTransparent(true); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(true, actor.IsTransparent(), TEST_LOCATION); + + application.GetScene().Remove(actor); END_TEST; } @@ -1828,100 +1108,93 @@ int UtcDaliCustomActorImplRelayoutRequest(void) { TestApplication application; - DALI_TEST_CHECK( gOnRelayout == false ); + DALI_TEST_CHECK(gOnRelayout == false); - TestCustomActor custom = TestCustomActor::NewNegoSize(); - Stage::GetCurrent().Add(custom); + Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); + application.GetScene().Add(custom); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gOnRelayout == true ); + DALI_TEST_CHECK(gOnRelayout == true); gOnRelayout = false; custom.TestRelayoutRequest(); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gOnRelayout == true ); + DALI_TEST_CHECK(gOnRelayout == true); END_TEST; } int UtcDaliCustomActorImplGetHeightForWidthBase(void) { - TestApplication application; - TestCustomActor custom = TestCustomActor::NewNegoSize(); + TestApplication application; + Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); float width = 300.0f; - float v = 0.0f; application.SendNotification(); application.Render(); - v = custom.TestGetHeightForWidthBase( width ); + float v = custom.TestGetHeightForWidthBase(width); - DALI_TEST_CHECK( v == width ); + DALI_TEST_CHECK(v == width); END_TEST; } int UtcDaliCustomActorImplGetWidthForHeightBase(void) { - TestApplication application; - TestCustomActor custom = TestCustomActor::NewNegoSize(); + TestApplication application; + Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); float height = 300.0f; - float v = 0.0f; application.SendNotification(); application.Render(); - v = custom.TestGetWidthForHeightBase( height ); + float v = custom.TestGetWidthForHeightBase(height); - DALI_TEST_CHECK( v == height ); + DALI_TEST_CHECK(v == height); END_TEST; } int UtcDaliCustomActorImplCalculateChildSizeBase(void) { - TestApplication application; - TestCustomActor custom = TestCustomActor::NewNegoSize(); + TestApplication application; + Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); Actor child = Actor::New(); child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS); - child.SetSize(150, 150); + child.SetProperty(Actor::Property::SIZE, Vector2(150, 150)); application.SendNotification(); application.Render(); - float v = 9.99f; - v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS ); - DALI_TEST_CHECK( v == 0.0f ); + float v = custom.TestCalculateChildSizeBase(child, Dali::Dimension::ALL_DIMENSIONS); + DALI_TEST_CHECK(v == 0.0f); END_TEST; } int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void) { - TestApplication application; - TestCustomActor custom = TestCustomActor::NewNegoSize(); + TestApplication application; + Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS); - bool v = false; + bool v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS); + DALI_TEST_CHECK(v == true); - v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( v == true ); - custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS); - v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH ); - application.SendNotification(); - application.Render(); - DALI_TEST_CHECK( v == false ); + v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH); + DALI_TEST_CHECK(v == false); END_TEST; } @@ -1932,8 +1205,8 @@ int UtcDaliCustomActorTypeRegistry(void) // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "CustomActor" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("CustomActor"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); std::string name; @@ -1944,23 +1217,22 @@ int UtcDaliCustomActorTypeRegistry(void) name = handle.GetTypeName(); tet_result(TET_FAIL); } - catch( DaliException& e ) + catch(DaliException& e) { exception = e.condition; - DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION ); + DALI_TEST_EQUALS(exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION); } END_TEST; } - int UtcDaliCustomActorGetExtensionP(void) { TestApplication application; - TestCustomActor custom = TestCustomActor::NewVariant5(); + Test::TestCustomActor custom = Test::TestCustomActor::NewVariant5(application.GetScene()); - DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() ); + DALI_TEST_CHECK(NULL == custom.GetImplementation().GetExtension()); END_TEST; } @@ -1968,9 +1240,9 @@ int UtcDaliCustomActorGetExtensionP(void) int UtcDaliCustomActorOnConnectionDepth(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnStageConnection() hierarchy depth"); + tet_infoline("Testing Dali::CustomActor::OnSceneConnection() hierarchy depth"); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); /* Build tree of actors: * @@ -1982,38 +1254,320 @@ int UtcDaliCustomActorOnConnectionDepth(void) * / \ \ * D E F 3 * - * OnStageConnection should return 1 for A, 2 for B and C, and 3 for D, E and F. + * OnSceneConnection should return 1 for A, 2 for B and C, and 3 for D, E and F. */ - TestCustomActor actorA = TestCustomActor::New(); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::New(); + stage.Add(actorA); - TestCustomActor actorB = TestCustomActor::New(); - actorA.Add( actorB ); + Test::TestCustomActor actorB = Test::TestCustomActor::New(); + actorA.Add(actorB); - TestCustomActor actorC = TestCustomActor::New(); - actorA.Add( actorC ); + Test::TestCustomActor actorC = Test::TestCustomActor::New(); + actorA.Add(actorC); - TestCustomActor actorD = TestCustomActor::New(); - actorB.Add( actorD ); + Test::TestCustomActor actorD = Test::TestCustomActor::New(); + actorB.Add(actorD); - TestCustomActor actorE = TestCustomActor::New(); - actorB.Add( actorE ); + Test::TestCustomActor actorE = Test::TestCustomActor::New(); + actorB.Add(actorE); - TestCustomActor actorF = TestCustomActor::New(); - actorC.Add( actorF ); + Test::TestCustomActor actorF = Test::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 ); + 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; +} + +int UtcDaliCustomActorSetGetProperty(void) +{ + TestApplication application; // Need the type registry + + Test::TestCustomActor actor = Test::TestCustomActor::New(); + application.GetScene().Add(actor); + + actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f); + actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f); + + Property::Value value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1); + DALI_TEST_EQUALS(value.Get(), 0.5f, 0.001f, TEST_LOCATION); + + value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2); + DALI_TEST_EQUALS(value.Get(), Color::WHITE, 0.001f, TEST_LOCATION); + + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3); + DALI_TEST_EQUALS(value.Get(), Color::BLUE, 0.001f, TEST_LOCATION); + + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4); + DALI_TEST_EQUALS(value.Get(), 20, TEST_LOCATION); + + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5); + DALI_TEST_EQUALS(value.Get(), 40.0f, 0.001f, TEST_LOCATION); + + // Get read-only property + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6); + DALI_TEST_EQUALS(value.Get(), 10.0f, 0.001f, TEST_LOCATION); + + // Attempt to set read-only property and then ensure value hasn't changed + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f); + DALI_TEST_EQUALS(value.Get(), 10.0f, 0.001f, TEST_LOCATION); + + END_TEST; +} + +int utcDaliActorGetTypeInfo(void) +{ + TestApplication application; + tet_infoline("Get the type info of a derived actor"); + + Test::TestCustomActor customActor = Test::TestCustomActor::New(); + + Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo(customActor); + + DALI_TEST_EQUALS(typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION); + + END_TEST; +} + +namespace Impl +{ +/** + * A custom actor that is not type registered on purpose + */ +struct UnregisteredCustomActor : public Dali::CustomActorImpl +{ + UnregisteredCustomActor() + : CustomActorImpl(ACTOR_BEHAVIOUR_DEFAULT) + { + } + virtual ~UnregisteredCustomActor() + { + } + virtual void OnSceneConnection(int32_t depth) + { + } + virtual void OnSceneDisconnection() + { + } + virtual void OnChildAdd(Actor& child) + { + } + virtual void OnChildRemove(Actor& child) + { + } + virtual void OnPropertySet(Property::Index index, const Property::Value& propertyValue) + { + } + virtual void OnSizeSet(const Vector3& targetSize) + { + } + virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) + { + } + virtual bool OnHoverEvent(const HoverEvent& event) + { + return false; + } + virtual bool OnWheelEvent(const WheelEvent& event) + { + return false; + } + virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) + { + } + virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) + { + } + virtual Vector3 GetNaturalSize() + { + return Vector3(); + } + virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) + { + return 0.f; + } + virtual float GetHeightForWidth(float width) + { + return 0.f; + } + virtual float GetWidthForHeight(float height) + { + return 0.f; + } + virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) + { + return false; + } + virtual void OnCalculateRelayoutSize(Dimension::Type dimension) + { + } + virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) + { + } +}; +} // namespace Impl +struct UnregisteredCustomActor : public Dali::CustomActor +{ + static UnregisteredCustomActor New() + { + Impl::UnregisteredCustomActor* impl = new Impl::UnregisteredCustomActor; + UnregisteredCustomActor custom(*impl); // takes ownership + return custom; + } + UnregisteredCustomActor() + { + } + ~UnregisteredCustomActor() + { + } + UnregisteredCustomActor(Internal::CustomActor* impl) + : CustomActor(impl) + { + } + UnregisteredCustomActor(Impl::UnregisteredCustomActor& impl) + : CustomActor(impl) + { + } + static UnregisteredCustomActor DownCast(BaseHandle handle) + { + UnregisteredCustomActor hndl; + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) + { + CustomActorImpl& customImpl = custom.GetImplementation(); + + Impl::UnregisteredCustomActor* impl = dynamic_cast(&customImpl); + + if(impl) + { + hndl = UnregisteredCustomActor(customImpl.GetOwner()); + } + } + return hndl; + } +}; + +int UtcDaliCustomActorSetGetActorPropertyActionSignal(void) +{ + TestApplication application; // Need the type registry + + auto custom = UnregisteredCustomActor::New(); + application.GetScene().Add(custom); + + // should have all actor properties + DALI_TEST_EQUALS(custom.GetPropertyType(Actor::Property::COLOR), Property::VECTOR4, TEST_LOCATION); + auto actorHandle = Actor::New(); + DALI_TEST_EQUALS(custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION); + + DALI_TEST_EQUALS(custom.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); + custom.SetProperty(Actor::Property::VISIBLE, false); + application.SendNotification(); + application.Render(); // IsVisible returns scene value + DALI_TEST_EQUALS(custom.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); + + // should have custom actor typename (as it has not registered itself) + DALI_TEST_EQUALS("CustomActor", custom.GetTypeName(), TEST_LOCATION); + + // should have actor actions + custom.DoAction("show", Property::Map()); + DALI_TEST_EQUALS(custom.GetProperty(Actor::Property::VISIBLE).Get(), true, TEST_LOCATION); + + Animation animation = Animation::New(0.01f); // very short animation + // should be able to animate actor property + animation.AnimateTo(Property(custom, Actor::Property::POSITION), Vector3(100.0f, 150.0f, 200.0f)); + animation.Play(); + + application.SendNotification(); + application.Render(1000.f); + + DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetProperty(Actor::Property::POSITION).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); + + Dali::WeakHandle weakRef(custom); + // should have actor signals + custom.ConnectSignal(&application, "offScene", [weakRef]() { + DALI_TEST_EQUALS(weakRef.GetHandle().GetProperty(Actor::Property::CONNECTED_TO_SCENE), false, TEST_LOCATION); + }); + + application.GetScene().Remove(custom); + application.GetScene().Add(custom); + + END_TEST; +} + +namespace Impl +{ +struct DerivedCustomActor : public UnregisteredCustomActor +{ +}; +} // namespace Impl + +struct DerivedCustomActor : public UnregisteredCustomActor +{ + static DerivedCustomActor New() + { + Impl::DerivedCustomActor* impl = new Impl::DerivedCustomActor; + DerivedCustomActor custom(*impl); // takes ownership + return custom; + } + DerivedCustomActor() + { + } + ~DerivedCustomActor() + { + } + DerivedCustomActor(Internal::CustomActor* impl) + : UnregisteredCustomActor(impl) + { + } + DerivedCustomActor(Impl::UnregisteredCustomActor& impl) + : UnregisteredCustomActor(impl) + { + } +}; + +// register custom +DALI_TYPE_REGISTRATION_BEGIN(DerivedCustomActor, UnregisteredCustomActor, nullptr); +DALI_TYPE_REGISTRATION_END() + +int UtcDaliCustomActorPropertyRegistrationDefaultValue(void) +{ + TestApplication application; // Need the type registry + + // register our base and add a property with default value for it + Dali::TypeRegistration typeRegistration(typeid(UnregisteredCustomActor), typeid(Dali::CustomActor), nullptr); + + auto derived = DerivedCustomActor::New(); + application.GetScene().Add(derived); + + // should have all actor properties + DALI_TEST_EQUALS(derived.GetPropertyType(Actor::Property::WORLD_MATRIX), Property::MATRIX, TEST_LOCATION); + auto actorHandle = Actor::New(); + DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION); + + // add a property in base class + AnimatablePropertyRegistration(typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f); + + // should be one more property now + DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION); + // check that the default value is set for base class + DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION); + // check that the default value is set for the derived instance as well + DALI_TEST_EQUALS(derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION); END_TEST; }