X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ItemView.cpp;h=f5e6da83cbbc5e18e2d8bc657c799b2b9a909b09;hb=5aaba5adcf1a717e1ece3ef9c55c8912420993b5;hp=deca627c36e3516fcec3c3aeb0865e4c80083487;hpb=410125f32fcd135226a2a0a668b2855ea9e17a69;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index deca627..f5e6da8 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) 2017 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,7 +24,7 @@ #include #include #include -#include + using namespace Dali; using namespace Toolkit; @@ -66,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; } /* @@ -565,9 +537,9 @@ int UtcDaliItemViewScrollToItem(void) Vector3 vec(480.0f, 800.0f, 0.0f); ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH ); - view.SetName("view actor"); + view.SetProperty( Dali::Actor::Property::NAME,"view actor"); view.AddLayout(*layout); - view.SetSize(vec); + view.SetProperty( Actor::Property::SIZE, vec ); Stage::GetCurrent().Add(view); layout->SetOrientation(ControlOrientation::Down); @@ -734,7 +706,7 @@ int UtcDaliItemViewInsertItemsP(void) { Actor child = view.GetChildAt( i ); Actor newActor = Actor::New(); - newActor.SetName("Inserted"); + newActor.SetProperty( Dali::Actor::Property::NAME,"Inserted"); insertList.push_back( Item( view.GetItemId(child), newActor ) ); } @@ -755,7 +727,7 @@ int UtcDaliItemViewInsertItemsP(void) { Actor child = view.GetChildAt( i ); - if( child.GetName() == "Inserted" ) + if( child.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Inserted" ) { removeList.push_back( view.GetItemId(child) ); } @@ -823,7 +795,7 @@ int UtcDaliItemViewReplaceItemsP(void) { Actor child = view.GetItem( i ); Actor newActor = Actor::New(); - newActor.SetName("Replaced"); + newActor.SetProperty( Dali::Actor::Property::NAME,"Replaced"); replaceList.push_back( Item( i, newActor ) ); } @@ -833,8 +805,8 @@ int UtcDaliItemViewReplaceItemsP(void) view.ReplaceItems( replaceList, 0.5f ); } - DALI_TEST_CHECK(view.GetItem(0).GetName() == "Replaced"); - DALI_TEST_CHECK(view.GetItem(8).GetName() == "Replaced"); + DALI_TEST_CHECK(view.GetItem(0).GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Replaced"); + DALI_TEST_CHECK(view.GetItem(8).GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Replaced"); END_TEST; } @@ -885,7 +857,7 @@ int UtcDaliItemViewSetItemsAnchorPointP(void) view.SetItemsAnchorPoint(anchorPoint); DALI_TEST_CHECK(view.GetItemsAnchorPoint() == anchorPoint); - DALI_TEST_CHECK(view.GetItem(0).GetCurrentAnchorPoint() == anchorPoint); + DALI_TEST_CHECK(view.GetItem(0).GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ) == anchorPoint); END_TEST; } @@ -910,7 +882,7 @@ int UtcDaliItemViewSetItemsParentOriginP(void) view.SetItemsParentOrigin(parentOrigin); DALI_TEST_CHECK(view.GetItemsParentOrigin() == parentOrigin); - DALI_TEST_CHECK(view.GetItem(0).GetCurrentParentOrigin() == parentOrigin); + DALI_TEST_CHECK(view.GetItem(0).GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ) == parentOrigin); END_TEST; } @@ -1144,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; } @@ -1205,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;