Merge "Send the empty string to IME when PlaceholderText shows" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
index 5471c95..35e1ae7 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -420,8 +422,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   Property::Map shadowMapSet;
   Property::Map shadowMapGet;
 
-  shadowMapSet.Insert( "color", "green" );
-  shadowMapSet.Insert( "offset", "2 2" );
+  shadowMapSet.Insert( "color", Color::GREEN );
+  shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
+  shadowMapSet.Insert( "blurRadius", 5.0f );
 
   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
 
@@ -431,8 +434,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
 
   shadowMapSet.Clear();
   Property::Map shadowDisabledMapGet;
-  shadowDisabledMapGet.Insert( "color", "green" );
-  shadowDisabledMapGet.Insert( "offset", "0 0" );
+  shadowDisabledMapGet.Insert( "color", Color::GREEN );
+  shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
+  shadowDisabledMapGet.Insert( "blurRadius", 5.0f );
 
   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
 
@@ -474,6 +478,13 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   label.SetProperty( TextLabel::Property::ELLIPSIS, true );
   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
 
+  // Check the layout direction property
+  label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
+  DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
   END_TEST;
 }
 
@@ -621,6 +632,12 @@ int UtcDaliToolkitTextlabelScrollingP(void)
     // Render some text with the shared atlas backend
     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+
+    labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+    labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+
+    labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+    labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
     application.SendNotification();
     application.Render();
 
@@ -1066,6 +1083,7 @@ int UtcDaliToolkitTextlabelTextStyle01(void)
   Property::Map shadowMapSet;
   shadowMapSet.Insert( "color", "green" );
   shadowMapSet.Insert( "offset", "2 2" );
+  shadowMapSet.Insert( "blurRadius", "3" );
   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
 
   outlineMapSet["color"] = Color::RED;
@@ -1109,3 +1127,52 @@ int UtcDaliToolkitTextlabelTextStyle01(void)
 
   END_TEST;
 }
+
+int UtcDaliToolkitTextlabelMultiline(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelMultiline");
+
+  TextLabel label = TextLabel::New();
+  label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
+  label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+  label.SetProperty( TextLabel::Property::MULTI_LINE, false );
+  Stage::GetCurrent().Add( label );
+
+  application.SendNotification();
+  application.Render();
+
+  int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+  DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+  application.SendNotification();
+  application.Render();
+
+  lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+  DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
+
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextlabelTextDirection(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
+
+  TextLabel label = TextLabel::New();
+  DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
+  label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+  Stage::GetCurrent().Add( label );
+
+  DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+  DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+  END_TEST;
+}