WheelEvent class pimpling
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.cpp
index 1ba8d0b..da5ce83 100644 (file)
@@ -24,7 +24,7 @@
 #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/wheel-event-integ.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -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 bool gOnWheelEventCalled;                          ///< Whether the WheelEventSignal signal was invoked.
 
 static void TestCallback(BaseHandle handle)
 {
@@ -66,6 +67,12 @@ static void OnScrollUpdate( const Vector2& position )
   gOnScrollUpdateCalled = true;
 }
 
+static bool OnWheelEvent( Actor actor, const Dali::WheelEvent& wheelEvent )
+{
+  gOnWheelEventCalled = true;
+  return false;
+}
+
 Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
 {
   Integration::TouchEvent touchEvent;
@@ -1323,3 +1330,40 @@ int UtcDaliItemEnableDisableRefresh(void)
 
   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;
+}