From: Jinho, Lee Date: Thu, 27 Jul 2017 10:41:59 +0000 (+0000) Subject: Merge " Calculate a new height when text was changed." into devel/master X-Git-Tag: dali_1.2.50~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=8b3dac6e167dd77d6db17c019d1e9778d79f198e;hp=24d391fe222bd0fd5910e3b3481124fa23b796be Merge " Calculate a new height when text was changed." into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 6c7e8d1..b764740 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -2455,3 +2455,50 @@ int utcDaliTextFieldSomeSpecialKeys(void) END_TEST; } + +int utcDaliTextFieldSizeUpdate(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextFieldSizeUpdate"); + + // Checks some special keys when the text is selected. + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + Stage::GetCurrent().Add( field ); + + float previousHeight = 0.0f; + float currentHeight = 0.0f; + const float fieldWidth = 1920.0f; + + + // "ㅁ" is bigger then "ኢ" + field.SetSize( Vector2( fieldWidth ,10.0f ) ); + field.SetResizePolicy( ResizePolicy::FIXED , Dimension::WIDTH ); + field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY , Dimension::HEIGHT ); + + field.SetProperty( TextField::Property::TEXT, "ኢ"); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + + field.SetKeyboardFocusable(true); + KeyboardFocusManager::Get().SetCurrentFocusActor( field ); + + application.SendNotification(); + application.Render(); + + previousHeight = field.GetHeightForWidth( fieldWidth ); + DALI_TEST_EQUALS( previousHeight, field.GetProperty( Actor::Property::SIZE_HEIGHT ) , TEST_LOCATION ); + + // Add another script characters ( glyph height is defferent ) + application.ProcessEvent( GenerateKey( "ㅁ", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "ㅁ", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) ); + + application.SendNotification(); + application.Render(); + + currentHeight = field.GetHeightForWidth( fieldWidth ); + DALI_TEST_EQUALS( currentHeight, field.GetProperty( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( (previousHeight < currentHeight), true , TEST_LOCATION ); + + END_TEST; +} diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 64e6a55..a992541 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1797,7 +1797,8 @@ float Controller::GetHeightForWidth( float width ) Size layoutSize; if( fabsf( width - mImpl->mModel->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 || - mImpl->mTextUpdateInfo.mFullRelayoutNeeded ) + mImpl->mTextUpdateInfo.mFullRelayoutNeeded || + mImpl->mTextUpdateInfo.mClearAll ) { // Operations that can be done only once until the text changes. const OperationsMask onlyOnceOperations = static_cast( CONVERT_TO_UTF32 |