END_TEST;
}
+int utcDaliTextEditorGeometryNullPtr(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("utcDaliTextEditorGeometryNullPtr");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ application.GetScene().Add(editor);
+
+ editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
+ editor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
+ editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+ editor.SetProperty(TextEditor::Property::TEXT, "");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ unsigned int expectedCount = 0;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 0;
+
+ Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
int utcDaliTextEditorSelectionClearedSignal(void)
{
ToolkitTestApplication application;
TextField copy(textField);
DALI_TEST_CHECK(copy);
- DALI_TEST_CHECK(copy.GetProperty<std::string>(TextLabel::Property::TEXT) == textField.GetProperty<std::string>(TextLabel::Property::TEXT));
+ DALI_TEST_CHECK(copy.GetProperty<std::string>(TextField::Property::TEXT) == textField.GetProperty<std::string>(TextField::Property::TEXT));
END_TEST;
}
END_TEST;
}
+
+int utcDaliTextFieldGeometryNullPtr(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("utcDaliTextFieldGeometryNullPtr");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+
+ field.SetProperty(TextField::Property::POINT_SIZE, 7.f);
+ field.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
+ field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
+ field.SetProperty(TextField::Property::TEXT, "");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ unsigned int expectedCount = 0;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 0;
+
+ Vector<Vector2> positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
int utcDaliTextFieldSelectionClearedSignal(void)
{
ToolkitTestApplication application;
const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>();
DALI_TEST_CHECK(!enabled);
+
+ label.SetProperty(TextLabel::Property::MULTI_LINE, false);
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 1);
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 9999.0f);
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
+
+ try
+ {
+ // Render the text.
+ application.SendNotification();
+ application.Render(1000);
+
+ application.GetScene().Remove(label);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(!label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, (Toolkit::TextLabel::AutoScrollStopMode::Type)2); // invalid type
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
END_TEST;
}
END_TEST;
}
+
+int utcDaliTextLabelGeometryNullPtr(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("utcDaliTextLabelGeometryNullPtr");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f);
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(TextLabel::Property::TEXT, "");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ unsigned int expectedCount = 0;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 0;
+
+ Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
{
ToolkitTestApplication application;
case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
{
const bool enableAutoScroll = value.Get<bool>();
+ impl.mLastAutoScrollEnabled = enableAutoScroll;
// If request to auto scroll is the same as current state then do nothing.
if(enableAutoScroll != impl.mController->IsAutoScrollEnabled())
{
}
}
+void TextLabel::OnSceneConnection(int depth)
+{
+ if(mController->IsAutoScrollEnabled() || mLastAutoScrollEnabled)
+ {
+ mController->SetAutoScrollEnabled(true);
+ }
+ Control::OnSceneConnection(depth);
+}
+
+void TextLabel::OnSceneDisconnection()
+{
+ if(mTextScroller)
+ {
+ if(mLastAutoScrollEnabled && !mController->IsAutoScrollEnabled())
+ {
+ mLastAutoScrollEnabled = false;
+ }
+
+ const Toolkit::TextLabel::AutoScrollStopMode::Type stopMode = mTextScroller->GetStopMode();
+ mTextScroller->SetStopMode(Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE);
+ mTextScroller->StopScrolling();
+ mTextScroller->SetStopMode(stopMode);
+ }
+ Control::OnSceneDisconnection();
+}
+
void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::OnRelayout\n");
TextLabel::TextLabel(ControlBehaviour additionalBehavior)
: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehavior)),
mRenderingBackend(DEFAULT_RENDERING_BACKEND),
- mTextUpdateNeeded(false)
+ mTextUpdateNeeded(false),
+ mLastAutoScrollEnabled(false)
{
}
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/atspi-interfaces/hypertext.h>
#include <dali/devel-api/atspi-interfaces/text.h>
#include <dali/public-api/object/property-map.h>
*/
void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
+ /**
+ * @copydoc Control::OnSceneConnection()
+ */
+ void OnSceneConnection(int depth) override;
+
+ /**
+ * @copydoc Control::OnSceneDisconnection()
+ */
+ void OnSceneDisconnection() override;
+
// From ControlInterface
/**
int mRenderingBackend;
bool mTextUpdateNeeded : 1;
+ bool mLastAutoScrollEnabled : 1;
protected:
/**
const CharacterIndex* const glyphToCharacterBuffer = visualModel->mGlyphsToCharacters.Begin();
const CharacterDirection* const modelCharacterDirectionsBuffer = (0u != logicalModel->mCharacterDirections.Count()) ? logicalModel->mCharacterDirections.Begin() : NULL;
+ //Clear the lists
+ sizesList.Clear();
+ positionsList.Clear();
+
+ if(charactersToGlyphBuffer == nullptr || glyphsPerCharacterBuffer == nullptr || charactersPerGlyphBuffer == nullptr || glyphToCharacterBuffer == nullptr )
+ {
+ return;
+ }
+
if(startIndex >= logicalModel->mText.Count() && endIndex >= logicalModel->mText.Count())
+ {
return;
+ }
if(startIndex >= logicalModel->mText.Count())
+ {
startIndex = logicalModel->mText.Count() - 1;
+ }
if(endIndex >= logicalModel->mText.Count())
+ {
endIndex = logicalModel->mText.Count() - 1;
+ }
if(startIndex > endIndex)
{