Merge "Add Text font size conversion description in documentation" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 23 Jun 2017 09:49:52 +0000 (09:49 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 23 Jun 2017 09:49:52 +0000 (09:49 +0000)
18 files changed:
automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/devel-api/controls/control-wrapper-impl.cpp
dali-toolkit/devel-api/controls/control-wrapper-impl.h
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/text/cursor-helper-functions.cpp
dali-toolkit/internal/text/cursor-helper-functions.h
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/decorator/text-decorator.h
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/texture-manager.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 3ea0786..c62e11c 100644 (file)
 
 #include <dali.h>
 #include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/custom-actor-devel.h>
+#include <dali/devel-api/object/csharp-type-registry.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/control-wrapper.h>
 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
@@ -52,13 +55,14 @@ bool gOnRelayout = false;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
+
 namespace Impl
 {
 struct TestCustomControl : public Toolkit::Internal::ControlWrapper
 {
   /**
-  * Constructor
-  */
+   * Constructor
+   */
   TestCustomControl()  : Toolkit::Internal::ControlWrapper( CustomControlBehaviour( Toolkit::Internal::ControlWrapper::DISABLE_STYLE_CHANGE_SIGNALS |
           Toolkit::Internal::ControlWrapper::REQUIRES_KEYBOARD_NAVIGATION_SUPPORT )) ,
           mDaliProperty( Property::INVALID_INDEX ),
@@ -97,26 +101,33 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper
   virtual void OnStageConnection( int depth )
   {
     mDepth = depth;
+    Control::OnStageConnection(depth);
   }
   virtual void OnStageDisconnection()
   {
+    Control::OnStageDisconnection();
   }
   virtual void OnChildAdd( Actor& child )
   {
+    Control::OnChildAdd(child);
   }
   virtual void OnChildRemove( Actor& child )
   {
+    Control::OnChildRemove(child);
   }
   virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
   {
+    Control::OnPropertySet(index, propertyValue);
   }
   virtual void OnSizeSet( const Vector3& targetSize )
   {
     mSizeSet = targetSize;
+    Control::OnSizeSet( targetSize );
   }
   virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
   {
     mTargetSize = targetSize;
+    Control::OnSizeAnimation( animation, targetSize );
   }
   virtual bool OnTouchEvent( const TouchEvent& event )
   {
@@ -155,9 +166,27 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper
     return 0.0f;
   }
 
+  void TestRegisterVisual( Property::Index index, Toolkit::Visual::Base visual )
+  {
+    ControlWrapper::RegisterVisual( index, visual );
+
+    VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index );
+    if( iter == mRegisteredVisualIndices.end() )
+    {
+      mRegisteredVisualIndices.push_back(index);
+    }
+  }
+
   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
   {
     gOnRelayout = true;
+
+    for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter )
+    {
+      Visual::Base visual = GetVisual(*iter);
+      Property::Map map; // empty map enforces defaults
+      visual.SetTransformAndSize( map, size );
+    }
   }
 
   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
@@ -216,13 +245,19 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper
   Vector3 mTargetSize;
   bool mNego;
   unsigned int mDepth;
+
+  typedef std::vector<Property::Index> VisualIndices;
+  VisualIndices mRegisteredVisualIndices;
 };
 
+
+
 }
 
-static std::string customControlTypeName = "TestCustomControl";
+static std::string customControlTypeName = "MyTestCustomControl";
 static TypeRegistration customControl( customControlTypeName, typeid(Dali::Toolkit::Control), NULL );
 
+
 int UtcDaliControlWrapperConstructor(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
@@ -236,6 +271,11 @@ int UtcDaliControlWrapperConstructor(void)
 
   DALI_TEST_CHECK( ControlWrapper::DownCast( controlWrapper ) );
 
+  Dali::TypeInfo typeInfo = DevelCustomActor::GetTypeInfo( controlWrapper );
+
+  DALI_TEST_EQUALS( typeInfo.GetName(), customControlTypeName, TEST_LOCATION);
+
+
   END_TEST;
 }
 
@@ -683,3 +723,87 @@ int UtcDaliControlWrapperTypeRegistryCreation(void)
 
   END_TEST;
 }
+
+void SetProperty(BaseObject* object, const char* const name, Property::Value* value)
+{
+}
+Property::Value* GetProperty(BaseObject* object, const char* const name )
+{
+  return NULL;
+}
+
+int UtcDaliControlWrapperAnimateVisual(void)
+{
+  tet_infoline("Test that the control wrapper's visuals can be animated by name when registered");
+
+  ToolkitTestApplication application;
+  Test::ObjectDestructionTracker objectDestructionTracker;
+
+  {
+    Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
+    ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
+
+    Property::Index index = Control::CONTROL_PROPERTY_END_INDEX+1;
+    std::string visualName("colorVisual");
+    CSharpTypeRegistry::RegisterProperty( customControlTypeName, visualName, index, Property::VECTOR4, SetProperty, GetProperty );
+
+    objectDestructionTracker.Start( controlWrapper );
+
+    Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+    Toolkit::Visual::Base visual;
+
+    Property::Map map;
+    map[Visual::Property::TYPE] = Visual::COLOR;
+    map[ColorVisual::Property::MIX_COLOR] = Color::RED;
+
+    visual = visualFactory.CreateVisual( map );
+    DALI_TEST_CHECK( visual );
+
+    // Register to self
+    controlWrapperImpl->TestRegisterVisual( index, visual );
+
+    Stage::GetCurrent().Add( controlWrapper );
+    controlWrapper.SetSize( 100, 100 );
+    application.SendNotification();
+    application.Render(0); // Trigger animation start
+
+    Property::Map transition;
+    transition["target"] = visualName;
+    transition["property"] = "mixColor";
+    transition["targetValue"] = Color::GREEN;
+    Property::Map animator;
+    animator["alphaFunction"] = "LINEAR";
+    animator["duration"] = 1.0f;
+    animator["delay"] = 0.0f;
+    transition["animator"] = animator;
+
+    TransitionData transitionData = TransitionData::New(transition);
+    Animation anim = DevelControl::CreateTransition( *controlWrapperImpl, transitionData );
+    anim.Play();
+
+    application.SendNotification();
+    application.Render(0); // Trigger animation start
+
+    application.Render(1000); // animation end
+    application.Render(  10);
+
+    Property::Map visualMap;
+    visual.CreatePropertyMap( visualMap );
+    Property::Value* value = visualMap.Find(ColorVisual::Property::MIX_COLOR, "mixColor");
+    DALI_TEST_CHECK( value != NULL );
+    if( value )
+    {
+      Vector4 testColor = value->Get<Vector4>();
+      DALI_TEST_EQUALS( testColor, Color::GREEN, 0.001f, TEST_LOCATION );
+    }
+
+    DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), false, TEST_LOCATION ); // Control not destroyed yet
+    DALI_TEST_EQUALS( controlWrapperImpl->GetVisual( index ), visual, TEST_LOCATION );
+
+    Stage::GetCurrent().Remove( controlWrapper );
+  }
+
+  DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), true, TEST_LOCATION ); // Should be destroyed
+
+  END_TEST;
+}
index 40e4ea1..bb9ae72 100644 (file)
@@ -1802,6 +1802,70 @@ int utcDaliTextEditorEvent05(void)
   END_TEST;
 }
 
+int utcDaliTextEditorEvent06(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextEditorEvent06");
+
+  // Checks if the highlight actor is created.
+
+  TextEditor editor = TextEditor::New();
+  DALI_TEST_CHECK( editor );
+
+  Stage::GetCurrent().Add( editor );
+
+  editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+  editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+  editor.SetSize( 100.f, 50.f );
+  editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Tap on the text editor
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Move to seconds line of the text.
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  float layoutHeight = editor.GetHeightForWidth( 100.f );
+
+
+  // Add  another script characters ( glyph height is defferent )
+  application.ProcessEvent( GenerateKey( "d", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+  application.ProcessEvent( GenerateKey( "d", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+  // Delete characters
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+  DALI_TEST_EQUALS( layoutHeight, editor.GetHeightForWidth( 100.f ), TEST_LOCATION );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( "Hello\nworld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+
+
+  END_TEST;
+}
+
 int utcDaliTextEditorHandles(void)
 {
   ToolkitTestApplication application;
index b8e40b8..2e7e268 100644 (file)
@@ -207,7 +207,7 @@ void TestVisualRender( ToolkitTestApplication& application,
                        Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
 {
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
 
   if( resourcePtr )
   {
@@ -317,7 +317,7 @@ int UtcDaliVisualFactoryGetColorVisual1(void)
   Visual::Base visual = factory.CreateVisual(propertyMap);
   DALI_TEST_CHECK( visual );
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual );
 
   Vector3 actualValue(Vector4::ZERO);
@@ -346,7 +346,7 @@ int UtcDaliVisualFactoryGetColorVisual2(void)
   Visual::Base visual = factory.CreateVisual( map );
   DALI_TEST_CHECK( visual );
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual );
 
   Vector3 actualValue;
@@ -381,9 +381,9 @@ int UtcDaliVisualFactoryGetBorderVisual1(void)
   Visual::Base visual = factory.CreateVisual(propertyMap);
   DALI_TEST_CHECK( visual );
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize(200.f, 200.f);
   Stage::GetCurrent().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f));
@@ -429,9 +429,9 @@ int UtcDaliVisualFactoryGetBorderVisual2(void)
   Visual::Base visual = factory.CreateVisual( propertyMap );
   DALI_TEST_CHECK( visual );
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize(200.f, 200.f);
   Stage::GetCurrent().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f));
@@ -504,7 +504,7 @@ int UtcDaliVisualFactoryGetLinearGradientVisual(void)
   DALI_TEST_CHECK( visual );
 
   // A lookup texture is generated and pass to shader as sampler
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u);
 
   END_TEST;
@@ -541,7 +541,7 @@ int UtcDaliVisualFactoryGetRadialGradientVisual(void)
   DALI_TEST_CHECK( visual );
 
   // A lookup texture is generated and pass to shader as sampler
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u );
 
   Matrix3 alignMatrix( radius, 0.f, 0.f, 0.f, radius, 0.f, center.x, center.y, 1.f );
@@ -581,7 +581,7 @@ int UtcDaliVisualFactoryDefaultOffsetsGradientVisual(void)
   DALI_TEST_CHECK( visual );
 
   // A lookup texture is generated and pass to shader as sampler
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u );
 
   Stage::GetCurrent().Remove( actor );
@@ -623,7 +623,7 @@ int UtcDaliVisualFactoryGetNPatchVisual1(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u,
                       ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                       ninePatchResource );
@@ -641,7 +641,7 @@ int UtcDaliVisualFactoryGetNPatchVisual1(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u,
                       ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                       ninePatchResource );
@@ -673,7 +673,7 @@ int UtcDaliVisualFactoryGetNPatchVisual2(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u );
 
     DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
@@ -689,7 +689,7 @@ int UtcDaliVisualFactoryGetNPatchVisual2(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u );
 
     DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
@@ -708,7 +708,7 @@ int UtcDaliVisualFactoryGetNPatchVisual2(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u );
 
     DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
@@ -749,7 +749,7 @@ int UtcDaliVisualFactoryGetNPatchVisual3(void)
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
 
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u,
                       ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                       ninePatchResource );
@@ -769,7 +769,7 @@ int UtcDaliVisualFactoryGetNPatchVisual3(void)
     TestGlAbstraction& gl = application.GetGlAbstraction();
     TraceCallStack& textureTrace = gl.GetTextureTrace();
     textureTrace.Enable(true);
-    DummyControl actor = DummyControl::New();
+    DummyControl actor = DummyControl::New(true);
     TestVisualRender( application, actor, visual, 1u,
                       ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                       ninePatchResource );
@@ -807,7 +807,7 @@ int UtcDaliVisualFactoryGetNPatchVisual4(void)
   TraceCallStack& textureTrace = gl.GetTextureTrace();
   textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u,
                     ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                     ninePatchResource );
@@ -853,7 +853,7 @@ int UtcDaliVisualFactoryGetNPatchVisual5(void)
   TraceCallStack& textureTrace = gl.GetTextureTrace();
   textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u,
                     ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                     ninePatchResource );
@@ -884,7 +884,7 @@ int UtcDaliVisualFactoryGetNPatchVisualN1(void)
   TraceCallStack& textureTrace = gl.GetTextureTrace();
   textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u,
                     ImageDimensions(),
                     Integration::ResourcePointer(bitmap) );
@@ -921,7 +921,7 @@ int UtcDaliVisualFactoryGetNPatchVisualN2(void)
   TraceCallStack& drawTrace = gl.GetDrawTrace();
   drawTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   TestVisualRender( application, actor, visual, 1u,
                     ImageDimensions(),
                     Integration::ResourcePointer(bitmap) );
@@ -964,9 +964,9 @@ int UtcDaliVisualFactoryGetSvgVisual(void)
   TraceCallStack& textureTrace = gl.GetTextureTrace();
   textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) );
@@ -1007,7 +1007,7 @@ int UtcDaliVisualFactoryGetSvgVisualLarge(void)
   DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
   actor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Only rasterizes when it knows control size.
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   Stage::GetCurrent().Add( actor );
 
   application.SendNotification();
@@ -1042,9 +1042,9 @@ void MeshVisualLoadsCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplic
   DALI_TEST_CHECK( visual );
 
   //Create an actor on stage to house the visual.
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.f, 200.f ) );
@@ -1085,9 +1085,9 @@ void MeshVisualDoesNotLoadCorrectlyTest( Property::Map& propertyMap, ToolkitTest
   DALI_TEST_CHECK( visual );
 
   //Create an actor on stage to house the visual.
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(),  Vector2( 200.f, 200.f ) );
@@ -1391,9 +1391,9 @@ void TestPrimitiveVisualWithProperties( Property::Map& propertyMap, ToolkitTestA
   DALI_TEST_CHECK( visual );
 
   //Create an actor on stage to house the visual.
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
 
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
@@ -1809,9 +1809,9 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual1(void)
   TraceCallStack& textureTrace = gl.GetTextureTrace();
   textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   actor.SetSize( 200.0f, 200.0f );
   Stage::GetCurrent().Add( actor );
 
@@ -1898,7 +1898,7 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual2(void)
   TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
   texParameterTrace.Enable( true );
 
-  DummyControl actor = DummyControl::New();
+  DummyControl actor = DummyControl::New(true);
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
   dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
   actor.SetSize( 200.0f, 200.0f );
index 8028707..37def2b 100755 (executable)
@@ -23,6 +23,7 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/devel-api/object/handle-devel.h>
+#include <dali/devel-api/actors/custom-actor-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -179,6 +180,11 @@ void ControlWrapper::ApplyThemeStyle()
   }
 }
 
+Dali::TypeInfo ControlWrapper::GetTypeInfo()
+{
+  return DevelCustomActor::GetTypeInfo(Self());
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 899a575..e5c371d 100755 (executable)
@@ -168,6 +168,13 @@ public: // From Control
    */
   void ApplyThemeStyle();
 
+public:
+  /**
+   * Enable access to non-native type info from native side
+   * @return The type info that was registered on this type
+   */
+  Dali::TypeInfo GetTypeInfo();
+
 protected:
 
   /**
index 304ba78..81fa035 100644 (file)
@@ -37,6 +37,7 @@
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
 
 namespace Dali
 {
@@ -439,21 +440,20 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base
   // ( If the control has been type registered )
   if( visual.GetName().empty() )
   {
-    // Check if the control has been type registered:
-    TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid( mControlImpl ) );
-    if( typeInfo )
+    try
     {
-      // Check if the property index has been registered:
-      Property::IndexContainer indices;
-      typeInfo.GetPropertyIndices( indices );
-      Property::IndexContainer::Iterator iter = std::find( indices.Begin(), indices.End(), index );
-      if( iter != indices.End() )
+      std::string visualName = self.GetPropertyName( index );
+      if( !visualName.empty() )
       {
-        // If it has, then get it's name and use that for the visual
-        std::string visualName = typeInfo.GetPropertyName( index );
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n",
+                       index, visualName.c_str() );
         visual.SetName( visualName );
       }
     }
+    catch( Dali::DaliException e )
+    {
+      DALI_LOG_WARNING( "Attempting to register visual without a registered property, index: %d\n", index );
+    }
   }
 
   if( !visualReplaced ) // New registration entry
@@ -603,11 +603,23 @@ Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData&
 
       if( visual )
       {
+#if defined(DEBUG_ENABLED)
+        Dali::TypeInfo typeInfo;
+        ControlWrapper* controlWrapperImpl = dynamic_cast<ControlWrapper*>(&mControlImpl);
+        if( controlWrapperImpl )
+        {
+          typeInfo = controlWrapperImpl->GetTypeInfo();
+        }
+
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found %s visual for %s\n",
+                       visual.GetName().c_str(), typeInfo?typeInfo.GetName().c_str():"Unknown" );
+#endif
         Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
         visualImpl.AnimateProperty( transition, *animator );
       }
       else
       {
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors");
         // Otherwise, try any actor children of control (Including the control)
         Actor child = mControlImpl.Self().FindChildByName( animator->objectName );
         if( child )
index eb2264b..fb97a76 100644 (file)
@@ -1502,14 +1502,6 @@ void TextEditor::UpdateScrollBar()
     return;
   }
 
-  // If scrolling is not started, start scrolling and emit ScrollStateChangedSignal
-  if( !mScrollStarted )
-  {
-    mScrollStarted = true;
-    Dali::Toolkit::TextEditor handle( GetOwner() );
-    mScrollStateChangedSignal.Emit( handle, DevelTextEditor::Scroll::STARTED );
-  }
-
   CustomActor self = Self();
   if( !mScrollBar )
   {
@@ -1553,6 +1545,14 @@ void TextEditor::UpdateScrollBar()
     self.SetProperty( propertyScrollContentSize, layoutSize );
   }
 
+  // If scrolling is not started, start scrolling and emit ScrollStateChangedSignal
+  if( !mScrollStarted )
+  {
+    mScrollStarted = true;
+    Dali::Toolkit::TextEditor handle( GetOwner() );
+    mScrollStateChangedSignal.Emit( handle, DevelTextEditor::Scroll::STARTED );
+  }
+
   Actor indicator = mScrollBar.GetScrollIndicator();
   if( mAnimation )
   {
index b847996..04a1af3 100644 (file)
@@ -668,9 +668,11 @@ void GetCursorPosition( VisualModelPtr visualModel,
     // Set the primary cursor's height.
     cursorInfo.primaryCursorHeight = cursorInfo.isSecondaryCursor ? 0.5f * glyphMetrics.fontHeight : glyphMetrics.fontHeight;
 
+
+    cursorInfo.glyphOffset = line.ascender - glyphMetrics.ascender;
     // Set the primary cursor's position.
     cursorInfo.primaryPosition.x = -glyphMetrics.xBearing + primaryPosition.x + glyphAdvance;
-    cursorInfo.primaryPosition.y = cursorInfo.lineOffset + line.ascender - glyphMetrics.ascender;
+    cursorInfo.primaryPosition.y = cursorInfo.lineOffset + cursorInfo.glyphOffset;
 
     // Transform the cursor info from line's coords to text's coords.
     cursorInfo.primaryPosition.x += line.alignmentOffset;
index f62165b..34a5f7b 100644 (file)
@@ -50,6 +50,7 @@ struct CursorInfo
   : primaryPosition(),
     secondaryPosition(),
     lineOffset( 0.f ),
+    glyphOffset( 0.f ),
     lineHeight( 0.f ),
     primaryCursorHeight( 0.f ),
     secondaryCursorHeight( 0.f ),
@@ -62,6 +63,7 @@ struct CursorInfo
   Vector2 primaryPosition;       ///< The primary cursor's position (in text's coords).
   Vector2 secondaryPosition;     ///< The secondary cursor's position (in text's coords).
   float   lineOffset;            ///< The vertical offset where the line containing the cursor starts.
+  float   glyphOffset;           ///< The difference of line ascender and glyph ascender.
   float   lineHeight;            ///< The height of the line where the cursor is placed.
   float   primaryCursorHeight;   ///< The primary cursor's height.
   float   secondaryCursorHeight; ///< The secondary cursor's height.
index da49940..e9e0b1a 100644 (file)
@@ -164,7 +164,8 @@ struct Decorator::Impl : public ConnectionTracker
     : color( Dali::Color::BLACK ),
       position(),
       cursorHeight( 0.0f ),
-      lineHeight( 0.0f )
+      lineHeight( 0.0f ),
+      glyphOffset( 0.0f )
     {
     }
 
@@ -172,6 +173,7 @@ struct Decorator::Impl : public ConnectionTracker
     Vector2 position;
     float cursorHeight;
     float lineHeight;
+    float glyphOffset;
   };
 
   struct HandleImpl
@@ -2006,6 +2008,18 @@ const Vector2& Decorator::GetPosition( Cursor cursor ) const
   return mImpl->mCursor[cursor].position;
 }
 
+void Decorator::SetGlyphOffset( Cursor cursor, float glyphOffset )
+{
+  Impl::CursorImpl& cursorImpl = mImpl->mCursor[cursor];
+
+  cursorImpl.glyphOffset = glyphOffset;
+}
+
+const float Decorator::GetGlyphOffset( Cursor cursor) const
+{
+  return mImpl->mCursor[cursor].glyphOffset;
+}
+
 void Decorator::SetCursorColor( Cursor cursor, const Dali::Vector4& color )
 {
   mImpl->mCursor[cursor].color = color;
index 6e7c727..8cff322 100644 (file)
@@ -243,6 +243,24 @@ public:
    */
   const Vector2& GetPosition( Cursor cursor ) const;
 
+
+  /**
+   * @brief Sets the glyph offset of a cursor.
+   *
+   * @param[in] cursor The cursor to set.
+   * @param[in] glyphoffset The difference of line ascender and glyph ascender.
+   */
+  void SetGlyphOffset( Cursor cursor, float glyphOffset );
+
+  /**
+   * @brief Retrieves the glyph offset of a cursor.
+   *
+   * @param[in] cursor The cursor to get.
+   *
+   * @return The glyph offset. glyph offset means difference of line ascender and glyph ascender.
+   */
+  const float GetGlyphOffset( Cursor cursor ) const;
+
   /**
    * @brief Sets the color for a cursor.
    *
index fd1d8e4..020a5cb 100644 (file)
@@ -613,8 +613,9 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
           if( !isValidFont ) // (3)
           {
             // The given font has not been validated.
+            int validCharacterIndex = fontClient.GetGlyphIndex(cachedDefaultFontId, character );
 
-            if( isValidCachedDefaultFont )
+            if( isValidCachedDefaultFont && validCharacterIndex != 0u )
             {
               // Use the cached default font for the script if there is one.
               fontId = cachedDefaultFontId;
index f119650..58893d4 100644 (file)
@@ -2695,6 +2695,8 @@ void Controller::Impl::UpdateCursorPosition( const CursorInfo& cursorInfo )
 
   const Vector2 cursorPosition = cursorInfo.primaryPosition + mModel->mScrollPosition;
 
+  mEventData->mDecorator->SetGlyphOffset( PRIMARY_CURSOR, cursorInfo.glyphOffset );
+
   // Sets the cursor position.
   mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
                                        cursorPosition.x,
@@ -2845,9 +2847,20 @@ void Controller::Impl::ScrollTextToMatchCursor( const CursorInfo& cursorInfo )
   // Get the current cursor position in decorator coords.
   const Vector2& currentCursorPosition = mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
 
+  const LineIndex lineIndex = mModel->mVisualModel->GetLineOfCharacter( mEventData->mPrimaryCursorPosition  );
+
+
+
   // Calculate the offset to match the cursor position before the character was deleted.
   mModel->mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x;
-  mModel->mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset;
+
+  //If text control has more than two lines and current line index is not last, calculate scrollpositionY
+  if( mModel->mVisualModel->mLines.Count() > 1u && lineIndex != mModel->mVisualModel->mLines.Count() -1u )
+  {
+    const float currentCursorGlyphOffset = mEventData->mDecorator->GetGlyphOffset( PRIMARY_CURSOR );
+    mModel->mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset - currentCursorGlyphOffset;
+  }
+
 
   ClampHorizontalScroll( mModel->mVisualModel->GetLayoutSize() );
   ClampVerticalScroll( mModel->mVisualModel->GetLayoutSize() );
index dc16aac..e50edca 100644 (file)
@@ -552,7 +552,10 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet )
     }
   }
 
-  shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_ON ); // Set default to align
+  // Set pixel align off as default.
+  // ToDo: Pixel align causes issues such as rattling image animation.
+  // We should trun it off until issues are resolved
+  shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_OFF );
 
   mImpl->mRenderer = Renderer::New( geometry, shader );
   if( textureSet )
index b113438..2283f22 100644 (file)
@@ -343,6 +343,7 @@ void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingCo
 
         if( textureInfo.loadState != CANCELLED )
         {
+          // textureInfo can be invalidated after this call (as the mTextureInfoContainer may be modified)
           PostLoad( textureInfo, pixelData );
         }
         else
@@ -469,19 +470,55 @@ void TextureManager::UploadTexture( PixelData pixelData, TextureInfo& textureInf
 
 void TextureManager::NotifyObservers( TextureInfo& textureInfo, bool success )
 {
-  // If there is an observer: Notify the upload is complete
-  const unsigned int observerCount = textureInfo.observerList.Count();
-  for( unsigned int i = 0; i < observerCount; ++i )
+  TextureId textureId = textureInfo.textureId;
+
+  // If there is an observer: Notify the load is complete, whether successful or not:
+  // And erase it from the list
+  unsigned int observerCount = textureInfo.observerList.Count();
+  TextureInfo* info = &textureInfo;
+
+  while( observerCount )
   {
-    TextureUploadObserver* observer = textureInfo.observerList[i];
-    if( observer )
+    TextureUploadObserver* observer = info->observerList[0];
+
+    // During UploadComplete() a Control ResourceReady() signal is emitted
+    // During that signal the app may add remove /add Textures (e.g. via ImageViews).
+    // At this point no more observers can be added to the observerList, because  textureInfo.loadState = UPLOADED
+    // However it is possible for observers to be removed, hence we check the observer list count every iteration
+
+    // Also the reference to the textureInfo struct can become invalidated, because new load requests can modify
+    // the mTextureInfoContainer list (e.g. if more requests are pushed_back it can cause the list to be resized
+    // invalidating the reference to the TextureInfo ).
+    observer->UploadComplete( success, info->textureSet, info->useAtlas, info->atlasRect );
+    observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
+
+    // regrab the textureInfo from the container as it may have been invalidated, if textures have been removed
+    // or added during the ResourceReady() signal emission (from UploadComplete() )
+    int textureInfoIndex = GetCacheIndexFromId( textureId );
+
+    if( textureInfoIndex == INVALID_CACHE_INDEX)
     {
-      observer->UploadComplete( success, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect );
-      observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
+      // texture has been removed
+      return;
     }
+    info = &mTextureInfoContainer[ textureInfoIndex ];
+    observerCount = info->observerList.Count();
+    if ( observerCount > 0 )
+    {
+      // remove the observer that was just triggered if it's still in the list
+      for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
+      {
+        if( *j == observer )
+        {
+          info->observerList.Erase( j );
+          observerCount--;
+          break;
+         }
+      }
+    }
+
   }
 
-  textureInfo.observerList.Clear();
 }
 
 
index 0dfc002..59e0a18 100644 (file)
@@ -122,6 +122,7 @@ Vector4 Control::GetBackgroundColor() const
 void Control::SetBackground( const Property::Map& map )
 {
   Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
+  visual.SetName("background");
   if( visual )
   {
     mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
index d2ad3a6..fca2eab 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 43;
+const unsigned int TOOLKIT_MICRO_VERSION = 44;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 8db8b94..13a5fb8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.2.43
+Version:    1.2.44
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT