/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace
{
-Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
+Integration::HoverEvent GenerateSingleHover( PointState::Type state, const Vector2& screenPosition )
{
Integration::HoverEvent hoverEvent;
Integration::Point point;
tet_infoline( "Ensure first value is a map and contains the right item" );
const Property::Value mapValue1 = contentArray->GetElementAt( 0 );
- Property::Map* map1 = mapValue1.GetMap();
+ const Property::Map* map1 = mapValue1.GetMap();
DALI_TEST_CHECK( map1 );
Property::Value* urlValue = map1->Find( ImageVisual::Property::URL );
DALI_TEST_CHECK( urlValue );
tet_infoline( "Ensure second value is a map and contains the right item" );
const Property::Value mapValue2 = contentArray->GetElementAt( 1 );
- Property::Map* map2 = mapValue2.GetMap();
+ const Property::Map* map2 = mapValue2.GetMap();
DALI_TEST_CHECK( map2 );
Property::Value* textValue = map2->Find( TextVisual::Property::TEXT );
DALI_TEST_CHECK( textValue );
control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
++rootChildCount;
DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Stationary, centerPoint ) ); // Emit for code coverage, will have no effect
+ application.ProcessEvent( GenerateSingleHover( PointState::STATIONARY, centerPoint ) ); // Emit for code coverage, will have no effect
END_TEST;
}
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::TAIL,
.Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT,
Property::Array().Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
.Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
application.Render();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
application.Render();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
application.Render();
- const Vector2 stageSize = Stage::GetCurrent().GetSize();
+ const Vector2 stageSize = application.GetScene().GetSize();
Vector2 hoverPoint = stageSize * 0.5f;
hoverPoint.x -= 10.0f;
hoverPoint.y -= 10.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
tet_infoline( "Start hover" );
- Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+ Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
application.SendNotification();
application.Render();
tet_infoline( "Emit a value which exceeds threshold, timer should start again" );
hoverPoint.x += 10.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
application.SendNotification();
application.Render();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
tet_infoline( "Start hover" );
- Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+ Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
application.SendNotification();
application.Render();
tet_infoline( "Emit a value which goes out of bounds" );
hoverPoint.x += 100.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
application.SendNotification();
application.Render();
control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+ Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
hoverPoint.x += 100.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
application.SendNotification();
application.Render();
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true )
.Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+ Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
hoverPoint.x += 10.0f; // Stay within bounds but exceed threshold
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
application.SendNotification();
application.Render();
control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- control.SetSize( 100.0f, 100.0f );
+ control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
int rootChildCount = rootActor.GetChildCount();
- Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
tet_infoline( "Change content while timer is running and ensure it matches the new value" );
control.SetProperty( DevelControl::Property::TOOLTIP, "Second Value" );
DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
tet_infoline( "More movement at same point, and emit signal, we should get the tooltip" );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, centerPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, centerPoint ) );
timer.MockEmitSignal();
application.SendNotification();
{
ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 stageSize = application.GetScene().GetSize();
tet_infoline( "Create a control and place it at the bottom of the screen, setting the tooltip to appear below" );
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
- control.SetSize( stageSize );
+ control.SetProperty( Actor::Property::SIZE, stageSize );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::TAIL,
.Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
application.Render();
Vector2 centerPoint = stageSize * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
{
ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 stageSize = application.GetScene().GetSize();
tet_infoline( "Create a control and place it at the top of the screen, setting the tooltip to appear above" );
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
- control.SetSize( stageSize );
+ control.SetProperty( Actor::Property::SIZE, stageSize );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::TAIL,
.Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
);
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
application.Render();
Vector2 centerPoint = stageSize * 0.5f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
{
ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 stageSize = application.GetScene().GetSize();
Vector2 centerPoint = stageSize * 0.5f;
tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the left of the screen" );
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
- control.SetSize( stageSize );
+ control.SetProperty( Actor::Property::SIZE, stageSize );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::TAIL,
.Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
.Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
);
- control.SetX( -centerPoint.x );
+ control.SetProperty( Actor::Property::POSITION_X, -centerPoint.x );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
Vector2 hoverPoint( centerPoint );
hoverPoint.x = 1.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();
{
ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 stageSize = application.GetScene().GetSize();
Vector2 centerPoint = stageSize * 0.5f;
tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the right of the screen" );
Control control = Control::New();
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
- control.SetSize( stageSize );
+ control.SetProperty( Actor::Property::SIZE, stageSize );
control.SetProperty( DevelControl::Property::TOOLTIP,
Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
.Add( Tooltip::Property::TAIL,
.Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
.Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
);
- control.SetX( centerPoint.x );
+ control.SetProperty( Actor::Property::POSITION_X, centerPoint.x );
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ Actor rootActor = application.GetScene().GetRootLayer();
rootActor.Add( control );
application.SendNotification();
Vector2 hoverPoint( centerPoint );
hoverPoint.x = 1.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
Dali::Timer timer = Timer::New( 1u );
timer.MockEmitSignal();