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-TextView.cpp;h=5569d96520f43498657195cdf4d57941dab3a6d4;hp=705b2f47ae2135e9bbe15ed490f265d4e51dc9cc;hb=e58197b2ce320f167a24865cdd048f0cc0c05e45;hpb=d57dd5d306bcfaee778dcb6c00e24465f0f4f5de diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp index 705b2f4..5569d96 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include #include @@ -46,10 +47,7 @@ const char* const PROPERTY_MULTILINE_POLICY = "multiline-policy"; const char* const PROPERTY_WIDTH_EXCEED_POLICY = "width-exceed-policy"; const char* const PROPERTY_HEIGHT_EXCEED_POLICY = "height-exceed-policy"; const char* const PROPERTY_LINE_JUSTIFICATION = "line-justification"; -const char* const PROPERTY_FADE_BOUNDARY_LEFT = "fade-boundary-left"; -const char* const PROPERTY_FADE_BOUNDARY_RIGHT = "fade-boundary-right"; -const char* const PROPERTY_FADE_BOUNDARY_TOP = "fade-boundary-top"; -const char* const PROPERTY_FADE_BOUNDARY_BOTTOM = "fade-boundary-bottom"; +const char* const PROPERTY_FADE_BOUNDARY = "fade-boundary"; const char* const PROPERTY_LINE_HEIGHT_OFFSET = "line-height-offset"; const char* const PROPERTY_HORIZONTAL_ALIGNMENT = "horizontal-alignment"; const char* const PROPERTY_VERTICAL_ALIGNMENT = "vertical-alignment"; @@ -235,13 +233,15 @@ int UtcDaliTextViewSetAndGetText(void) ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK( registry ); - gNumberObjectCreated = 0; + gNumberObjectCreated = 0u; registry.ObjectCreatedSignal().Connect(&TestCallback); // Following string should create three text-actors ([Hel], [lo wo] and [rld]). std::string text( "Hello world!\n" "\n" ); + view.SetMarkupProcessingEnabled( true ); // Enables markup processing. + Stage::GetCurrent().Add( view ); view.SetText( text ); @@ -486,6 +486,7 @@ int UtcDaliTextViewTestLayoutOptions02(void) TextView textView = TextView::New(); textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering. + textView.SetMarkupProcessingEnabled( true ); // Enables markup processing. Stage::GetCurrent().Add( textView ); @@ -625,7 +626,9 @@ int UtcDaliTextViewSnapshotEnable(void) // Avoids the frame buffer texture to throw an exception. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TextView view = TextView::New( "Hello world! This is a snapshot test." ); + TextView view = TextView::New(); + view.SetMarkupProcessingEnabled( true ); // Enables markup processing. + view.SetText( "Hello world! This is a snapshot test." ); Stage::GetCurrent().Add( view ); @@ -745,25 +748,13 @@ int UtcDaliTextViewSetProperty(void) DALI_TEST_CHECK( Toolkit::TextView::Justified == view.GetLineJustification() ); //Test fade boundary property - unsigned int testValue = 23; - PixelSize leftFadeBoundary(testValue); - view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_LEFT), testValue); - DALI_TEST_CHECK( leftFadeBoundary == view.GetFadeBoundary().mLeft ); - - testValue = 26; - PixelSize rightFadeBoundary(testValue); - view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_RIGHT), testValue); - DALI_TEST_CHECK( rightFadeBoundary == view.GetFadeBoundary().mRight ); - - testValue = 2; - PixelSize topFadeBoundary(testValue); - view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_TOP), testValue); - DALI_TEST_CHECK( topFadeBoundary == view.GetFadeBoundary().mTop ); - - testValue = 11; - PixelSize bottomFadeBoundary(testValue); - view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_BOTTOM), testValue); - DALI_TEST_CHECK( bottomFadeBoundary == view.GetFadeBoundary().mBottom ); + const Vector4 testValue( 23.f, 26.f, 2.f, 11.f ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY), testValue); + DALI_TEST_CHECK( testValue.x == view.GetFadeBoundary().mLeft ); + DALI_TEST_CHECK( testValue.y == view.GetFadeBoundary().mRight ); + DALI_TEST_CHECK( testValue.z == view.GetFadeBoundary().mTop ); + DALI_TEST_CHECK( testValue.w == view.GetFadeBoundary().mBottom ); //Test Line height offset property float testOffsetValue = 14.04f; @@ -800,8 +791,10 @@ int UtcDaliTextViewUnderlineText(void) tet_infoline("UtcDaliTextViewUnderlineText: "); ToolkitTestApplication application; - TextView textView = TextView::New( "gggggggggggggg" ); + TextView textView = TextView::New(); textView.SetSnapshotModeEnabled( false ); + textView.SetMarkupProcessingEnabled( true ); + textView.SetText( "gggggggggggggg" ); textView.SetSize( 150.f, 100.f );