+ tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
+
+ DevelText::BitmapFontDescription fontDescription;
+ fontDescription.name = "Digits";
+ fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f});
+
+ TextAbstraction::BitmapFont bitmapFont;
+ DevelText::CreateBitmapFont(fontDescription, bitmapFont);
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.GetFontId(bitmapFont);
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty(TextLabel::Property::FONT_FAMILY, "Digits");
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded.");
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+ label.SetProperty(TextLabel::Property::MULTI_LINE, true);
+
+ Property::Map underlineMapSet;
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", true);
+ underlineMapSet.Insert("color", Color::RED);
+ underlineMapSet.Insert("height", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert("enable", true);
+ strikethroughMapSet.Insert("color", Color::RED);
+ strikethroughMapSet.Insert("height", 2.0f);
+ label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ const int maxTextureSize = Dali::GetMaxTextureSize();
+ // Whether the rendered text is greater than maxTextureSize
+ DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
+
+ // Check if the number of renderers is greater than 1.
+ DALI_TEST_CHECK(label.GetRendererCount() > 1u);
+
+ //DASHED
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", false);
+ underlineMapSet.Insert("color", Color::BLUE);
+ underlineMapSet.Insert("height", 0);
+ underlineMapSet.Insert("type", Text::Underline::DASHED);
+ underlineMapSet.Insert("dashWidth", 2);
+ underlineMapSet.Insert("dashGap", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ // Whether the rendered text is greater than maxTextureSize
+ DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
+
+ // Check if the number of renderers is greater than 1.
+ DALI_TEST_CHECK(label.GetRendererCount() > 1u);
+
+ //DOUBLE
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", false);
+ underlineMapSet.Insert("color", Color::BLUE);
+ underlineMapSet.Insert("height", 0);
+ underlineMapSet.Insert("type", Text::Underline::DOUBLE);
+ underlineMapSet.Insert("dashWidth", 2);
+ underlineMapSet.Insert("dashGap", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ // Whether the rendered text is greater than maxTextureSize
+ DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
+
+ // Check if the number of renderers is greater than 1.
+ DALI_TEST_CHECK(label.GetRendererCount() > 1u);
+
+ // Coverage test for case of layoutSize is bigger than maxTextureSize
+ float max_value = static_cast<float>(std::numeric_limits<uint16_t>::max());
+ label.SetProperty(Actor::Property::SIZE, Vector2(max_value, 30.0f));
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty(TextLabel::Property::TEXT, "Test");
+ label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+ //Exeeding BufferWidth
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert("enable", true);
+ strikethroughMapSet.Insert("color", Color::BLUE);
+ strikethroughMapSet.Insert("height", 2.0f);
+ label.SetProperty(TextLabel::Property::TEXT, "Test1");
+ label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
+
+ label = TextLabel::New();
+ label.SetProperty(TextLabel::Property::TEXT, "Test");
+ label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ //Exeeding BufferHeight
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert("enable", true);
+ strikethroughMapSet.Insert("color", Color::BLUE);
+ strikethroughMapSet.Insert("height", 2.0f);
+ label.SetProperty(TextLabel::Property::TEXT, "Test2");
+ label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelUnderlineExceedsWidth(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelUnderlineExceedsWidth");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty(TextLabel::Property::TEXT, "Test");
+ label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+ //Exeeding BufferWidth
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+
+ Property::Map underlineMapSet;
+
+ //SOLID
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", true);
+ underlineMapSet.Insert("color", Color::BLUE);
+ underlineMapSet.Insert("height", 1);
+ underlineMapSet.Insert("type", Text::Underline::SOLID);
+ underlineMapSet.Insert("dashWidth", 2);
+ underlineMapSet.Insert("dashGap", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
+
+ //DASHED
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", true);
+ underlineMapSet.Insert("color", Color::BLUE);
+ underlineMapSet.Insert("height", 1);
+ underlineMapSet.Insert("type", Text::Underline::DASHED);
+ underlineMapSet.Insert("dashWidth", 2);
+ underlineMapSet.Insert("dashGap", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
+
+ //DOUBLE
+ underlineMapSet.Clear();
+ underlineMapSet.Insert("enable", true);
+ underlineMapSet.Insert("color", Color::BLUE);
+ underlineMapSet.Insert("height", 1);
+ underlineMapSet.Insert("type", Text::Underline::DOUBLE);
+ underlineMapSet.Insert("dashWidth", 2);
+ underlineMapSet.Insert("dashGap", 1);
+ label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
+ label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
+
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelLastCharacterIndex(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
+
+ Vector2 size(300.0f, 100.0f);
+
+ Dali::Toolkit::DevelText::RendererParameters textParameters;
+ textParameters.text = "This is a sample text to get the last index.";
+ textParameters.layout = "multiLine";
+ textParameters.fontSize = 20.f;
+ textParameters.textWidth = 300u;
+ textParameters.textHeight = 100u;
+ textParameters.ellipsisEnabled = true;
+ Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex(textParameters);
+
+ DALI_TEST_CHECK(!indexArray.Empty());
+ DALI_TEST_EQUALS(indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelFontSizeScale(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 30.f);
+ label.SetProperty(TextLabel::Property::TEXT, "Test");
+ Vector3 nonScaledSize = label.GetNaturalSize();
+
+ TextLabel labelScaled = TextLabel::New();
+ labelScaled.SetProperty(TextLabel::Property::POINT_SIZE, 15.f);
+ labelScaled.SetProperty(Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f);
+ labelScaled.SetProperty(TextLabel::Property::TEXT, "Test");
+ Vector3 scaledSize = labelScaled.GetNaturalSize();
+
+ DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
+
+ label.SetProperty(TextLabel::Property::PIXEL_SIZE, 30.f);
+ label.SetProperty(TextLabel::Property::TEXT, "Test");
+ nonScaledSize = label.GetNaturalSize();
+
+ labelScaled.SetProperty(TextLabel::Property::PIXEL_SIZE, 15.f);
+ labelScaled.SetProperty(Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f);
+ labelScaled.SetProperty(TextLabel::Property::TEXT, "Test");
+ scaledSize = labelScaled.GetNaturalSize();
+
+ DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelAnchorColor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelAnchorColor");
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+
+ // connect to the anchor clicked signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
+ bool anchorClickedSignal = false;
+ label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
+
+ gAnchorClickedCallBackCalled = false;
+ label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ // Check that anchor color can be properly set
+ label.SetProperty(DevelTextLabel::Property::ANCHOR_COLOR, Color::BLUE);
+ DALI_TEST_EQUALS(label.GetProperty<Vector4>(DevelTextLabel::Property::ANCHOR_COLOR), Color::BLUE, TEST_LOCATION);
+
+ label.SetProperty(DevelTextLabel::Property::ANCHOR_CLICKED_COLOR, Color::RED);
+ DALI_TEST_EQUALS(label.GetProperty<Vector4>(DevelTextLabel::Property::ANCHOR_CLICKED_COLOR), Color::RED, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text label.
+ TestGenerateTap(application, 5.0f, 25.0f, 100);
+ application.SendNotification();
+ application.Render();
+
+ // Update clicked color
+ label.SetProperty(DevelTextLabel::Property::ANCHOR_CLICKED_COLOR, Color::BLUE);
+ DALI_TEST_EQUALS(label.GetProperty<Vector4>(DevelTextLabel::Property::ANCHOR_CLICKED_COLOR), Color::BLUE, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+ DALI_TEST_CHECK(anchorClickedSignal);
+
+ END_TEST;
+}
+
+// Positive test for the anchorClicked signal.
+int UtcDaliToolkitTextlabelAnchorClicked(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
+ TextLabel label = TextLabel::New();