X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-TextLabel-internal.cpp;h=2bd7df1f020c868ab0159b07e7e055c35d484e80;hb=e6c8fad2c1ee24ce368976221941dfec12290b29;hp=dd460f29c3f6426e4025c88623cd49fb5635ea8a;hpb=cee2831414bee408f07923a17cad74671c14d180;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextLabel-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextLabel-internal.cpp index dd460f2..2bd7df1 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextLabel-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextLabel-internal.cpp @@ -561,6 +561,76 @@ int UtcDaliTextLabelMarkupNestedUnderlineTags(void) END_TEST; } +int UtcDaliTextLabelMarkupSpanStrikethrough(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextLabelMarkupSpanStrikethrough "); + + TextLabel textLabel = TextLabel::New(); + + application.GetScene().Add(textLabel); + + std::string testText = + "startABC1then" + "ABC2then" + "ABC3end"; + + textLabel.SetProperty(TextLabel::Property::TEXT, testText); + textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true); + + application.SendNotification(); + application.Render(); + + const uint32_t expectedNumberOfStrikethroughRuns = 2u; + + Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel); + const Text::Length numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns(); + + DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughRuns, TEST_LOCATION); + + Vector strikethroughRuns; + strikethroughRuns.Resize(numberOfStrikethroughRuns); + textLabelImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns); + + struct DataOfCase + { + std::string title; + GlyphIndex glyphIndex; + Length numberOfGlyphs; + StrikethroughStyleProperties properties; + }; + DataOfCase data[] = + { + + {"ABC2then", + 13u, + 4u, + {Color::BLUE, + 0u, + true, + false}}, + + {"ABC3", + 21u, + 4u, + {Color::GREEN, + 0u, + true, + false}}, + + }; + + for(uint32_t i = 0; i < expectedNumberOfStrikethroughRuns; i++) + { + tet_infoline(data[i].title.c_str()); + DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION); + DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION); + DALI_TEST_CHECK(data[i].properties == strikethroughRuns[i].properties); + } + + END_TEST; +} + int UtcDaliTextLabelBackgroundTag(void) { ToolkitTestApplication application; @@ -592,6 +662,37 @@ int UtcDaliTextLabelBackgroundTag(void) END_TEST; } +int UtcDaliTextLabelSpanBackgroundTag(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextLabelSpanBackgroundTag\n"); + + TextLabel label = TextLabel::New(); + DALI_TEST_CHECK(label); + + label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true); + label.SetProperty(TextLabel::Property::TEXT, "He World"); + application.GetScene().Add(label); + application.SendNotification(); + application.Render(); + + Toolkit::Internal::TextLabel& labelImpl = GetImpl(label); + const ColorIndex* const backgroundColorIndicesBuffer = labelImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices(); + + DALI_TEST_CHECK(backgroundColorIndicesBuffer); + + //default color + DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION); + + //red color + DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION); + + //yellow color + DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION); + + END_TEST; +} + int UtcDaliToolkitTextlabelEllipsisInternalAPIs(void) { ToolkitTestApplication application; @@ -739,18 +840,18 @@ int UtcDaliTextLabelMarkupStrikethrough(void) //ABC have strikethrough DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION); DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.numberOfGlyphs, 3u, TEST_LOCATION); - DALI_TEST_CHECK(strikethroughRuns[0u].isColorSet); - DALI_TEST_EQUALS(strikethroughRuns[0u].color.r, 1u, TEST_LOCATION); - DALI_TEST_EQUALS(strikethroughRuns[0u].color.g, 0u, TEST_LOCATION); - DALI_TEST_EQUALS(strikethroughRuns[0u].color.b, 0u, TEST_LOCATION); + DALI_TEST_CHECK(strikethroughRuns[0u].properties.colorDefined); + DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.r, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.g, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.b, 0u, TEST_LOCATION); //GH have strikethrough DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.glyphIndex, 5u, TEST_LOCATION); DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.numberOfGlyphs, 2u, TEST_LOCATION); - DALI_TEST_CHECK(strikethroughRuns[1u].isColorSet); - DALI_TEST_EQUALS(strikethroughRuns[1u].color.r, 0u, TEST_LOCATION); - DALI_TEST_EQUALS(strikethroughRuns[1u].color.g, 1u, TEST_LOCATION); - DALI_TEST_EQUALS(strikethroughRuns[1u].color.b, 0u, TEST_LOCATION); + DALI_TEST_CHECK(strikethroughRuns[1u].properties.colorDefined); + DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.r, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.g, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.b, 0u, TEST_LOCATION); END_TEST; }