../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/test-button.cpp
../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
- ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-button.cpp
../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
- ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/test-button.cpp
../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
- ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
dali-toolkit-test-utils/test-application.cpp
dali-toolkit-test-utils/test-button.cpp
dali-toolkit-test-utils/test-harness.cpp
- dali-toolkit-test-utils/test-gesture-manager.cpp
+ dali-toolkit-test-utils/test-gesture-generator.cpp
dali-toolkit-test-utils/test-gl-abstraction.cpp
dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
dali-toolkit-test-utils/test-platform-abstraction.cpp
-#ifndef __DALI_TEST_SUITE_UTILS_H__
-#define __DALI_TEST_SUITE_UTILS_H__
+#ifndef DALI_TEST_SUITE_UTILS_H
+#define DALI_TEST_SUITE_UTILS_H
/*
- * 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.
#include "test-application.h"
#include "test-actor-utils.h"
+#include "test-gesture-generator.h"
using namespace Dali;
} // namespace Test
-#endif // __DALI_TEST_SUITE_UTILS_H__
+#endif // DALI_TEST_SUITE_UTILS_H
mPlatformAbstraction,
mGlAbstraction,
mGlSyncAbstraction,
- mGestureManager,
mDataRetentionPolicy,
Integration::RenderToFrameBuffer::FALSE,
Integration::DepthBufferAvailable::TRUE,
return mGlSyncAbstraction;
}
-TestGestureManager& TestApplication::GetGestureManager()
-{
- return mGestureManager;
-}
-
void TestApplication::ProcessEvent(const Integration::Event& event)
{
mCore->QueueEvent(event);
// INTERNAL INCLUDES
#include <test-platform-abstraction.h>
-#include "test-gesture-manager.h"
#include "test-gl-sync-abstraction.h"
#include "test-gl-abstraction.h"
#include "test-render-controller.h"
TestRenderController& GetRenderController();
TestGlAbstraction& GetGlAbstraction();
TestGlSyncAbstraction& GetGlSyncAbstraction();
- TestGestureManager& GetGestureManager();
void ProcessEvent(const Integration::Event& event);
void SendNotification();
bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
TestRenderController mRenderController;
TestGlAbstraction mGlAbstraction;
TestGlSyncAbstraction mGlSyncAbstraction;
- TestGestureManager mGestureManager;
TestRenderSurface* mRenderSurface;
Integration::UpdateStatus mStatus;
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test-gesture-generator.h"
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/events/touch-event-integ.h>
+
+namespace
+{
+const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+
+Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+{
+ 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;
+}
+
+Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+{
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState( stateA );
+ point.SetDeviceId(4);
+ point.SetScreenPosition( screenPositionA );
+ point.SetDeviceClass( Device::Class::TOUCH );
+ point.SetDeviceSubclass( Device::Subclass::NONE );
+ touchEvent.points.push_back( point );
+ point.SetScreenPosition( screenPositionB );
+ point.SetState( stateB);
+ point.SetDeviceId(7);
+ touchEvent.points.push_back( point );
+ touchEvent.time = time;
+ return touchEvent;
+}
+} // namespace
+
+namespace Dali
+{
+uint32_t TestGetFrameInterval()
+{
+ return RENDER_FRAME_INTERVAL;
+}
+
+void TestStartLongPress( TestApplication& application, float x, float y, uint32_t time )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time ) );
+}
+
+void TestTriggerLongPress( TestApplication& application )
+{
+ application.GetPlatform().TriggerTimer();
+}
+
+void TestGenerateLongPress( TestApplication& application, float x, float y, uint32_t time )
+{
+ TestStartLongPress( application, x, y, time );
+ TestTriggerLongPress( application );
+}
+
+void TestEndLongPress( TestApplication& application, float x, float y, uint32_t time )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time ) );
+}
+
+void TestGeneratePinch( TestApplication& application)
+{
+ application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 55.0f ), PointState::UP, Vector2( 20.0f, 58.0f ), 200 ) );
+}
+
+void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+{
+ application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) );
+}
+
+void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+{
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) );
+}
+
+void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+{
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) );
+}
+
+void TestGenerateMiniPan( TestApplication& application)
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 255 ) );
+}
+
+void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, start, time ) );
+
+ time += RENDER_FRAME_INTERVAL;
+
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+
+ time += RENDER_FRAME_INTERVAL;
+
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+
+ time += RENDER_FRAME_INTERVAL;
+}
+
+void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, pos, time ) );
+}
+
+void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, pos, time ) );
+}
+
+void TestGenerateTap( TestApplication& application, float x, float y, uint32_t time_down )
+{
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time_down ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time_down + 20 ) );
+}
+
+void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down )
+{
+ application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( x1, y1 ), PointState::DOWN, Vector2( x2, y2 ), time_down ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( x1, y1 ), PointState::UP, Vector2( x2, y2 ), time_down + 20 ) );
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TEST_GESTURE_GENERATOR_H
+#define DALI_TEST_GESTURE_GENERATOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test-application.h"
+
+namespace Dali
+{
+/**
+ * These functions use touch events to trigger a gesture, assuming the default gesture parameters are used
+ */
+
+/**
+ * Returns the frame interval used in ms
+ */
+uint32_t TestGetFrameInterval();
+
+/**
+ * Produces the initial touch of a long press
+ */
+void TestStartLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+
+/**
+ * Triggers the timer to begin a long press gesture
+ */
+void TestTriggerLongPress( TestApplication& application );
+
+/**
+ * Produces the initial press and triggers the timer to begin a long press gesture
+ */
+void TestGenerateLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+
+/**
+ * End a long press by lifting the touch
+ */
+void TestEndLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+
+/**
+ * Produces a vertical pinch gesture between (20,20) and (20,90)
+ */
+void TestGeneratePinch( TestApplication& application );
+
+/**
+ * Produces the gesture started event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
+ */
+void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+
+/**
+ * Produces a gesture continuing event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
+ */
+void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+
+/**
+ * Produces a gesture finished event of a pinch, using 2 touches, 50ms apart
+ */
+void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+
+/**
+ * Produces a pan gesture from (20,20) to (20,40)
+ */
+void TestGenerateMiniPan( TestApplication& application );
+
+/**
+ * Produces the start event of a pan gesture, assuming minimum distance moved between start and end is greater than 15
+ * in either direction or 11 in both (x&y). Time will be incremented using the standard frame interval per touch movement
+ */
+void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time );
+
+/**
+ * Continues a pan event by creating a single touch at pos.
+ * N.B This does not increment the time
+ */
+void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time = 400);
+
+/**
+ * End a pan gesture at position pos
+ */
+void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time = 500);
+
+/**
+ * Produces a single point tap gesture with a 20ms interval
+ */
+void TestGenerateTap( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100 );
+
+/**
+ * Produce a tap gesture with two touch points and a 20ms interval
+ */
+void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down );
+
+} // namespace Dali
+
+#endif // DALI_TEST_GESTURE_GENERATOR_H
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "test-gesture-manager.h"
-
-namespace Dali
-{
-
-TestGestureManager::TestGestureManager()
-{
- Initialize();
-}
-
-/**
- * Destructor
- */
-TestGestureManager::~TestGestureManager()
-{
-}
-
-/**
- * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type)
- */
-void TestGestureManager::Register(const Integration::GestureRequest& request)
-{
- mFunctionsCalled.Register = true;
-}
-
-/**
- * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type)
- */
-void TestGestureManager::Unregister(const Integration::GestureRequest& request)
-{
- mFunctionsCalled.Unregister = true;
-}
-
-/**
- * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type)
- */
-void TestGestureManager::Update(const Integration::GestureRequest& request)
-{
- mFunctionsCalled.Update = true;
-}
-
-
-/** Call this every test */
-void TestGestureManager::Initialize()
-{
- mFunctionsCalled.Reset();
-}
-
-bool TestGestureManager::WasCalled(TestFuncEnum func)
-{
- switch(func)
- {
- case RegisterType: return mFunctionsCalled.Register;
- case UnregisterType: return mFunctionsCalled.Unregister;
- case UpdateType: return mFunctionsCalled.Update;
- }
- return false;
-}
-
-void TestGestureManager::ResetCallStatistics(TestFuncEnum func)
-{
- switch(func)
- {
- case RegisterType: mFunctionsCalled.Register = false; break;
- case UnregisterType: mFunctionsCalled.Unregister = false; break;
- case UpdateType: mFunctionsCalled.Update = false; break;
- }
-}
-
-TestGestureManager::TestFunctions::TestFunctions()
-: Register(false),
- Unregister(false),
- Update(false)
-{
-}
-
-void TestGestureManager::TestFunctions::Reset()
-{
- Register = false;
- Unregister = false;
- Update = false;
-}
-
-
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TEST_GESTURE_MANAGER_H__
-#define __DALI_TEST_GESTURE_MANAGER_H__
-
-/*
- * Copyright (c) 2018 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/gesture-manager.h>
-#include <dali/public-api/common/dali-common.h>
-
-namespace Dali
-{
-
-/**
- * Concrete implementation of the gesture manager class.
- */
-class DALI_CORE_API TestGestureManager : public Dali::Integration::GestureManager
-{
-
-public:
-
- /**
- * Constructor
- */
- TestGestureManager();
-
- /**
- * Destructor
- */
- virtual ~TestGestureManager();
-
- /**
- * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type)
- */
- virtual void Register(const Integration::GestureRequest& request);
-
- /**
- * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type)
- */
- virtual void Unregister(const Integration::GestureRequest& request);
-
- /**
- * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type)
- */
- virtual void Update(const Integration::GestureRequest& request);
-
-public: // TEST FUNCTIONS
-
- // Enumeration of Gesture Manager methods
- enum TestFuncEnum
- {
- RegisterType,
- UnregisterType,
- UpdateType,
- };
-
- /** Call this every test */
- void Initialize();
- bool WasCalled(TestFuncEnum func);
- void ResetCallStatistics(TestFuncEnum func);
-
-private:
-
- struct TestFunctions
- {
- TestFunctions();
- void Reset();
-
- bool Register;
- bool Unregister;
- bool Update;
- };
-
- TestFunctions mFunctionsCalled;
-};
-
-} // Dali
-
-#endif // __DALI_TEST_GESTURE_MANAGER_H__
/*
- * 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.
mClosestSize(),
mLoadFileResult(),
mSaveFileResult( false ),
- mSynchronouslyLoadedResource()
+ mSynchronouslyLoadedResource(),
+ mTimerId(0),
+ mCallbackFunction(nullptr)
{
Initialize();
}
return mLoadFileResult.loadResult;
}
-
/** Call this every test */
void TestPlatformAbstraction::Initialize()
{
mDecodedBitmap = bitmap;
}
+uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBase* callback )
+{
+ mCallbackFunction = callback;
+ mTimerId++;
+ return mTimerId;
+}
+
+void TestPlatformAbstraction::TriggerTimer()
+{
+ if (mCallbackFunction != nullptr)
+ {
+ CallbackBase::Execute( *mCallbackFunction );
+ }
+}
+
+void TestPlatformAbstraction::CancelTimer ( uint32_t timerId )
+{
+ mCallbackFunction = nullptr;
+}
+
} // namespace Dali
-#ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__
-#define __DALI_TEST_PLATFORM_ABSTRACTION_H__
+#ifndef DALI_TEST_PLATFORM_ABSTRACTION_H
+#define DALI_TEST_PLATFORM_ABSTRACTION_H
/*
- * Copyright (c) 2018 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.
*/
virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
+ /**
+ * @copydoc PlatformAbstraction::StartTimer()
+ */
+ virtual uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback );
+
+ /*
+ * @copydoc PlatformAbstraction::CancelTimer()
+ */
+ virtual void CancelTimer ( uint32_t timerId );
public: // TEST FUNCTIONS
*/
void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+ /**
+ * @brief Triggers the previously stored callback function
+ */
+ void TriggerTimer();
+
private:
TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
Integration::ResourcePointer mSynchronouslyLoadedResource;
Integration::BitmapPtr mDecodedBitmap;
+
+ uint32_t mTimerId;
+ CallbackBase* mCallbackFunction;
};
} // Dali
-#endif /* __DALI_TEST_PLATFORM_ABSTRACTION_H__ */
+#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */
/*
- * Copyright (c) 2015 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.
*/
#include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
namespace Dali
{
mIsEnabled = enabled;
}
- void SendPanGesture( const Dali::Integration::PanGestureEvent& panEvent );
+ void SendPanGesture( const AccessibilityGestureEvent& panEvent );
public:
return mIsEnabled;
}
-void AccessibilityAdaptor::SendPanGesture( const Integration::PanGestureEvent& panEvent )
+void AccessibilityAdaptor::SendPanGesture( const AccessibilityGestureEvent& panEvent )
{
mGestureHandler->HandlePanGesture( panEvent );
}
Dali::Internal::Adaptor::GetImplementation(adaptor).SetEnabled(enabled);
}
-void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::Integration::PanGestureEvent& panEvent )
+void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::AccessibilityGestureEvent& panEvent )
{
Dali::Internal::Adaptor::GetImplementation(adaptor).SendPanGesture( panEvent );
}
-#ifndef __DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
-#define __DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
+#ifndef DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H
+#define DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H
/*
- * Copyright (c) 2016 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.
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
namespace Test
{
void MockSetReadPosition( Dali::AccessibilityAdaptor adaptor, Dali::Vector2& position );
void SetEnabled( Dali::AccessibilityAdaptor adaptor, bool enabled);
-void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::Integration::PanGestureEvent& panEvent );
+void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::AccessibilityGestureEvent& panEvent );
} // namespace AccessibilityAdaptor
} // namespace Test
-#endif //
+#endif // DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H
/*
- * 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.
{
}
-void Adaptor::SetMinimumPinchDistance(float distance)
-{
-}
-
void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
{
}
/*
- * Copyright (c) 2016 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.
dummyControl.SetSize(480, 800);
Stage::GetCurrent().Add( dummyControl );
- Dali::Integration::PanGestureEvent panGestureEvent(Gesture::Started);
+ AccessibilityGestureEvent panGestureEvent(AccessibilityGestureEvent::Started);
panGestureEvent.previousPosition = Vector2(0.f, 0.f);
panGestureEvent.currentPosition = Vector2(100.f, 0.f);
panGestureEvent.timeDelta = 16;
Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent );
- panGestureEvent.state = Gesture::Continuing;
+ panGestureEvent.state = AccessibilityGestureEvent::Continuing;
panGestureEvent.previousPosition = Vector2(100.f, 0.f);
panGestureEvent.currentPosition = Vector2(200.f, 0.f);
Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent );
- panGestureEvent.state = Gesture::Finished;
+ panGestureEvent.state = AccessibilityGestureEvent::Finished;
panGestureEvent.previousPosition = Vector2(200.f, 0.f);
panGestureEvent.currentPosition = Vector2(300.f, 0.f);
Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent );
/*
- * 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.
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
-#include <dali/integration-api/events/long-press-gesture-event.h>
-#include <dali/integration-api/events/pinch-gesture-event.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
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 );
+ TestGenerateMiniPan(application);
- 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);
-
- 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<DummyControlImpl&>(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;
}
/*
- * Copyright (c) 2018 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.
#include <dali-toolkit/devel-api/drag-drop-detector/drag-and-drop-detector.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
using namespace Dali;
using namespace Dali::Toolkit;
touchEvent.points.push_back(point);
return touchEvent;
}
-
- Integration::PanGestureEvent GeneratePan(
- Gesture::State state,
- Vector2 previousPosition,
- Vector2 currentPosition,
- unsigned long timeDelta,
- unsigned int numberOfTouches = 1,
- unsigned int time = 1u)
- {
- Integration::PanGestureEvent pan(state);
- pan.previousPosition = previousPosition;
- pan.currentPosition = currentPosition;
- pan.timeDelta = timeDelta;
- pan.numberOfTouches = numberOfTouches;
- pan.time = time;
-
- return pan;
- }
-
}
int UtcDaliDragAndDropDetectorConstructorN(void)
DragSignalFunctor functor(data);
detector.StartedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(control, data.control, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(12.0f, 12.0f), data.detector.GetCurrentScreenPosition(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 40.0f), data.detector.GetCurrentScreenPosition(), TEST_LOCATION);
data.Reset();
END_TEST;
DragSignalFunctor functor(data);
detector.EnteredSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
Vector2 screenCoordinates(10.0f, 110.0f);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
DragSignalFunctor functor(data);
detector.MovedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
Vector2 screenCoordinates(10.0f, 110.0f);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
DragSignalFunctor functor(data);
detector.ExitedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
Vector2 screenCoordinates(10.0f, 110.0f);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
DragSignalFunctor functor(data);
detector.DroppedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
Vector2 screenCoordinates(10.0f, 110.0f);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
DragSignalFunctor functor(data);
detector.EndedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Down, Vector2(10.0f, 10.0f)));
- application.ProcessEvent(GeneratePan(Gesture::Continuing, Vector2(10.0f, 10.0f), Vector2(120.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(120.0f, 12.0f), Vector2(120.0f, 20.0f), 10));
-
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(control1, data.control, TEST_LOCATION);
data.Reset();
DragSignalFunctor functor(data);
detector.DroppedSignal().Connect(&application, functor);
- application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
- application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10));
+ TestGenerateMiniPan(application);
Vector2 screenCoordinates(10.0f, 110.0f);
application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
/*
- * 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.
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
+
using namespace Dali;
using namespace Toolkit;
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;
}
/*
// 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;
}
// 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;
#include <string.h>
#include <sstream>
#include <dali-toolkit-test-suite-utils.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
* @param application Test application instance
* @param duration Time to pass in milliseconds.
*/
-void Wait(ToolkitTestApplication& application, int duration = 0)
+int Wait(ToolkitTestApplication& application, int duration = 0)
{
+ int time = 0;
+
for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
{
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
}
-}
-
-// 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::PanGestureEvent pan(state);
- pan.previousPosition = previousPosition;
- pan.currentPosition = currentPosition;
- pan.timeDelta = timeDelta;
- pan.numberOfTouches = numberOfTouches;
-
- return pan;
+ return time;
}
-/**
- * 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;
-}
-
-static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool toStart = true, bool toFinish = true)
+static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t& time, bool toStart = true, bool toFinish = true)
{
- // Now do a pan starting from (start) and heading (direction)
- Vector2 pos(start);
+ Vector2 pos( start );
if( toStart )
{
- SendPan(application, Gesture::Possible, pos);
- Wait(application);
- SendPan(application, Gesture::Started, pos);
- Wait(application);
+ // Now do a pan starting from (start + 20) and heading (direction)
+ Vector2 pos_start_jump( start + Vector2(15.0f, 0.0f) );
+ TestStartPan( application, start, pos_start_jump, time );
+ pos += direction;
}
+ time += Wait(application);
+
for(int i = 0;i<frames;i++)
{
- pos += direction; // Move in this direction
- SendPan(application, Gesture::Continuing, pos);
- Wait(application);
+ pos += direction;
+ TestMovePan(application, pos, time );
+ time += Wait(application);
}
if(toFinish)
{
- pos += direction; // Move in this direction
- SendPan(application, Gesture::Finished, pos);
- Wait(application);
+ pos += direction;
+ TestEndPan(application, pos, time );
+ time += Wait(application);
}
return pos;
//-----Test 1: pan 10 frames from position(size * 0.75f) to position(size * 0.25f), page 0 will be turned forward----
pageIndex = 0;
isTurningForwards = true;
- // Do a pan moving up diagonally.
+ // Do a pan moving up diagonally
+ uint32_t time = 0;
Vector2 start = size * 0.75f;
Vector2 direction = -size*0.05f; //-size*0.5f/10.f;
DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 0, TEST_LOCATION );
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false);
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
- PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true);
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
- Wait(application, 1000);
+ time += Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
// the page is turned over
DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), (int)(pageIndex+1), TEST_LOCATION );
//pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f )
start = Vector2( size.width, size.height*0.5f );
direction = Vector2(-size.width*0.025f, size.height*0.025f);
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false);
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
signalVerified[0] = false;
isTurningForwards = false;
- PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, time, false, true);
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); // start the sliding back
- Wait(application, 1000);
+ time += Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), (int)pageIndex, TEST_LOCATION ); // the page is not turned over
isTurningForwards = false;
start = size*0.25f;
direction = Vector2(size.x*0.05f, 0.f);
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 4, time, true, false);
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
- PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true);
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
pageIndex = 0;
isTurningForwards = true;
// Do a pan to the left.
+ uint32_t time = 0;
Vector2 start = Vector2(stageSize.x * 0.85f, stageSize.y*0.5);
Vector2 direction = Vector2(-stageSize.x*0.04f, -stageSize.x*0.03f);
DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 0, TEST_LOCATION );
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false);
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
- PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true);
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
- Wait(application, 1000);
+ time += Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
// the page is turned over
DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), (int)(pageIndex+1), TEST_LOCATION );
//pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f )
start = Vector2( stageSize.x * 0.15f, stageSize.y*0.5f );
direction = Vector2(stageSize.x * 0.03f, 0.f);
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false);
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
- PerformGestureDiagonalSwipe( application, start + direction*5.f , direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start + direction*5.f , direction, 5, time, false, true);
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
- Wait(application, 1000);
+ time += Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 0, TEST_LOCATION ); // the first page is turned back
isTurningForwards = false;
start = stageSize*0.55f;
direction = Vector2(stageSize.x*0.025f, 0.f);
- PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false);
DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
- PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true);
DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
/*
- * 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.
#include <string>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
using namespace Dali;
using namespace Toolkit;
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
-// 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::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;
-}
-
/*
* Simulate time passed by.
*
gOnScrollPositionIntervalReachedSignalCalled = true;
}
-static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames)
+static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t start_time)
{
gOnPanFinishedCalled = false;
// Now do a pan starting from (start) and heading (direction)
- Vector2 pos(start);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
+ Vector2 pos( start + ( direction * 15 ) );
+ uint32_t time = start_time;
+
+ TestStartPan( application, start, pos, time );
+
Wait(application);
for(int i = 0; i < frames; i++)
{
pos += direction; // Move in this direction
- SendPan(application, Gesture::Continuing, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestMovePan( application, pos, time);
Wait(application);
}
pos += direction; // Move in this direction.
- SendPan(application, Gesture::Finished, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestEndPan(application, pos, time );
Wait(application);
return pos;
application.Render();
// Perform a swipe gesture on the indicator
- PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
+ PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 1, 500);
DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
application.Render();
// Perform a vertical swipe gesture on the indicator when there is no source object set on the scroll bar
- PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
+ PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 500);
DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
// Create a source actor that owns the scroll properties required by the scroll bar
application.Render();
// Perform a swipe gesture on the scroll bar but not on the indicator
- PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20);
+ PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20, 2000);
DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION );
// Perform a swipe gesture on the indicator
- PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
+ PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 4000);
DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
using namespace Dali;
using namespace Toolkit;
const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
-// 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::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;
-}
-
/*
* Simulate time passed by.
*
return std::min( progress * 2.0f, 1.0f );
}
-static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
+/**
+ * Generate a complete pan gesture
+ * Note: To initiate the gesture it will go from start, diagonally SE on the screen, then continue in the direction for frames touches
+ */
+static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t& time, bool finish = true)
{
gOnScrollStartCalled = false;
gOnScrollUpdateCalled = false;
gOnScrollCompleteCalled = false;
gOnSnapStartCalled = false;
- // Now do a pan starting from (start) and heading (direction)
- Vector2 pos(start);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
+ Vector2 pos( start );
+
+ // This is created to ensure a pan is started
+ Vector2 pos_start_jump( start + Vector2(11.0f, 11.0f) );
+ TestStartPan( application, start, pos_start_jump, time );
+ pos = pos_start_jump;
+
Wait(application);
for(int i = 0;i<frames;i++)
{
pos += direction; // Move in this direction
- SendPan(application, Gesture::Continuing, pos);
- Wait(application);
+ TestMovePan(application, pos, time );
+ time += Wait(application);
}
if(finish)
{
pos += direction; // Move in this direction.
- SendPan(application, Gesture::Finished, pos);
- Wait(application, RENDER_DELAY_SCROLL);
+ TestEndPan(application, pos, time );
+ time += Wait(application, RENDER_DELAY_SCROLL);
}
return pos;
Vector2 startPos( 50.0f, 0.0f );
Vector2 direction( -5.0f, 0.0f );
int frames = 200;
+ uint32_t time = 0;
// Force starting position.
scrollView.ScrollTo( startPos, 0.0f );
- Wait( application );
+ time += Wait( application );
// Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
- Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
+ Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
- SendPan( application, Gesture::Finished, currentPos );
+ TestEndPan( application, currentPos, time );
// We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
- Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
+ time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final X coord has snapped to exactly one page ahead of the start page.
DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
Vector2 startPos( 0.0f, 50.0f );
Vector2 direction( 0.0f, -6.0f );
int frames = 200;
+ uint32_t time = 0;
// Force starting position.
scrollView.ScrollTo( startPos, 0.0f );
- Wait( application );
+ time += Wait( application );
// Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
- Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
+ Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
- SendPan( application, Gesture::Finished, currentPos );
+ time += Wait( application );
+ TestEndPan( application, currentPos, time );
// We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
Vector2 startPos( 0.0f, 50.0f );
Vector2 direction( 0.0f, -6.0f );
int frames = 200;
+ uint32_t time = 0;
// Force starting position.
scrollView.ScrollTo( startPos, 0.0f );
- Wait( application );
+ time += Wait( application );
// Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
- Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
+ Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
- SendPan( application, Gesture::Finished, currentPos );
+ TestEndPan( application, currentPos, time );
// We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
Vector2 START_POSITION = Vector2(10.0f, 10.0f);
+ uint32_t time = 0;
scrollView.ScrollTo(START_POSITION, 0.0f);
- Wait(application);
+ time += Wait(application);
+
// Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
+ // PerformGestureSwipe not used as a different initial direction was required
+ Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
+ Vector2 dir( 0.0f, 1.0f );
+
+ TestStartPan( application, START_POSITION, pos, time );
+
+ Wait(application);
+
+ for( int i = 0; i<45; i++ )
+ {
+ pos += dir;
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+
+ pos += dir;
+
+ TestEndPan( application, pos, time );
+ Wait( application, RENDER_DELAY_SCROLL );
+
// Take into account resampling done when prediction is off.
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
-
END_TEST;
}
// Do a pan starting from 100,100 and moving down diagonally.
Vector2 pos(100.0f, 100.0f);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
+ uint32_t time = 100;
+ TestStartPan( application, pos, pos, time );
pos.x += 5.0f;
pos.y += 5.0f;
Wait(application, 100);
for(int i = 0;i<20;i++)
{
- SendPan(application, Gesture::Continuing, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestMovePan( application, pos, time);
pos.x += 5.0f;
pos.y += 5.0f;
Wait(application);
}
- SendPan(application, Gesture::Finished, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestEndPan(application, pos, time );
Wait(application, RENDER_DELAY_SCROLL);
DALI_TEST_CHECK(gOnScrollStartCalled);
// Do a pan starting from 100,100 and moving down diagonally.
Vector2 pos(100.0f, 100.0f);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
+ uint32_t time = 100;
+ TestStartPan( application, pos, pos, time );
pos.x += 5.0f;
pos.y += 5.0f;
Wait(application, 100);
for(int i = 0;i<20;i++)
{
- SendPan(application, Gesture::Continuing, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestMovePan( application, pos, time);
pos.x += 5.0f;
pos.y += 5.0f;
Wait(application);
}
- SendPan(application, Gesture::Finished, pos);
+ time += RENDER_FRAME_INTERVAL;
+ TestEndPan(application, pos, time );
Wait(application, RENDER_DELAY_SCROLL);
DALI_TEST_CHECK(scrollStarted);
scrollView.SnapStartedSignal().Connect( &OnSnapStart );
scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
+ uint32_t time = 0;
+ time +=Wait(application);
// First try insensitive swipe.
scrollView.SetScrollSensitive(false);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, time, true);
DALI_TEST_CHECK( !gOnScrollStartCalled );
DALI_TEST_CHECK( !gOnScrollCompleteCalled );
// Second try sensitive swipe.
scrollView.SetScrollSensitive(true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, time, true);
DALI_TEST_CHECK( gOnScrollStartCalled );
DALI_TEST_CHECK( gOnScrollCompleteCalled );
// Normal
scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
- Wait(application);
+ uint32_t time = 0;
+ time += Wait(application);
+
Vector2 startPosition = scrollView.GetCurrentScrollPosition();
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
+ Vector2 dir(5.0f, 1.0f);
+
+ // PerformGestureSwipe not used as a different initial direction was required
+
+ Vector2 pos( CLAMP_TOUCH_START + Vector2(15.0f, 3.0f) );
+
+ TestStartPan( application, CLAMP_TOUCH_START, pos, time );
+
+ time += Wait(application);
+
+ for( int i = 0; i<47; i++ )
+ {
+ pos += dir;
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+
+ pos += dir;
+
+ TestEndPan( application, pos, time );
+
const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
// Autolock
DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
- Wait(application);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
+ time += Wait(application);
+
+ Vector2 pos2( CLAMP_TOUCH_START + Vector2(15.0f, 3.0f) );
+
+ TestStartPan( application, CLAMP_TOUCH_START, pos2, time );
+
+ time += Wait(application);
+
+ for( int i = 0; i<47; i++ )
+ {
+ pos2 += dir;
+ TestMovePan( application, pos2, time );
+ time += Wait( application );
+ }
+
+ pos2 += dir;
+
+ TestEndPan( application, pos2, time );
+
const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
// compare how much the Y position has deviated for normal and autolock.
ScrollView scrollView = ScrollView::New();
scrollView.SetOvershootEnabled(true);
+ uint32_t time = 0;
Vector2 overshootSize = Vector2(100.0f,100.0f);
scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
+ time += Wait(application);
// 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
Vector2 currentPos = Vector2(100.0f, 100.0f);
- currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
+ currentPos = PerformGestureSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, time, false);
float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
Vector2 positionValue = scrollView.GetCurrentProperty< Vector2 >( ScrollView::Property::SCROLL_POSITION );
float timeToReachOrigin;
// Now release touch. Overshoot should snap back to zero.
- SendPan(application, Gesture::Finished, currentPos);
+ TestEndPan(application, currentPos, time);
+
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
// 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
- currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
// Now release touch. Overshoot should snap back to zero.
- SendPan(application, Gesture::Finished, currentPos);
+ TestEndPan(application, currentPos, time);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
// 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
- currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
// Now release touch. Overshoot should snap back to zero.
- SendPan(application, Gesture::Finished, currentPos);
+ TestEndPan(application, currentPos, time);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
- currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
// Now release touch. Overshoot should snap back to zero.
- SendPan(application, Gesture::Finished, currentPos);
+ TestEndPan(application, currentPos, time);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
scrollView.SnapStartedSignal().Connect( &OnSnapStart );
scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
+ uint32_t time = 0;
+ time += Wait(application);
// First try a snap.
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true);
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, time, true);
DALI_TEST_CHECK( gOnSnapStartCalled );
DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
// Second try a swipe.
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true);
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, time, true);
DALI_TEST_CHECK( gOnSnapStartCalled );
DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
scrollView.SetMaxOvershoot(50.0f, 50.0f);
scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
+ uint32_t time = 0;
+ time += Wait(application);
// Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
- Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false);
+ Vector2 currentPos = PerformGestureSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 10, time, false);
float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
+ time += Wait(application);
// Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
- currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false);
+ for(int i = 0; i<106; i++)
+ {
+ TestMovePan(application, currentPos, time );
+ currentPos += Vector2(1.0f, 1.0f);
+ time += Wait(application);
+ }
+
overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
// The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
// EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
- float correctOvershootValue = 50.0f / 105.f;
+ float correctOvershootValue = 0.508f; // This was measured and then set as the limit
DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION );
- // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
- currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
+ // Scroll page further in NW (-25,-25 pixels), then check that overshoot should be now 1.0. (don't release touch)
+ for(int i = 0;i<25;i++)
+ {
+ TestMovePan(application, currentPos, time );
+ currentPos += Vector2(1.0f, 1.0f); // Move in this direction
+ time += Wait(application);
+ }
+
overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
- // Change the max overshoot to be 100 pixels in both X axis and Y axis
- scrollView.SetMaxOvershoot(100.0f, 100.0f);
- Wait(application);
+ // Change the max overshoot to be 250 pixels in both X axis and Y axis
+ scrollView.SetMaxOvershoot(250.0f, 250.0f);
+ time += Wait(application);
// Check that overshoot should be now around 0.8.
overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
- // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
- currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
+ // Scroll page further in NW (-50,-50 pixels), then check that overshoot should be now 1.0. (don't release touch)
+ for(int i = 0;i<50;i++)
+ {
+ TestMovePan(application, currentPos, time );
+ currentPos += Vector2(1.0f, 1.0f); // Move in this direction
+ time += Wait(application);
+ }
+
overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
Vector2 START_POSITION = Vector2(10.0f, 10.0f);
scrollView.ScrollTo(START_POSITION, 0.0f);
- Wait(application);
+ uint32_t time = 0;
+ time += Wait(application);
+
// Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
+ // PerformGestureSwipe not used as a different initial direction was required
+
+ Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
+ TestStartPan( application, START_POSITION, pos, time );
+ time += Wait(application);
+ for( int i = 0; i<45; i++ )
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan( application, pos, time );
+ time += Wait( application );
+
// Take into account resampling done when prediction is off.
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
scrollView.ScrollTo(START_POSITION, 0.0f);
- Wait(application);
+ time += Wait(application);
+
// Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
+ // PerformGestureSwipe not used as a different initial direction was required
+ pos = ( START_POSITION + Vector2(0.0f, 15.0f) );
+ TestStartPan( application, START_POSITION, pos, time );
+ time += Wait(application);
+ for( int i = 0; i<45; i++ )
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan( application, pos, time );
+ time += Wait( application );
+
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
- scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
- Wait(application);
+ scrollView.ScrollTo(START_POSITION, 0.0f);
+
+ time += Wait(application);
+
// Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
+ // PerformGestureSwipe not used as a different initial direction was required
+ pos = ( START_POSITION + Vector2(0.0f, 15.0f) );
+ TestStartPan( application, START_POSITION, pos, time );
+ time += Wait(application);
+ for( int i = 0; i<45; i++ )
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan( application, pos, time );
+ time += Wait( application );
+
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
END_TEST;
scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Vector2 START_POSITION = Vector2(10.0f, 10.0f);
+ uint32_t time = 0;
scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
scrollView.ScrollTo(START_POSITION, 0.0f);
- Wait(application);
- // Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
+
+ time += Wait(application);
+
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
+ // Try a vertical swipe.
+ // PerformGestureSwipe not used as a different initial direction was required
+ Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
+ TestStartPan( application, START_POSITION, pos, time );
+ time += Wait(application);
+ for( int i = 0; i<45; i++ )
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan( application, pos, time );
+ time += Wait( application );
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan( application, pos, time );
+ time += Wait( application );
+
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
+
scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
+ // When the horizontal direction is removed, there are no directions set and therefore all will work
+ scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_HORIZONTAL);
- scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
- Wait(application);
+ time += Wait(application);
// Try a vertical swipe.
- PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
- // Take into account resampling done when prediction is off.
+ Vector2 pos2( pos + Vector2(0.0f, 15.0f) );
+ TestStartPan( application, pos, pos2, time );
+ time += Wait(application);
+ for( int i = 0; i<45; i++ )
+ {
+ pos2 += Vector2(0.0f, 1.0f);
+ TestMovePan( application, pos2, time );
+ time += Wait( application );
+ }
+ pos2 += Vector2(0.0f, 1.0f);
+ TestEndPan( application, pos2, time );
+
+ // The previous scroll should not have had any effect
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
END_TEST;
// Force starting position.
scrollView.ScrollTo( startPos, 0.0f );
- Wait( application );
+ uint32_t time = 0;
+ time += Wait( application );
// Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
- Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
+ Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
- SendPan( application, Gesture::Finished, currentPos );
+ TestEndPan(application, currentPos, time);
// We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
- Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
+ time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final X coord has snapped to exactly one page ahead of the start page.
DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
/*
- * 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.
#include <dali.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
using namespace Dali;
using namespace Toolkit;
/*
- * Copyright (c) 2016 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.
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
using namespace Dali;
using namespace Dali::Toolkit;
#include <dali/devel-api/adaptor-framework/key-devel.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
gInputStyleMask = mask;
}
-// Generate a TapGestureEvent to send to Core.
-Integration::TapGestureEvent GenerateTap(
- Gesture::State state,
- unsigned int numberOfTaps,
- unsigned int numberOfTouches,
- Vector2 point)
-{
- Integration::TapGestureEvent tap( state );
-
- tap.numberOfTaps = numberOfTaps;
- tap.numberOfTouches = numberOfTouches;
- tap.point = point;
-
- return tap;
-}
-
-Integration::LongPressGestureEvent GenerateLongPress(
- Gesture::State state,
- unsigned int numberOfTouches,
- Vector2 point)
-{
- Integration::LongPressGestureEvent longPress( state );
-
- longPress.numberOfTouches = numberOfTouches;
- longPress.point = point;
- return longPress;
-}
-
-// 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 = 1u )
-{
- Integration::PanGestureEvent pan(state);
-
- pan.previousPosition = previousPosition;
- pan.currentPosition = currentPosition;
- pan.timeDelta = timeDelta;
- pan.numberOfTouches = numberOfTouches;
-
- return pan;
-}
-
// Generate a KeyEvent to send to Core.
Integration::KeyEvent GenerateKey( const std::string& keyName,
const std::string& logicalKey,
deviceSubclass );
}
-/**
- * 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, 16 ) );
-
- last.x = pos.x;
- last.y = pos.y;
-}
-
-/*
- * Simulate time passed by.
- *
- * @note this will always process at least 1 frame (1/60 sec)
- *
- * @param application Test application instance
- * @param duration Time to pass in milliseconds.
- * @return The actual time passed in milliseconds
- */
-static int Wait(ToolkitTestApplication& application, int duration = 0)
-{
- int time = 0;
-
- for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
- {
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
- time += RENDER_FRAME_INTERVAL;
- }
-
- return time;
-}
-
Dali::Integration::Point GetPointDownInside( Vector2& pos )
{
Dali::Integration::Point point;
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+ TestGenerateTap( application, 18.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ TestGenerateTap( application, 30.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+ TestGenerateTap( application, 43.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+ TestGenerateTap( application, 88.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+ TestGenerateTap( application, 115.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+ TestGenerateTap( application, 164.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+ TestGenerateTap( application, 191.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+ TestGenerateTap( application, 53.0f, 25.0f, 100 );
+ TestGenerateTap( application, 53.0f, 25.0f, 200 );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( !inputStyleChangedSignal );
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+ TestGenerateTap( application, 63.0f, 25.0f, 900 );
// Render and notify
application.SendNotification();
editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ TestGenerateTap( application, 30.0f, 25.0f, 1500 );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string(""), TEST_LOCATION );
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Create a tap event on the second text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
+ TestGenerateTap( application, 150.0f, 125.0f );
// Render and notify
application.SendNotification();
Actor stencil = editor.GetChildAt( 0u );
// Create a tap event to touch the text editor.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f, 100 );
// Render and notify
application.SendNotification();
// Send some taps and check the cursor positions.
// Try to tap at the beginning.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f, 700 );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
// Tap away from the start position.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
+ TestGenerateTap( application, 16.0f, 25.0f, 1400 );
// Render and notify
application.SendNotification();
// Send some taps and check text controller with clipboard window
Dali::Clipboard clipboard = Clipboard::Get();
clipboard.ShowClipboard();
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 100 );
clipboard.HideClipboard();
// Render and notify
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 1000 );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 1100 );
// Render and notify
application.SendNotification();
}
// Double tap out of bounds
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
+ TestGenerateTap( application, 29.0f, 25.0f, 1700 );
+ TestGenerateTap( application, 29.0f, 25.0f, 1800 );
// Render and notify
application.SendNotification();
}
// Long Press
- application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateLongPress(application, 1.0f, 25.0f);
// Render and notify
application.SendNotification();
application.Render();
// Tap on the text editor
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap on the text editor
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap on the text editor
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap on the text editor
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap on the text editor
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 100 );
// Render and notify
application.SendNotification();
application.Render();
// Tap to create the grab handle.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 700 );
// Render and notify
application.SendNotification();
application.SendNotification();
application.Render();
- // drag grab handle right
- SendPan(application, Gesture::Possible, touchPos);
- SendPan(application, Gesture::Started, touchPos);
- touchPos.x += 5.0f;
- Wait(application, 100);
-
- for(int i = 0;i<20;i++)
- {
- SendPan(application, Gesture::Continuing, touchPos);
- touchPos.x += 5.0f;
- Wait(application);
- }
-
- SendPan(application, Gesture::Finished, touchPos);
- Wait(application);
-
// Release the grab handle.
event = Dali::Integration::TouchEvent();
event.AddPoint( GetPointUpInside( touchPos ) );
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 1400 );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word and create the selection handles.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f, 1500 );
// Render and notify
application.SendNotification();
application.SendNotification();
application.Render();
- // drag the left selection handle right
- SendPan(application, Gesture::Possible, touchPos);
- SendPan(application, Gesture::Started, touchPos);
- touchPos.x += 5.0f;
- Wait(application, 100);
-
- for(int i = 0;i<20;i++)
- {
- SendPan(application, Gesture::Continuing, touchPos);
- touchPos.x += 5.0f;
- Wait(application);
- }
-
- SendPan(application, Gesture::Finished, touchPos);
- Wait(application);
-
// Release the left selection handle.
event = Dali::Integration::TouchEvent();
event.AddPoint( GetPointUpInside( touchPos ) );
#include <dali/public-api/rendering/renderer.h>
#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/integration-api/events/long-press-gesture-event.h>
+
#include <dali/devel-api/adaptor-framework/key-devel.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap );
}
-// Generate a PanGestureEvent to send to Core
-static Integration::PanGestureEvent GeneratePan(
- Gesture::State state,
- const Vector2& previousPosition,
- const Vector2& currentPosition,
- unsigned long timeDelta,
- unsigned int numberOfTouches = 1)
-{
- 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, 16));
-
- last.x = pos.x;
- last.y = pos.y;
-}
-
/*
* Simulate time passed by.
*
gInputStyleMask = mask;
}
-// Generate a TapGestureEvent to send to Core.
-Integration::TapGestureEvent GenerateTap(
- Gesture::State state,
- unsigned int numberOfTaps,
- unsigned int numberOfTouches,
- Vector2 point)
-{
- Integration::TapGestureEvent tap( state );
-
- tap.numberOfTaps = numberOfTaps;
- tap.numberOfTouches = numberOfTouches;
- tap.point = point;
-
- return tap;
-}
-
-Integration::LongPressGestureEvent GenerateLongPress(
- Gesture::State state,
- unsigned int numberOfTouches,
- Vector2 point)
-{
- Integration::LongPressGestureEvent longPress( state );
-
- longPress.numberOfTouches = numberOfTouches;
- longPress.point = point;
- return longPress;
-}
-
// Generate a KeyEvent to send to Core.
Integration::KeyEvent GenerateKey( const std::string& keyName,
const std::string& logicalKey,
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+ TestGenerateTap( application, 18.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ TestGenerateTap( application, 30.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+ TestGenerateTap( application, 43.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+ TestGenerateTap( application, 88.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+ TestGenerateTap( application, 115.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+ TestGenerateTap( application, 164.0f, 25.0f );
// Render and notify
application.SendNotification();
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+ TestGenerateTap( application, 191.0f, 25.0f );
// Render and notify
application.SendNotification();
TextField field = TextField::New();
DALI_TEST_CHECK( field );
-
field.SetSize( 300.f, 50.f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
inputStyleChangedSignal = false;
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+ TestGenerateTap( application, 53.0f, 25.0f, 100 );
+ TestGenerateTap( application, 53.0f, 25.0f, 200 );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( !inputStyleChangedSignal );
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+ TestGenerateTap( application, 63.0f, 25.0f, 300 );
// Render and notify
application.SendNotification();
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
// Avoid a crash when core load gl resources.
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
field2.SetParentOrigin( ParentOrigin::TOP_LEFT );
field2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- field2.SetSize( 100.f, 100.f );
- field2.SetPosition( 100.f, 100.f );
+ field2.SetSize( 100.f, 100.0f );
+ field2.SetPosition( 100.0f, 100.0f );
Stage::GetCurrent().Add( field2 );
application.Render();
// Create a tap event on the second text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
+ TestGenerateTap( application, 150.0f, 125.0f );
// Render and notify
application.SendNotification();
Stage::GetCurrent().Add( field );
- field.SetSize( 300.f, 50.f );
+ field.SetSize( 300.0f, 50.0f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f, 300 );
// Render and notify
application.SendNotification();
// Send some taps and check the cursor positions.
// Try to tap at the beginning.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f, 900 );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( position4, position5, TEST_LOCATION ); // Should be in the same position2.
// Tap away from the start position.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
+ TestGenerateTap( application, 16.0f, 25.0f, 1500 );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
+ TestGenerateTap( application, 3.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap grab handle
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
+ TestGenerateTap( application, 0.0f, 40.0f );
END_TEST;
}
application.Render();
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
- // drag grab handle right
- Vector2 pos(0.0f, 40.0f);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
- pos.x += 5.0f;
- Wait(application, 100);
-
- for(int i = 0;i<20;i++)
- {
- SendPan(application, Gesture::Continuing, pos);
- pos.x += 5.0f;
- Wait(application);
- }
-
- SendPan(application, Gesture::Finished, pos);
- Wait(application, RENDER_FRAME_INTERVAL);
-
Actor stencil = field.GetChildAt( 1u );
END_TEST;
}
application.Render();
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Long Press
- application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateLongPress(application, 1.0f, 25.0f);
// Render and notify
application.SendNotification();
application.Render();
// Long Press
- application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateLongPress(application, 1.0f, 25.0f);
// Render and notify
application.SendNotification();
application.Render();
// Long Press
- application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateLongPress( application, 1.0f, 25.0f, 20 );
// Render and notify
application.SendNotification();
Wait(application, 500);
+ TestEndLongPress( application, 1.0f, 25.0f, 520 );
+
// Long Press
- application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateLongPress( application, 1.0f, 25.0f, 600 );
// Render and notify
- application.SendNotification();
application.Render();
Wait(application, 500);
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
application.SendNotification();
application.Render();
application.Render();
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Tap first to get the focus.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ TestGenerateTap( application, 1.0f, 25.0f );
// Render and notify
application.SendNotification();
TextField field = TextField::New();
DALI_TEST_CHECK( field );
- field.SetSize( 300.f, 50.f );
+ field.SetSize( 300.0f, 50.0f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Stage::GetCurrent().Add( field );
TextField field = TextField::New();
DALI_TEST_CHECK( field );
- field.SetSize( 300.f, 50.f );
+ field.SetSize( 300.0f, 50.0f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Stage::GetCurrent().Add( field );
TextField field = TextField::New();
DALI_TEST_CHECK( field );
- field.SetSize( 300.f, 50.f );
+ field.SetSize( 300.0f, 50.0f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Stage::GetCurrent().Add( field );
Stage::GetCurrent().Add( field );
- field.SetSize( 300.f, 50.f );
+ field.SetSize( 300.0f, 50.0f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END");
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN");
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER");
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END");
// Create a tap event to touch the text field.
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ TestGenerateTap( application, 150.0f, 25.0f );
// Render and notify
application.SendNotification();
/*
- * Copyright (c) 2016 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.
return handled;
}
-bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
+bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& panEvent)
{
bool handled = false;
- if( panEvent.state == Gesture::Started )
+ if( panEvent.state == AccessibilityGestureEvent::Started )
{
// Find the focusable actor at the event position
Dali::HitTestAlgorithm::Results results;
// Gesture::Finished (Up) events are delivered with previous (Motion) event position
// Use the real previous position; otherwise we may incorrectly get a ZERO velocity
- if ( Gesture::Finished != panEvent.state )
+ if ( AccessibilityGestureEvent::Finished != panEvent.state )
{
// Store the previous position for next Gesture::Finished iteration.
mPreviousPosition = panEvent.previousPosition;
Actor rootActor = Stage::GetCurrent().GetRootLayer();
- Dali::PanGesture pan(panEvent.state);
+ Dali::PanGesture pan( static_cast<Dali::Gesture::State>(panEvent.state) );
+
pan.time = panEvent.time;
pan.numberOfTouches = panEvent.numberOfTouches;
pan.screenPosition = panEvent.currentPosition;
-#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H
+#define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H
/*
- * Copyright (c) 2016 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.
#include <dali/devel-api/common/map-wrapper.h>
#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
* @param[in] panEvent The pan event to be handled.
* @return whether the gesture is handled successfully or not.
*/
- virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent);
+ virtual bool HandlePanGesture(const AccessibilityGestureEvent& panEvent);
/**
* Change the accessibility status when Accessibility feature(screen-reader) turned on or off.
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
+#endif // DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H