X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-web-engine.cpp;h=9d7a582863bb11fd3d6ad8a9c0fda7a2d37427c9;hb=1a0dc2cc53708bbc32546da6031e996465544f51;hp=531633128fdf10f9f47dea78ed61e4bdd45149e1;hpb=e5d379064ba0e9a68d1d2680906952dbde263f34;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp index 5316331..9d7a582 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ #include #include #include -#include #include namespace Dali @@ -74,6 +73,9 @@ public: , mDefaultTextEncodingName() , mDefaultFontSize( 16 ) , mEvaluating( false ) + , mScrollPosition( 0, 0 ) + , mScrollSize( 500, 500 ) + , mContentSize( 500, 500 ) { gInstanceCount++; gInstance = this; @@ -206,6 +208,39 @@ public: mDefaultFontSize = defaultFontSize; } + void ScrollBy( int dx, int dy ) + { + mScrollPosition += Dali::Vector2( dx, dy ); + if ( mScrollPosition.y + mScrollSize.height > mContentSize.height ) + { + gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM ); + } + } + + void SetScrollPosition( int x, int y ) + { + mScrollPosition.x = x; + mScrollPosition.y = y; + } + + void GetScrollPosition( int& x, int& y ) const + { + x = mScrollPosition.x; + y = mScrollPosition.y; + } + + void GetScrollSize( int& w, int& h ) const + { + w = mScrollSize.width; + h = mScrollSize.height; + } + + void GetContentSize( int& w, int& h ) const + { + w = mContentSize.width; + h = mContentSize.height; + } + Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal() { return mPageLoadStartedSignal; @@ -221,6 +256,11 @@ public: return mPageLoadErrorSignal; } + Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal() + { + return mScrollEdgeReachedSignal; + } + std::string mUrl; std::vector< std::string > mHistory; size_t mCurrentPlusOnePos; @@ -236,6 +276,11 @@ public: Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal; std::vector< std::function< void( const std::string& ) > > mResultCallbacks; bool mEvaluating; + + Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal; + Dali::Vector2 mScrollPosition; + Dali::Vector2 mScrollSize; + Dali::Vector2 mContentSize; }; inline WebEngine& GetImplementation( Dali::WebEngine& webEngine ) @@ -523,11 +568,36 @@ void WebEngine::SetDefaultFontSize( int defaultFontSize ) Internal::Adaptor::GetImplementation( *this ).SetDefaultFontSize( defaultFontSize ); } +void WebEngine::ScrollBy( int dx, int dy ) +{ + Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy ); +} + +void WebEngine::SetScrollPosition( int x, int y ) +{ + Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y ); +} + +void WebEngine::GetScrollPosition( int& x, int& y ) const +{ + Internal::Adaptor::GetImplementation( *this ).GetScrollPosition( x, y ); +} + +void WebEngine::GetScrollSize( int& w, int& h ) const +{ + Internal::Adaptor::GetImplementation( *this ).GetScrollSize( w, h ); +} + +void WebEngine::GetContentSize( int& w, int& h ) const +{ + Internal::Adaptor::GetImplementation( *this ).GetContentSize( w, h ); +} + void WebEngine::SetSize( int width, int height ) { } -bool WebEngine::SendTouchEvent( const TouchData& touch ) +bool WebEngine::SendTouchEvent( const TouchEvent& touch ) { return true; } @@ -537,6 +607,10 @@ bool WebEngine::SendKeyEvent( const KeyEvent& event ) return true; } +void WebEngine::SetFocus( bool focused ) +{ +} + Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal() { return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal(); @@ -552,5 +626,10 @@ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErro return Internal::Adaptor::GetImplementation( *this ).PageLoadErrorSignal(); } +Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal() +{ + return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal(); +} + } // namespace Dali;