X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ControlImpl.cpp;h=60fd218a276c7bc0b7de554dffe8a21638fe15cc;hb=5aaba5adcf1a717e1ece3ef9c55c8912420993b5;hp=615038590b5d7c14c957d53c1d25baa7939fc46f;hpb=0ade1ea02b460b002d9cd82cd3023a5107eb6294;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 6150385..60fd218 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.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. @@ -28,10 +28,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -221,9 +217,9 @@ int UtcDaliControlImplOnGestureMethods(void) // Check gesture actually happens { DummyControl dummy = DummyControl::New(true); - dummy.SetSize( Vector2(100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); // Render and notify a couple of times @@ -236,107 +232,32 @@ int UtcDaliControlImplOnGestureMethods(void) dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); DALI_TEST_CHECK( dummyImpl.pinchCalled == false ); - Integration::PinchGestureEvent pinch(Gesture::Started); - pinch.scale = 10.0f; - pinch.speed = 50.0f; - pinch.centerPoint = Vector2(20.0f, 20.0f); - application.ProcessEvent(pinch); + + TestGeneratePinch(application); + DALI_TEST_CHECK( dummyImpl.pinchCalled == true ); DALI_TEST_CHECK( dummyImpl.panCalled == false ); - Integration::PanGestureEvent pan(Gesture::Possible); - pan.previousPosition = Vector2(10.0f, 20.0f); - pan.currentPosition = Vector2(20.0f, 20.0f); - pan.timeDelta = 10; - pan.numberOfTouches = 1u; - application.ProcessEvent(pan); - pan.state = Gesture::Started; - application.ProcessEvent(pan); - DALI_TEST_CHECK( dummyImpl.panCalled == true ); - - DALI_TEST_CHECK( dummyImpl.tapCalled == false ); - Integration::TapGestureEvent tap(Gesture::Possible); - tap.numberOfTaps = 1u; - tap.numberOfTouches = 1u; - tap.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(tap); - tap.state = Gesture::Started; - application.ProcessEvent(tap); - DALI_TEST_CHECK( dummyImpl.tapCalled == true ); - DALI_TEST_CHECK( dummyImpl.longPressCalled == false ); - Integration::LongPressGestureEvent longPress(Gesture::Possible); - longPress.numberOfTouches = 1u; - longPress.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(longPress); - longPress.state = Gesture::Started; - application.ProcessEvent(longPress); - DALI_TEST_CHECK( dummyImpl.longPressCalled == true ); - longPress.state = Gesture::Finished; - application.ProcessEvent(longPress); + TestGenerateMiniPan(application); - Stage::GetCurrent().Remove(dummy); - } + DALI_TEST_CHECK( dummyImpl.panCalled == true ); - // Ensure full code coverage - { - DummyControl dummy = DummyControl::New(); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); + DALI_TEST_CHECK( dummyImpl.tapCalled == false ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); - Stage::GetCurrent().Add(dummy); + TestGenerateTap(application); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); + DALI_TEST_CHECK( dummyImpl.tapCalled == true ); - DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + DALI_TEST_CHECK( dummyImpl.longPressCalled == false ); - DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f ); - Integration::PinchGestureEvent pinch(Gesture::Started); - pinch.scale = 10.0f; - pinch.speed = 50.0f; - pinch.centerPoint = Vector2(20.0f, 20.0f); - application.ProcessEvent(pinch); + TestGenerateLongPress(application); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); - DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f ); - - Integration::PanGestureEvent pan(Gesture::Possible); - pan.previousPosition = Vector2(10.0f, 20.0f); - pan.currentPosition = Vector2(20.0f, 20.0f); - pan.timeDelta = 10; - pan.numberOfTouches = 1u; - application.ProcessEvent(pan); - pan.state = Gesture::Started; - application.ProcessEvent(pan); - - Integration::TapGestureEvent tap(Gesture::Possible); - tap.numberOfTaps = 1u; - tap.numberOfTouches = 1u; - tap.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(tap); - tap.state = Gesture::Started; - application.ProcessEvent(tap); - - Integration::LongPressGestureEvent longPress(Gesture::Possible); - longPress.numberOfTouches = 1u; - longPress.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(longPress); - longPress.state = Gesture::Started; - application.ProcessEvent(longPress); - longPress.state = Gesture::Finished; - application.ProcessEvent(longPress); + DALI_TEST_CHECK( dummyImpl.longPressCalled == true ); Stage::GetCurrent().Remove(dummy); } + END_TEST; } @@ -454,14 +375,14 @@ int UtcDaliControlImplSizeSetP(void) DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size not set, no onSizeSet called Vector2 size(100.0f, 200.0f); - dummy.SetSize( size ); + dummy.SetProperty( Actor::Property::SIZE, size ); DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size is going to get negotiated, no onSizeSet called application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION ); + DALI_TEST_EQUALS( size, dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY(), TEST_LOCATION ); DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION ); Stage::GetCurrent().Remove(dummy); @@ -479,17 +400,17 @@ int UtcDaliControlImplSizeSet2P(void) Stage::GetCurrent().Add(dummy); Vector2 size(100.0f, 200.0f); - DALI_TEST_CHECK( size != dummy.GetCurrentSize().GetVectorXY() ); + DALI_TEST_CHECK( size != dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY() ); application.SendNotification(); application.Render(); - dummy.SetSize(size); + dummy.SetProperty( Actor::Property::SIZE, size); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION); + DALI_TEST_EQUALS(size, dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY(), TEST_LOCATION); Stage::GetCurrent().Remove(dummy); } @@ -552,8 +473,8 @@ int UtcDaliControlImplTouchEvent(void) DummyControl dummy = DummyControl::New( true ); Impl::DummyControl& dummyImpl = static_cast(dummy.GetImplementation()); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); application.Render(); @@ -578,8 +499,8 @@ int UtcDaliControlImplTouchEvent(void) { DummyControl dummy = DummyControl::New(); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); application.Render(); @@ -608,8 +529,8 @@ int UtcDaliControlImplHoverEvent(void) DummyControl dummy = DummyControl::New( true ); Impl::DummyControl& dummyImpl = static_cast(dummy.GetImplementation()); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); application.Render(); @@ -634,8 +555,8 @@ int UtcDaliControlImplHoverEvent(void) { DummyControl dummy = DummyControl::New(); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); application.Render(); @@ -805,8 +726,8 @@ int UtcDaliControlImplWheelEvent(void) DummyControl dummy = DummyControl::New( true ); Impl::DummyControl& dummyImpl = static_cast(dummy.GetImplementation()); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); dummy.WheelEventSignal().Connect(&WheelEventCallback); @@ -831,8 +752,8 @@ int UtcDaliControlImplWheelEvent(void) { DummyControl dummy = DummyControl::New(); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); dummy.WheelEventSignal().Connect(&WheelEventCallback); @@ -859,8 +780,8 @@ int UtcDaliControlImplSetStyleName(void) { DummyControl dummy = DummyControl::New( true ); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); dummy.SetStyleName("TestStyle");