X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextLabel.cpp;h=1aecd89f92fb84afb179f4990f635e461cdf9f72;hb=3b147431173dca18392a6e9b724c50a54822004f;hp=424521795a13cbb23e9060c1595df482c4c7725a;hpb=9d379104c45c7979f7dcd1ef2f9df84e8cc902c1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 4245217..1aecd89 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1508,6 +1508,44 @@ int UtcDaliToolkitTextlabelScrollingN(void) const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get(); DALI_TEST_CHECK(!enabled); + label.SetProperty(TextLabel::Property::MULTI_LINE, false); + label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 1); + label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 9999.0f); + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true); + + try + { + // Render the text. + application.SendNotification(); + application.Render(1000); + + application.GetScene().Remove(label); + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(!label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true); + application.GetScene().Add(label); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + + label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, (Toolkit::TextLabel::AutoScrollStopMode::Type)2); // invalid type + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + } + catch(...) + { + tet_result(TET_FAIL); + } + END_TEST; } @@ -1999,6 +2037,47 @@ int UtcDaliToolkitTextlabelTextFit(void) END_TEST; } +int UtcDaliToolkitTextlabelTextFitStressTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelTextFitStressTest"); + TextLabel label = TextLabel::New(); + Vector2 size(460.0f, 100.0f); + label.SetProperty(Actor::Property::SIZE, size); + label.SetProperty(TextLabel::Property::TEXT, "Hello world"); + + // connect to the text git changed signal. + ConnectionTracker* testTracker = new ConnectionTracker(); + DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback); + bool textFitChangedSignal = false; + label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal)); + gTextFitChangedCallBackCalled = false; + + // check point size with veryvery big range + Property::Map textFitMapSet; + textFitMapSet["enable"] = true; + textFitMapSet["minSize"] = 10.f; + textFitMapSet["maxSize"] = 10000.f; + textFitMapSet["stepSize"] = -1.0f; + textFitMapSet["fontSizeType"] = "pointSize"; + + label.SetProperty(Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet); + label.SetProperty(TextLabel::Property::POINT_SIZE, 120.f); + + application.GetScene().Add(label); + + application.SendNotification(); + application.Render(); + + const Vector3 EXPECTED_NATURAL_SIZE(450.0f, 96.0f, 0.0f); + DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION); + + DALI_TEST_CHECK(gTextFitChangedCallBackCalled); + DALI_TEST_CHECK(textFitChangedSignal); + + END_TEST; +} + int UtcDaliToolkitTextlabelMaxTextureSet(void) { ToolkitTestApplication application; @@ -2099,7 +2178,6 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void) application.SendNotification(); application.Render(); - END_TEST; } @@ -2634,10 +2712,20 @@ int utcDaliTextLabelGeometryOneGlyph(void) TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + positionsList.Clear(); + sizeList.Clear(); + + startIndex = 2; + endIndex = 0; + + positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex); + sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex); + + TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + END_TEST; } - int utcDaliTextLabelGeometryNullPtr(void) { ToolkitTestApplication application; @@ -2991,4 +3079,38 @@ int UtcDaliToolkitTextlabelParagraphTag(void) application.Render(); END_TEST; +} + +int utcDaliTextLabelGetTextBoundingRectangle(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextLabelGeometryEllipsisMiddle"); + + 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(100.f, 50.f)); + label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + label.SetProperty(TextLabel::Property::TEXT, "Hello this is the Text Bounding Rectangle TC"); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + // Render and notify + application.SendNotification(); + application.Render(); + + unsigned int startIndex = 0; + unsigned int endIndex = 15; + + Rect<> textBoundingRectangle = DevelTextLabel::GetTextBoundingRectangle(label, startIndex, endIndex); + Rect<> expectedTextBoundingRectangle = {0, 0, 100, 25}; + + TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle); + + END_TEST; } \ No newline at end of file