X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Control.cpp;h=32d16e4012aa3e81cb276eab6e00d83b6c26e116;hp=93ee34e14df294b2f0e1634401f3470c0c51e8fa;hb=b480cf8f1604782bc3104e1b170e73a27c9d351b;hpb=db152116b8c7de79b206d7d361c9d3875d05d0ac diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 93ee34e..32d16e4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -24,6 +24,10 @@ #include #include +#include +#include +#include + #include "dummy-control.h" using namespace Dali; @@ -186,6 +190,39 @@ int UtcDaliControlDownCastTemplate(void) END_TEST; } +int UtcDaliControlNavigationProperties(void) +{ + ToolkitTestApplication application; + + Control control = Control::New(); + Stage::GetCurrent().Add( control ); + + DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + + control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 1 ); + DALI_TEST_EQUALS( 1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 2 ); + DALI_TEST_EQUALS( 2, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 3 ); + DALI_TEST_EQUALS( 3, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 4 ); + DALI_TEST_EQUALS( 4, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + + control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 15 ); + DALI_TEST_EQUALS( 15, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 16 ); + DALI_TEST_EQUALS( 16, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 17 ); + DALI_TEST_EQUALS( 17, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 18 ); + DALI_TEST_EQUALS( 18, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION ); + + END_TEST; +} + int UtcDaliControlKeyInputFocus(void) { ToolkitTestApplication application; @@ -483,6 +520,13 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get(), (int)Visual::IMAGE, TEST_LOCATION ); DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get(), "Foobar.png", TEST_LOCATION ); + // set as Color + control.SetProperty( Control::Property::BACKGROUND, Color::RED ); + propValue = control.GetProperty( Control::Property::BACKGROUND ); + resultMap = propValue.GetMap(); + DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get(), (int)Visual::COLOR, TEST_LOCATION ); + DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get(), Color::RED, TEST_LOCATION ); + // Deprecated Properties control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::YELLOW ); DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::YELLOW, TEST_LOCATION ); @@ -721,3 +765,41 @@ int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void) END_TEST; } + +int UtcDaliControlSetTransformSize(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + + Property::Map transformMap; + transformMap.Add( DevelVisual::Transform::Property::OFFSET, Vector2( 10, 10 ) ) + .Add( DevelVisual::Transform::Property::ANCHOR_POINT, Align::BOTTOM_END ) + .Add( DevelVisual::Transform::Property::ORIGIN, Align::BOTTOM_END ) + .Add( DevelVisual::Transform::Property::SIZE, Vector2( 10, 20 ) ); + + control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( DevelVisual::Property::TRANSFORM, transformMap ) ); + + tet_infoline( "Test to ensure that the control background transform does not get overwritten when adding to the stage" ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + // Ensure the transform property still matches what we set + Property::Value value = control.GetProperty( Control::Property::BACKGROUND ); + Property::Map* map = value.GetMap(); + DALI_TEST_CHECK( map ); + Property::Value* transformValue = map->Find( DevelVisual::Property::TRANSFORM ); + DALI_TEST_CHECK( transformValue ); + + Property::Map* retMap = transformValue->GetMap(); + DALI_TEST_CHECK( retMap ); + DALI_TEST_EQUALS( retMap->Find( DevelVisual::Transform::Property::OFFSET )->Get< Vector2 >(), Vector2( 10, 10 ), TEST_LOCATION ); + DALI_TEST_EQUALS( retMap->Find( DevelVisual::Transform::Property::ANCHOR_POINT )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION ); + DALI_TEST_EQUALS( retMap->Find( DevelVisual::Transform::Property::ORIGIN )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION ); + DALI_TEST_EQUALS( retMap->Find( DevelVisual::Transform::Property::SIZE )->Get< Vector2 >(), Vector2( 10, 20 ), TEST_LOCATION ); + + END_TEST; +}