ToolkitTestApplication application;
tet_infoline(" UtcDaliTextCharacterSetConversionGetNumberOfUtf8Bytes");
+ char utf8_06[] = { -8, -7, -6, -5, -4, -3, -2, -1 }; // Invalid string
+
unsigned int utf32_01[] = { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; // Hello World
unsigned int utf32_02[] = { 0xA, 0x20, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0xA, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; // Hello World + CR and CR+LF
unsigned int utf32_03[] = { 0x645, 0x631, 0x62D, 0x628, 0x627, 0x20, 0x628, 0x627, 0x644, 0x639, 0x627, 0x644, 0x645 }; // مرحبا بالعالم
unsigned int utf32_04[] = { 0x939, 0x948, 0x932, 0x94B, 0x20, 0x935, 0x930, 0x94D, 0x932, 0x94D, 0x921 }; // हैलो वर्ल्ड
unsigned int utf32_05[] = { 0x1F601, 0x20, 0x1F602, 0x20, 0x1F603, 0x20, 0x1F604 }; // Emojis
+ unsigned int utf32_06[] = { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; // Invalid string
const Utf8ToUtf32Data data[] =
{
"\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84",
utf32_05,
},
+ {
+ "Invalid text",
+ utf8_06,
+ utf32_06,
+ },
};
- const unsigned int numberOfTests = 5u;
+ const unsigned int numberOfTests = 6u;
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
void Impl::DummyControl::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
+ if ( mRelayoutCallback )
+ {
+ mRelayoutCallback( size ); // Execute callback if set
+ }
+
Property::Map emptyMap;
for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter )
}
}
+void Impl::DummyControl::SetRelayoutCallback( RelayoutCallbackFunc callback )
+{
+ mRelayoutCallback = callback;
+}
+
+
DummyControl DummyControl::New( bool override )
{
DummyControl control;
// INTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
+// EXTERNAL INCLUDES
+#include <functional>
+
namespace Dali
{
{
public:
+ typedef std::function<void( Size )> RelayoutCallbackFunc;
+
static Toolkit::DummyControl New();
void SetLayout( Property::Index visualIndex, Property::Map& map );
+ void SetRelayoutCallback( RelayoutCallbackFunc callback );
+
private:
DummyControl();
bool keyInputFocusLost;
Property::Map mLayouts;
+ RelayoutCallbackFunc mRelayoutCallback;
+
};
} // namespace Impl
#include <sstream>
#include <unistd.h>
+#include "dummy-control.h"
+
using namespace Dali;
using namespace Toolkit;
}
bool gResourceReadySignalFired = false;
+Vector3 gNaturalSize;
void ResourceReadySignal( Control control )
{
END_TEST;
}
+
+void OnRelayoutOverride( Size size )
+{
+ gNaturalSize = size; // Size Relayout is using
+}
+
+int UtcDaliImageViewReplaceImageAndGetNaturalSize(void)
+{
+ ToolkitTestApplication application;
+
+ // Check ImageView with background and main image, to ensure both visuals are marked as loaded
+ ImageView imageView = ImageView::New( TEST_IMAGE_1 );
+ imageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+
+ DummyControl dummyControl = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyControl.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+
+ dummyControl.Add( imageView );
+ dummyImpl.SetRelayoutCallback( &OnRelayoutOverride );
+ Stage::GetCurrent().Add( dummyControl );
+
+ application.SendNotification();
+ application.Render();
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gNaturalSize.width, 1024.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( gNaturalSize.height, 1024.0f, TEST_LOCATION );
+
+ gNaturalSize = Vector3::ZERO;
+
+ imageView.SetImage(gImage_600_RGB);
+
+ // Waiting for resourceReady so SendNotifcation not called here.
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ // Trigger a potential relayout
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( gNaturalSize.width, 600.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( gNaturalSize.height, 600.0f, TEST_LOCATION );
+
+ END_TEST;
+}
KeyboardFocusManager manager = KeyboardFocusManager::Get();
DALI_TEST_CHECK(manager);
- // Make history stack full
- for(int i = 0 ; i < 31 ; i ++)
- {
- Actor actor = Actor::New();
- actor.SetKeyboardFocusable(true);
- Stage::GetCurrent().Add(actor);
- manager.SetCurrentFocusActor(actor);
- }
-
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetKeyboardFocusable(true);
second.SetKeyboardFocusable(true);
Stage::GetCurrent().Add(second);
- // Create the second actor and add it to the stage
+ // Create the third actor and add it to the stage
Actor third = Actor::New();
third.SetKeyboardFocusable(true);
Stage::GetCurrent().Add(third);
+ // Create the fourth actor and add it to the stage
+ Actor fourth = Actor::New();
+ fourth.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(fourth);
+
// Check that the focus is set on the second actor
DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ // Check that the focus is set on the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(fourth) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+
// Move the focus backward
manager.MoveFocusBackward();
- // Check that it current focused actor is second actor
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // Check that the focus is set on the third actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ // Check that it current focused actor is third actor
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
// Remove the second actor on stage
second.Unparent();
+ // Reset the first actor
+ first.Unparent();
+ first.Reset();
+
// Move the focus backward
manager.MoveFocusBackward();
- // Check that it current focused actor is first actor
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ // Check that it current focused actor is third actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+
+ // Make history stack full
+ for(int i = 0 ; i < 31 ; i ++)
+ {
+ Actor actor = Actor::New();
+ actor.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(actor);
+ manager.SetCurrentFocusActor(actor);
+ }
+
+ for(int i = 0 ; i < 31 ; i ++)
+ {
+ manager.MoveFocusBackward();
+ }
+
+ // Check that it current focused actor is not second actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() != second);
END_TEST;
}
* by a control are loaded and ready.
* Most resources are only loaded when the control is placed on stage.
*
+ * @note A RelayoutRequest is queued by Control before this signal is emitted
+ *
* A callback of the following type may be connected:
* @code
* void YourCallbackName( Control control );
using namespace Dali;
ImageView::ImageView()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
- mRelayoutRequired(true)
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) )
{
}
mPropertyMap = map;
mUrl.clear();
mImage.Reset();
+
Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( mPropertyMap );
// Don't set mVisual until it is ready and shown. Getters will still use current visual.
if (!mVisual)
{
Control::OnRelayout( size, container );
- // If visual is being replaced then mVisual will be the replacement visual even if not ready.
- mVisual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE );
-
if( mVisual )
{
// Pass in an empty map which uses default transform values meaning our visual fills the control
void ImageView::OnResourceReady( Toolkit::Control control )
{
- if( mRelayoutRequired)
- {
- mRelayoutRequired = false;
- RelayoutRequest();
- }
+ // Visual ready so update visual attached to this ImageView, following call to RelayoutRequest will use this visual.
+ mVisual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE );
}
///////////////////////////////////////////////////////////
std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
Image mImage; ///< the Image if the image came from a Image, null otherwise
Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- bool mRelayoutRequired; ///< True if relayout is required, e.g. due to unreadiness
};
} // namespace Internal
case Toolkit::Slider::Property::MARKS:
{
- // TODO: Need to be able to return a PropertyArray
- // value = sliderImpl.GetMarks();
+ Property::Value value1( Property::ARRAY );
+ Property::Array* markArray = value1.GetArray();
+
+ if( markArray )
+ {
+ *markArray = sliderImpl.GetMarks();
+ }
+
+ value = value1;
break;
}
}
// Push Current Focused Actor to FocusHistory
- mFocusHistory.PushBack( &actor.GetBaseObject() );
+ mFocusHistory.push_back( actor );
// Delete first element before add new element when Stack is full.
- if( mFocusHistory.Count() > MAX_HISTORY_AMOUNT )
+ if( mFocusHistory.size() > MAX_HISTORY_AMOUNT )
{
- FocusStackIterator beginPos = mFocusHistory.Begin();
- mFocusHistory.Erase( beginPos );
+ FocusStackIterator beginPos = mFocusHistory.begin();
+ mFocusHistory.erase( beginPos );
}
DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] SUCCEED\n", __FUNCTION__, __LINE__);
void KeyboardFocusManager::MoveFocusBackward()
{
// Find Pre Focused Actor when the list size is more than 1
- if( mFocusHistory.Count() > 1 )
+ if( mFocusHistory.size() > 1 )
{
// Delete current focused actor in history
- FocusStackIterator endPos = mFocusHistory.End();
- endPos = mFocusHistory.Erase( --endPos );
+ mFocusHistory.pop_back();
- // If pre-focused actors are not on stage, remove them in stack
- while( !Dali::Actor::DownCast(BaseHandle(mFocusHistory[ mFocusHistory.Count() - 1 ])).OnStage() )
+ // If pre-focused actors are not on stage or deleted, remove them in stack
+ while( mFocusHistory.size() > 0 )
{
- endPos = mFocusHistory.Erase( --endPos );
- }
-
- // Get pre focused actor
- BaseObject* object = mFocusHistory[ mFocusHistory.Count() - 1 ];
- BaseHandle handle( object );
- Actor preFocusedActor = Dali::Actor::DownCast( handle );
+ // Get pre focused actor
+ Actor target = mFocusHistory[ mFocusHistory.size() -1 ].GetHandle();
- // Delete pre focused actor in history because it will pushed again by SetCurrentFocusActor()
- mFocusHistory.Erase( --endPos );
+ // Impl of Actor is not null
+ if( target && target.OnStage() )
+ {
+ // Delete pre focused actor in history because it will pushed again by SetCurrentFocusActor()
+ mFocusHistory.pop_back();
+ SetCurrentFocusActor( target );
+ break;
+ }
+ else
+ {
+ // Target is empty handle or off stage. Erase from queue
+ mFocusHistory.pop_back();
+ }
+ }
- SetCurrentFocusActor( preFocusedActor );
- }
+ // if there is no actor which can get focus, then push current focus actor in stack again
+ if( mFocusHistory.size() == 0 )
+ {
+ Actor currentFocusedActor = GetCurrentFocusActor();
+ mFocusHistory.push_back( currentFocusedActor );
+ }
+ }
}
bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
#include <dali/devel-api/object/weak-handle.h>
+#include <dali/public-api/common/vector-wrapper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
private:
- typedef Dali::Vector< Dali::BaseObject* > FocusStack; ///< Define Dali::Vector< Dali::BaseObject* > as FocusStack to contain focus history
- typedef FocusStack::Iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
+ typedef std::vector< WeakHandle< Actor > > FocusStack; ///< Define Dali::Vector< Dali::BaseObject* > as FocusStack to contain focus history
+ typedef FocusStack::iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
/**
* Get configuration from StyleManager.
code |= *begin++ & 0x3fu;
break;
}
+
+ case U0: // Invalid case
+ {
+ begin++;
+ *utf32++ = 0x20; // Use white space
+ break;
+ }
}
}
if( !isValidFont ) // (3)
{
// The given font has not been validated.
- int validCharacterIndex = fontClient.GetGlyphIndex(cachedDefaultFontId, character );
- if( isValidCachedDefaultFont && validCharacterIndex != 0u )
+ if( isValidCachedDefaultFont )
{
// Use the cached default font for the script if there is one.
fontId = cachedDefaultFontId;
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 51;
+const unsigned int TOOLKIT_MICRO_VERSION = 52;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.51
+Version: 1.2.52
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT