ImageVisual Action::Reload added
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 82527f4..deca627
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -22,8 +22,9 @@
 // Need to override adaptor classes for toolkit test harness, so include
 // test harness headers before dali headers.
 #include <dali-toolkit-test-suite-utils.h>
-
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -40,16 +41,95 @@ void utc_dali_toolkit_item_view_cleanup(void)
 
 namespace
 {
-const unsigned int TOTAL_ITEM_NUMBER = 100;
+
+const unsigned int TOTAL_ITEM_NUMBER = 400;
 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
 
+const int RENDER_FRAME_INTERVAL = 16;                     ///< Duration of each frame in ms. (at approx 60FPS)
+
 static bool gObjectCreatedCallBackCalled;
+static bool gOnLayoutActivatedCalled;                     ///< Whether the LayoutActivated signal was invoked.
+static bool gOnScrollUpdateCalled;
 
 static void TestCallback(BaseHandle handle)
 {
   gObjectCreatedCallBackCalled = true;
 }
 
+static void OnLayoutActivated()
+{
+  gOnLayoutActivatedCalled = true;
+}
+
+static void OnScrollUpdate( const Vector2& position )
+{
+  gOnScrollUpdateCalled = true;
+}
+
+// Generate a PanGestureEvent to send to Core
+Integration::PanGestureEvent GeneratePan(
+    Gesture::State state,
+    const Vector2& previousPosition,
+    const Vector2& currentPosition,
+    unsigned long timeDelta,
+    unsigned int numberOfTouches = 1)
+{
+  Integration::PanGestureEvent pan(state);
+
+  pan.previousPosition = previousPosition;
+  pan.currentPosition = currentPosition;
+  pan.timeDelta = timeDelta;
+  pan.numberOfTouches = numberOfTouches;
+
+  return pan;
+}
+
+/**
+ * Helper to generate PanGestureEvent
+ *
+ * @param[in] application Application instance
+ * @param[in] state The Gesture State
+ * @param[in] pos The current position of touch.
+ */
+static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
+{
+  static Vector2 last;
+
+  if( (state == Gesture::Started) ||
+      (state == Gesture::Possible) )
+  {
+    last.x = pos.x;
+    last.y = pos.y;
+  }
+
+  application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
+
+  last.x = pos.x;
+  last.y = pos.y;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+  int time = 0;
+
+  for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+  {
+    application.SendNotification();
+    application.Render(RENDER_FRAME_INTERVAL);
+    time += RENDER_FRAME_INTERVAL;
+  }
+
+  return time;
+}
 
 // Implementation of ItemFactory for providing actors to ItemView
 class TestItemFactory : public ItemFactory
@@ -82,9 +162,9 @@ public: // From ItemFactory
    */
   virtual Actor NewItem(unsigned int itemId)
   {
-    // Create an image actor for this item
+    // Create a renderable actor for this item
     Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
-    Actor actor = ImageActor::New(image);
+    Actor actor = CreateRenderableActor(image);
 
     return actor;
   }
@@ -270,6 +350,7 @@ int UtcDaliItemViewDeactivateCurrentLayout(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Down);
   view.AddLayout(*gridLayout);
 
   // Check there is no active layout at the moment
@@ -300,6 +381,7 @@ int UtcDaliItemViewGetItemAndGetItemId(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Left);
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
@@ -324,6 +406,7 @@ int UtcDaliItemViewRemoveItem(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Right);
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
@@ -337,13 +420,34 @@ int UtcDaliItemViewRemoveItem(void)
   // Remove the item with ID 2
   view.RemoveItem(2, 0.0f);
 
-  // Get the new item given the item ID 2
+  // Get the new item given the item ID 2 and 3
   Actor newItemActorID2 = view.GetItem(2);
+  Actor newItemActorID3 = view.GetItem(3);
 
   // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
   DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
   DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
-  DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3);
+  DALI_TEST_CHECK(newItemActorID2 == oldItemActorID3);
+
+  // scroll to the end of item view
+  view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
+
+  application.SendNotification();
+  application.Render(0);
+
+  // Refresh the item view
+  view.Refresh();
+
+  Actor itemActorID390 = view.GetItem(390);
+  DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
+
+  // Remove the item with ID 2 (which is now before the current item range)
+  view.RemoveItem(2, 0.0f);
+
+  // Check the original item with item ID 2 was deleted and now item ID 389 represents the original item with ID 390
+  DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 389);
+  DALI_TEST_CHECK(view.GetItem(389) == itemActorID390);
+
   END_TEST;
 }
 
