X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextLabel.cpp;h=f7bf429114027b11b36609cf2f5c71016f02fcf0;hp=30aaadecc824ff26324baff349ac6c703344b230;hb=1621192f7b42f1fa210d6bdf12d853629304bea3;hpb=11ac31ab089b6b0d6cb8b06381724ac8c0ce126e diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 30aaade..f7bf429 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -644,6 +644,21 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION); DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION); + // Check the transparent strikethrough property for coverage. + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert("enable", true); + strikethroughMapSet.Insert("color", Color::TRANSPARENT); + strikethroughMapSet.Insert("height", 2.0f); + + label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet); + + application.SendNotification(); + application.Render(); + + strikethroughMapGet = label.GetProperty(DevelTextLabel::Property::STRIKETHROUGH); + DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION); + strikethroughMapSet.Clear(); strikethroughMapSet.Insert(Toolkit::DevelText::Strikethrough::Property::ENABLE, true); strikethroughMapSet.Insert(Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED); @@ -803,6 +818,24 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION); DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION); + // Check the transparent double underline property for coverage. + underlineMapSet.Clear(); + underlineMapSet.Insert("enable", true); + underlineMapSet.Insert("color", Color::TRANSPARENT); + underlineMapSet.Insert("height", 1); + underlineMapSet.Insert("type", Text::Underline::DOUBLE); + underlineMapSet.Insert("dashWidth", 2); + underlineMapSet.Insert("dashGap", 1); + + label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet); + + application.SendNotification(); + application.Render(); + + underlineMapGet = label.GetProperty(TextLabel::Property::UNDERLINE); + DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION); + underlineMapSet.Clear(); underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::ENABLE, true); underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN); @@ -931,6 +964,19 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS(backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION); DALI_TEST_EQUALS(DaliTestCheckMaps(backgroundMapGet, backgroundMapSet), true, TEST_LOCATION); + // Check the transparent background property for coverage + backgroundMapSet.Clear(); + backgroundMapSet["enable"] = true; + backgroundMapSet["color"] = Color::TRANSPARENT; + label.SetProperty(DevelTextLabel::Property::BACKGROUND, backgroundMapSet); + + application.SendNotification(); + application.Render(); + + backgroundMapGet = label.GetProperty(DevelTextLabel::Property::BACKGROUND); + DALI_TEST_EQUALS(backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(DaliTestCheckMaps(backgroundMapGet, backgroundMapSet), true, TEST_LOCATION); + backgroundMapSet.Clear(); backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true; backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN; @@ -1094,6 +1140,7 @@ int UtcDaliToolkitTextLabelEmojisP(void) // EMOJI Sequences case for coverage. std::string emojiSequences = + "Glyphs not included in the font \n" //case for coverage when glyph is not included in the font "Text VS15 ☪︎\n" //text presentation sequence and selector "Color VS16 ☪️\n" //emoji presentation sequence and selector "Default ☪ \n" //default presentation @@ -2041,6 +2088,13 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void) // 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(std::numeric_limits::max()); + label.SetProperty(Actor::Property::SIZE, Vector2(max_value, 30.0f)); + application.SendNotification(); + application.Render(); + + END_TEST; } @@ -2525,8 +2579,53 @@ int utcDaliTextLabelGeometryGlyphMiddle(void) Vector expectedSizes; Vector expectedPositions; - expectedPositions.PushBack(Vector2(12, 0)); - expectedSizes.PushBack(Vector2(118, 25)); + expectedPositions.PushBack(Vector2(6, 0)); + expectedSizes.PushBack(Vector2(124, 25)); + + TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + + END_TEST; +} + +int utcDaliTextLabelGeometryOneGlyph(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextLabelGeometryOneGlyph "); + + 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, "H"); + + // 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 = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex); + Vector sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + Vector expectedSizes; + Vector expectedPositions; + + expectedPositions.PushBack(Vector2(-2, 0)); + expectedSizes.PushBack(Vector2(16, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -2679,7 +2778,7 @@ int UtcDaliToolkitTextLabelMarkupRelativeLineHeight(void) //no effect of relative line size for paragraph with single line DALI_TEST_EQUALS(naturalSize.y, relativeSingleNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); - DALI_TEST_EQUALS(lineSize*8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(lineSize * 8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); END_TEST; }