}
- bool SetSize(const Vector2& size)
+ bool SetSize(Vector2 size)
{
mSize = size;
// For negative test
return true;
}
- const Vector2& GetSize()
+ Vector2 GetSize() const
{
- mSize = Vector2(200, 200);
- return mSize;
+ return Vector2(200, 200);
}
bool SetViewBox(const Vector2& viewBox)
return Internal::Adaptor::GetImplementation(*this).RemoveAllDrawables();
}
-bool CanvasRenderer::SetSize(const Vector2& size)
+bool CanvasRenderer::SetSize(Vector2 size)
{
return Internal::Adaptor::GetImplementation(*this).SetSize(size);
}
-const Vector2& CanvasRenderer::GetSize()
+Vector2 CanvasRenderer::GetSize() const
{
return Internal::Adaptor::GetImplementation(*this).GetSize();
}
END_TEST;
}
+int UtcDaliTextFieldPlaceholderCoverage(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTextFieldPlaceholderCoverage");
+
+ // mPlaceholderFont is created only once, so create a new control for coverage.
+ TextField fieldForCoverage = TextField::New();
+ DALI_TEST_CHECK(fieldForCoverage);
+ application.GetScene().Add(fieldForCoverage);
+
+ // for SetPlaceholderFontFamily() coverage.
+ Property::Map fontFamilyMap;
+ fontFamilyMap[Text::PlaceHolder::Property::FONT_FAMILY] = "Arial";
+ fieldForCoverage.SetProperty(TextField::Property::PLACEHOLDER, fontFamilyMap);
+
+ // mPlaceholderFont is created only once, so create a new control for coverage.
+ fieldForCoverage = TextField::New();
+ DALI_TEST_CHECK(fieldForCoverage);
+ application.GetScene().Add(fieldForCoverage);
+
+ // for SetPlaceholderTextFontSize coverage.
+ Property::Map fontSizeMap;
+ fontSizeMap[Text::PlaceHolder::Property::PIXEL_SIZE] = 15.0f;
+ fieldForCoverage.SetProperty(TextField::Property::PLACEHOLDER, fontSizeMap);
+
+ // mPlaceholderFont is created only once, so create a new control for coverage.
+ fieldForCoverage = TextField::New();
+ DALI_TEST_CHECK(fieldForCoverage);
+ application.GetScene().Add(fieldForCoverage);
+
+ // for SetPlaceholderTextFontWeight coverage.
+ Property::Map fontStyleWeightMap;
+ Property::Map fontStyleWeightPropertyMap;
+ fontStyleWeightPropertyMap.Insert("weight", "bold");
+ fontStyleWeightMap[Text::PlaceHolder::Property::FONT_STYLE] = fontStyleWeightPropertyMap;
+ fieldForCoverage.SetProperty(TextField::Property::PLACEHOLDER, fontStyleWeightMap);
+
+ // mPlaceholderFont is created only once, so create a new control for coverage.
+ fieldForCoverage = TextField::New();
+ DALI_TEST_CHECK(fieldForCoverage);
+ application.GetScene().Add(fieldForCoverage);
+
+ // for SetPlaceholderTextFontWidth coverage.
+ Property::Map fontStyleWidthMap;
+ Property::Map fontStyleWidthPropertyMap;
+ fontStyleWidthPropertyMap.Insert("width", "expanded");
+ fontStyleWidthMap[Text::PlaceHolder::Property::FONT_STYLE] = fontStyleWidthPropertyMap;
+ fieldForCoverage.SetProperty(TextField::Property::PLACEHOLDER, fontStyleWidthMap);
+
+ // mPlaceholderFont is created only once, so create a new control for coverage.
+ fieldForCoverage = TextField::New();
+ DALI_TEST_CHECK(fieldForCoverage);
+ application.GetScene().Add(fieldForCoverage);
+
+ // for SetPlaceholderTextFontSlant coverage.
+ Property::Map fontStyleSlantMap;
+ Property::Map fontStyleSlantPropertyMap;
+ fontStyleSlantPropertyMap.Insert("slant", "italic");
+ fontStyleSlantMap[Text::PlaceHolder::Property::FONT_STYLE] = fontStyleSlantPropertyMap;
+ fieldForCoverage.SetProperty(TextField::Property::PLACEHOLDER, fontStyleSlantMap);
+
+ END_TEST;
+}
+
int UtcDaliTextFieldSetPaddingProperty(void)
{
ToolkitTestApplication application;
{\r
case Dali::Toolkit::Control::KeyboardFocus::LEFT:\r
{\r
- return (srcRect.right > destRect.right || srcRect.left >= destRect.right);\r
+ return (srcRect.right > destRect.right || srcRect.left >= destRect.right) && srcRect.left > destRect.left;\r
}\r
case Dali::Toolkit::Control::KeyboardFocus::RIGHT:\r
{\r
- return (srcRect.left < destRect.left || srcRect.right <= destRect.left);\r
+ return (srcRect.left < destRect.left || srcRect.right <= destRect.left) && srcRect.right < destRect.right;\r
}\r
case Dali::Toolkit::Control::KeyboardFocus::UP:\r
{\r
- return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom);\r
+ return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom) && srcRect.top > destRect.top;\r
}\r
case Dali::Toolkit::Control::KeyboardFocus::DOWN:\r
{\r
- return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top);\r
+ return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top) && srcRect.bottom < destRect.bottom;\r
}\r
default:\r
{\r
{\r
return (actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) &&\r
actor.GetProperty<bool>(Actor::Property::VISIBLE) &&\r
- actor.GetProperty<bool>(Actor::Property::SENSITIVE) &&\r
actor.GetProperty<Vector4>(Actor::Property::WORLD_COLOR).a > FULLY_TRANSPARENT);\r
}\r
\r
Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect, Rect<float>& bestCandidateRect, Toolkit::Control::KeyboardFocus::Direction direction)\r
{\r
Actor nearestActor;\r
- if(actor)\r
+ if(actor && actor.GetProperty<bool>(Actor::Property::VISIBLE))\r
{\r
// Recursively children\r
const auto childCount = actor.GetChildCount();\r
OPACITY = Dali::Toolkit::Visual::Property::OPACITY,
/**
- * @brief The fitting mode of the visual
+ * @brief The fitting mode of the visual.
* @details Name "fittingMode", type FittingMode (Property::INTEGER) or Property::STRING.
* @see DevelVisual::FittingMode
* @note The default is defined by the type of visual (if it's suitable to be stretched or not).
VISUAL_FITTING_MODE = OPACITY + 1,
/**
- * @brief The radius for the rounded corners of the visual
+ * @brief The radius for the rounded corners of the visual.
* @details Name "cornerRadius", type Property::FLOAT or Prooperty::VECTOR4, animatable
* @note By default, it is Vector::ZERO.
* @note Only Property::Vector4 can be animated.
* @note Each radius will clamp internally to the half of smaller of the visual width and visual height.
- * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN
+ * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN.
* @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner.
* When radius is Vector4(x, y, z, w)
* x y
CORNER_RADIUS = OPACITY + 2,
/**
- * @brief Whether the corner radius value is relative (percentage [0.0f to 1.0f] of the visual size) or absolute (in world units).
+ * @brief Whether the corner radius value is relative (percentage [0.0f to 0.5f] of the visual size) or absolute (in world units).
* @details Name "cornerRadiusPolicy", type Property::INTEGER.
* @see Policy::Type
* @note By default, it is ABSOLUTE to the visual's size.
CORNER_RADIUS_POLICY = OPACITY + 3,
/**
- * @brief The width for the borderline of the visual
+ * @brief The width for the borderline of the visual.
* @details Name "borderlineWidth", type Property::FLOAT, animatable
* @note Optional. Default value is 0.0f.
*/
BORDERLINE_WIDTH = OPACITY + 4,
/**
- * @brief The color for the borderline of the visual
+ * @brief The color for the borderline of the visual.
* @details Name "borderlineColor", type Property::VECTOR4, animatable
- * @note Default value is Color::BLACK
+ * @note Default value is Color::BLACK.
+ * @note This color is affected by opacity.
*/
BORDERLINE_COLOR = OPACITY + 5,
EventData::EventData(DecoratorPtr decorator, InputMethodContext& inputMethodContext)
: mDecorator(decorator),
mInputMethodContext(inputMethodContext),
- mPlaceholderFont(NULL),
+ mPlaceholderFont(nullptr),
mPlaceholderTextActive(),
mPlaceholderTextInactive(),
mPlaceholderTextColor(0.8f, 0.8f, 0.8f, 0.8f), // This color has been published in the Public API (placeholder-properties.h).
return (stateToCheck == EDITING || stateToCheck == EDITING_WITH_POPUP || stateToCheck == EDITING_WITH_GRAB_HANDLE || stateToCheck == EDITING_WITH_PASTE_POPUP);
}
- DecoratorPtr mDecorator; ///< Pointer to the decorator.
- InputMethodContext mInputMethodContext; ///< The Input Method Framework Manager.
- FontDefaults* mPlaceholderFont; ///< The placeholder default font.
- std::string mPlaceholderTextActive; ///< The text to display when the TextField is empty with key-input focus.
- std::string mPlaceholderTextInactive; ///< The text to display when the TextField is empty and inactive.
- Vector4 mPlaceholderTextColor; ///< The in/active placeholder text color.
+ DecoratorPtr mDecorator; ///< Pointer to the decorator.
+ InputMethodContext mInputMethodContext; ///< The Input Method Framework Manager.
+ std::unique_ptr<FontDefaults> mPlaceholderFont; ///< The placeholder default font.
+ std::string mPlaceholderTextActive; ///< The text to display when the TextField is empty with key-input focus.
+ std::string mPlaceholderTextInactive; ///< The text to display when the TextField is empty and inactive.
+ Vector4 mPlaceholderTextColor; ///< The in/active placeholder text color.
/**
* This is used to delay handling events until after the model has been updated.
{
if(NULL != controller.mImpl->mEventData)
{
- if(NULL == controller.mImpl->mEventData->mPlaceholderFont)
- {
- controller.mImpl->mEventData->mPlaceholderFont = new FontDefaults();
- }
+ // if mPlaceholderFont is null, create an instance.
+ CreatePlaceholderFont(controller);
controller.mImpl->mEventData->mPlaceholderFont->mFontDescription.family = placeholderTextFontFamily;
DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetPlaceholderFontFamily %s\n", placeholderTextFontFamily.c_str());
{
if(NULL != controller.mImpl->mEventData)
{
- if(NULL == controller.mImpl->mEventData->mPlaceholderFont)
- {
- controller.mImpl->mEventData->mPlaceholderFont = new FontDefaults();
- }
+ // if mPlaceholderFont is null, create an instance.
+ CreatePlaceholderFont(controller);
controller.mImpl->mEventData->mPlaceholderFont->mFontDescription.weight = weight;
controller.mImpl->mEventData->mPlaceholderFont->weightDefined = true;
{
if(NULL != controller.mImpl->mEventData)
{
- if(NULL == controller.mImpl->mEventData->mPlaceholderFont)
- {
- controller.mImpl->mEventData->mPlaceholderFont = new FontDefaults();
- }
+ // if mPlaceholderFont is null, create an instance.
+ CreatePlaceholderFont(controller);
controller.mImpl->mEventData->mPlaceholderFont->mFontDescription.width = width;
controller.mImpl->mEventData->mPlaceholderFont->widthDefined = true;
{
if(NULL != controller.mImpl->mEventData)
{
- if(NULL == controller.mImpl->mEventData->mPlaceholderFont)
- {
- controller.mImpl->mEventData->mPlaceholderFont = new FontDefaults();
- }
+ // if mPlaceholderFont is null, create an instance.
+ CreatePlaceholderFont(controller);
controller.mImpl->mEventData->mPlaceholderFont->mFontDescription.slant = slant;
controller.mImpl->mEventData->mPlaceholderFont->slantDefined = true;
{
if(NULL != controller.mImpl->mEventData)
{
- if(NULL == controller.mImpl->mEventData->mPlaceholderFont)
- {
- controller.mImpl->mEventData->mPlaceholderFont = new FontDefaults();
- }
+ // if mPlaceholderFont is null, create an instance.
+ CreatePlaceholderFont(controller);
switch(type)
{
}
}
+void Controller::PlaceholderHandler::CreatePlaceholderFont(Controller& controller)
+{
+ if(nullptr == controller.mImpl->mEventData->mPlaceholderFont)
+ {
+ controller.mImpl->mEventData->mPlaceholderFont = std::unique_ptr<FontDefaults>(new FontDefaults());
+ }
+}
+
} // namespace Text
} // namespace Toolkit
static void SetPlaceholderProperty(Controller& controller, const Property::Map& map);
static void GetPlaceholderProperty(Controller& controller, Property::Map& map);
static void ShowPlaceholderText(Controller& controller);
+ static void CreatePlaceholderFont(Controller& controller);
};
} // namespace Text
}
}
+ if(mImageUrl.IsValid())
+ {
+ // Decrease reference count of External Resources :
+ // EncodedImageBuffer or ExternalTextures.
+ // Ensure the stage is still valid before accessing texture manager.
+ if(mImageUrl.GetProtocolType() == VisualUrl::TEXTURE)
+ {
+ TextureManager& textureManager = mFactoryCache.GetTextureManager();
+ textureManager.RemoveExternalTexture(mImageUrl.GetUrl());
+ }
+ else if(mImageUrl.IsBufferResource())
+ {
+ TextureManager& textureManager = mFactoryCache.GetTextureManager();
+ textureManager.RemoveExternalEncodedImageBuffer(mImageUrl.GetUrl());
+ }
+ }
+
// ImageVisual destroyed so remove texture unless ReleasePolicy is set to never release
if((mTextureId != TextureManager::INVALID_TEXTURE_ID) && (mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER))
{
}
}
+ // Increase reference count of External Resources :
+ // EncodedImageBuffer or ExternalTextures.
+ // Reference count will be decreased at destructor of the visual.
+ if(mImageUrl.IsValid() && (mImageUrl.IsBufferResource() || mImageUrl.GetProtocolType() == VisualUrl::TEXTURE))
+ {
+ TextureManager& textureManager = mFactoryCache.GetTextureManager();
+ textureManager.UseExternalResource(mImageUrl.GetUrl());
+ }
+
Shader shader = GetShader();
// Create the renderer
if(encodedImageBuffer)
{
textureId = targetId;
+
+ // Increase EncodedImageBuffer reference during it contains mTextureInfoContainer.
+ UseExternalResource(url.GetUrl());
+
// Insert this buffer at mTextureInfoContainer.
// This buffer will decode at ImageLoaderThread.
bool preMultiply = (preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD);
// If the state allows us to remove the TextureInfo data, we do so.
if(removeTextureInfo)
{
+ // If url location is BUFFER, decrease reference count of EncodedImageBuffer.
+ if(textureInfo.url.IsBufferResource())
+ {
+ RemoveExternalEncodedImageBuffer(textureInfo.url.GetUrl());
+ }
// Permanently remove the textureInfo struct.
mTextureInfoContainer.erase(mTextureInfoContainer.begin() + textureInfoIndex);
}
// EXTERNAL HEADERS
#include <cstring> // for toupper()
-// INTERNAL HEADERS
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-
namespace Dali
{
namespace Toolkit
// TEXTURE and BUFFER location url doesn't need type resolving, REGULAR_IMAGE is fine
mType = ResolveType(url);
}
- else
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
- }
- }
}
}
mType(url.mType),
mLocation(url.mLocation)
{
- if(VisualUrl::TEXTURE == mLocation || VisualUrl::BUFFER == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
- }
- }
}
VisualUrl::~VisualUrl()
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
- }
- }
- else if(VisualUrl::BUFFER == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalEncodedImageBuffer(mUrl);
- }
- }
}
VisualUrl& VisualUrl::operator=(const VisualUrl& url)
{
if(&url != this)
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
- }
- }
- else if(VisualUrl::BUFFER == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalEncodedImageBuffer(mUrl);
- }
- }
-
mUrl = url.mUrl;
mType = url.mType;
mLocation = url.mLocation;
-
- if(VisualUrl::TEXTURE == mLocation || VisualUrl::BUFFER == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
- }
- }
}
return *this;
}
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
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
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.38
+Version: 2.0.39
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT