END_TEST;
}
+
+int UtcDaliTextEditorLineCountAfterGetNaturalSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorLineCountAfterGetNaturalSize ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty(TextEditor::Property::TEXT, "A\nB\nC\nD\nE\nF\n");
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ int lineCount = 0;
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ textEditor.GetNaturalSize();
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ END_TEST;
+}
VisualModelPtr& visualModel = model->mVisualModel;
if(impl.mRecalculateNaturalSize)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT | REORDER),
naturalSize.GetVectorXY());
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Stores the natural size to avoid recalculate it again
// unless the text/style changes.
visualModel->SetNaturalSize(naturalSize.GetVectorXY());
// Restore the actual control's size.
visualModel->mControlSize = actualControlSize;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z);
}
else
textUpdateInfo.mFullRelayoutNeeded ||
textUpdateInfo.mClearAll)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT),
layoutSize);
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
-
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Clear the update info. This info will be set the next time the text is updated.
textUpdateInfo.Clear();
textUpdateInfo.mClearAll = true;
// Restore the actual control's width.
visualModel->mControlSize.width = actualControlWidth;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height);
}
else