- // Create layout info for the input group of words.
- Toolkit::Internal::TextView::RelayoutData relayoutData;
- TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray inputStyledText;
- MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
-
- TextViewProcessor::CreateTextInfo( inputStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData );
-
- // Get the input group of words
- TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
-
- if( !inputLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the first part of the result (after split the group of words)
-
- Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
- TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray firstResultStyledText;
- MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( firstResultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- firstRelayoutData );
-
- // Get the first result group of words
- TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
-
- if( !firstResultLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the last part of the result (after split the group of words)
-
- Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
- TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray lastResultStyledText;
- MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( lastResultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- lastRelayoutData );
-
- // Get the last result group of words
- TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
-
- if( !lastResultLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Split the group of words.
-
- TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
-
- TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
- SplitWordGroup( indices,
- inputWordGroupLayout,
- lastWordGroupLayoutInfo );
-
- // Test results
- if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- return true;
-}
-
-/**
- * Splits the \e input line in two by the given \e groupPosition, \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
- *
- * If the test fails it prints a short description and the line where this function was called.
- *
- * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
- * @param input The input word.
- * @param groupPosition Index to the group of words within the line where to split the line.
- * @param wordPosition Index to the word within the group where to split the group.
- * @param position Where to split the word.
- * @param lineHeightOffset Offset between lines.
- * @param firstResult First part of the split line.
- * @param lastResult Last part of the split line.
- * @param location Where this function has been called.
- *
- * @return \e true if the experiment is successful. Otherwise returns \e false.
- */
-bool TestSplitLine( const std::string& description,
- const std::string& input,
- const size_t groupPosition,
- const size_t wordPosition,
- const size_t position,
- const float lineHeightOffset,
- const std::string& firstResult,
- const std::string& lastResult,
- const char* location )
-{
- tet_printf( "%s", description.c_str() );
-
- // Create layout info for the input line.