X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-TextView-Relayout-Utilities.cpp;h=3bf0a462d3012186e825caa526a9c826cbcb608d;hp=12463a2ab6c82feb1bbb91e9fbf14642d34c587f;hb=49499a0b6e23d98f681f7aefe6b18c5dad55f8b3;hpb=64485a966f60d59a33610e3439703dc7e7c19c32
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp
index 12463a2..3bf0a46 100644
--- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp
+++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp
@@ -54,14 +54,14 @@ bool TestEqual( float x, float y )
//////////////////////////////////////////////////////////////////
-struct CalculateSubLineLayoutTest
+struct CalculateLineLayoutTest
{
std::string description;
- std::string inputLine;
+ std::string inputParagraph;
float parentWidth;
std::size_t wordIndex;
std::size_t characterIndex;
- std::size_t characterLineIndex;
+ std::size_t characterParagraphIndex;
TextViewRelayout::HorizontalWrapType splitPolicy;
float shrinkFactor;
@@ -70,13 +70,13 @@ struct CalculateSubLineLayoutTest
float resultMaxAscender;
};
-bool TestCalculateSubLineLayout( const CalculateSubLineLayoutTest& test, const char* location )
+bool TestCalculateLineLayout( const CalculateLineLayoutTest& test, const char* location )
{
tet_printf( "%s", test.description.c_str() );
// Create styled text.
MarkupProcessor::StyledTextArray inputStyledText;
- MarkupProcessor::GetStyledTextArray( test.inputLine, inputStyledText, true );
+ MarkupProcessor::GetStyledTextArray( test.inputParagraph, inputStyledText, true );
// Create styled text layout info.
Toolkit::Internal::TextView::RelayoutData relayoutData;
@@ -88,24 +88,25 @@ bool TestCalculateSubLineLayout( const CalculateSubLineLayoutTest& test, const
// Creaqte indices.
TextViewProcessor::TextInfoIndices indices( 0u, test.wordIndex, test.characterIndex );
+ indices.mCharacterParagraphIndex = test.characterParagraphIndex;
- // Get the input line.
- TextViewProcessor::LineLayoutInfo inputLineLayout;
+ // Get the input paragraph.
+ TextViewProcessor::ParagraphLayoutInfo inputParagraphLayout;
- if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
+ if( !relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.empty() )
{
- inputLineLayout = *relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin();
+ inputParagraphLayout = *relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.begin();
}
// Result struct.
- TextViewRelayout::SubLineLayoutInfo resultLayoutInfo;
+ TextViewRelayout::LineLayoutInfo resultLayoutInfo;
- CalculateSubLineLayout( test.parentWidth,
- indices,
- inputLineLayout,
- test.splitPolicy,
- test.shrinkFactor,
- resultLayoutInfo );
+ CalculateLineLayout( test.parentWidth,
+ indices,
+ inputParagraphLayout,
+ test.splitPolicy,
+ test.shrinkFactor,
+ resultLayoutInfo );
// Check results.
if( !TestEqual( test.resultLineLength, resultLayoutInfo.mLineLength ) )
@@ -235,17 +236,17 @@ int UtcDaliTextViewDefaultConstructorDestructor_RU(void)
TextViewRelayout::RelayoutParameters relayoutParameters;
DALI_TEST_EQUALS( relayoutParameters.mPositionOffset, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( relayoutParameters.mLineSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mParagraphSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mWordSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mCharacterSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( relayoutParameters.mIndices.mLineIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mParagraphIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mIndices.mWordIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mIndices.mCharacterIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mCharacterGlobalIndex, 0u, TEST_LOCATION );
DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacter );
DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacterOfWord );
DALI_TEST_CHECK( !relayoutParameters.mIsNewLine );
- DALI_TEST_CHECK( !relayoutParameters.mIsNewLineCharacter );
+ DALI_TEST_CHECK( !relayoutParameters.mIsNewParagraphCharacter );
DALI_TEST_CHECK( !relayoutParameters.mIsWhiteSpace );
DALI_TEST_CHECK( !relayoutParameters.mIsVisible );
@@ -306,27 +307,27 @@ int UtcDaliTextViewDefaultConstructorDestructor_RU(void)
DALI_TEST_EQUALS( textUnderlineStatus.mLineGlobalIndex, 0u, TEST_LOCATION );
DALI_TEST_CHECK( !textUnderlineStatus.mCurrentUnderlineStatus );
- // Test SubLineLayoutInfo defaults
- TextViewRelayout::SubLineLayoutInfo subLineLayoutInfo;
+ // Test LineLayoutInfo defaults
+ TextViewRelayout::LineLayoutInfo lineLayoutInfo;
- DALI_TEST_EQUALS( subLineLayoutInfo.mLineLength, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( subLineLayoutInfo.mMaxCharHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( subLineLayoutInfo.mMaxAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mLineLength, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mMaxCharHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mMaxAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
END_TEST;
}
-int UtcDaliTextViewCalculateSubLineLayout(void)
+int UtcDaliTextViewCalculateLineLayout(void)
{
ToolkitTestApplication application;
- tet_infoline("UtcDaliTextViewCalculateSubLineLayout : ");
+ tet_infoline("UtcDaliTextViewCalculateLineLayout : ");
- struct CalculateSubLineLayoutTest calculateSubLineLayoutTest[] =
+ struct CalculateLineLayoutTest calculateLineLayoutTest[] =
{
//WrapByCharacter
{
- "The line is wraped by character. All characters have the same size.",
- "Hello world", // input line
+ "The paragraph is wraped by character. All characters have the same size.",
+ "Hello world", // input paragraph
100.f, // parent width
0, // indices
0,
@@ -339,8 +340,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by character. There are characters with different sizes.",
- "Hello world", // input line
+ "The paragraph is wraped by character. There are characters with different sizes.",
+ "Hello world", // input paragraph
100.f, // parent width
0, // indices
0,
@@ -353,8 +354,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
11.949220f // max ascender
},
{
- "The line is wraped by character. There are characters with different sizes. It calculates the layout for the second line.",
- "Hello world hello world", // input line
+ "The paragraph is wraped by character. There are characters with different sizes. It calculates the layout for the second line.",
+ "Hello world hello world", // input paragraph
100.f, // parent width
2, // indices. The third character of the third word starts in a new line.
2,
@@ -367,8 +368,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by character. There are characters with different sizes. It calculates the layout for the third line.",
- "Hello world hello world", // input line
+ "The paragraph is wraped by character. There are characters with different sizes. It calculates the layout for the third line.",
+ "Hello world hello world", // input paragraph
100.f, // parent width
4, // indices. The fifth character of the fifth word starts in a new line.
4,
@@ -383,8 +384,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
//WrapByWord
{
- "The line is wraped by word. All characters have the same size.",
- "Hello world", // input line
+ "The paragraph is wraped by word. All characters have the same size.",
+ "Hello world", // input paragraph
100.f, // parent width
0, // indices. It shouldn't use the index character so 9999999 shouldn't make it crash.
9999999,
@@ -397,8 +398,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by word. There are characters with different sizes.",
- "Hello world", // input line
+ "The paragraph is wraped by word. There are characters with different sizes.",
+ "Hello world", // input paragraph
100.f, // parent width
0, // indices.
0,
@@ -411,8 +412,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
11.949220f // max ascender
},
{
- "The line is wraped by word. There are characters with different sizes. It calculates the layout for the second line.",
- "Hello world hello world", // input line
+ "The paragraph is wraped by word. There are characters with different sizes. It calculates the layout for the second line.",
+ "Hello world hello world", // input paragraph
100.f, // parent width
2, // indices. The third word starts in a new line.
0,
@@ -425,8 +426,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
11.949220f // max ascender
},
{
- "The line is wraped by word. The word doen't fit.",
- "Hello world", // input line
+ "The paragraph is wraped by word. The word doen't fit.",
+ "Hello world", // input paragraph
40.f, // parent width
0, // indices. The third word starts in a new line.
0,
@@ -441,8 +442,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
//WrapByWordAndSplit
{
- "The line is wraped by word and by character. All characters have the same size. There is not a long word.",
- "Hello world hello world", // input line
+ "The paragraph is wraped by word and by character. All characters have the same size. There is not a long word.",
+ "Hello world hello world", // input paragraph
100.f, // parent width
0, // indices.
0,
@@ -455,8 +456,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by word and by character. All characters have the same size. There is a long word.",
- "Helloooooooo world", // input line
+ "The paragraph is wraped by word and by character. All characters have the same size. There is a long word.",
+ "Helloooooooo world", // input paragraph
100.f, // parent width
0, // indices.
0,
@@ -469,8 +470,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by word and by character. There are characters with different sizes. There is a long word. It calculates the layout for the second line.",
- "Helloooooooo world", // input line
+ "The paragraph is wraped by word and by character. There are characters with different sizes. There is a long word. It calculates the layout for the second line.",
+ "Helloooooooo world", // input paragraph
100.f, // parent width
0, // indices.
8,
@@ -483,8 +484,8 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by word and by character. There are characters with different sizes. There is a shrink factor.",
- "Helloooooooo world", // input line
+ "The paragraph is wraped by word and by character. There are characters with different sizes. There is a shrink factor.",
+ "Helloooooooo world", // input paragraph
100.f, // parent width
0, // indices.
8,
@@ -497,15 +498,15 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
7.169531f // max ascender
},
- //WrapByLineAndSplit
+ //WrapByParagraphCharacterAndSplit
{
- "The line is wraped by end of line and by character. All characters have the same size.",
- "Hello world", // input line
+ "The paragraph is wraped by end of paragraph and by character. All characters have the same size.",
+ "Hello world", // input paragraph
100.f, // parent width
0, // indices
0,
0,
- TextViewRelayout::WrapByLineAndSplit, // split policy
+ TextViewRelayout::WrapByParagraphCharacterAndSplit, // split policy
1.f,
// results
91.041672f, // line length. (only fits 8 characters 8x11.38)
@@ -513,13 +514,13 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line fits in the width.",
- "Hello", // input line
+ "The paragraph fits in the width.",
+ "Hello", // input paragraph
100.f, // parent width
0, // indices
0,
0,
- TextViewRelayout::WrapByLineAndSplit, // split policy
+ TextViewRelayout::WrapByParagraphCharacterAndSplit, // split policy
1.f,
// results
56.901047f, // line length. (only fits 5 characters 5x11.38)
@@ -527,13 +528,13 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
10.242188f // max ascender
},
{
- "The line is wraped by end of line and by character. All characters have the same size. It calculates the layout for the second line.",
- "Hello world, hello world", // input line
+ "The paragraph is wraped by end of paragraph and by character. All characters have the same size. It calculates the layout for the second line.",
+ "Hello world, hello world", // input paragraph
100.f, // parent width
2, // indices
2,
8,
- TextViewRelayout::WrapByLineAndSplit, // split policy
+ TextViewRelayout::WrapByParagraphCharacterAndSplit, // split policy
1.f,
// results
91.041672f, // line length. (only fits 8 characters 8x11.38)
@@ -545,9 +546,9 @@ int UtcDaliTextViewCalculateSubLineLayout(void)
for( std::size_t index = 0; index < numberOfTests; ++index )
{
- const CalculateSubLineLayoutTest& test = calculateSubLineLayoutTest[index];
+ const CalculateLineLayoutTest& test = calculateLineLayoutTest[index];
- if( !TestCalculateSubLineLayout( test, TEST_LOCATION ) )
+ if( !TestCalculateLineLayout( test, TEST_LOCATION ) )
{
tet_result( TET_FAIL );
}
@@ -800,8 +801,8 @@ int UtcDaliTextViewMiscelaneousAsserts(void)
}
catch( Dali::DaliException& e )
{
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong horizontal text alignment. Did you set a vertical one?\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_EQUALS( e.condition, "!\"TextViewRelayout::CalculateXoffset: Wrong horizontal text alignment. Did you set a vertical one?\"", TEST_LOCATION );
assert1 = true;
}
catch( ... )
@@ -816,8 +817,8 @@ int UtcDaliTextViewMiscelaneousAsserts(void)
}
catch( Dali::DaliException& e )
{
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong vertical text alignment. Did you set an horizontal one?\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_EQUALS( e.condition, "!\"TextViewRelayout::CalculateXoffset: Wrong vertical text alignment. Did you set an horizontal one?\"", TEST_LOCATION );
assert2 = true;
}
catch( ... )