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-ItemView.cpp;h=040fb1ced0780faf0fc339bc9c43a1c7d6ed23af;hp=fdef315cad80d6be538c669564c48113b95bea94;hb=9ce1fa453940de2fb38552cc374cd54af660debf;hpb=a303f9aeedf6c41514ab474e0cb7f52cd692deec diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp old mode 100644 new mode 100755 index fdef315..040fb1c --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include using namespace Dali; @@ -938,12 +940,83 @@ int UtcDaliItemViewSetGetProperty(void) view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f ); DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get(), 11.0f, TEST_LOCATION ); + // Test "layout" property + DALI_TEST_CHECK( view.GetPropertyIndex("layout") == DevelItemView::Property::LAYOUT ); + Property::Map gridLayoutProperty; + gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) ); + gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) ); + gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) ); + gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) ); + + Property::Map depthLayoutProperty; + depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) ); + depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) ); + depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) ); + + Property::Map spiralLayoutPrperty; + spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) ); + spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) ); + spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) ); + + Property::Map listLayoutPrperty; + listLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::LIST) ); + listLayoutPrperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(100, 100,50)) ); + + + Property::Array layoutArray; + layoutArray.PushBack(gridLayoutProperty); + layoutArray.PushBack(depthLayoutProperty); + layoutArray.PushBack(spiralLayoutPrperty); + layoutArray.PushBack(listLayoutPrperty); + + view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray); + + Property::Array getLayoutArray; + DALI_TEST_CHECK( view.GetProperty(DevelItemView::Property::LAYOUT ).Get( getLayoutArray ) ); + + //Check that the result is the same as + DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION ); + Property::Map firstLayout = *((getLayoutArray.GetElementAt( 0 )).GetMap()); + + for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx ) + { + KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) ); + if(propertyPair.first == DefaultItemLayoutProperty::TYPE) + { + int layoutType = propertyPair.second.Get(); + DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION ); + } + else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE) + { + Vector3 size = propertyPair.second.Get(); + DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION ); + } + else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING) + { + float spacing = propertyPair.second.Get(); + DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION ); + } + else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER) + { + int number = propertyPair.second.Get(); + DALI_TEST_EQUALS(number, 4, TEST_LOCATION ); + } + } + view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray); + + // Test "overshootEnabled" property DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED ); DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get(), view.IsOvershootEnabled(), TEST_LOCATION ); view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false ); DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get(), false, TEST_LOCATION ); + // Test "overshootSize" property + DALI_TEST_CHECK( view.GetPropertyIndex("overshootSize") == Scrollable::Property::OVERSHOOT_SIZE ); + Vector2 overshootSize = Vector2(100.0f,100.0f); + view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize ); + DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get(), overshootSize, TEST_LOCATION ); + // Animatable properties // Test "layoutPosition" property