@@ -355,9 +459,10 @@ int UtcDaliItemViewGetCurrentLayoutPosition(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a depth layout and add it to ItemView
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+  depthLayout->SetOrientation(ControlOrientation::Up);
+  view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -458,14 +563,14 @@ int UtcDaliItemViewScrollToItem(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
   Vector3 vec(480.0f, 800.0f, 0.0f);
-  ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
 
   view.SetName("view actor");
   view.AddLayout(*layout);
   view.SetSize(vec);
 
   Stage::GetCurrent().Add(view);
-  layout->SetOrientation(ControlOrientation::Up);
+  layout->SetOrientation(ControlOrientation::Down);
   view.ActivateLayout(0, vec, 0.0f);
 
   application.SendNotification();
@@ -550,14 +655,15 @@ int UtcDaliItemViewInsertItemP(void)
   ItemView view = ItemView::New(factory);
 
   // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID);
+  gridLayout->SetOrientation(ControlOrientation::Left);
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
-  view.ActivateLayout(0, stageSize, 0.5f);
+  view.ActivateLayout(0, stageSize, 0.0f);
 
-  // Get the item given the item ID
+  // Get the specified item where new item to be inserted before that
   Actor itemActor = view.GetItem(2);
 
   ItemId id = view.GetItemId( itemActor );
@@ -567,9 +673,33 @@ int UtcDaliItemViewInsertItemP(void)
 
   Actor newActor = Actor::New();
 
-  view.InsertItem(Item(id, newActor), 0.5f);
+  view.InsertItem(Item(id, newActor), 0.0f);
 
   DALI_TEST_CHECK(view.GetItem(2) == newActor);
+
+  DALI_TEST_CHECK(view.GetItemId(itemActor) == 3);
+  DALI_TEST_CHECK(view.GetItem(3) == itemActor);
+
+  // scroll to the end of item view
+  view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
+
+  application.SendNotification();
+  application.Render(0);
+
+  // Refresh the item view
+  view.Refresh();
+
+  Actor itemActorID390 = view.GetItem(390);
+  DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
+
+  // Insert the item with ID 2 (which is now before the current item range)
+  Actor anotherNewActor = Actor::New();
+  view.InsertItem(Item(id, anotherNewActor), 0.0f);
+
+  // Check that item ID 391 now represents the original item with ID 390
+  DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 391);
+  DALI_TEST_CHECK(view.GetItem(391) == itemActorID390);
+
   END_TEST;
 }
 
@@ -581,9 +711,10 @@ int UtcDaliItemViewInsertItemsP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a depth layout and add it to ItemView
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
+  depthLayout->SetOrientation(ControlOrientation::Right);
+  view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -591,9 +722,15 @@ int UtcDaliItemViewInsertItemsP(void)
 
   unsigned int itemCount = view.GetChildCount();
 
+  // Get the specified item where new items to be inserted before that
+  Actor itemActor = view.GetItem(1);
+
+  // Check we are getting the correct Item ID given the specified item
+  DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
+
   ItemContainer insertList;
 
