From: Paul Wisbey Date: Thu, 23 Apr 2015 13:33:25 +0000 (-0700) Subject: Merge "Text Decorator - Set positions in Control coords." into tizen X-Git-Tag: dali_1.0.40~11 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=e7211d427157b86dff6f5be4e88706bf54c7f3c3;hp=48ce7053cae43576126273091e0a865e5a87aea6 Merge "Text Decorator - Set positions in Control coords." into tizen --- diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index 62d0174..9372e84 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -40,7 +40,6 @@ SET(TC_SOURCES utc-Dali-TextField.cpp utc-Dali-TextLabel.cpp utc-Dali-ToolBar.cpp - utc-Dali-View.cpp utc-Dali-WaterEffect.cpp utc-Dali-Button.cpp utc-Dali-Control.cpp diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 39af3d3..f8bded0 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -67,6 +67,8 @@ const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% toler const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second). const Vector3 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f, 0.0f); ///< Scroll start position for the Overshoot tests. +const float SCROLL_ANIMATION_DURATION(0.33f); ///< Duration of scroll animation in Overshoot tests (i.e. 100 pixels of overshoot in the speed of 500 pixels per 100 frames, 100/(500/(60/100)) = 0.33) +const Vector3 SNAP_POSITION_WITH_DECELERATED_VELOCITY(74.0f, 74.0f, 0.0f); ///< the snap position for Overshoot tests with the decelerated velocity (i.e. Decelerated from 500 pixels per 100 frames). const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function. @@ -1027,8 +1029,11 @@ int UtcDaliScrollViewOvershoot(void) SendPan(application, Gesture::Finished, currentPos); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); - DALI_TEST_CHECK( (timeToReachOrigin > Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && - (timeToReachOrigin < Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; + float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE; + + DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) && + (timeToReachOrigin < maxTimeToReachOrigin) ); // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION); @@ -1038,8 +1043,11 @@ int UtcDaliScrollViewOvershoot(void) SendPan(application, Gesture::Finished, currentPos); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); - DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && - (timeToReachOrigin < TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; + maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE; + + DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) && + (timeToReachOrigin < maxTimeToReachOrigin) ); // 3. Repeat Scroll, but this time change overshoot snap duration to longer time. scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION); @@ -1049,8 +1057,11 @@ int UtcDaliScrollViewOvershoot(void) SendPan(application, Gesture::Finished, currentPos); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); - DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && - (timeToReachOrigin < TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; + maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE; + + DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) && + (timeToReachOrigin < maxTimeToReachOrigin) ); // 4. Repeat Scroll, but this time change overshoot function. scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION); @@ -1061,8 +1072,11 @@ int UtcDaliScrollViewOvershoot(void) SendPan(application, Gesture::Finished, currentPos); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); - DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && - (timeToReachOrigin < TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; + maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE; + + DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) && + (timeToReachOrigin < maxTimeToReachOrigin) ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-View.cpp b/automated-tests/src/dali-toolkit/utc-Dali-View.cpp deleted file mode 100644 index 72f32d2..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-View.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * 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 -#include -#include -#include - -using namespace Dali; -using namespace Toolkit; - - -void dali_view_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void dali_view_cleanup(void) -{ - test_return_value = TET_PASS; -} - - -namespace -{ - -static bool gAnimationStarted = false; - -void StartAnimation( View, Animation& animation, const Orientation& orientation ) -{ - gAnimationStarted = true; -} - - -static bool gObjectCreatedCallBackCalled; -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - - -} - - -int UtcDaliViewNew(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewNew"); - - View view1; - DALI_TEST_CHECK( !view1 ); - - view1 = View::New(); - DALI_TEST_CHECK( view1 ); - - View view2( view1 ); - DALI_TEST_CHECK( view2 ); - - View view3 = view2; - DALI_TEST_CHECK( view3 ); - - view1.Reset(); - view2.Reset(); - view3.Reset(); - - //Additional check to ensure object is created by checking if it's registered - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); - - gObjectCreatedCallBackCalled = false; - registry.ObjectCreatedSignal().Connect( &TestCallback ); - { - View view = View::New(); - } - DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); - END_TEST; -} - -int UtcDaliViewAddGetRemoveContentLayer01(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewAddGetRemoveContentLayer01"); - - View view = View::New(); - Layer layer1; - Layer layer2; - Layer layer3; - Layer layer4; - - // Test: add and get layers. - try - { - layer1 = Layer::New(); - layer1.SetName( "Layer1" ); - layer2 = Layer::New(); - layer2.SetName( "Layer2" ); - - unsigned int layerId1 = view.AddContentLayer( layer1 ); - unsigned int layerId2 = view.AddContentLayer( layer2 ); - - layer3 = view.GetContentLayer( layerId1 ); - layer4 = view.GetContentLayer( layerId2 ); - - DALI_TEST_EQUALS( layer1.GetName(), layer3.GetName(), TEST_LOCATION ); - DALI_TEST_EQUALS( layer2.GetName(), layer4.GetName(), TEST_LOCATION ); - } - catch( ... ) - { - tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding and geting layers to/from view.\n" ); - tet_result(TET_FAIL); - } - - bool test1 = false; - bool test2 = false; - // Test: remove layers. - try - { - view.RemoveContentLayer( layer3 ); - view.RemoveContentLayer( layer4 ); - test1 = true; - } - catch( ... ) - { - tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while removing layers from view.\n" ); - tet_result(TET_FAIL); - } - - // Test: add same layers again. - try - { - view.AddContentLayer( layer1 ); - view.AddContentLayer( layer2 ); - test2 = true; - } - catch( ... ) - { - tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding layers from view after have been removed.\n" ); - tet_result(TET_FAIL); - } - - DALI_TEST_CHECK( test1 && test2 ); - END_TEST; -} - -int UtcDaliViewAddGetRemoveContentLayer02(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewAddGetRemoveContentLayer02"); - - View view = View::New(); - - Layer layer1 = Layer::New(); - layer1.SetName( "Layer1" ); - Layer layer2 = Layer::New(); - layer2.SetName( "Layer2" ); - - view.AddContentLayer( layer1 ); - view.AddContentLayer( layer2 ); - - // Test: add a layer twice. - try - { - view.AddContentLayer( layer1 ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - // Test: add an unitialized layer. - try - { - Layer layer; - view.AddContentLayer( layer ); - } - catch( DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_EQUALS( e.condition, "layer", TEST_LOCATION ); - } - - // Test: get a layer which was not added before. - Layer layer = view.GetContentLayer( 100 ); - DALI_TEST_CHECK( !layer ); - - // Test: Remove a layer which was not added before. - try - { - Layer layer = Layer::New(); - view.RemoveContentLayer( layer ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - tet_result(TET_PASS); - END_TEST; -} - -int UtcDaliViewSetGetBackgroundLayer01(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewSetGetBackgroundLayer01"); - - View view; - Layer layer1, layer2; - - // Test with an actor. - - view = View::New(); - Stage::GetCurrent().Add( view ); - - ImageActor background = CreateSolidColorActor( Color::RED ); - - view.SetBackground( background ); - - layer1 = view.GetBackgroundLayer(); - - DALI_TEST_CHECK( layer1 ); - - background = CreateSolidColorActor( Color::GREEN ); - - view.SetBackground( background ); - - layer2 = view.GetBackgroundLayer(); - - DALI_TEST_CHECK( layer2 ); - - Stage::GetCurrent().Remove( view ); - END_TEST; -} - -int UtcDaliViewSetGetBackgroundLayer02(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewSetGetBackgroundLayer02"); - - bool assert = false; - - try - { - View view = View::New(); - - ImageActor background = CreateSolidColorActor( Color::RED ); - - view.SetBackground( background ); - } - catch( DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_EQUALS( e.condition, "mBackgroundLayer.OnStage()", TEST_LOCATION ); - assert = true; - } - - DALI_TEST_CHECK( assert ); - END_TEST; -} - -int UtcDaliViewSetOrientationFunction(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewSetOrientationFunction"); - - // Test it doesn't crash - try - { - View view = View::New(); - Stage::GetCurrent().Add( view ); - - view.SetSize( 480, 800 ); - view.SetOrientationFunction( Degree( 0.f ), Degree( 90.f ), Degree( 180.f ), Degree( 270.f ) ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - tet_result(TET_PASS); - END_TEST; -} - -int UtcDaliViewOrientationChanged(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliViewOrientationChanged"); - - gAnimationStarted = false; - - // Test it doesn't crash - try - { - View view = View::New(); - Stage::GetCurrent().Add( view ); - - view.SetSize( Vector2( 480, 800 ) ); - - view.OrientationAnimationStartedSignal().Connect( &StartAnimation ); - - application.SendNotification(); // Remove these two lines causes - application.Render(); // ToolkitTestApplication destructor to crash - - //Orientation orientation = application.GetOrientation().GetHandle(); - //application.GetOrientation().SetDegrees( 90 ); - //view.OrientationChanged( orientation ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - // Check the view animation started. - DALI_TEST_CHECK( gAnimationStarted ); - END_TEST; -} - -int UtcSetAutoRotate(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcSetAutoRotate"); - - gAnimationStarted = false; - - View view; - - // Test it doesn't crash - try - { - view = View::New(); - Stage::GetCurrent().Add( view ); - - view.SetSize( 480, 800 ); - - //view.OrientationAnimationStartedSignal().Connect( &StartAnimation ); - - application.SendNotification(); - application.Render(); - - //Orientation orientation = application.GetOrientation().GetHandle(); - //application.GetOrientation().SetDegrees( 90 ); - //view.OrientationChanged( orientation ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - // Check the view animation started. - //DALI_TEST_CHECK( gAnimationStarted ); - - - gAnimationStarted = false; - - try - { - view = View::New(); - view.SetAutoRotate( false ); // Animation shouldn't start. - Stage::GetCurrent().Add( view ); - - view.SetSize( 480, 800 ); - - application.SendNotification(); - application.Render(); - - //Orientation orientation = application.GetOrientation().GetHandle(); - //application.GetOrientation().SetDegrees( 180 ); - //view.OrientationChanged( orientation ); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - - // Check the view animation didn't start. - DALI_TEST_CHECK( !gAnimationStarted ); - END_TEST; -} diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index b584d0d..23cc8f0 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 38; +const unsigned int TOOLKIT_MICRO_VERSION = 39; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 07f1c1e..d53e83b 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.38 +Version: 1.0.39 Release: 1 Group: System/Libraries License: Apache-2.0