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=e1273952bf039c5f02226729522ab3e48b4d76e3;hp=1ba8d0bff0cd05175e921b531ab778858deab70e;hb=0c862d5823332bc2161c64f901395f2390c82fd2;hpb=dea624eb348a4926d8761c8a1364f03f9f71acf5 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index 1ba8d0b..e127395 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -24,7 +24,7 @@ #include #include #include - +#include 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; @@ -355,7 +362,7 @@ int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void) DALI_TEST_CHECK(view.GetLayoutCount() == 3); // Check there is no active layout at the moment - DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + DALI_TEST_CHECK(!view.GetActiveLayout()); // Activate the depth layout Vector3 stageSize(application.GetScene().GetSize()); @@ -392,7 +399,7 @@ int UtcDaliItemViewDeactivateCurrentLayout(void) view.AddLayout(*gridLayout); // Check there is no active layout at the moment - DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + DALI_TEST_CHECK(!view.GetActiveLayout()); // Activate the grid layout Vector3 stageSize(application.GetScene().GetSize()); @@ -405,7 +412,7 @@ int UtcDaliItemViewDeactivateCurrentLayout(void) view.DeactivateCurrentLayout(); // Check there is no active layout at the moment - DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + DALI_TEST_CHECK(!view.GetActiveLayout()); END_TEST; } @@ -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; +}