+
+int UtcDaliItemViewOvershootVertical(void)
+{
+ ToolkitTestApplication application;
+ Dali::Integration::Scene stage = application.GetScene();
+
+ // 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);
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+
+ pos.y += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+ pos.y += 5.0f;
+ Wait(application);
+ }
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
+
+ Wait(application, 100);
+
+ // Do a pan starting from 100,100 and moving up
+ pos = Vector2(100.0f, 300.0f);
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+
+ pos.y -= 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+ pos.y -= 5.0f;
+ Wait(application);
+ }
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
+ Wait(application, 100);
+ END_TEST;
+}
+
+int UtcDaliItemViewOvershootHorizontal(void)
+{
+ ToolkitTestApplication application;
+ Dali::Integration::Scene stage = application.GetScene();
+
+ // 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);
+ application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ));
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ));
+ pos.x -= 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+ pos.x -= 5.0f;
+ Wait(application);
+ }
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
+ Wait(application, 100);
+
+ // Do a pan starting from 100,100 and moving right
+ pos = Vector2(100.0f, 100.0f);
+ application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+ pos.x += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
+ pos.x += 5.0f;
+ Wait(application);
+ }
+
+ application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
+ Wait(application, 100);
+
+ END_TEST;
+}
+
+int UtcDaliItemEnableDisableRefresh(void)
+{
+ ToolkitTestApplication application;
+ Dali::Integration::Scene stage = application.GetScene();
+
+ // 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;
+}
+
+int UtcDaliItemViewWheelEvent(void)
+{
+ ToolkitTestApplication application;
+ Dali::Integration::Scene stage = application.GetScene();
+
+ // 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 wheel event signal
+ view.WheelEventSignal().Connect( &OnWheelEvent );
+
+ DALI_TEST_CHECK( !gOnWheelEventCalled );
+
+ // Render and notify
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ // Perform a wheel event
+ Dali::Integration::WheelEvent wheelEvent( Dali::Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, Vector2( 10.0f, 10.0f ), 1, 1000u );
+ application.ProcessEvent( wheelEvent );
+ DALI_TEST_CHECK( gOnWheelEventCalled );
+
+ END_TEST;
+}