-  for( unsigned int i = 0u; i < 10; ++i )
+  for( unsigned int i = 1u; i < 11; ++i )
   {
     Actor child = view.GetChildAt( i );
     Actor newActor = Actor::New();
@@ -608,6 +745,10 @@ int UtcDaliItemViewInsertItemsP(void)
 
   DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
 
+  // Check that new items are inserted in the correct positions
+  DALI_TEST_CHECK(view.GetItemId(itemActor) == 11);
+  DALI_TEST_CHECK(view.GetItem(11) == itemActor);
+
   ItemIdContainer removeList;
 
   for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
@@ -626,6 +767,11 @@ int UtcDaliItemViewInsertItemsP(void)
   }
 
   DALI_TEST_CHECK(view.GetChildCount() == itemCount);
+
+  // Check that new items are removed correctly so that we are getting the correct Item ID given the specified item
+  DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
+  DALI_TEST_CHECK(view.GetItem(1) == itemActor);
+
   END_TEST;
 }
 
@@ -637,9 +783,9 @@ int UtcDaliItemViewReplaceItemP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -647,9 +793,10 @@ int UtcDaliItemViewReplaceItemP(void)
 
   Actor newActor = Actor::New();
 
-  view.ReplaceItem( Item( 0, newActor ), 0.5f );
+  view.ReplaceItem( Item( 5, newActor ), 0.5f );
+
+  DALI_TEST_CHECK(view.GetItem(5) == newActor);
 
-  DALI_TEST_CHECK(view.GetItem(0) == newActor);
   END_TEST;
 }
 
@@ -661,9 +808,10 @@ int UtcDaliItemViewReplaceItemsP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Down );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -673,11 +821,11 @@ int UtcDaliItemViewReplaceItemsP(void)
 
   for( unsigned int i = 0u; i < 10; ++i )
   {
-    Actor child = view.GetChildAt( i );
+    Actor child = view.GetItem( i );
     Actor newActor = Actor::New();
     newActor.SetName("Replaced");
 
-    replaceList.push_back( Item( view.GetItemId(child), newActor ) );
+    replaceList.push_back( Item( i, newActor ) );
   }
 
   if( !replaceList.empty() )
@@ -698,9 +846,10 @@ int UtcDaliItemViewGetItemsRangeP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Left );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -722,9 +871,10 @@ int UtcDaliItemViewSetItemsAnchorPointP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Right );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -771,3 +921,362 @@ int UtcDaliItemFactoryGetExtention(void)
   DALI_TEST_CHECK( factory.GetExtension() == NULL );
   END_TEST;
 }
