+ uint32_t time = 100;
+
+ TestStartPan( application, startPosition, position, time );
+
+ for(int i = 0; i < 47; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ TestEndPan( application, position, time );
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
+
+ constraintData.Reset();
+ END_TEST;
+}
+
+int UtcDaliPanGesturePredictionSmoothing02(void)
+{
+ TestApplication application;
+ Integration::SetPanGesturePredictionMode( 1 );
+ Integration::SetPanGestureMaximumPredictionAmount( 1 );
+ Integration::SetPanGesturePredictionAmountAdjustment( 2 );
+ Integration::SetPanGestureSmoothingMode( 1 );
+ Integration::SetPanGestureSmoothingAmount( 0.25f );
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Add a pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach( actor );
+ SignalData data;
+ GestureReceivedFunctor functor( data );
+ detector.DetectedSignal().Connect( &application, functor );
+
+ Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+
+ ConstraintData constraintData;
+ Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ constraint.Apply();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Vector2 startPosition( 2.0f, 2.0f );
+ Vector2 position( 4.0f, 2.0f );
+ Vector2 directionX(Vector2::XAXIS);
+ Vector2 directionY(Vector2::YAXIS);
+ uint32_t time = 100;
+
+ TestStartPan( application, startPosition, position, time );
+
+ for(int i = 0; i < 7; i++ )
+ {
+ position += directionX;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ position += directionX * 10.0f;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ for(int i = 0; i < 2; i++ )
+ {
+ position += ( directionX * -1.0f );
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += directionX;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += directionY;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ TestEndPan( application, position, time );
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+
+ constraintData.Reset();
+ END_TEST;
+}
+
+int UtcDaliPanGesturePrediction2SmoothingMultiTap01(void)
+{
+ TestApplication application;
+
+ Integration::SetPanGesturePredictionMode( 2 );
+ Integration::SetPanGesturePredictionAmount( 57 );
+ Integration::SetPanGestureSmoothingMode( 2 );
+ Integration::SetPanGestureUseActualTimes( false );
+ Integration::SetPanGestureInterpolationTimeRange( 10 );
+ Integration::SetPanGestureScalarOnlyPredictionEnabled( false );
+ Integration::SetPanGestureTwoPointPredictionEnabled( true );
+ Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
+ Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
+ Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
+ Integration::SetPanGestureMultitapSmoothingRange( 34 );
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Add a pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach( actor );
+ SignalData data;
+ GestureReceivedFunctor functor( data );
+ detector.DetectedSignal().Connect( &application, functor );
+
+ Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+
+ ConstraintData constraintData;
+ Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ constraint.Apply();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Vector2 startPosition( 2.0f, 2.0f );
+ Vector2 position( -1.0f, 2.0f );
+ Vector2 direction(Vector2::XAXIS * -1.0f);
+ uint32_t time = 100;
+
+ TestStartPan( application, startPosition, position, time );
+
+ for(int i = 0; i < 27; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ TestEndPan( application, position, time );
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+
+ constraintData.Reset();
+ END_TEST;
+}
+
+int UtcDaliPanGesturePrediction2SmoothingMultiTap02(void)
+{
+ TestApplication application;
+
+ Integration::SetPanGesturePredictionMode( 2 );
+ Integration::SetPanGestureSmoothingMode( 2 );
+ Integration::SetPanGestureUseActualTimes( true );
+ Integration::SetPanGestureInterpolationTimeRange( 10 );
+ Integration::SetPanGestureScalarOnlyPredictionEnabled( true );
+ Integration::SetPanGestureTwoPointPredictionEnabled( true );
+ Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
+ Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
+ Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
+ Integration::SetPanGestureMultitapSmoothingRange( 34 );
+
+ Integration::EnableProfiling( Integration::PROFILING_TYPE_PAN_GESTURE );
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Add a pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach( actor );
+ SignalData data;
+ GestureReceivedFunctor functor( data );
+ detector.DetectedSignal().Connect( &application, functor );
+
+ Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+
+ ConstraintData constraintData;
+ Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ constraint.Apply();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Vector2 startPosition( 2.0f, 2.0f );
+ Vector2 position( 17.0f, 2.0f );
+ Vector2 direction(Vector2::XAXIS * -1.0f);
+ uint32_t time = 100;
+
+ TestStartPan( application, startPosition, position, time );
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ TestEndPan( application, position, time );
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+
+ constraintData.Reset();
+ END_TEST;
+}
+
+int UtcDaliPanGesturePrediction2Smoothing(void)
+{
+ TestApplication application;
+
+ Integration::SetPanGesturePredictionMode( 2 );
+ Integration::SetPanGesturePredictionAmount( 57 );
+ Integration::SetPanGestureSmoothingMode( 1 );
+ Integration::SetPanGestureUseActualTimes( false );
+ Integration::SetPanGestureInterpolationTimeRange( 10 );
+ Integration::SetPanGestureScalarOnlyPredictionEnabled( true );
+ Integration::SetPanGestureTwoPointPredictionEnabled( true );
+ Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
+ Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
+ Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
+ Integration::SetPanGestureMultitapSmoothingRange( 34 );
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Add a pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach( actor );
+ SignalData data;
+ GestureReceivedFunctor functor( data );
+ detector.DetectedSignal().Connect( &application, functor );
+
+ Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+
+ ConstraintData constraintData;
+ Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ constraint.Apply();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Vector2 startPosition( 2.0f, 2.0f );
+ Vector2 position( 17.0f, 2.0f );
+ Vector2 direction(Vector2::XAXIS * -1.0f);
+ uint32_t time = 100;
+
+ TestStartPan( application, startPosition, position, time );
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ for(int i = 0; i < 5; i++ )
+ {
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ for(int i = 0; i < 10; i++ )
+ {
+ position += direction;
+ TestMovePan( application, position, time );
+ time += TestGetFrameInterval();
+ application.SendNotification();
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+ }
+
+ TestEndPan( application, position, time );
+ application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );