X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ControlImpl.cpp;h=f30007f3403bda20c007cbd21ba6364c3d6b5663;hb=9a36e256c115e4c7e63e6ded1e1a69b06963ccff;hp=ee92498655b3f7e225083947ebbf1f572975e82a;hpb=a76cdbc69caa7c0c52b2f4b235560cca6db69c2a;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 ee92498..f30007f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,7 +34,6 @@ #include #include -#include #include "dummy-control.h" @@ -199,17 +198,17 @@ int UtcDaliControlImplDisableGestureDetector(void) TapGestureDetector tap = dummyImpl.GetTapGestureDetector(); LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector(); - DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == pinch.GetAttachedActorCount(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == pan.GetAttachedActorCount(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == tap.GetAttachedActorCount(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == longPress.GetAttachedActorCount(), false, TEST_LOCATION ); dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); - DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == pinch.GetAttachedActorCount(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == pan.GetAttachedActorCount(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == tap.GetAttachedActorCount(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( 0 == longPress.GetAttachedActorCount(), true, TEST_LOCATION ); } END_TEST; } @@ -354,7 +353,7 @@ int UtcDaliControlImplChildAddAndRemove(void) DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION ); DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); - Actor actor = RenderableActor::New(); + Actor actor = Actor::New(); dummy.Add(actor); DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION ); DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION ); @@ -382,7 +381,7 @@ int UtcDaliControlImplChildAddAndRemove(void) application.SendNotification(); DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); - Actor actor = RenderableActor::New(); + Actor actor = Actor::New(); dummy.Add(actor); DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION ); @@ -563,7 +562,10 @@ int UtcDaliControlImplTouchEvent(void) DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION ); Integration::TouchEvent touchEvent(1); - TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f); + Integration::Point point; + point.SetDeviceId( 1 ); + point.SetState( PointState::DOWN ); + point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION ); @@ -585,7 +587,10 @@ int UtcDaliControlImplTouchEvent(void) application.SendNotification(); Integration::TouchEvent touchEvent(1); - TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f); + Integration::Point point; + point.SetDeviceId( 1 ); + point.SetState( PointState::DOWN ); + point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); @@ -613,8 +618,11 @@ int UtcDaliControlImplHoverEvent(void) DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, false, TEST_LOCATION ); Integration::HoverEvent event(1); - TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f ); - event.AddPoint( point ); + Integration::Point point; + point.SetDeviceId( 1 ); + point.SetState( PointState::MOTION ); + point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + event.AddPoint(point); application.ProcessEvent( event ); DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, true, TEST_LOCATION ); @@ -635,8 +643,11 @@ int UtcDaliControlImplHoverEvent(void) application.SendNotification(); Integration::HoverEvent event(1); - TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f ); - event.AddPoint( point ); + Integration::Point point; + point.SetDeviceId( 1 ); + point.SetState( PointState::MOTION ); + point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + event.AddPoint(point); application.ProcessEvent( event ); Stage::GetCurrent().Remove(dummy); @@ -780,13 +791,13 @@ int UtcDaliControlImplTypeRegistry(void) /////////////////////////////////////////////////////////////////////////////////////////////////// namespace { -static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event) +static bool WheelEventCallback(Actor actor, const WheelEvent& event) { return false; } } -int UtcDaliControlImplMouseWheelEvent(void) +int UtcDaliControlImplWheelEvent(void) { ToolkitTestApplication application; @@ -798,20 +809,20 @@ int UtcDaliControlImplMouseWheelEvent(void) dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); - dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + dummy.WheelEventSignal().Connect(&WheelEventCallback); application.Render(); application.SendNotification(); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, false, TEST_LOCATION ); - // simulate a mouse wheel event + // simulate a wheel event Vector2 screenCoordinates( 10.0f, 10.0f ); - Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); - application.ProcessEvent(event); - DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, true, TEST_LOCATION ); + Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u ); + application.ProcessEvent( event ); + DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, true, TEST_LOCATION ); Stage::GetCurrent().Remove(dummy); } @@ -824,17 +835,17 @@ int UtcDaliControlImplMouseWheelEvent(void) dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); - dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + dummy.WheelEventSignal().Connect(&WheelEventCallback); application.Render(); application.SendNotification(); application.Render(); application.SendNotification(); - // simulate a mouse wheel event + // simulate a wheel event Vector2 screenCoordinates( 20.0f, 20.0f ); - Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); - application.ProcessEvent(event); + Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u ); + application.ProcessEvent( event ); Stage::GetCurrent().Remove(dummy); } @@ -861,17 +872,17 @@ int UtcDaliControlImplSetStyleName(void) END_TEST; } -int UtcDaliControlImplOnStyleChangeP(void) +int UtcDaliControlImplOnStyleChangeN(void) { ToolkitTestApplication application; - DummyControl dummy = DummyControl::New( true ); + Control dummy = Control::New(); Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy ); + // test that style manager is being used, passing an empty handle does nothing but does not crash either Dali::Toolkit::StyleManager styleManager; controlImpl.OnStyleChange( styleManager, StyleChange::THEME_CHANGE ); - - // unfortunately OnStyleChange does not return anything - DALI_TEST_CHECK( true ); + // no crash so test passes + tet_result(TET_PASS); END_TEST; } @@ -880,10 +891,11 @@ int UtcDaliControlImplOnStyleChangeP(void) int UtcDaliControlImplOnAccessibilityPanP(void) { ToolkitTestApplication application; - DummyControl dummy = DummyControl::New( true ); - DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + Control dummy = Control::New(); + Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy ); + PanGesture pan; - DALI_TEST_EQUALS( false, dummyImpl.OnAccessibilityPan( pan ), TEST_LOCATION ); + DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityPan( pan ), TEST_LOCATION ); END_TEST; } @@ -891,29 +903,45 @@ int UtcDaliControlImplOnAccessibilityPanP(void) int UtcDaliControlImplOnAccessibilityTouchP(void) { ToolkitTestApplication application; - DummyControl dummy = DummyControl::New( true ); - DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + Control dummy = Control::New(); + Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy ); TouchEvent touch; - DALI_TEST_EQUALS( false, dummyImpl.OnAccessibilityTouch( touch ), TEST_LOCATION ); + DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityTouch( touch ), TEST_LOCATION ); END_TEST; } - -int UtcDaliControlImplGetNextKeyboardFocusableActorP(void) +int UtcDaliControlImplOnAccessibilityActivatedP(void) { ToolkitTestApplication application; - DummyControl dummy = DummyControl::New( true ); - DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); - Actor currentFocusedActor; - Actor result = dummyImpl.GetNextKeyboardFocusableActor( currentFocusedActor, Control::Left, false ); + Control dummy = Control::New(); + Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy ); + DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityActivated(), TEST_LOCATION ); - DALI_TEST_EQUALS( result, currentFocusedActor, TEST_LOCATION ); + // Invoke the control's activate action + TypeInfo type = TypeRegistry::Get().GetTypeInfo( "Control" ); + DALI_TEST_CHECK( type ); + + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + Property::Map attributes; + DALI_TEST_EQUALS( false, handle.DoAction("accessibilityActivated", attributes), TEST_LOCATION ); END_TEST; } +int UtcDaliControlImplGetNextKeyboardFocusableActorP(void) +{ + ToolkitTestApplication application; + Control dummy = Control::New(); + Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy ); + Actor currentFocusedActor; + Actor result = controlImpl.GetNextKeyboardFocusableActor( currentFocusedActor, Control::KeyboardFocus::LEFT, false ); + DALI_TEST_EQUALS( result, currentFocusedActor, TEST_LOCATION ); + END_TEST; +}