+
+int UtcDaliItemViewLayoutActivatedSignalP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  TestItemFactory factory;
+  ItemView view = ItemView::New(factory);
+
+  // Create a grid layout and add it to ItemView
+  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  view.AddLayout(*gridLayout);
+
+  Stage::GetCurrent().Add( view );
+
+  // Connect the layout activated signal
+  view.LayoutActivatedSignal().Connect( &OnLayoutActivated );
+
+  gOnLayoutActivatedCalled = false;
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.1f);
+
+  // Wait for 0.1 second
+  Wait(application, 100);
+
+  DALI_TEST_EQUALS( gOnLayoutActivatedCalled, true, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliItemViewSetGetProperty(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  TestItemFactory factory;
+  ItemView view = ItemView::New(factory);
+  DALI_TEST_CHECK(view);
+
+  // Event side properties
+
+  // Test "minimumSwipeSpeed" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeSpeed") == ItemView::Property::MINIMUM_SWIPE_SPEED  );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), view.GetMinimumSwipeSpeed(), TEST_LOCATION );
+  view.SetProperty( ItemView::Property::MINIMUM_SWIPE_SPEED, 2.5f );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), 2.5f, TEST_LOCATION );
+
+  // Test "minimumSwipeDistance" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeDistance") == ItemView::Property::MINIMUM_SWIPE_DISTANCE  );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), view.GetMinimumSwipeDistance(), TEST_LOCATION );
+  view.SetProperty( ItemView::Property::MINIMUM_SWIPE_DISTANCE, 8.725f );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), 8.725f, TEST_LOCATION );
+
+  // Test "wheelScrollDistanceStep" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("wheelScrollDistanceStep") == ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP  );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), view.GetWheelScrollDistanceStep(), TEST_LOCATION );
+  view.SetProperty( ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP, 5.0f );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), 5.0f, TEST_LOCATION );
+
+  // Test "snapToItemEnabled" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("snapToItemEnabled") == ItemView::Property::SNAP_TO_ITEM_ENABLED  );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), view.GetAnchoring(), TEST_LOCATION );
+  view.SetProperty( ItemView::Property::SNAP_TO_ITEM_ENABLED, true );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+  // Test "refreshInterval" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("refreshInterval") == ItemView::Property::REFRESH_INTERVAL  );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), view.GetRefreshInterval(), TEST_LOCATION );
+  view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
+
+  // Test "layout" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("layout") == ItemView::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( ItemView::Property::LAYOUT, layoutArray);
+
+  Property::Array getLayoutArray;
+  DALI_TEST_CHECK( view.GetProperty( ItemView::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<int>();
+      DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
+    }
+    else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+    {
+      Vector3 size = propertyPair.second.Get<Vector3>();
+      DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+    }
+    else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
+    {
+      float spacing = propertyPair.second.Get<float>();
+      DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION );
+    }
+    else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
+    {
+      int number = propertyPair.second.Get<int>();
+      DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
+    }
+  }
+  view.SetProperty( ItemView::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<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
+  view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
+  DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), 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<Vector2>(), overshootSize, TEST_LOCATION );
+
+  // Animatable properties
+
+  // Test "layoutPosition" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("layoutPosition") == ItemView::Property::LAYOUT_POSITION  );
+  view.SetProperty( ItemView::Property::LAYOUT_POSITION, 20.5f );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_POSITION).Get<float>(), 20.5f, TEST_LOCATION );
+
+  // Test "scrollSpeed" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("scrollSpeed") == ItemView::Property::SCROLL_SPEED  );
+  view.SetProperty( ItemView::Property::SCROLL_SPEED, 3.35f );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_SPEED).Get<float>(), 3.35f, TEST_LOCATION );
+
+  // Test "overshoot" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("overshoot") == ItemView::Property::OVERSHOOT  );
+  view.SetProperty( ItemView::Property::OVERSHOOT, 0.15f );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::OVERSHOOT).Get<float>(), 0.15f, TEST_LOCATION );
+
+  // Test "scrollDirection" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("scrollDirection") == ItemView::Property::SCROLL_DIRECTION  );
+  view.SetProperty( ItemView::Property::SCROLL_DIRECTION, Vector2(0.85f, 0.5f) );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_DIRECTION).Get<Vector2>(), Vector2(0.85f, 0.5f), TEST_LOCATION );
+
+  // Test "layoutOrientation" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("layoutOrientation") == ItemView::Property::LAYOUT_ORIENTATION  );
+  view.SetProperty( ItemView::Property::LAYOUT_ORIENTATION, 2 );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_ORIENTATION).Get<int>(), 2, TEST_LOCATION );
+
+  // Test "scrollContentSize" property
+  DALI_TEST_CHECK( view.GetPropertyIndex("scrollContentSize") == ItemView::Property::SCROLL_CONTENT_SIZE  );
+  view.SetProperty( ItemView::Property::SCROLL_CONTENT_SIZE, 250.0f );
+  Wait(application);
+  DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_CONTENT_SIZE).Get<float>(), 250.0f, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliItemViewOvershootVertical(void)
+{
+  ToolkitTestApplication application;
+  Dali::Stage stage = Dali::Stage::GetCurrent();
+
+  // Create the ItemView actor
+  TestItemFactory factory;
+  ItemView view = ItemView::New(factory);
+
+  // Create a grid layout and add it to ItemView
+  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  view.AddLayout(*gridLayout);
+  stage.Add(view);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(stage.GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
+  DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+  view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
+
+  Wait(application);
+
+  // Do a pan starting from 100,100 and moving down
+  Vector2 pos(100.0f, 100.0f);
+  SendPan(application, Gesture::Possible, pos);
+  SendPan(application, Gesture::Started, pos);
+  pos.y += 5.0f;
+  Wait(application, 100);
+
+  for(int i = 0;i<200;i++)
+  {
+    SendPan(application, Gesture::Continuing, pos);
+    pos.y += 5.0f;
+    Wait(application);
+  }
+
+  SendPan(application, Gesture::Finished, pos);
+  Wait(application, 100);
+
+  // Do a pan starting from 100,100 and moving up
+  pos = Vector2(100.0f, 300.0f);
+  SendPan(application, Gesture::Possible, pos);
+  SendPan(application, Gesture::Started, pos);
+  pos.y -= 5.0f;
+  Wait(application, 100);
+
+  for(int i = 0;i<200;i++)
+  {
+    SendPan(application, Gesture::Continuing, pos);
+    pos.y -= 5.0f;
+    Wait(application);
+  }
+
+  SendPan(application, Gesture::Finished, pos);
+  Wait(application, 100);
+  END_TEST;
+}
+
+int UtcDaliItemViewOvershootHorizontal(void)
+{
+  ToolkitTestApplication application;
+  Dali::Stage stage = Dali::Stage::GetCurrent();
+
+  // Create the ItemView actor
+  TestItemFactory factory;
+  ItemView view = ItemView::New(factory);
+
+  // Create a grid layout and add it to ItemView
+  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  view.AddLayout(*gridLayout);
+  stage.Add(view);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(stage.GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
+  DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+  view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
+
+  Wait(application);
+
+  // Do a pan starting from 100,100 and moving left
+  Vector2 pos(100.0f, 100.0f);
+  SendPan(application, Gesture::Possible, pos);
+  SendPan(application, Gesture::Started, pos);
+  pos.x -= 5.0f;
+  Wait(application, 100);
+
+  for(int i = 0;i<200;i++)
+  {
+    SendPan(application, Gesture::Continuing, pos);
+    pos.x -= 5.0f;
+    Wait(application);
+  }
+
+  SendPan(application, Gesture::Finished, pos);
+  Wait(application, 100);
+
+  // Do a pan starting from 100,100 and moving right
+  pos = Vector2(100.0f, 100.0f);
+  SendPan(application, Gesture::Possible, pos);
+  SendPan(application, Gesture::Started, pos);
+  pos.x += 5.0f;
+  Wait(application, 100);
+
+  for(int i = 0;i<200;i++)
+  {
+    SendPan(application, Gesture::Continuing, pos);
+    pos.x += 5.0f;
+    Wait(application);
+  }
+
+  SendPan(application, Gesture::Finished, pos);
+  Wait(application, 100);
+
+  END_TEST;
+}
+
+int UtcDaliItemEnableDisableRefresh(void)
+{
+  ToolkitTestApplication application;
+  Dali::Stage stage = Dali::Stage::GetCurrent();
+
+  // Create the ItemView actor
+  TestItemFactory factory;
+  ItemView view = ItemView::New(factory);
+
+  // Create a grid layout and add it to ItemView
+  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  view.AddLayout(*gridLayout);
+  stage.Add(view);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(stage.GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  //Connect to signal scroll updated
+  view.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+
+  Property::Map attributes;
+  view.DoAction("enableRefresh", attributes );
+  gOnScrollUpdateCalled = true;
+  view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
+  application.SendNotification();
+  application.Render(1000);
+  DALI_TEST_EQUALS( gOnScrollUpdateCalled, true, TEST_LOCATION );
+
+
+  view.DoAction("disableRefresh", attributes );
+  gOnScrollUpdateCalled = false;
+  view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
+  application.SendNotification();
+  application.Render(1000);
+
+  DALI_TEST_EQUALS( gOnScrollUpdateCalled, false, TEST_LOCATION );
+
+  END_TEST;
+}