+
+int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged ");
+
+ int lineCountBefore = 0;
+ int lineCountAfter = 0;
+
+ // Create a text editor
+ TextLabel textLabel = TextLabel::New();
+ //Set very large font-size using point-size
+ textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 10);
+ //Specify font-family
+ textLabel.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textLabel.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.f));
+ //Set text longer than width of textLabel
+ textLabel.SetProperty(TextLabel::Property::TEXT, "Short text");
+ //Set line wrap mode Character
+ textLabel.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
+ textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
+
+ application.GetScene().Add(textLabel);
+
+ application.SendNotification();
+ application.Render();
+
+ lineCountBefore = textLabel.GetProperty<int>(TextLabel::Property::LINE_COUNT);
+
+ textLabel.SetProperty(TextLabel::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
+ lineCountAfter = textLabel.GetProperty<int>(TextLabel::Property::LINE_COUNT);
+
+ // When the text changed, the Line-count should be updated according to new text.
+ // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
+ DALI_TEST_EQUALS(lineCountBefore, 1, TEST_LOCATION);
+ DALI_TEST_GREATER(lineCountAfter, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliTextLabelGeometryRTL(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextLabelGeometryRTL");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f);
+ label.SetProperty(Actor::Property::SIZE, Vector2(150.f, 100.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(TextLabel::Property::MULTI_LINE, true);
+ label.SetProperty(TextLabel::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 4;
+ unsigned int startIndex = 3;
+ unsigned int endIndex = 24;
+
+ Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(24, 0));
+ expectedSizes.PushBack(Vector2(33, 25));
+
+ expectedPositions.PushBack(Vector2(-1, 25));
+ expectedSizes.PushBack(Vector2(52, 25));
+
+ expectedPositions.PushBack(Vector2(-1, 50));
+ expectedSizes.PushBack(Vector2(59, 25));
+
+ expectedPositions.PushBack(Vector2(73, 75));
+ expectedSizes.PushBack(Vector2(37, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
+int utcDaliTextLabelGeometryGlyphMiddle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextLabelGeometryGlyphMiddle");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f);
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(TextLabel::Property::TEXT, "لا تحتوي على لا");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 1;
+ unsigned int startIndex = 1;
+ unsigned int endIndex = 13;
+
+ Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(12, 0));
+ expectedSizes.PushBack(Vector2(118, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
+ TextLabel textLabel = TextLabel::New();
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
+ DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
+
+ TextLabel textLabel = TextLabel::New();
+ textLabel.SetProperty(TextLabel::Property::TEXT, "Test");
+ textLabel.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
+ textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 10);
+ textLabel.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add(textLabel);
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert("enable", true);
+ strikethroughMapSet.Insert("color", Color::RED);
+ strikethroughMapSet.Insert("height", 2.0f);
+
+ // Check the strikethrough property
+ textLabel.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
+ strikethroughMapGet = textLabel.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
+ textLabel.SetProperty(TextLabel::Property::TEXT, "Test1");
+ DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+}
+
+int UtcDaliTextLabelCharacterSpacing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextLabelCharacterSpacing ");
+
+ TextLabel textLabel = TextLabel::New();
+
+ textLabel.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
+
+ application.GetScene().Add(textLabel);
+ application.SendNotification();
+ application.Render();
+
+ textLabel.SetProperty(TextLabel::Property::TEXT, "Hi Experiment");
+ textLabel.SetProperty(DevelTextLabel::Property::CHARACTER_SPACING, 10.f);
+ DALI_TEST_EQUALS(textLabel.GetProperty<float>(DevelTextLabel::Property::CHARACTER_SPACING), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
\ No newline at end of file