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=48913704c09635f66cd18f465f179f677136c806;hp=3b5cefb7ed9b8e6e43b0a6533ade0e9f2ed0e9db;hb=7dbe383e1d72909ceb2ef46e33b880243911df7e;hpb=a2d9a530516aa8e8db9ffb1cdfc5e121fc0df46d diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index 3b5cefb..4891370 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,6 @@ #include #include #include -#include -#include -#include using namespace Dali; @@ -69,46 +66,18 @@ static void OnScrollUpdate( const Vector2& position ) gOnScrollUpdateCalled = true; } -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) +Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) { - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState( state ); + point.SetDeviceId(4); + point.SetScreenPosition( screenPosition ); + point.SetDeviceClass( Device::Class::TOUCH ); + point.SetDeviceSubclass( Device::Subclass::NONE ); + touchEvent.points.push_back( point ); + touchEvent.time = time; + return touchEvent; } /* @@ -1002,7 +971,7 @@ int UtcDaliItemViewSetGetProperty(void) DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get(), 11.0f, TEST_LOCATION ); // Test "layout" property - DALI_TEST_CHECK( view.GetPropertyIndex("layout") == DevelItemView::Property::LAYOUT ); + DALI_TEST_CHECK( view.GetPropertyIndex("layout") == ItemView::Property::LAYOUT ); Property::Map gridLayoutProperty; gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) ); gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) ); @@ -1030,10 +999,10 @@ int UtcDaliItemViewSetGetProperty(void) layoutArray.PushBack(spiralLayoutPrperty); layoutArray.PushBack(listLayoutPrperty); - view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray); + view.SetProperty( ItemView::Property::LAYOUT, layoutArray); Property::Array getLayoutArray; - DALI_TEST_CHECK( view.GetProperty(DevelItemView::Property::LAYOUT ).Get( getLayoutArray ) ); + DALI_TEST_CHECK( view.GetProperty( ItemView::Property::LAYOUT ).Get( getLayoutArray ) ); //Check that the result is the same as DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION ); @@ -1063,7 +1032,7 @@ int UtcDaliItemViewSetGetProperty(void) DALI_TEST_EQUALS(number, 4, TEST_LOCATION ); } } - view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray); + view.SetProperty( ItemView::Property::LAYOUT, layoutArray); // Test "overshootEnabled" property @@ -1147,36 +1116,41 @@ int UtcDaliItemViewOvershootVertical(void) // Do a pan starting from 100,100 and moving down Vector2 pos(100.0f, 100.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + + 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++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.y += 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + 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); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + + 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++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.y -= 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); Wait(application, 100); END_TEST; } @@ -1208,36 +1182,36 @@ int UtcDaliItemViewOvershootHorizontal(void) // Do a pan starting from 100,100 and moving left Vector2 pos(100.0f, 100.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + 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++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.x -= 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + 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); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + 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++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.x += 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); Wait(application, 100); END_TEST;