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;
rotationProperty.mKeyFrames = Dali::KeyFrames::New();
for(uint32_t j = 0; j < frameCount; ++j)
{
- translationProperty.mKeyFrames.Add(static_cast<float>(j) * keyFrameInterval, (jointList[i]->translations[j] / scale));
+ translationProperty.mKeyFrames.Add(static_cast<float>(j) * keyFrameInterval, (jointList[i]->translations[j] * scale));
rotationProperty.mKeyFrames.Add(static_cast<float>(j) * keyFrameInterval, jointList[i]->rotations[j]);
}
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
#include "canvas-view-impl.h"
// EXTERNAL INCLUDES
+#include <dali/devel-api/rendering/texture-devel.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/rendering/texture-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-devel.h>
if(Adaptor::IsAvailable())
{
- Adaptor::Get().UnregisterProcessor(*this);
+ Adaptor::Get().UnregisterProcessor(*this, true);
}
}
void CanvasView::ApplyRasterizedImage(Texture rasterizedTexture)
{
- if (rasterizedTexture && rasterizedTexture.GetWidth() != 0 && rasterizedTexture.GetHeight() != 0)
+ if(rasterizedTexture && rasterizedTexture.GetWidth() != 0 && rasterizedTexture.GetHeight() != 0)
{
if(!mTextureSet)
{
SetupTouch();
- DevelControl::AppendAccessibilityAttribute(Toolkit::Control::DownCast(self), "sub-role", "Alert");
-
self.SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::DIALOG);
}
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:
/**
void setupMinMaxPotential()
{
- gPotentialRange = 1.0;
+ // Set soft anti-alias range at most 2% of visual size
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential);
// Muliply borderlineWidth to resolve very thin borderline
- borderlineOpacity *= min(1.0, borderlineWidth);
+ borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange);
}
lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb;
void setupMinMaxPotential()
{
- gPotentialRange = 1.0;
+ // Set soft anti-alias range at most 2% of visual size
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential);
// Muliply borderlineWidth to resolve very thin borderline
- borderlineOpacity *= min(1.0, borderlineWidth);
+ borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange);
}
lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb;
void setupMinMaxPotential()
{
- gPotentialRange = 1.0;
+ // Set soft anti-alias range at most 2% of visual size
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential);
// Muliply borderlineWidth to resolve very thin borderline
- borderlineOpacity *= min(1.0, borderlineWidth);
+ borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange);
}
lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb;
vOptRectSize = vRectSize;
#endif
+#ifdef IS_REQUIRED_BORDERLINE
+ // Extend size of visual by borderline.
+ mediump float outerBorderlineSize = (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
+#endif
+
#ifdef IS_REQUIRED_ROUNDED_CORNER
#ifdef IS_REQUIRED_BORDERLINE
- mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
+ mediump float minSize = min(visualSize.x, visualSize.y) + outerBorderlineSize;
#else
mediump float minSize = min(visualSize.x, visualSize.y);
#endif
#endif
#ifdef IS_REQUIRED_BORDERLINE
- vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth);
- vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
+ vPosition = aPosition * (visualSize + outerBorderlineSize);
+ vOptRectSize -= (borderlineWidth - outerBorderlineSize * 0.5) + 1.0;
#elif defined(IS_REQUIRED_ROUNDED_CORNER)
vPosition = aPosition * visualSize;
#else
pixelArea.zw * maskTextureRatio
),
cropToMask);
- vMaskTexCoord = pixelArea.xy + pixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5));
+ vMaskTexCoord = pixelArea.xy + pixelArea.zw * (vec2(0.5) + aPosition.xy
+#ifdef IS_REQUIRED_BORDERLINE
+ * (1.0 + outerBorderlineSize / visualSize)
+#endif
+ );
+#endif
+ vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vec2(0.5) + aPosition.xy
+#ifdef IS_REQUIRED_BORDERLINE
+ * (1.0 + outerBorderlineSize / visualSize)
#endif
- vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5));
+ );
return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
}
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)
{
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 36;
+const unsigned int TOOLKIT_MICRO_VERSION = 37;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.1.36
+Version: 2.1.37
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT