From: Paul Wisbey
Date: Mon, 7 Nov 2016 10:09:21 +0000 (-0800)
Subject: Merge "Revert the TextLabel to use the old renderer." into devel/master
X-Git-Tag: dali_1.2.14~11
X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=84c98859f482a168f4cc5f4d84b3a08c39b8902c;hp=-c
Merge "Revert the TextLabel to use the old renderer." into devel/master
---
84c98859f482a168f4cc5f4d84b3a08c39b8902c
diff --combined automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
index 5f70749,263e79e..7cda6e5
--- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
+++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
@@@ -191,7 -191,16 +191,7 @@@ int UtcDaliVisualSize(void
imageVisual.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 200.f), TEST_LOCATION );
- // n patch visual
- TestPlatformAbstraction& platform = application.GetPlatform();
- Vector2 testSize(80.f, 160.f);
- platform.SetClosestImageSize(testSize);
- image = ResourceImage::New(TEST_NPATCH_FILE_NAME);
- Visual::Base nPatchVisual = factory.CreateVisual( image );
- nPatchVisual.SetSize( visualSize );
- DALI_TEST_EQUALS( nPatchVisual.GetSize(), visualSize, TEST_LOCATION );
- nPatchVisual.GetNaturalSize(naturalSize);
- DALI_TEST_EQUALS( naturalSize, testSize, TEST_LOCATION );
+ // n patch visual is tested in the utc-Dali-VisualFactory.cpp
// border visual
float borderSize = 5.f;
@@@ -241,9 -250,6 +241,9 @@@
DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION ); // Natural size should still be 100, 100
// Batch Image visual
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ Vector2 testSize(80.f, 160.f);
+ platform.SetClosestImageSize(testSize);
propertyMap.Clear();
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
@@@ -656,6 -662,19 +656,6 @@@ int UtcDaliVisualGetPropertyMap5(void
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get() == true );
- // Test the properties..
- Property::Value imageValue = imageVisual.GetProperty( ImageVisual::Property::URL );
- DALI_TEST_CHECK( imageValue.Get() == TEST_IMAGE_FILE_NAME );
-
- // Other Properties for Image Visual can be tested here once implemented in the Visual
-
- tet_infoline( "UtcDaliVisualGetPropertyMap5 Ensuring Property without a Getter is not problematic" );
- imageValue = imageVisual.GetProperty( ImageVisual::Property::DESIRED_HEIGHT );
- DALI_TEST_CHECK( imageValue.Get() != 30 );
-
-
- // Rest of test uses Image not an url ( legacy )
-
// Get an image visual with an image handle, and test the default property values
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageVisual = factory.CreateVisual(image);
@@@ -709,11 -728,13 +709,11 @@@ int UtcDaliVisualGetPropertyMap6(void
ToolkitTestApplication application;
tet_infoline( "UtcDaliVisualGetPropertyMap6: NPatchVisual" );
- bool BORDER_ONLY_SETTING = true;
-
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, BORDER_ONLY_SETTING );
+ propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
@@@ -732,6 -753,19 +732,6 @@@
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get() );
- // Test the properties via Index.
- nPatchVisual.SetProperty( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME ); // May not able to change URL in future using SetProperty
- Property::Value nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::URL );
- DALI_TEST_CHECK( nPatchValue.Get() == TEST_NPATCH_FILE_NAME );
-
- nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::BORDER_ONLY );
- DALI_TEST_CHECK( nPatchValue.Get() == BORDER_ONLY_SETTING );
-
- // Other Properties for N-Patch Visual can be tested here once implemented in the Visual
-
- tet_infoline( "UtcDaliVisualGetPropertyMap6 Ensuring Property without a Getter is not problematic" );
- nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::DESIRED_HEIGHT );
- DALI_TEST_CHECK( nPatchValue.Get() != 30 );
END_TEST;
}
@@@ -1047,8 -1081,7 +1047,7 @@@ int UtcDaliVisualGetPropertyMap10(void
DALI_TEST_CHECK( !value->Get() );
value = resultMap.Find( TextVisual::Property::ENABLE_AUTO_SCROLL, Property::BOOLEAN );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( !value->Get() );
+ DALI_TEST_CHECK( !value );
value = resultMap.Find( TextVisual::Property::LINE_SPACING, Property::FLOAT );
DALI_TEST_CHECK( value );
@@@ -1583,37 -1616,4 +1582,37 @@@ int UtcDaliVisualSetTransform7(void
END_TEST;
}
+int UtcDaliNPatchVisualCustomShader(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "NPatchVisual with custom shader" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map properties;
+ Property::Map shader;
+ const std::string fragmentShader = "Foobar";
+ shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = fragmentShader;
+ properties[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
+ properties[Dali::Toolkit::Visual::Property::SHADER]=shader;
+ properties[Dali::Toolkit::ImageVisual::Property::URL] = TEST_NPATCH_FILE_NAME;
+
+ Visual::Base visual = factory.CreateVisual( properties );
+ Actor dummy = Actor::New();
+ // trigger creation through setting on stage
+ visual.SetOnStage( dummy );
+
+ Renderer renderer = dummy.GetRendererAt( 0 );
+ Shader shader2 = renderer.GetShader();
+ Property::Value value = shader2.GetProperty( Shader::Property::PROGRAM );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+
+ Property::Value* fragment = map->Find( "fragment" ); // fragment key name from shader-impl.cpp
+ // *map["vertex"]; is default here so not verifying it
+
+ DALI_TEST_EQUALS( fragmentShader, fragment->Get(), TEST_LOCATION );
+
+ END_TEST;
+}
+
diff --combined dali-toolkit/internal/file.list
index 902074b,e11393d..1e78bf6
--- a/dali-toolkit/internal/file.list
+++ b/dali-toolkit/internal/file.list
@@@ -13,7 -13,6 +13,7 @@@ toolkit_src_files =
$(toolkit_src_dir)/visuals/visual-base-impl.cpp \
$(toolkit_src_dir)/visuals/visual-base-data-impl.cpp \
$(toolkit_src_dir)/visuals/image-atlas-manager.cpp \
+ $(toolkit_src_dir)/visuals/npatch-loader.cpp \
$(toolkit_src_dir)/visuals/visual-factory-cache.cpp \
$(toolkit_src_dir)/visuals/visual-factory-impl.cpp \
$(toolkit_src_dir)/visuals/visual-string-constants.cpp \
@@@ -115,7 -114,6 +115,6 @@@
$(toolkit_src_dir)/text/text-font-style.cpp \
$(toolkit_src_dir)/text/text-io.cpp \
$(toolkit_src_dir)/text/text-scroller.cpp \
- $(toolkit_src_dir)/text/text-scroller-data.cpp \
$(toolkit_src_dir)/text/text-scroller-interface.cpp \
$(toolkit_src_dir)/text/text-view.cpp \
$(toolkit_src_dir)/text/text-view-interface.cpp \
diff --combined dali-toolkit/internal/visuals/text/text-visual.cpp
index f7c4f24,ea514b0..baba744
--- a/dali-toolkit/internal/visuals/text/text-visual.cpp
+++ b/dali-toolkit/internal/visuals/text/text-visual.cpp
@@@ -162,14 -162,6 +162,6 @@@ TextVisualPtr TextVisual::New( VisualFa
return new TextVisual( factoryCache );
}
- void TextVisual::SetTextControlInterface( Text::ControlInterface* controlInterface )
- {
- if( mController )
- {
- mController->SetTextControlInterface( controlInterface );
- }
- }
-
void TextVisual::SetSize( const Vector2& size )
{
const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
@@@ -191,7 -183,7 +183,7 @@@ float TextVisual::GetHeightForWidth( fl
return mController->GetHeightForWidth( width );
}
-void TextVisual::GetNaturalSize( Vector2& naturalSize ) const
+void TextVisual::GetNaturalSize( Vector2& naturalSize )
{
naturalSize = mController->GetNaturalSize().GetVectorXY();
}
@@@ -226,14 -218,6 +218,6 @@@ void TextVisual::DoCreatePropertyMap( P
map.Insert( Toolkit::TextVisual::Property::ENABLE_MARKUP, mController->IsMarkupProcessorEnabled() );
- map.Insert( Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL, mController->IsAutoScrollEnabled() );
-
- map.Insert( Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED, mController->GetAutoScrollSpeed() );
-
- map.Insert( Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT, mController->GetAutoScrollLoopCount() );
-
- map.Insert( Toolkit::TextVisual::Property::AUTO_SCROLL_GAP, mController->GetAutoScrollWrapGap() );
-
map.Insert( Toolkit::TextVisual::Property::LINE_SPACING, mController->GetDefaultLineSpacing() );
GetUnderlineProperties( mController, value, Text::EffectStyle::DEFAULT );
@@@ -501,47 -485,22 +485,22 @@@ void TextVisual::DoSetProperty( Dali::P
}
case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
{
- const bool enableAutoScroll = propertyValue.Get();
-
- // If request to auto scroll is the same as current state then do nothing.
- if( enableAutoScroll != mController->IsAutoScrollEnabled() )
- {
- // If request is disable (false) and auto scrolling is enabled then need to stop it
- if( !enableAutoScroll )
- {
- StopTextAutoScrolling(); // Causes the current animation to finish playing.
- }
- // If request is enable (true) then start autoscroll as not already running
- else
- {
- mController->GetLayoutEngine().SetTextEllipsisEnabled( false );
- mController->SetAutoScrollEnabled( enableAutoScroll );
- mController->RequestRelayout();
- }
- }
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
{
- mController->SetAutoscrollSpeed( propertyValue.Get() );
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
{
- const int loopCount = propertyValue.Get();
- if( loopCount > 0 )
- {
- mController->SetAutoScrollLoopCount( loopCount );
- }
- else
- {
- StopTextAutoScrolling(); // Causes the current animation to finish playing.
- }
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
{
- mController->SetAutoScrollWrapGap( propertyValue.Get() );
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::LINE_SPACING:
@@@ -751,22 -710,22 +710,22 @@@ Dali::Property::Value TextVisual::DoGet
}
case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
{
- value = mController->IsAutoScrollEnabled();
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
{
- value = mController->GetAutoScrollSpeed();
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
{
- value = mController->GetAutoScrollLoopCount();
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
{
- value = mController->GetAutoScrollWrapGap();
+ // nothing to do.
break;
}
case Toolkit::TextVisual::Property::LINE_SPACING:
@@@ -837,46 -796,6 +796,6 @@@ void TextVisual::RenderText(
self.Add( renderableActor );
}
mRenderableActor = renderableActor;
-
- if( mController->IsAutoScrollEnabled() )
- {
- SetUpAutoScrolling();
- }
- }
- }
-
- void TextVisual::StopTextAutoScrolling()
- {
- if( mTextScroller )
- {
- mTextScroller->StopScrolling();
- }
- }
-
- void TextVisual::SetUpAutoScrolling()
- {
- Actor self = mSelf.GetHandle();
- if( !self )
- {
- // Nothing to do if the handle is not initialized.
- return;
- }
-
- const Text::ScrollerData* const data = mController->GetAutoScrollData();
-
- if( NULL != data )
- {
- if( !mTextScroller )
- {
- // If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults
- mTextScroller = Text::TextScroller::New( *mController );
- }
-
- mTextScroller->StartScrolling( mRenderableActor,
- *data );
-
- self.Add( mTextScroller->GetScrollingText() );
- self.Add( mTextScroller->GetSourceCamera() );
}
}
diff --combined dali-toolkit/internal/visuals/text/text-visual.h
index e1a4f80,c2a6194..dd1abf6
--- a/dali-toolkit/internal/visuals/text/text-visual.h
+++ b/dali-toolkit/internal/visuals/text/text-visual.h
@@@ -26,7 -26,6 +26,6 @@@
#include
#include
#include
- #include
namespace Dali
{
@@@ -80,12 -79,6 +79,6 @@@ public
*/
static TextVisualPtr New( VisualFactoryCache& factoryCache );
- /**
- * @brief Sets the text control interface which is needed to communicate with a control.
- * @param[in] controlInterface Pointer to the control-interface.
- */
- void SetTextControlInterface( Text::ControlInterface* controlInterface );
-
public: // from Visual::Base
/**
@@@ -101,7 -94,7 +94,7 @@@
/**
* @copydoc Visual::Base::GetNaturalSize()
*/
- virtual void GetNaturalSize( Vector2& naturalSize ) const;
+ virtual void GetNaturalSize( Vector2& naturalSize );
/**
* @copydoc Visual::Base::CreatePropertyMap()
@@@ -157,22 -150,11 +150,11 @@@ private
*/
void RenderText();
- /**
- * @brief Stops the text auto scroll.
- */
- void StopTextAutoScrolling();
-
- /**
- * @brief Set up Autoscrolling.
- */
- void SetUpAutoScrolling();
-
private:
Text::ControllerPtr mController; ///< The text's controller.
WeakHandle mSelf;
Text::RendererPtr mRenderer;
- Text::TextScrollerPtr mTextScroller;
Actor mRenderableActor;
int mRenderingBackend;