[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
index a45aa41..47c7369 100644 (file)
@@ -80,6 +80,9 @@ const char* const PROPERTY_NAME_ELLIPSIS_POSITION    = "ellipsisPosition";
 const char* const PROPERTY_NAME_ANCHOR_COLOR         = "anchorColor";
 const char* const PROPERTY_NAME_ANCHOR_CLICKED_COLOR = "anchorClickedColor";
 
+const char* const PROPERTY_NAME_REMOVE_FRONT_INSET    = "removeFrontInset";
+const char* const PROPERTY_NAME_REMOVE_BACK_INSET     = "removeBackInset";
+
 const std::string  DEFAULT_FONT_DIR("/resources/fonts");
 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
 
@@ -360,6 +363,8 @@ int UtcDaliToolkitTextLabelGetPropertyP(void)
   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextLabel::Property::STRIKETHROUGH);
   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ANCHOR_COLOR) == DevelTextLabel::Property::ANCHOR_COLOR);
   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ANCHOR_CLICKED_COLOR) == DevelTextLabel::Property::ANCHOR_CLICKED_COLOR);
+  DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_REMOVE_FRONT_INSET) == DevelTextLabel::Property::REMOVE_FRONT_INSET);
+  DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_REMOVE_BACK_INSET) == DevelTextLabel::Property::REMOVE_BACK_INSET);
 
   END_TEST;
 }
@@ -947,6 +952,7 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
 
   outlineMapSet["color"] = Color::RED;
   outlineMapSet["width"] = 2.0f;
+  outlineMapSet["offset"] = Vector2(2.0f, 2.0f);
   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
 
   outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
@@ -956,11 +962,13 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   outlineMapSet.Clear();
   outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
   outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
+  outlineMapSet[Toolkit::DevelText::Outline::Property::OFFSET] = Vector2(3.0f, 3.0f);
+
   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
 
   outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
   DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
-  std::vector<std::string> outlineIndicesConversionTable = {"color", "width"};
+  std::vector<std::string> outlineIndicesConversionTable = {"color", "width", "offset"};
   DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet, outlineIndicesConversionTable), true, TEST_LOCATION);
 
   // Check the background property
@@ -1019,6 +1027,18 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   application.SendNotification();
   application.Render();
 
+  // Check Remove Front/Back Inset Property
+  DALI_TEST_CHECK(label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_FRONT_INSET));
+  label.SetProperty(DevelTextLabel::Property::REMOVE_FRONT_INSET, false);
+  DALI_TEST_CHECK(!label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_FRONT_INSET));
+
+  DALI_TEST_CHECK(label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_BACK_INSET));
+  label.SetProperty(DevelTextLabel::Property::REMOVE_BACK_INSET, false);
+  DALI_TEST_CHECK(!label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_BACK_INSET));
+
+  application.SendNotification();
+  application.Render();
+
   END_TEST;
 }
 
@@ -1800,6 +1820,7 @@ int UtcDaliToolkitTextlabelTextStyle01(void)
 
   outlineMapSet["color"] = Color::BLUE;
   outlineMapSet["width"] = 2.0f;
+  outlineMapSet["offset"] = "2 2";
   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
 
   application.SendNotification();
@@ -3323,4 +3344,40 @@ int utcDaliTextLabelGetTextBoundingRectangle(void)
   TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
 
   END_TEST;
+}
+
+int utcDaliTextLabelRemoveFrontInset(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextLabelRemoveFrontInset");
+
+  TextLabel label = TextLabel::New();
+  DALI_TEST_CHECK(label);
+
+  application.GetScene().Add(label);
+  application.SendNotification();
+  application.Render();
+
+  DevelTextLabel::SetRemoveFrontInset(label, false);
+  DALI_TEST_CHECK(!DevelTextLabel::IsRemoveFrontInset(label));
+
+  END_TEST;
+}
+
+int utcDaliTextLabelRemoveBackInset(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextLabelRemoveBackInset");
+
+  TextLabel label = TextLabel::New();
+  DALI_TEST_CHECK(label);
+
+  application.GetScene().Add(label);
+  application.SendNotification();
+  application.Render();
+
+  DevelTextLabel::SetRemoveBackInset(label, false);
+  DALI_TEST_CHECK(!DevelTextLabel::IsRemoveBackInset(label));
+
+  END_TEST;
 }
\ No newline at end of file