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=da5ce83797ba1f559585c25e05794b7d8f0769f9;hp=6b5f743646d8d9b0a2b7763fbbb7da766731dfc2;hb=be93fd772a1b1b09425ac0aaec1ea1b64e9a9e60;hpb=e9e0a004027846f001ca87c1db13c811177c8f70 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index 6b5f743..da5ce83 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; @@ -166,6 +173,75 @@ int UtcDaliItemViewNew(void) END_TEST; } +int UtcDaliItemViewCopyConstructor(void) +{ + ToolkitTestApplication application; + + TestItemFactory factory; + ItemView itemView = ItemView::New( factory ); + DALI_TEST_CHECK( itemView ); + + ItemView copy( itemView ); + DALI_TEST_CHECK( copy ); + + END_TEST; +} + +int UtcDaliItemViewCopyAssignment(void) +{ + ToolkitTestApplication application; + + TestItemFactory factory; + ItemView itemView = ItemView::New( factory ); + DALI_TEST_CHECK( itemView ); + + ItemView copy; + copy = itemView; + DALI_TEST_CHECK( copy ); + DALI_TEST_EQUALS( itemView, copy, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliItemViewMoveConstructor(void) +{ + ToolkitTestApplication application; + + TestItemFactory factory; + ItemView itemView = ItemView::New( factory ); + DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + itemView.SetProperty( Actor::Property::SENSITIVE, false ); + DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) ); + + ItemView moved = std::move( itemView ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) ); + DALI_TEST_CHECK( !itemView ); + + END_TEST; +} + +int UtcDaliItemViewMoveAssignment(void) +{ + ToolkitTestApplication application; + + TestItemFactory factory; + ItemView itemView = ItemView::New( factory ); + DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + itemView.SetProperty( Actor::Property::SENSITIVE, false ); + DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) ); + + ItemView moved; + moved = std::move( itemView ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) ); + DALI_TEST_CHECK( !itemView ); + + END_TEST; +} + int UtcDaliItemViewDownCast(void) { ToolkitTestApplication application; @@ -1254,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; +}