2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali-toolkit/dali-toolkit.h>
23 // Internal headers are allowed here
24 #include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
25 #include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
26 #include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
27 #include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
28 #include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
31 using namespace Dali::Toolkit;
32 using namespace Dali::Toolkit::Internal;
34 void dali_text_view_startup(void)
36 test_return_value = TET_UNDEF;
39 void dali_text_view_cleanup(void)
41 test_return_value = TET_PASS;
48 const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
49 const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
51 // Data structures used to create an 'experiment' in TET cases
55 std::string description;
58 std::string firstResult;
59 std::string lastResult;
62 struct SplitWordGroupTest
64 std::string description;
66 std::size_t wordPosition;
68 std::string firstResult;
69 std::string lastResult;
74 std::string description;
76 std::size_t groupPosition;
77 std::size_t wordPosition;
79 float lineHeightOffset;
80 std::string firstResult;
81 std::string lastResult;
86 std::string description;
87 std::string inputFirst;
88 std::string inputLast;
92 struct MergeWordGroupsTest
94 std::string description;
95 std::string inputFirst;
96 std::string inputLast;
100 struct MergeLinesTest
102 std::string description;
103 std::string inputFirst;
104 std::string inputLast;
105 float lineHeightOffset;
109 struct RemoveCharactersFromWordTest
111 std::string description;
113 std::size_t position;
114 std::size_t numberOfCharacters;
118 struct RemoveWordsFromGroupTest
120 std::string description;
122 std::size_t wordIndex;
123 std::size_t numberOfWords;
127 struct RemoveGroupsFromLineTest
129 std::string description;
131 std::size_t groupIndex;
132 std::size_t numberOfGroups;
133 float lineHeightOffset;
137 enum UpdateTextInfoOperation
144 struct UpdateTextInfoTest
146 std::string description;
147 UpdateTextInfoOperation operation;
149 std::size_t position;
150 std::size_t numberOfCharacters;
151 std::string inputText;
152 float lineHeightOffset;
156 // Useful Print functions when something goes wrong.
158 void Print( const TextViewProcessor::CharacterLayoutInfo& character )
160 std::cout << " height : " << character.mHeight << std::endl;
161 std::cout << " advance : " << character.mAdvance << std::endl;
162 std::cout << " bearing : " << character.mBearing << std::endl;
163 std::cout << " mPosition : " << character.mPosition << std::endl;
164 std::cout << " mSize : " << character.mSize << std::endl;
165 std::cout << " mAscender : " << character.mAscender << std::endl;
167 TextActor textActor = TextActor::DownCast( character.mGlyphActor );
170 std::cout << "[" << textActor.GetText() << "]";
174 std::cout << "{" << character.mStyledText.mText.GetText() << "}";
178 void Print( const TextViewProcessor::WordLayoutInfo& word )
181 std::cout << " mSize : " << word.mSize << std::endl;
182 std::cout << " mAscender : " << word.mAscender << std::endl;
183 std::cout << " mType : " << word.mType << std::endl;
184 std::cout << "mNumberOfCharacters : " << word.mCharactersLayoutInfo.size() << std::endl;
186 for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it )
190 std::cout << "]"; std::cout << std::endl;
191 std::cout << "]"; std::cout << std::endl;
194 void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup )
197 std::cout << " mSize : " << wordGroup.mSize << std::endl;
198 std::cout << " mAscender : " << wordGroup.mAscender << std::endl;
199 std::cout << " mDirection : " << wordGroup.mDirection << std::endl;
200 std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl;
201 for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it )
205 std::cout << ")"; std::cout << std::endl;
208 void Print( const TextViewProcessor::LineLayoutInfo& line )
211 std::cout << " mSize : " << line.mSize << std::endl;
212 std::cout << " mAscender : " << line.mAscender << std::endl;
213 std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl;
214 for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it )
218 std::cout << ">" << std::endl;
221 void Print( const TextViewProcessor::TextLayoutInfo& text )
224 for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it = text.mLinesLayoutInfo.begin(), endIt = text.mLinesLayoutInfo.end(); it != endIt; ++it )
228 std::cout << "||" << std::endl;
231 void Print( const TextStyle& style )
233 std::cout << " font name : " << style.GetFontName() << std::endl;
234 std::cout << " : " << style.GetFontStyle() << std::endl;
235 std::cout << " : " << style.GetFontPointSize() << std::endl;
236 std::cout << " : " << style.GetWeight() << std::endl;
237 std::cout << " : " << style.GetTextColor() << std::endl;
238 std::cout << " : " << style.GetItalics() << std::endl;
239 std::cout << " : " << style.GetUnderline() << std::endl;
240 std::cout << " : " << style.GetShadow() << std::endl;
241 std::cout << " : " << style.GetShadowColor() << std::endl;
242 std::cout << " : " << style.GetShadowOffset() << std::endl;
243 std::cout << " : " << style.GetGlow() << std::endl;
244 std::cout << " : " << style.GetGlowColor() << std::endl;
245 std::cout << " : " << style.GetGlowIntensity() << std::endl;
246 std::cout << " : " << style.GetSmoothEdge() << std::endl;
247 std::cout << " : " << style.GetOutline() << std::endl;
248 std::cout << " : " << style.GetOutlineThickness() << std::endl;
251 // Test functions used to check if two data structures are equal.
253 bool TestEqual( float x, float y )
255 return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
258 bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1,
259 const TextViewProcessor::CharacterLayoutInfo& character2 )
261 if( !TestEqual( character1.mHeight, character2.mHeight ) )
265 if( !TestEqual( character1.mAdvance, character2.mAdvance ) )
269 if( !TestEqual( character1.mBearing, character2.mBearing ) )
274 if( !TestEqual( character1.mPosition.x, character2.mPosition.x ) )
278 if( !TestEqual( character1.mPosition.y, character2.mPosition.y ) )
283 if( !TestEqual( character1.mSize.x, character2.mSize.x ) )
287 if( !TestEqual( character1.mSize.y, character2.mSize.y ) )
292 if( !TestEqual( character1.mAscender, character2.mAscender ) )
297 if( character1.mGlyphActor && !character2.mGlyphActor )
302 if( !character1.mGlyphActor && character2.mGlyphActor )
312 TextActor textActor1 = TextActor::DownCast( character1.mGlyphActor );
313 TextActor textActor2 = TextActor::DownCast( character2.mGlyphActor );
316 text1 = textActor1.GetText();
317 style1 = textActor1.GetTextStyle();
319 text2 = textActor2.GetText();
320 style2 = textActor2.GetTextStyle();
328 if( style1 != style2 )
333 text1 = character1.mStyledText.mText.GetText();
334 style1 = character1.mStyledText.mStyle;
336 text2 = character2.mStyledText.mText.GetText();
337 style2 = character2.mStyledText.mStyle;
344 if( style1 != style2 )
352 bool TestEqual( const TextViewProcessor::WordLayoutInfo& word1,
353 const TextViewProcessor::WordLayoutInfo& word2 )
355 if( !TestEqual( word1.mSize.x, word2.mSize.x ) )
359 if( !TestEqual( word1.mSize.y, word2.mSize.y ) )
364 if( !TestEqual( word1.mAscender, word2.mAscender ) )
369 if( word1.mType != word2.mType )
374 if( word1.mCharactersLayoutInfo.size() != word2.mCharactersLayoutInfo.size() )
379 for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it1 = word1.mCharactersLayoutInfo.begin(), endIt1 = word1.mCharactersLayoutInfo.end(),
380 it2 = word2.mCharactersLayoutInfo.begin(), endIt2 = word2.mCharactersLayoutInfo.end();
381 ( it1 != endIt1 ) && ( it2 != endIt2 );
384 if( !TestEqual( *it1, *it2 ) )
393 bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1,
394 const TextViewProcessor::WordGroupLayoutInfo& group2 )
397 if( group1.mNumberOfCharacters != group2.mNumberOfCharacters )
402 if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() )
407 if( !TestEqual( group1.mSize.x, group2.mSize.x ) )
411 if( !TestEqual( group1.mSize.y, group2.mSize.y ) )
416 if( !TestEqual( group1.mAscender, group2.mAscender ) )
421 if( group1.mDirection != group2.mDirection )
426 for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(),
427 it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end();
428 ( it1 != endIt1 ) && ( it2 != endIt2 );
431 if( !TestEqual( *it1, *it2 ) )
440 bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1,
441 const TextViewProcessor::LineLayoutInfo& line2 )
443 if( !TestEqual( line1.mSize.x, line2.mSize.x ) )
447 if( !TestEqual( line1.mSize.y, line2.mSize.y ) )
452 if( !TestEqual( line1.mAscender, line2.mAscender ) )
457 if( line1.mNumberOfCharacters != line2.mNumberOfCharacters )
462 if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() )
467 for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(),
468 it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end();
469 ( it1 != endIt1 ) && ( it2 != endIt2 );
472 if( !TestEqual( *it1, *it2 ) )
481 bool TestEqual( const TextViewProcessor::TextLayoutInfo& text1,
482 const TextViewProcessor::TextLayoutInfo& text2 )
484 if( !TestEqual( text1.mWholeTextSize.x, text2.mWholeTextSize.x ) )
488 if( !TestEqual( text1.mWholeTextSize.y, text2.mWholeTextSize.y ) )
493 if( !TestEqual( text1.mMaxWordWidth, text2.mMaxWordWidth ) )
498 if( text1.mNumberOfCharacters != text2.mNumberOfCharacters )
503 if( text1.mLinesLayoutInfo.size() != text2.mLinesLayoutInfo.size() )
508 for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it1 = text1.mLinesLayoutInfo.begin(), endIt1 = text1.mLinesLayoutInfo.end(),
509 it2 = text2.mLinesLayoutInfo.begin(), endIt2 = text2.mLinesLayoutInfo.end();
510 ( it1 != endIt1 ) && ( it2 != endIt2 );
513 if( !TestEqual( *it1, *it2 ) )
523 * Splits the \e input word in two by the given \e position and checks the results with \e firstResult and \e lastResult.
525 * If the test fails it prints a short description and the line where this function was called.
527 * @param description Short description of the experiment. i.e. "Split the word from the beginning. (position 0)".
528 * @param input The input word.
529 * @param position Where to split the word.
530 * @param firstResult First part of the split word.
531 * @param lastResult Last part of the split word.
532 * @param location Where this function has been called.
534 * @return \e true if the experiment is successful. Otherwise returns \e false.
536 bool TestSplitWord( const std::string& description, const std::string& input, const size_t position, const std::string& firstResult, const std::string& lastResult, const char* location )
538 tet_printf( "%s", description.c_str() );
540 // Create layout info for the input word.
541 Toolkit::Internal::TextView::RelayoutData relayoutData;
542 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
544 MarkupProcessor::StyledTextArray inputStyledText;
545 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
547 TextViewProcessor::CreateTextInfo( inputStyledText,
548 DEFAULT_LAYOUT_PARAMETERS,
551 // Get the input word
552 TextViewProcessor::WordLayoutInfo inputWordLayout;
554 if( !inputLayout.mLinesLayoutInfo.empty() )
556 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
557 if( !line.mWordGroupsLayoutInfo.empty() )
559 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
560 if( !group.mWordsLayoutInfo.empty() )
562 inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
567 // Create layout info for the first part of the result (after split the word)
569 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
570 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
572 MarkupProcessor::StyledTextArray firstResultStyledText;
573 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
575 TextViewProcessor::CreateTextInfo( firstResultStyledText,
576 DEFAULT_LAYOUT_PARAMETERS,
579 // Get the first result word
580 TextViewProcessor::WordLayoutInfo firstResultWordLayout;
582 if( !firstResultLayout.mLinesLayoutInfo.empty() )
584 const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
585 if( !line.mWordGroupsLayoutInfo.empty() )
587 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
588 if( !group.mWordsLayoutInfo.empty() )
590 firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
595 // Create layout info for the last part of the result (after split the word)
597 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
598 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
600 MarkupProcessor::StyledTextArray lastResultStyledText;
601 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
603 TextViewProcessor::CreateTextInfo( lastResultStyledText,
604 DEFAULT_LAYOUT_PARAMETERS,
607 // Get the last result word
608 TextViewProcessor::WordLayoutInfo lastResultWordLayout;
610 if( !lastResultLayout.mLinesLayoutInfo.empty() )
612 const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
613 if( !line.mWordGroupsLayoutInfo.empty() )
615 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
616 if( !group.mWordsLayoutInfo.empty() )
618 lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
625 TextViewProcessor::WordLayoutInfo lastWordLayoutInfo;
629 lastWordLayoutInfo );
632 if( !TestEqual( inputWordLayout, firstResultWordLayout ) )
634 tet_printf( "Fail. different layout info. %s", location );
638 if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) )
640 tet_printf( "Fail. different layout info. %s", location );
648 * Splits the \e input group of words in two by the given \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
650 * If the test fails it prints a short description and the line where this function was called.
652 * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)".
653 * @param input The input word.
654 * @param wordPosition Index to the word within the group where to split the group.
655 * @param position Where to split the word.
656 * @param firstResult First part of the split group of words.
657 * @param lastResult Last part of the split group of words.
658 * @param location Where this function has been called.
660 * @return \e true if the experiment is successful. Otherwise returns \e false.
662 bool TestSplitWordGroup( const std::string& description,
663 const std::string& input,
664 const size_t wordPosition,
665 const size_t position,
666 const std::string& firstResult,
667 const std::string& lastResult,
668 const char* location )
670 tet_printf( "%s", description.c_str() );
672 // Create layout info for the input group of words.
673 Toolkit::Internal::TextView::RelayoutData relayoutData;
674 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
676 MarkupProcessor::StyledTextArray inputStyledText;
677 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
679 TextViewProcessor::CreateTextInfo( inputStyledText,
680 DEFAULT_LAYOUT_PARAMETERS,
683 // Get the input group of words
684 TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
686 if( !inputLayout.mLinesLayoutInfo.empty() )
688 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
689 if( !line.mWordGroupsLayoutInfo.empty() )
691 inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
695 // Create layout info for the first part of the result (after split the group of words)
697 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
698 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
700 MarkupProcessor::StyledTextArray firstResultStyledText;
701 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
703 TextViewProcessor::CreateTextInfo( firstResultStyledText,
704 DEFAULT_LAYOUT_PARAMETERS,
707 // Get the first result group of words
708 TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
710 if( !firstResultLayout.mLinesLayoutInfo.empty() )
712 const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
713 if( !line.mWordGroupsLayoutInfo.empty() )
715 firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
719 // Create layout info for the last part of the result (after split the group of words)
721 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
722 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
724 MarkupProcessor::StyledTextArray lastResultStyledText;
725 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
727 TextViewProcessor::CreateTextInfo( lastResultStyledText,
728 DEFAULT_LAYOUT_PARAMETERS,
731 // Get the last result group of words
732 TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
734 if( !lastResultLayout.mLinesLayoutInfo.empty() )
736 const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
737 if( !line.mWordGroupsLayoutInfo.empty() )
739 lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
743 // Split the group of words.
745 TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
747 TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
748 SplitWordGroup( indices,
749 inputWordGroupLayout,
750 lastWordGroupLayoutInfo );
753 if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
755 tet_printf( "Fail. different layout info. %s", location );
759 if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
761 tet_printf( "Fail. different layout info. %s", location );
769 * 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.
771 * If the test fails it prints a short description and the line where this function was called.
773 * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
774 * @param input The input word.
775 * @param groupPosition Index to the group of words within the line where to split the line.
776 * @param wordPosition Index to the word within the group where to split the group.
777 * @param position Where to split the word.
778 * @param lineHeightOffset Offset between lines.
779 * @param firstResult First part of the split line.
780 * @param lastResult Last part of the split line.
781 * @param location Where this function has been called.
783 * @return \e true if the experiment is successful. Otherwise returns \e false.
785 bool TestSplitLine( const std::string& description,
786 const std::string& input,
787 const size_t groupPosition,
788 const size_t wordPosition,
789 const size_t position,
790 const float lineHeightOffset,
791 const std::string& firstResult,
792 const std::string& lastResult,
793 const char* location )
795 tet_printf( "%s", description.c_str() );
797 // Create layout info for the input line.
798 Toolkit::Internal::TextView::RelayoutData relayoutData;
799 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
801 MarkupProcessor::StyledTextArray inputStyledText;
802 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
804 TextViewProcessor::CreateTextInfo( inputStyledText,
805 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
806 Toolkit::TextView::Original,
807 Toolkit::TextView::Original,
808 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
809 Toolkit::TextView::Center,
810 PointSize( lineHeightOffset ),
811 std::string( "..." ),
815 // Get the input line
816 TextViewProcessor::LineLayoutInfo inputLineLayout;
818 if( !inputLayout.mLinesLayoutInfo.empty() )
820 inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
823 // Create layout info for the first part of the result (after split the line)
825 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
826 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
828 MarkupProcessor::StyledTextArray firstResultStyledText;
829 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
831 TextViewProcessor::CreateTextInfo( firstResultStyledText,
832 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
833 Toolkit::TextView::Original,
834 Toolkit::TextView::Original,
835 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
836 Toolkit::TextView::Center,
837 PointSize( lineHeightOffset ),
838 std::string( "..." ),
842 // Get the first result line
843 TextViewProcessor::LineLayoutInfo firstResultLineLayout;
845 if( !firstResultLayout.mLinesLayoutInfo.empty() )
847 firstResultLineLayout = *firstResultLayout.mLinesLayoutInfo.begin();
850 // Create layout info for the last part of the result (after split the line)
852 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
853 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
855 MarkupProcessor::StyledTextArray lastResultStyledText;
856 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
858 TextViewProcessor::CreateTextInfo( lastResultStyledText,
859 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
860 Toolkit::TextView::Original,
861 Toolkit::TextView::Original,
862 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
863 Toolkit::TextView::Center,
864 PointSize( lineHeightOffset ),
869 // Get the last result line
870 TextViewProcessor::LineLayoutInfo lastResultLineLayout;
872 if( !lastResultLayout.mLinesLayoutInfo.empty() )
874 lastResultLineLayout = *lastResultLayout.mLinesLayoutInfo.begin();
879 TextViewProcessor::LineLayoutInfo lastLineLayoutInfo;
881 TextViewProcessor::TextInfoIndices indices( 0, groupPosition, wordPosition, position );
883 PointSize( lineHeightOffset ),
885 lastLineLayoutInfo );
888 if( !TestEqual( inputLineLayout, firstResultLineLayout ) )
890 tet_printf( "Fail. different layout info. %s", location );
894 if( !TestEqual( lastLineLayoutInfo, lastResultLineLayout ) )
896 tet_printf( "Fail. different layout info. %s", location );
904 * Merges the \e inputFirst word and the \e inputLast word, and checks the results with \e result.
906 * If the test fails it prints a short description and the line where this function was called.
908 * @param description Short description of the experiment. i.e. "Merge two words with same style".
909 * @param inputFirst The first part of the word.
910 * @param inputLast The last part of the word.
911 * @param result The merged word.
912 * @param location Where this function has been called.
914 * @return \e true if the experiment is successful. Otherwise returns \e false.
916 bool TestMergeWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
918 tet_printf( "%s", description.c_str() );
920 // Create layout info for the inputFirst word.
921 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
922 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
924 MarkupProcessor::StyledTextArray inputFirstStyledText;
925 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
927 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
928 DEFAULT_LAYOUT_PARAMETERS,
931 // Get the input word
932 TextViewProcessor::WordLayoutInfo inputFirstWordLayout;
934 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
936 const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
937 if( !line.mWordGroupsLayoutInfo.empty() )
939 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
940 if( !group.mWordsLayoutInfo.empty() )
942 inputFirstWordLayout = *( *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
947 // Create layout info for the inputLast word.
948 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
949 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
951 MarkupProcessor::StyledTextArray inputLastStyledText;
952 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
954 TextViewProcessor::CreateTextInfo( inputLastStyledText,
955 DEFAULT_LAYOUT_PARAMETERS,
958 // Get the input word
959 TextViewProcessor::WordLayoutInfo inputLastWordLayout;
961 if( !inputLastLayout.mLinesLayoutInfo.empty() )
963 const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
964 if( !line.mWordGroupsLayoutInfo.empty() )
966 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
967 if( !group.mWordsLayoutInfo.empty() )
969 inputLastWordLayout = *( *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
974 // Create layout info for the result word.
975 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
976 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
978 MarkupProcessor::StyledTextArray resultStyledText;
979 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
981 TextViewProcessor::CreateTextInfo( resultStyledText,
982 DEFAULT_LAYOUT_PARAMETERS,
983 resultRelayoutData );
985 // Get the result word
986 TextViewProcessor::WordLayoutInfo resultWordLayout;
988 if( !resultLayout.mLinesLayoutInfo.empty() )
990 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
991 if( !line.mWordGroupsLayoutInfo.empty() )
993 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
994 if( !group.mWordsLayoutInfo.empty() )
996 resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1001 MergeWord( inputFirstWordLayout,
1002 inputLastWordLayout );
1004 if( !TestEqual( inputFirstWordLayout, resultWordLayout ) )
1006 tet_printf( "Fail. different layout info. %s", location );
1014 * Merges the \e inputFirst group of words and the \e inputLast group of words, and checks the results with \e result.
1016 * If the test fails it prints a short description and the line where this function was called.
1018 * @param description Short description of the experiment.
1019 * @param inputFirst The first part of the group of words.
1020 * @param inputLast The last part of the group of words.
1021 * @param result The merged group of word.
1022 * @param location Where this function has been called.
1024 * @return \e true if the experiment is successful. Otherwise returns \e false.
1026 bool TestMergeGroupsOfWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
1028 tet_printf( "%s", description.c_str() );
1030 // Create layout info for the inputFirst group of word.
1031 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
1032 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
1034 MarkupProcessor::StyledTextArray inputFirstStyledText;
1035 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
1037 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
1038 DEFAULT_LAYOUT_PARAMETERS,
1039 firstRelayoutData );
1041 // Get the input group of words.
1042 TextViewProcessor::WordGroupLayoutInfo inputFirstWordGroupLayout;
1044 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
1046 const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
1047 if( !line.mWordGroupsLayoutInfo.empty() )
1049 inputFirstWordGroupLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1053 // Create layout info for the inputLast group of words.
1054 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
1055 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
1057 MarkupProcessor::StyledTextArray inputLastStyledText;
1058 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
1060 TextViewProcessor::CreateTextInfo( inputLastStyledText,
1061 DEFAULT_LAYOUT_PARAMETERS,
1064 // Get the input group of words
1065 TextViewProcessor::WordGroupLayoutInfo inputLastWordGroupLayout;
1067 if( !inputLastLayout.mLinesLayoutInfo.empty() )
1069 const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
1070 if( !line.mWordGroupsLayoutInfo.empty() )
1072 inputLastWordGroupLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1076 // Create layout info for the result group of words.
1077 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1078 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1080 MarkupProcessor::StyledTextArray resultStyledText;
1081 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1083 TextViewProcessor::CreateTextInfo( resultStyledText,
1084 DEFAULT_LAYOUT_PARAMETERS,
1085 resultRelayoutData );
1087 // Get the result word
1088 TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
1090 if( !resultLayout.mLinesLayoutInfo.empty() )
1092 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1093 if( !line.mWordGroupsLayoutInfo.empty() )
1095 resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1099 MergeWordGroup( inputFirstWordGroupLayout,
1100 inputLastWordGroupLayout );
1102 if( !TestEqual( inputFirstWordGroupLayout, resultWordGroupLayout ) )
1104 tet_printf( "Fail. different layout info. %s", location );
1112 * Merges the \e inputFirst line and the \e inputLast line, and checks the results with \e result.
1114 * If the test fails it prints a short description and the line where this function was called.
1116 * @param description Short description of the experiment.
1117 * @param inputFirst The first part of the line.
1118 * @param inputLast The last part of the line.
1119 * @param lineHeightOffset Offset between lines.
1120 * @param result The merged line.
1121 * @param location Where this function has been called.
1123 * @return \e true if the experiment is successful. Otherwise returns \e false.
1125 bool TestMergeLines( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const float lineHeightOffset, const std::string& result, const char* location )
1127 tet_printf( "%s", description.c_str() );
1129 // Create layout info for the inputFirst line.
1130 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
1131 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
1133 MarkupProcessor::StyledTextArray inputFirstStyledText;
1134 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
1136 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
1137 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1138 Toolkit::TextView::Original,
1139 Toolkit::TextView::Original,
1140 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1141 Toolkit::TextView::Center,
1142 PointSize( lineHeightOffset ),
1143 std::string( "..." ),
1145 firstRelayoutData );
1147 // Get the input word
1148 TextViewProcessor::LineLayoutInfo inputFirstLineLayout;
1150 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
1152 inputFirstLineLayout = *inputFirstLayout.mLinesLayoutInfo.begin();
1155 // Create layout info for the inputLast line.
1156 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
1157 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
1159 MarkupProcessor::StyledTextArray inputLastStyledText;
1160 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
1162 TextViewProcessor::CreateTextInfo( inputLastStyledText,
1163 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1164 Toolkit::TextView::Original,
1165 Toolkit::TextView::Original,
1166 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1167 Toolkit::TextView::Center,
1168 PointSize( lineHeightOffset ),
1169 std::string( "..." ),
1173 // Get the input word
1174 TextViewProcessor::LineLayoutInfo inputLastLineLayout;
1176 if( !inputLastLayout.mLinesLayoutInfo.empty() )
1178 inputLastLineLayout = *inputLastLayout.mLinesLayoutInfo.begin();
1181 // Create layout info for the result word.
1182 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1183 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1185 MarkupProcessor::StyledTextArray resultStyledText;
1186 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1188 TextViewProcessor::CreateTextInfo( resultStyledText,
1189 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1190 Toolkit::TextView::Original,
1191 Toolkit::TextView::Original,
1192 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1193 Toolkit::TextView::Center,
1194 PointSize( lineHeightOffset ),
1195 std::string( "..." ),
1197 resultRelayoutData );
1199 // Get the result word
1200 TextViewProcessor::LineLayoutInfo resultLineLayout;
1202 if( !resultLayout.mLinesLayoutInfo.empty() )
1204 resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
1207 MergeLine( inputFirstLineLayout,
1208 inputLastLineLayout );
1210 if( !TestEqual( inputFirstLineLayout, resultLineLayout ) )
1212 tet_printf( "Fail. different layout info. %s", location );
1220 * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result.
1222 * If the test fails it prints a short description and the line where this function was called.
1224 * @param description Short description of the experiment. i.e. "Remove a whole group of characters. Merge".
1225 * @param input The input word.
1226 * @param position Where to start to remove characters
1227 * @param numberOfCharacters The number of characters to remove.
1228 * @param result The word without the removed characters.
1229 * @param location Where this function has been called.
1231 * @return \e true if the experiment is successful. Otherwise returns \e false.
1233 bool TestRemoveCharactersFromWord( const std::string& description, const std::string& input, const std::size_t position, const std::size_t numberOfCharacters, const std::string& result, const char* location )
1235 tet_printf( "%s", description.c_str() );
1237 // Create layout info for the input word.
1238 Toolkit::Internal::TextView::RelayoutData relayoutData;
1239 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1241 MarkupProcessor::StyledTextArray inputStyledText;
1242 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1244 TextViewProcessor::CreateTextInfo( inputStyledText,
1245 DEFAULT_LAYOUT_PARAMETERS,
1248 // Get the input word
1249 TextViewProcessor::WordLayoutInfo inputWordLayout;
1251 if( !inputLayout.mLinesLayoutInfo.empty() )
1253 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
1254 if( !line.mWordGroupsLayoutInfo.empty() )
1256 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
1257 if( !group.mWordsLayoutInfo.empty() )
1259 inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1264 // Create layout info for the result word.
1265 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1266 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1268 MarkupProcessor::StyledTextArray resultStyledText;
1269 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1271 TextViewProcessor::CreateTextInfo( resultStyledText,
1272 DEFAULT_LAYOUT_PARAMETERS,
1273 resultRelayoutData );
1275 // Get the result word
1276 TextViewProcessor::WordLayoutInfo resultWordLayout;
1278 if( !resultLayout.mLinesLayoutInfo.empty() )
1280 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1281 if( !line.mWordGroupsLayoutInfo.empty() )
1283 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
1284 if( !group.mWordsLayoutInfo.empty() )
1286 resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1291 RemoveCharactersFromWord( position,
1295 if( !TestEqual( inputWordLayout, resultWordLayout ) )
1297 tet_printf( "Fail. different layout info. %s", location );
1305 * Removes from the \e input group of words the \e numberOfWords words starting from the given \e wordIndex and checks the results with \e result.
1307 * If the test fails it prints a short description and the line where this function was called.
1309 * @param description Short description of the experiment.
1310 * @param input The input group of words.
1311 * @param wordIndex Where to start to remove words.
1312 * @param numberOfWords The number of words to remove.
1313 * @param result The group of words without the removed words.
1314 * @param location Where this function has been called.
1316 * @return \e true if the experiment is successful. Otherwise returns \e false.
1318 bool TestRemoveWordsFromGroup( const std::string& description, const std::string& input, const std::size_t wordIndex, const std::size_t numberOfWords, const std::string& result, const char* location )
1320 tet_printf( "%s", description.c_str() );
1322 // Create layout info for the input group of words.
1323 Toolkit::Internal::TextView::RelayoutData relayoutData;
1324 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1326 MarkupProcessor::StyledTextArray inputStyledText;
1327 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1329 TextViewProcessor::CreateTextInfo( inputStyledText,
1330 DEFAULT_LAYOUT_PARAMETERS,
1333 // Get the input group of words
1334 TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
1336 if( !inputLayout.mLinesLayoutInfo.empty() )
1338 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
1339 if( !line.mWordGroupsLayoutInfo.empty() )
1341 inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1345 // Create layout info for the result group of words.
1346 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1347 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1349 MarkupProcessor::StyledTextArray resultStyledText;
1350 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1352 TextViewProcessor::CreateTextInfo( resultStyledText,
1353 DEFAULT_LAYOUT_PARAMETERS,
1354 resultRelayoutData );
1356 // Get the result group of words.
1357 TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
1359 if( !resultLayout.mLinesLayoutInfo.empty() )
1361 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1362 if( !line.mWordGroupsLayoutInfo.empty() )
1364 resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1368 RemoveWordsFromWordGroup( wordIndex,
1370 inputWordGroupLayout );
1372 if( !TestEqual( inputWordGroupLayout, resultWordGroupLayout ) )
1374 tet_printf( "Fail. different layout info. %s", location );
1383 * Removes from the \e input line the \e numberOfGroups groups of words starting from the given \e groupIndex and checks the results with \e result.
1385 * If the test fails it prints a short description and the line where this function was called.
1387 * @param description Short description of the experiment.
1388 * @param input The input line.
1389 * @param groupIndex Where to start to remove groups of words
1390 * @param numberOfGroups The number of groups of words to remove.
1391 * @param lineHeightOffset Offset between lines.
1392 * @param result The line without the removed groups of words.
1393 * @param location Where this function has been called.
1395 * @return \e true if the experiment is successful. Otherwise returns \e false.
1397 bool TestRemoveGroupsFromLine( const std::string& description, const std::string& input, const std::size_t groupIndex, const std::size_t numberOfGroups, const float lineHeightOffset, const std::string& result, const char* location )
1399 tet_printf( "%s", description.c_str() );
1401 // Create layout info for the input line.
1402 Toolkit::Internal::TextView::RelayoutData relayoutData;
1403 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1405 MarkupProcessor::StyledTextArray inputStyledText;
1406 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1408 TextViewProcessor::CreateTextInfo( inputStyledText,
1409 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1410 Toolkit::TextView::Original,
1411 Toolkit::TextView::Original,
1412 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1413 Toolkit::TextView::Center,
1414 PointSize( lineHeightOffset ),
1415 std::string( "..." ),
1419 // Get the input line
1420 TextViewProcessor::LineLayoutInfo inputLineLayout;
1422 if( !inputLayout.mLinesLayoutInfo.empty() )
1424 inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
1427 // Create layout info for the result line.
1428 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1429 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1431 MarkupProcessor::StyledTextArray resultStyledText;
1432 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1434 TextViewProcessor::CreateTextInfo( resultStyledText,
1435 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1436 Toolkit::TextView::Original,
1437 Toolkit::TextView::Original,
1438 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1439 Toolkit::TextView::Center,
1440 PointSize( lineHeightOffset ),
1441 std::string( "..." ),
1443 resultRelayoutData );
1445 // Get the result line
1446 TextViewProcessor::LineLayoutInfo resultLineLayout;
1448 if( !resultLayout.mLinesLayoutInfo.empty() )
1450 resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
1453 RemoveWordGroupsFromLine( groupIndex,
1455 PointSize( lineHeightOffset ),
1458 if( !TestEqual( inputLineLayout, resultLineLayout ) )
1460 tet_printf( "Fail. different layout info. %s", location );
1468 * Tests inserts, removes and updates operation in the given \e input text and checks with the given \e result.
1470 * If the test fails it prints a short description and the line where this function was called.
1472 * @param description Short description of the experiment.
1473 * @param operation Type of update operation (insert, remove, replace)
1474 * @param input The input text.
1475 * @param position Where to insert, remove or replace text.
1476 * @param numberOfCharacters Number of characters to remove or replace.
1477 * @param inputText Inserted or updated text.
1478 * @param lineHeightOffset Offset between lines.
1479 * @param result Expected result.
1480 * @param location Where this function has been called.
1482 * @return \e true if the experiment is successful. Otherwise returns \e false.
1484 bool TestUpdateTextInfo( const std::string& description,
1485 const UpdateTextInfoOperation operation,
1486 const std::string& input,
1487 const std::size_t position,
1488 const std::size_t numberOfCharacters,
1489 const std::string& inputText,
1490 const float lineHeightOffset,
1491 const std::string& result,
1492 const char* location )
1494 tet_printf( "%s", description.c_str() );
1496 // Create layout info for the input.
1497 Toolkit::Internal::TextView::RelayoutData relayoutData;
1498 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1500 MarkupProcessor::StyledTextArray inputStyledText;
1501 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1503 TextViewProcessor::CreateTextInfo( inputStyledText,
1504 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1505 Toolkit::TextView::Original,
1506 Toolkit::TextView::Original,
1507 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1508 Toolkit::TextView::Center,
1509 PointSize( lineHeightOffset ),
1510 std::string( "..." ),
1514 // Create layout info for the result.
1515 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1516 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1518 MarkupProcessor::StyledTextArray resultStyledText;
1519 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1521 TextViewProcessor::CreateTextInfo( resultStyledText,
1522 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1523 Toolkit::TextView::Original,
1524 Toolkit::TextView::Original,
1525 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1526 Toolkit::TextView::Center,
1527 PointSize( lineHeightOffset ),
1528 std::string( "..." ),
1530 resultRelayoutData );
1532 // Choose operation and call appropiate UpdateTextInfo() method.
1533 const Toolkit::Internal::TextView::LayoutParameters layoutParameters( Toolkit::TextView::SplitByNewLineChar,
1534 Toolkit::TextView::Original,
1535 Toolkit::TextView::Original,
1536 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1537 Toolkit::TextView::Center,
1538 PointSize( lineHeightOffset ),
1539 std::string( "..." ),
1546 MarkupProcessor::StyledTextArray inputStyledText;
1547 MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
1549 TextViewProcessor::UpdateTextInfo( position,
1557 TextViewProcessor::UpdateTextInfo( position,
1561 TextViewProcessor::CLEAR_TEXT );
1566 MarkupProcessor::StyledTextArray inputStyledText;
1567 MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
1569 TextViewProcessor::UpdateTextInfo( position,
1578 tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location );
1583 if( !TestEqual( inputLayout, resultLayout ) )
1585 tet_printf( "Fail. different layout info. %s", location );
1587 std::cout << " result : "; Print( inputLayout );
1588 std::cout << " expected result : "; Print( resultLayout );
1598 int UtcDaliTextViewCreateTextInfo(void)
1600 ToolkitTestApplication application;
1602 tet_infoline("UtcDaliTextViewCreateTextInfo : ");
1604 // Metrics for characters
1607 // size : [9.48351, 9.48351]
1608 // advance : 9.48351
1609 // bearing : 8.53516
1610 // ascender : 8.53516
1613 // size : [11.3802, 11.3802]
1614 // advance : 11.3802
1615 // bearing : 10.2422
1616 // ascender : 10.2422
1619 // size : [13.2769, 13.2769]
1620 // advance : 13.2769
1621 // bearing : 11.9492
1622 // ascender : 11.9492
1624 const float WIDTH_10( 9.48351f );
1625 const float HEIGHT_10( 9.48351f );
1626 const float ADVANCE_10( 9.48351f );
1627 const float BEARING_10( 8.53516f );
1628 const float ASCENDER_10( 8.53516f );
1630 const float WIDTH_12( 11.3802f );
1631 const float HEIGHT_12( 11.3802f );
1632 const float ADVANCE_12( 11.3802f );
1633 const float BEARING_12( 10.2422f );
1634 const float ASCENDER_12( 10.2422f );
1638 Toolkit::Internal::TextView::RelayoutData relayoutData;
1639 TextViewProcessor::TextLayoutInfo& textLayoutInfo( relayoutData.mTextLayoutInfo );
1641 std::string text( "Hel<font size='10'>lo wo</font>rld!\n"
1644 MarkupProcessor::StyledTextArray styledText;
1645 MarkupProcessor::GetStyledTextArray( text, styledText, true );
1647 TextViewProcessor::CreateTextInfo( styledText,
1648 DEFAULT_LAYOUT_PARAMETERS,
1652 // Build the text info with metric values.
1656 TextViewProcessor::CharacterLayoutInfo layoutInfo10; // ( [lo wo])
1657 layoutInfo10.mHeight = HEIGHT_10;
1658 layoutInfo10.mAdvance = ADVANCE_10;
1659 layoutInfo10.mBearing = BEARING_10;
1660 layoutInfo10.mSize = Size( WIDTH_10, HEIGHT_10 );
1661 layoutInfo10.mAscender = ASCENDER_10;
1662 TextViewProcessor::CharacterLayoutInfo layoutInfo12; // ( [Hel], [rld!] and [CR])
1663 layoutInfo12.mHeight = HEIGHT_12;
1664 layoutInfo12.mAdvance = ADVANCE_12;
1665 layoutInfo12.mBearing = BEARING_12;
1666 layoutInfo12.mSize = Size( WIDTH_12, HEIGHT_12 );
1667 layoutInfo12.mAscender = ASCENDER_12;
1670 style10.SetFontPointSize( PointSize( 10.f ) );
1672 style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size.
1674 layoutInfo12.mStyledText.mStyle = style12;
1675 layoutInfo10.mStyledText.mStyle = style10;
1679 TextViewProcessor::WordLayoutInfo wordLayout1, wordLayout2, wordLayout3, wordLayout4;
1682 wordLayout1.mSize = Size( 3.f * WIDTH_12 + 2.f * WIDTH_10, HEIGHT_12 );
1683 wordLayout1.mAscender = ASCENDER_12;
1684 wordLayout1.mType = TextViewProcessor::NoSeparator;
1686 layoutInfo12.mStyledText.mText = Text( "H" );
1687 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // H
1688 layoutInfo12.mStyledText.mText = Text( "e" );
1689 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // e
1690 layoutInfo12.mStyledText.mText = Text( "l" );
1691 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
1692 layoutInfo10.mStyledText.mText = Text( "l" );
1693 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // l
1694 layoutInfo10.mStyledText.mText = Text( "o" );
1695 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
1698 wordLayout2.mSize = Size( WIDTH_10, HEIGHT_10 );
1699 wordLayout2.mAscender = ASCENDER_10;
1700 wordLayout2.mType = TextViewProcessor::WordSeparator;
1701 layoutInfo10.mStyledText.mText = Text( " " );
1702 wordLayout2.mCharactersLayoutInfo.push_back( layoutInfo10 ); // (white space)
1705 wordLayout3.mSize = Size( 2.f * WIDTH_10 + 4.f * WIDTH_12, HEIGHT_12 );
1706 wordLayout3.mAscender = ASCENDER_12;
1707 wordLayout3.mType = TextViewProcessor::NoSeparator;
1708 layoutInfo10.mStyledText.mText = Text( "w" );
1709 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // w
1710 layoutInfo10.mStyledText.mText = Text( "o" );
1711 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
1712 layoutInfo12.mStyledText.mText = Text( "r" );
1713 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // r
1714 layoutInfo12.mStyledText.mText = Text( "l" );
1715 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
1716 layoutInfo12.mStyledText.mText = Text( "d" );
1717 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // d
1718 layoutInfo12.mStyledText.mText = Text( "!" );
1719 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // !
1721 // (new line character)
1722 wordLayout4.mSize = Size( 0.f, HEIGHT_12 );
1723 wordLayout4.mAscender = ASCENDER_12;
1724 wordLayout4.mType = TextViewProcessor::LineSeparator;
1725 layoutInfo12.mStyledText.mText = Text( "\n" );
1726 layoutInfo12.mSize.width = 0.f;
1727 wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char)
1731 TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2;
1733 groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
1734 groupLayout1.mAscender = ASCENDER_12;
1735 groupLayout1.mDirection = TextViewProcessor::LTR;
1736 groupLayout1.mNumberOfCharacters = 13;
1737 groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
1738 groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
1739 groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
1740 groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
1742 groupLayout2.mSize = Size( 0.f, HEIGHT_12 );
1743 groupLayout2.mAscender = ASCENDER_12;
1744 groupLayout2.mDirection = TextViewProcessor::LTR;
1745 groupLayout2.mNumberOfCharacters = 1;
1746 groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
1750 TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3;
1752 lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
1753 lineLayout1.mAscender = ASCENDER_12;
1754 lineLayout1.mNumberOfCharacters = 13;
1755 lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 );
1757 lineLayout2.mSize = Size( 0.f, HEIGHT_12 );
1758 lineLayout2.mAscender = ASCENDER_12;
1759 lineLayout2.mNumberOfCharacters = 1;
1760 lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 );
1762 lineLayout3.mSize = Size( 0.f, HEIGHT_12 );
1765 TextViewProcessor::TextLayoutInfo textLayout;
1767 textLayout.mWholeTextSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, 3.f * HEIGHT_12 );
1768 textLayout.mMaxWordWidth = 2.f * WIDTH_10 + 4.f * WIDTH_12;
1769 textLayout.mNumberOfCharacters = 14;
1770 textLayout.mLinesLayoutInfo.push_back( lineLayout1 );
1771 textLayout.mLinesLayoutInfo.push_back( lineLayout2 );
1772 textLayout.mLinesLayoutInfo.push_back( lineLayout3 );
1774 if(!TestEqual( textLayout, textLayoutInfo ))
1776 std::cout << "Layout fails" << std::endl;
1777 Print(textLayout); std::cout << std::endl;
1778 Print(textLayoutInfo); std::cout << std::endl;
1781 DALI_TEST_CHECK( TestEqual( textLayout, textLayoutInfo ) );
1785 int UtcDaliTextViewSplitWord(void)
1787 ToolkitTestApplication application;
1789 tet_infoline("UtcDaliTextViewSplitWord : ");
1791 struct SplitWordTest splitWordTests[] =
1794 std::string( "Split word, position 0." ),
1795 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1798 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1801 std::string( "Split word, position 8." ),
1802 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1804 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1808 std::string( "Split word, position 2." ),
1809 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1811 std::string( "<font size='10'>He</font>" ),
1812 std::string( "<font size='12'>ll</font><font size='10'>oooo</font>" ),
1815 std::string( "Split word, position 3." ),
1816 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1818 std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
1819 std::string( "<font size='12'>l</font><font size='10'>oooo</font>" ),
1822 std::string( "Split word, position 4." ),
1823 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1825 std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
1826 std::string( "<font size='10'>oooo</font>" ),
1829 const std::size_t numberOfTests( 5 );
1831 for( std::size_t index = 0; index < numberOfTests; ++index )
1833 const SplitWordTest& test = splitWordTests[index];
1835 if( !TestSplitWord( test.description, test.input, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
1837 tet_result( TET_FAIL );
1841 tet_result( TET_PASS );
1845 int UtcDaliTextViewUpdateTextInfo(void)
1847 ToolkitTestApplication application;
1849 tet_infoline("UtcDaliTextViewUpdateTextInfo : ");
1851 struct UpdateTextInfoTest updateTextInfoTest[] =
1853 // Remove operations
1856 std::string( "Remove from new line character to first character next line." ),
1858 std::string("Hello world\nhello world."),
1863 std::string("Hello worldello world."),
1866 std::string( "Replace style from new line character to first character next line." ),
1868 std::string("Hello world\nhello world."),
1871 std::string("<b>\nh</b>"),
1873 std::string("Hello world<b>\nh</b>ello world."),
1876 std::string( "Remove from the beginning to the middle of last word." ),
1878 std::string("Hello world, hello world."),
1881 std::string(), // Not used.
1886 std::string( "Remove from the beginning to the middle of the text." ),
1888 std::string("Hello world hello world."),
1891 std::string(), // Not used.
1893 std::string("hello world."),
1895 // Remove within the same word:
1896 // * within the same group of characters.
1898 std::string( "Remove within the same word, within the same group of characters" ),
1900 std::string("Hello <font size='30'>world\nhello</font> world"),
1903 std::string(), // Not used.
1905 std::string( "Hello <font size='30'>wd\nhello</font> world" )
1907 // * whole group of characters (merge adjacent group of characters)
1909 std::string( "Remove within the same word, whole group of characters (merge adjacent group of characters)" ),
1911 std::string("Hello <font size='30'>w<font size='20'>orl</font>d\nhello</font> world"),
1914 std::string(), // Not used.
1916 std::string( "Hello <font size='30'>wd\nhello</font> world" )
1918 // * whole group of characters (don't merge adjacent gtoup of characters)
1920 std::string( "Remove within the same word, whole group of characters (don't merge adjacent gtoup of characters)" ),
1922 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1925 std::string(), // Not used.
1927 std::string( "Hello <font size='30'>w</font><font size='10'>d\nhello</font> world" )
1929 // * Remove whole word (merge words)
1931 std::string( "Remove within the same word, whole word (merge words)" ),
1933 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1936 std::string(), // Not used.
1938 std::string( "Hello<font size='30'>w</font>orl<font size='10'>d\nhello</font> world" )
1940 // * Remove whole word (don't merge words)
1942 std::string( "Remove within the same word, whole word (don't merge words)" ),
1944 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1947 std::string(), // Not used.
1949 std::string( "Hello <font size='10'>\nhello</font> world" )
1951 // * Remove whole word (merge lines)
1953 std::string( "Remove within the same word, whole word (merge lines)" ),
1955 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1958 std::string(), // Not used.
1960 std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> world" )
1962 // * Remove whole group of words
1963 /* TODO check this when RTL text is working
1965 std::string( "Remove within the same line, whole group of words (merge groups)" ),
1967 std::string("Hello world, שלום עולם, hello world"),
1970 std::string(), // Not used.
1972 std::string( "Hello worlello world" )
1975 // * Remove whole line
1977 std::string( "Remove whole line" ),
1979 std::string("Hello world, hello world\n"
1980 "Hello world, hello world\n"
1981 "Hello world, hello world\n"
1982 "Hello world, hello world\n"),
1985 std::string(), // Not used.
1987 std::string("Hello world, hello world\n"
1988 "Hello world, hello world\n"
1989 "Hello world, hello world\n"),
1992 std::string( "Remove whole line" ),
1994 std::string("Hello world, hello world\n"
1998 std::string(), // Not used.
2000 std::string("Hello world, hello world\n"),
2004 // Insert operations
2006 std::string( "insert some text" ),
2008 std::string("inpuext"),
2011 std::string( "t t" ),
2013 std::string( "input text" )
2016 std::string( "Insert text at the end" ),
2018 std::string("touch "),
2021 std::string("me\nhello"),
2023 std::string("touch me\nhello")
2026 // Replace operations.
2028 std::string( "Replace style from the beginning to some point in the middle of the text." ),
2030 std::string( "Hello <font color='green'>world</font>" ),
2033 std::string( "<font color='red'>Hello w</font>" ),
2035 std::string( "<font color='red'>Hello w</font><font color='green'>orld</font>" )
2038 std::string( "Replace style from the middle of the text to the end." ),
2040 std::string( "Touch me\nhello" ),
2043 std::string( "<b>me\nhello</b>" ),
2045 std::string( "Touch <b>me\nhello</b>" )
2048 std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 1." ),
2050 std::string( "Touch me\nhello\nworld" ),
2055 std::string( "Touch \nworld" )
2058 std::string( "Insert styled text in the middle of a text. Previous: Replace style from the middle of the text 1." ),
2060 std::string( "Touch \nworld" ),
2063 std::string( "<b>me\nhello</b>" ),
2065 std::string( "Touch <b>me\nhello</b>\nworld" )
2068 std::string( "Replace style from the middle of the text 1." ),
2070 std::string( "Touch me\nhello\nworld" ),
2073 std::string( "<b>me\nhello</b>" ),
2075 std::string( "Touch <b>me\nhello</b>\nworld" )
2078 std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 2." ),
2080 std::string( "Touch me\nhello\nworld" ),
2085 std::string( "Touch world" )
2088 std::string( "Replace style from the middle of the text 2." ),
2090 std::string( "Touch me\nhello\nworld" ),
2093 std::string( "<b>me\nhello\n</b>" ),
2095 std::string( "Touch <b>me\nhello\n</b>world" )
2098 const std::size_t numberOfTests( 21 );
2100 for( std::size_t index = 0; index < numberOfTests; ++index )
2102 const UpdateTextInfoTest& test = updateTextInfoTest[index];
2104 if( !TestUpdateTextInfo( test.description, test.operation, test.input, test.position, test.numberOfCharacters, test.inputText, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2106 tet_result( TET_FAIL );
2110 tet_result( TET_PASS );
2114 int UtcDaliTextViewSplitWordGroup(void)
2116 ToolkitTestApplication application;
2118 tet_infoline("UtcDaliTextViewSplitWordGroup : ");
2120 struct SplitWordGroupTest splitWordGroupTests[] =
2123 std::string( "Split word group, wordPosition 0, position 0." ),
2124 std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
2128 std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
2131 std::string( "Split word group, wordPosition 2, position 8." ),
2132 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2135 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2139 std::string( "Split word group, wordPosition 0, position 2." ),
2140 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2143 std::string( "<font size='10'>He</font>" ),
2144 std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
2147 std::string( "Split word group, wordPosition 0, position 3." ),
2148 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2151 std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
2152 std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
2155 std::string( "Split word group, wordPosition 0, position 4." ),
2156 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2159 std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
2160 std::string( "<font size='10'>oooo wooorld</font>" ),
2163 std::string( "Split word group, wordPosition 1, position 0." ),
2164 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2167 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
2168 std::string( "<font size='10'> wooorld</font>" ),
2171 const std::size_t numberOfTests( 6 );
2173 for( std::size_t index = 0; index < numberOfTests; ++index )
2175 const SplitWordGroupTest& test = splitWordGroupTests[index];
2177 if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
2179 tet_result( TET_FAIL );
2183 tet_result( TET_PASS );
2187 int UtcDaliTextViewSplitLine(void)
2189 ToolkitTestApplication application;
2191 tet_infoline("UtcDaliTextViewSplitLine : ");
2193 struct SplitLineTest splitLineTests[] =
2196 std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ),
2197 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2203 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2206 std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
2207 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2212 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2215 /* TODO check when RTL is working.
2217 std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
2218 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2223 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
2224 std::string( " עולם text text" ),
2227 std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
2228 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2233 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
2234 std::string( "שלום עולם text text" ),
2238 std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
2239 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2244 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
2245 std::string( "text text" ),
2248 const std::size_t numberOfTests( 3 );
2250 for( std::size_t index = 0; index < numberOfTests; ++index )
2252 const SplitLineTest& test = splitLineTests[index];
2254 if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) )
2256 tet_result( TET_FAIL );
2260 tet_result( TET_PASS );
2264 int UtcDaliTextViewMergeWord01(void)
2266 ToolkitTestApplication application;
2268 tet_infoline("UtcDaliTextViewMergeWord01 : ");
2270 struct MergeWordsTest mergeWordsTests[] =
2273 std::string( "Merge words with same style." ),
2274 std::string( "Hel" ),
2275 std::string( "lo" ),
2276 std::string( "Hello" ),
2279 std::string( "Merge words with different styles." ),
2280 std::string( "<font size='10>Hel</font>" ),
2281 std::string( "<font size='20'>lo</font>" ),
2282 std::string( "<font size='10'>Hel</font><font size='20'>lo</font>" )
2285 const std::size_t numberOfTests( 2 );
2287 for( std::size_t index = 0; index < numberOfTests; ++index )
2289 const MergeWordsTest& test = mergeWordsTests[index];
2291 if( !TestMergeWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
2293 tet_result( TET_FAIL );
2297 tet_result( TET_PASS );
2301 int UtcDaliTextViewMergeWord02(void)
2304 // It test white spaces and new line characters can't be merged to other words.
2306 ToolkitTestApplication application;
2308 tet_infoline("UtcDaliTextViewMergeWord02 : ");
2310 // Generate three words
2312 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2313 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2314 Toolkit::Internal::TextView::RelayoutData relayoutData03;
2315 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2316 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2317 TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
2319 std::string text01( " " );
2320 std::string text02( "\n" );
2321 std::string text03( "a" );
2322 MarkupProcessor::StyledTextArray styledText01;
2323 MarkupProcessor::StyledTextArray styledText02;
2324 MarkupProcessor::StyledTextArray styledText03;
2325 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2326 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2327 MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
2329 TextViewProcessor::CreateTextInfo( styledText01,
2330 DEFAULT_LAYOUT_PARAMETERS,
2333 TextViewProcessor::WordLayoutInfo wordLayoutInfo01;
2335 wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2337 TextViewProcessor::CreateTextInfo( styledText02,
2338 DEFAULT_LAYOUT_PARAMETERS,
2341 TextViewProcessor::WordLayoutInfo wordLayoutInfo02;
2343 wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2345 TextViewProcessor::CreateTextInfo( styledText03,
2346 DEFAULT_LAYOUT_PARAMETERS,
2349 TextViewProcessor::WordLayoutInfo wordLayoutInfo03;
2351 wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2353 // Test MergeWord() asserts if white spaces or new line chars are merged.
2354 bool assert1 = false;
2355 bool assert2 = false;
2356 bool assert3 = false;
2357 bool assert4 = false;
2358 bool assert5 = false;
2359 bool assert6 = false;
2363 MergeWord( wordLayoutInfo01,
2366 catch( Dali::DaliException& e )
2368 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2369 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2374 MergeWord( wordLayoutInfo01,
2377 catch( Dali::DaliException& e )
2379 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2380 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2385 MergeWord( wordLayoutInfo02,
2388 catch( Dali::DaliException& e )
2390 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2391 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2396 MergeWord( wordLayoutInfo02,
2399 catch( Dali::DaliException& e )
2401 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2402 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2407 MergeWord( wordLayoutInfo03,
2410 catch( Dali::DaliException& e )
2412 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2413 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2418 MergeWord( wordLayoutInfo03,
2421 catch( Dali::DaliException& e )
2423 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2424 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2428 if( assert1 && assert2 && assert3 && assert4 && assert5 && assert6 )
2430 tet_result( TET_PASS );
2434 tet_result( TET_FAIL );
2439 int UtcDaliTextViewMergeGroup01(void)
2441 ToolkitTestApplication application;
2443 tet_infoline("UtcDaliTextViewMergeGroup01 : ");
2445 struct MergeWordGroupsTest mergeWordGroupssTests[] =
2448 std::string( "Merge a void first group." ),
2450 std::string( "Hello world" ),
2451 std::string( "Hello world" ),
2454 std::string( "Merge a void last group." ),
2455 std::string( "Hello world" ),
2457 std::string( "Hello world" ),
2460 std::string( "Merge groups and merge last and first words." ),
2461 std::string( "Hello wor" ),
2462 std::string( "ld, hello world" ),
2463 std::string( "Hello world, hello world" ),
2466 std::string( "Merge groups and don't merge last and first words." ),
2467 std::string( "Hello world, " ),
2468 std::string( "hello world" ),
2469 std::string( "Hello world, hello world" )
2472 const std::size_t numberOfTests( 4 );
2474 for( std::size_t index = 0; index < numberOfTests; ++index )
2476 const MergeWordGroupsTest& test = mergeWordGroupssTests[index];
2478 if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
2480 tet_result( TET_FAIL );
2484 tet_result(TET_PASS);
2488 int UtcDaliTextViewMergeGroup02(void)
2490 ToolkitTestApplication application;
2492 tet_infoline("UtcDaliTextViewMergeGroup02 : ");
2494 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2495 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2496 Toolkit::Internal::TextView::RelayoutData relayoutData03;
2497 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2498 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2499 TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
2501 std::string text01( "Hello \n" );
2502 std::string text02( "world" );
2503 std::string text03( "السلام عليكم" );
2504 MarkupProcessor::StyledTextArray styledText01;
2505 MarkupProcessor::StyledTextArray styledText02;
2506 MarkupProcessor::StyledTextArray styledText03;
2507 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2508 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2509 MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
2511 TextViewProcessor::CreateTextInfo( styledText01,
2512 DEFAULT_LAYOUT_PARAMETERS,
2515 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01;
2517 wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2519 TextViewProcessor::CreateTextInfo( styledText02,
2520 DEFAULT_LAYOUT_PARAMETERS,
2523 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02;
2525 wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2527 TextViewProcessor::CreateTextInfo( styledText03,
2528 DEFAULT_LAYOUT_PARAMETERS,
2531 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03;
2533 wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2535 bool assert1 = false;
2536 bool assert2 = false;
2540 MergeWordGroup( wordGroupLayoutInfo01,
2541 wordGroupLayoutInfo02 );
2543 catch( Dali::DaliException& e )
2545 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2546 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character.\"", TEST_LOCATION );
2552 MergeWordGroup( wordGroupLayoutInfo03,
2553 wordGroupLayoutInfo02 );
2555 catch( Dali::DaliException& e )
2557 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2558 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION );
2562 if( assert1 && assert2 )
2564 tet_result( TET_PASS );
2568 tet_result( TET_FAIL );
2573 int UtcDaliTextViewMergeLine01(void)
2575 ToolkitTestApplication application;
2577 tet_infoline("UtcDaliTextViewMergeLine01 : ");
2579 struct MergeLinesTest mergeLinesTests[] =
2582 std::string( "Merge a void first line." ),
2584 std::string( "Hello world, this is a whole line" ),
2586 std::string( "Hello world, this is a whole line" )
2589 std::string( "Merge a void last line." ),
2590 std::string( "Hello world, this is a whole line" ),
2593 std::string( "Hello world, this is a whole line" )
2595 /* TODO: check when RTL text is working.
2597 std::string( "Merge lines and merge last and first groups" ),
2598 std::string( "Hello world, שלום" ),
2599 std::string( " עולם, hello world." ),
2601 std::string( "Hello world, שלום עולם, hello world." )
2604 std::string( "Merge lines and don't merge last and first words." ),
2605 std::string( "Hello world, " ),
2606 std::string( "שלום עולם, hello world." ),
2608 std::string( "Hello world, שלום עולם, hello world." )
2612 std::string( "Merge lines. Don't merge words" ),
2613 std::string( "Hello world," ),
2614 std::string( " this is a whole line" ),
2616 std::string( "Hello world, this is a whole line" )
2619 std::string( "Merge lines. Merge words" ),
2620 std::string( "Hello world, th" ),
2621 std::string( "is is a whole line" ),
2623 std::string( "Hello world, this is a whole line" )
2626 const std::size_t numberOfTests( 4 );
2628 for( std::size_t index = 0; index < numberOfTests; ++index )
2630 const MergeLinesTest& test = mergeLinesTests[index];
2632 if( !TestMergeLines( test.description, test.inputFirst, test.inputLast, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2634 tet_result( TET_FAIL );
2638 tet_result( TET_PASS );
2642 int UtcDaliTextViewMergeLine02(void)
2644 ToolkitTestApplication application;
2646 tet_infoline("UtcDaliTextViewMergeLine02 : ");
2648 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2649 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2650 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2651 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2653 std::string text01( "Hello world\n" );
2654 std::string text02( "hello world" );
2655 MarkupProcessor::StyledTextArray styledText01;
2656 MarkupProcessor::StyledTextArray styledText02;
2657 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2658 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2660 TextViewProcessor::CreateTextInfo( styledText01,
2661 DEFAULT_LAYOUT_PARAMETERS,
2664 TextViewProcessor::LineLayoutInfo lineLayoutInfo01;
2666 lineLayoutInfo01 = *textLayoutInfo01.mLinesLayoutInfo.begin();
2668 TextViewProcessor::CreateTextInfo( styledText02,
2669 DEFAULT_LAYOUT_PARAMETERS,
2672 TextViewProcessor::LineLayoutInfo lineLayoutInfo02;
2674 lineLayoutInfo02 = *textLayoutInfo02.mLinesLayoutInfo.begin();
2676 bool assert1 = false;
2680 MergeLine( lineLayoutInfo01,
2683 catch( Dali::DaliException& e )
2685 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2686 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeLine(). ERROR: A line can't be merged to another line which finishes with a new line character.\"", TEST_LOCATION );
2692 tet_result( TET_PASS );
2696 tet_result( TET_FAIL );
2701 int UtcDaliTextViewRemoveCharactersFromWord(void)
2703 ToolkitTestApplication application;
2705 tet_infoline("UtcDaliTextViewMergeWord02 : ");
2707 struct RemoveCharactersFromWordTest removeCharactersFromWordTests[] =
2710 std::string( "Delete 0 characters." ),
2711 std::string( "Hello" ),
2714 std::string( "Hello" ),
2717 std::string( "Delete within the same group of characters. Starting from the beginning" ),
2718 std::string( "Hello" ),
2721 std::string( "lo" ),
2724 std::string( "Delete within the same group of characters. Somewhere in the middle" ),
2725 std::string( "Hello" ),
2728 std::string( "Heo" ),
2731 std::string( "Delete within the same group of characters. Starting somewhere in the middle to the end" ),
2732 std::string( "Hello" ),
2735 std::string( "Hel" ),
2738 std::string( "Delete within the same group of characters. Finish just before a new one." ),
2739 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2742 std::string( "<font size='10'>H</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2745 std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
2746 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2749 std::string( "<font size='10'>He</font><font size='20'>Wo</font><font size='30'>rld</font>" ),
2752 std::string( "Delete within the same group of characters. Starting just after a different one." ),
2753 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2756 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>d</font>" ),
2759 std::string( "Delete whole group of characters. No merge" ),
2760 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2763 std::string( "<font size='10'>Hel</font><font size='30'>rld</font>" ),
2766 std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
2767 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2770 std::string( "<font size='10'>He</font><font size='30'>ld</font>" ),
2773 std::string( "Delete whole group of characters. Merge" ),
2774 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
2777 std::string( "<font size='10'>Helrld</font>" ),
2780 std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
2781 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
2784 std::string( "<font size='10'>Held</font>" ),
2787 const std::size_t numberOfTests( 11 );
2789 for( std::size_t index = 0; index < numberOfTests; ++index )
2791 const RemoveCharactersFromWordTest& test = removeCharactersFromWordTests[index];
2793 if( !TestRemoveCharactersFromWord( test.description, test.input, test.position, test.numberOfCharacters, test.result, TEST_LOCATION ) )
2795 tet_result( TET_FAIL );
2799 tet_result( TET_PASS );
2803 int UtcDaliTextViewRemoveWordsFromGroup(void)
2805 // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or
2806 // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so
2807 // tehere isn't any TET case to cover these cases. To be done if needed.
2809 ToolkitTestApplication application;
2811 tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : ");
2812 struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] =
2815 std::string( "Delete 0 words." ),
2816 std::string( "Hello world, hello world" ),
2819 std::string( "Hello world, hello world" ),
2822 std::string( "Delete some words in the middle. Don't merge words" ),
2823 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
2826 std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
2829 std::string( "Delete words up to the end" ),
2830 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
2833 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
2836 std::string( "Delete words from the beginning." ),
2837 std::string( "Hello world, hello world" ),
2840 std::string( " hello world" ),
2843 const std::size_t numberOfTests( 4 );
2845 for( std::size_t index = 0; index < numberOfTests; ++index )
2847 const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index];
2849 if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) )
2851 tet_result( TET_FAIL );
2855 tet_result( TET_PASS );
2859 int UtcDaliTextViewRemoveGroupsFromLine(void)
2861 // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or
2862 // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so
2863 // tehere isn't any TET case to cover these cases. To be done if needed.
2865 ToolkitTestApplication application;
2867 tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : ");
2868 struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] =
2871 std::string( "Delete 0 groups of words." ),
2872 std::string( "Hello hello, שלום עולם hello hello" ),
2876 std::string( "Hello hello, שלום עולם hello hello" ),
2879 std::string( "Delete from the middle to the end." ),
2880 std::string( "Hello hello, שלום עולם hello hello" ),
2884 std::string( "Hello hello, " ),
2887 std::string( "Delete from the beginning to the middle." ),
2888 std::string( "Hello hello, שלום עולם hello hello" ),
2892 std::string( "hello hello" ),
2895 const std::size_t numberOfTests( 3 );
2897 for( std::size_t index = 0; index < numberOfTests; ++index )
2899 const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index];
2901 if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2903 tet_result( TET_FAIL );
2907 tet_result( TET_PASS );