Patch to synchronize with bug fixes done in Tizen 2.4 MCD branch.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.cpp
index d5c6af5..fdef315 100644 (file)
@@ -50,6 +50,7 @@ const int RENDER_FRAME_INTERVAL = 16;                     ///< Duration of each
 
 static bool gObjectCreatedCallBackCalled;
 static bool gOnLayoutActivatedCalled;                     ///< Whether the LayoutActivated signal was invoked.
+static bool gOnScrollUpdateCalled;
 
 static void TestCallback(BaseHandle handle)
 {
@@ -61,6 +62,11 @@ 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,
@@ -1102,3 +1108,44 @@ int UtcDaliItemViewOvershootHorizontal(void)
 
   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;
+}