ImageVisual Action::Reload added
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
index 846446b..93a644b 100644 (file)
@@ -420,8 +420,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 +432,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 +476,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 +630,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();
 
@@ -954,7 +969,7 @@ int UtcDaliToolkitTextlabelEllipsis(void)
   END_TEST;
 }
 
-int UtcDaliToolkitTextlabelTextWarpMode(void)
+int UtcDaliToolkitTextlabelTextWrapMode(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
@@ -971,7 +986,8 @@ int UtcDaliToolkitTextlabelTextWarpMode(void)
   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
   Stage::GetCurrent().Add( label );
 
-  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WRAP_MODE_WORD" );
+  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
+  DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
 
   application.SendNotification();
   application.Render();
@@ -979,17 +995,34 @@ int UtcDaliToolkitTextlabelTextWarpMode(void)
   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
   DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
 
+  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
+  DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
 
+  application.SendNotification();
+  application.Render();
 
-  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WRAP_MODE_CHARACTER" );
+  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
+  DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
 
   application.SendNotification();
   application.Render();
 
+  lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+  DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
+  DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
 
   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
   DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
 
+  tet_infoline( "Ensure invalid string does not change wrapping mode" );
+  label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
+  DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -1048,6 +1081,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;
@@ -1091,3 +1125,32 @@ 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;
+}