2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
24 // Internal headers are allowed here
25 #include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
26 #include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
27 #include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
28 #include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
29 #include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
32 using namespace Dali::Toolkit;
33 using namespace Dali::Toolkit::Internal;
35 void dali_text_view_startup(void)
37 test_return_value = TET_UNDEF;
40 void dali_text_view_cleanup(void)
42 test_return_value = TET_PASS;
49 const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
50 const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
52 // Data structures used to create an 'experiment' in TET cases
56 std::string description;
59 std::string firstResult;
60 std::string lastResult;
63 struct SplitWordGroupTest
65 std::string description;
67 std::size_t wordPosition;
69 std::string firstResult;
70 std::string lastResult;
75 std::string description;
77 std::size_t groupPosition;
78 std::size_t wordPosition;
80 float lineHeightOffset;
81 std::string firstResult;
82 std::string lastResult;
87 std::string description;
88 std::string inputFirst;
89 std::string inputLast;
93 struct MergeWordGroupsTest
95 std::string description;
96 std::string inputFirst;
97 std::string inputLast;
101 struct MergeLinesTest
103 std::string description;
104 std::string inputFirst;
105 std::string inputLast;
106 float lineHeightOffset;
110 struct RemoveCharactersFromWordTest
112 std::string description;
114 std::size_t position;
115 std::size_t numberOfCharacters;
119 struct RemoveWordsFromGroupTest
121 std::string description;
123 std::size_t wordIndex;
124 std::size_t numberOfWords;
128 struct RemoveGroupsFromLineTest
130 std::string description;
132 std::size_t groupIndex;
133 std::size_t numberOfGroups;
134 float lineHeightOffset;
138 enum UpdateTextInfoOperation
145 struct UpdateTextInfoTest
147 std::string description;
148 UpdateTextInfoOperation operation;
150 std::size_t position;
151 std::size_t numberOfCharacters;
152 std::string inputText;
153 float lineHeightOffset;
157 // Useful Print functions when something goes wrong.
159 void Print( const TextViewProcessor::CharacterLayoutInfo& character )
161 std::cout << " height : " << character.mHeight << std::endl;
162 std::cout << " advance : " << character.mAdvance << std::endl;
163 std::cout << " bearing : " << character.mBearing << std::endl;
164 std::cout << " mPosition : " << character.mPosition << std::endl;
165 std::cout << " mSize : " << character.mSize << std::endl;
166 std::cout << " mAscender : " << character.mAscender << std::endl;
168 TextActor textActor = TextActor::DownCast( character.mGlyphActor );
171 std::cout << "[" << textActor.GetText() << "]";
175 std::cout << "{" << character.mStyledText.mText.GetText() << "}";
179 void Print( const TextViewProcessor::WordLayoutInfo& word )
182 std::cout << " mSize : " << word.mSize << std::endl;
183 std::cout << " mAscender : " << word.mAscender << std::endl;
184 std::cout << " mType : " << word.mType << std::endl;
185 std::cout << "mNumberOfCharacters : " << word.mCharactersLayoutInfo.size() << std::endl;
187 for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it )
191 std::cout << "]"; std::cout << std::endl;
192 std::cout << "]"; std::cout << std::endl;
195 void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup )
198 std::cout << " mSize : " << wordGroup.mSize << std::endl;
199 std::cout << " mAscender : " << wordGroup.mAscender << std::endl;
200 std::cout << " mDirection : " << wordGroup.mDirection << std::endl;
201 std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl;
202 for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it )
206 std::cout << ")"; std::cout << std::endl;
209 void Print( const TextViewProcessor::LineLayoutInfo& line )
212 std::cout << " mSize : " << line.mSize << std::endl;
213 std::cout << " mAscender : " << line.mAscender << std::endl;
214 std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl;
215 for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it )
219 std::cout << ">" << std::endl;
222 void Print( const TextViewProcessor::TextLayoutInfo& text )
225 for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it = text.mLinesLayoutInfo.begin(), endIt = text.mLinesLayoutInfo.end(); it != endIt; ++it )
229 std::cout << "||" << std::endl;
232 void Print( const TextStyle& style )
234 std::cout << " font name : " << style.GetFontName() << std::endl;
235 std::cout << " : " << style.GetFontStyle() << std::endl;
236 std::cout << " : " << style.GetFontPointSize() << std::endl;
237 std::cout << " : " << style.GetWeight() << std::endl;
238 std::cout << " : " << style.GetTextColor() << std::endl;
239 std::cout << " : " << style.GetItalics() << std::endl;
240 std::cout << " : " << style.GetUnderline() << std::endl;
241 std::cout << " : " << style.GetShadow() << std::endl;
242 std::cout << " : " << style.GetShadowColor() << std::endl;
243 std::cout << " : " << style.GetShadowOffset() << std::endl;
244 std::cout << " : " << style.GetGlow() << std::endl;
245 std::cout << " : " << style.GetGlowColor() << std::endl;
246 std::cout << " : " << style.GetGlowIntensity() << std::endl;
247 std::cout << " : " << style.GetSmoothEdge() << std::endl;
248 std::cout << " : " << style.GetOutline() << std::endl;
249 std::cout << " : " << style.GetOutlineThickness() << std::endl;
252 // Test functions used to check if two data structures are equal.
254 bool TestEqual( float x, float y )
256 return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
259 bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1,
260 const TextViewProcessor::CharacterLayoutInfo& character2 )
262 if( !TestEqual( character1.mHeight, character2.mHeight ) )
266 if( !TestEqual( character1.mAdvance, character2.mAdvance ) )
270 if( !TestEqual( character1.mBearing, character2.mBearing ) )
275 if( !TestEqual( character1.mPosition.x, character2.mPosition.x ) )
279 if( !TestEqual( character1.mPosition.y, character2.mPosition.y ) )
284 if( !TestEqual( character1.mSize.x, character2.mSize.x ) )
288 if( !TestEqual( character1.mSize.y, character2.mSize.y ) )
293 if( !TestEqual( character1.mAscender, character2.mAscender ) )
298 if( character1.mGlyphActor && !character2.mGlyphActor )
303 if( !character1.mGlyphActor && character2.mGlyphActor )
313 TextActor textActor1 = TextActor::DownCast( character1.mGlyphActor );
314 TextActor textActor2 = TextActor::DownCast( character2.mGlyphActor );
317 text1 = textActor1.GetText();
318 style1 = textActor1.GetTextStyle();
320 text2 = textActor2.GetText();
321 style2 = textActor2.GetTextStyle();
329 if( style1 != style2 )
334 text1 = character1.mStyledText.mText.GetText();
335 style1 = character1.mStyledText.mStyle;
337 text2 = character2.mStyledText.mText.GetText();
338 style2 = character2.mStyledText.mStyle;
345 if( style1 != style2 )
353 bool TestEqual( const TextViewProcessor::WordLayoutInfo& word1,
354 const TextViewProcessor::WordLayoutInfo& word2 )
356 if( !TestEqual( word1.mSize.x, word2.mSize.x ) )
360 if( !TestEqual( word1.mSize.y, word2.mSize.y ) )
365 if( !TestEqual( word1.mAscender, word2.mAscender ) )
370 if( word1.mType != word2.mType )
375 if( word1.mCharactersLayoutInfo.size() != word2.mCharactersLayoutInfo.size() )
380 for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it1 = word1.mCharactersLayoutInfo.begin(), endIt1 = word1.mCharactersLayoutInfo.end(),
381 it2 = word2.mCharactersLayoutInfo.begin(), endIt2 = word2.mCharactersLayoutInfo.end();
382 ( it1 != endIt1 ) && ( it2 != endIt2 );
385 if( !TestEqual( *it1, *it2 ) )
394 bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1,
395 const TextViewProcessor::WordGroupLayoutInfo& group2 )
398 if( group1.mNumberOfCharacters != group2.mNumberOfCharacters )
403 if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() )
408 if( !TestEqual( group1.mSize.x, group2.mSize.x ) )
412 if( !TestEqual( group1.mSize.y, group2.mSize.y ) )
417 if( !TestEqual( group1.mAscender, group2.mAscender ) )
422 if( group1.mDirection != group2.mDirection )
427 for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(),
428 it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end();
429 ( it1 != endIt1 ) && ( it2 != endIt2 );
432 if( !TestEqual( *it1, *it2 ) )
441 bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1,
442 const TextViewProcessor::LineLayoutInfo& line2 )
444 if( !TestEqual( line1.mSize.x, line2.mSize.x ) )
448 if( !TestEqual( line1.mSize.y, line2.mSize.y ) )
453 if( !TestEqual( line1.mAscender, line2.mAscender ) )
458 if( line1.mNumberOfCharacters != line2.mNumberOfCharacters )
463 if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() )
468 for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(),
469 it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end();
470 ( it1 != endIt1 ) && ( it2 != endIt2 );
473 if( !TestEqual( *it1, *it2 ) )
482 bool TestEqual( const TextViewProcessor::TextLayoutInfo& text1,
483 const TextViewProcessor::TextLayoutInfo& text2 )
485 if( !TestEqual( text1.mWholeTextSize.x, text2.mWholeTextSize.x ) )
489 if( !TestEqual( text1.mWholeTextSize.y, text2.mWholeTextSize.y ) )
494 if( !TestEqual( text1.mMaxWordWidth, text2.mMaxWordWidth ) )
499 if( text1.mNumberOfCharacters != text2.mNumberOfCharacters )
504 if( text1.mLinesLayoutInfo.size() != text2.mLinesLayoutInfo.size() )
509 for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it1 = text1.mLinesLayoutInfo.begin(), endIt1 = text1.mLinesLayoutInfo.end(),
510 it2 = text2.mLinesLayoutInfo.begin(), endIt2 = text2.mLinesLayoutInfo.end();
511 ( it1 != endIt1 ) && ( it2 != endIt2 );
514 if( !TestEqual( *it1, *it2 ) )
524 * Splits the \e input word in two by the given \e position and checks the results with \e firstResult and \e lastResult.
526 * If the test fails it prints a short description and the line where this function was called.
528 * @param description Short description of the experiment. i.e. "Split the word from the beginning. (position 0)".
529 * @param input The input word.
530 * @param position Where to split the word.
531 * @param firstResult First part of the split word.
532 * @param lastResult Last part of the split word.
533 * @param location Where this function has been called.
535 * @return \e true if the experiment is successful. Otherwise returns \e false.
537 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 )
539 tet_printf( "%s", description.c_str() );
541 // Create layout info for the input word.
542 Toolkit::Internal::TextView::RelayoutData relayoutData;
543 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
545 MarkupProcessor::StyledTextArray inputStyledText;
546 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
548 TextViewProcessor::CreateTextInfo( inputStyledText,
549 DEFAULT_LAYOUT_PARAMETERS,
552 // Get the input word
553 TextViewProcessor::WordLayoutInfo inputWordLayout;
555 if( !inputLayout.mLinesLayoutInfo.empty() )
557 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
558 if( !line.mWordGroupsLayoutInfo.empty() )
560 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
561 if( !group.mWordsLayoutInfo.empty() )
563 inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
568 // Create layout info for the first part of the result (after split the word)
570 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
571 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
573 MarkupProcessor::StyledTextArray firstResultStyledText;
574 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
576 TextViewProcessor::CreateTextInfo( firstResultStyledText,
577 DEFAULT_LAYOUT_PARAMETERS,
580 // Get the first result word
581 TextViewProcessor::WordLayoutInfo firstResultWordLayout;
583 if( !firstResultLayout.mLinesLayoutInfo.empty() )
585 const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
586 if( !line.mWordGroupsLayoutInfo.empty() )
588 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
589 if( !group.mWordsLayoutInfo.empty() )
591 firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
596 // Create layout info for the last part of the result (after split the word)
598 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
599 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
601 MarkupProcessor::StyledTextArray lastResultStyledText;
602 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
604 TextViewProcessor::CreateTextInfo( lastResultStyledText,
605 DEFAULT_LAYOUT_PARAMETERS,
608 // Get the last result word
609 TextViewProcessor::WordLayoutInfo lastResultWordLayout;
611 if( !lastResultLayout.mLinesLayoutInfo.empty() )
613 const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
614 if( !line.mWordGroupsLayoutInfo.empty() )
616 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
617 if( !group.mWordsLayoutInfo.empty() )
619 lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
626 TextViewProcessor::WordLayoutInfo lastWordLayoutInfo;
630 lastWordLayoutInfo );
633 if( !TestEqual( inputWordLayout, firstResultWordLayout ) )
635 tet_printf( "Fail. different layout info. %s", location );
639 if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) )
641 tet_printf( "Fail. different layout info. %s", location );
649 * 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.
651 * If the test fails it prints a short description and the line where this function was called.
653 * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)".
654 * @param input The input word.
655 * @param wordPosition Index to the word within the group where to split the group.
656 * @param position Where to split the word.
657 * @param firstResult First part of the split group of words.
658 * @param lastResult Last part of the split group of words.
659 * @param location Where this function has been called.
661 * @return \e true if the experiment is successful. Otherwise returns \e false.
663 bool TestSplitWordGroup( const std::string& description,
664 const std::string& input,
665 const size_t wordPosition,
666 const size_t position,
667 const std::string& firstResult,
668 const std::string& lastResult,
669 const char* location )
671 tet_printf( "%s", description.c_str() );
673 // Create layout info for the input group of words.
674 Toolkit::Internal::TextView::RelayoutData relayoutData;
675 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
677 MarkupProcessor::StyledTextArray inputStyledText;
678 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
680 TextViewProcessor::CreateTextInfo( inputStyledText,
681 DEFAULT_LAYOUT_PARAMETERS,
684 // Get the input group of words
685 TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
687 if( !inputLayout.mLinesLayoutInfo.empty() )
689 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
690 if( !line.mWordGroupsLayoutInfo.empty() )
692 inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
696 // Create layout info for the first part of the result (after split the group of words)
698 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
699 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
701 MarkupProcessor::StyledTextArray firstResultStyledText;
702 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
704 TextViewProcessor::CreateTextInfo( firstResultStyledText,
705 DEFAULT_LAYOUT_PARAMETERS,
708 // Get the first result group of words
709 TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
711 if( !firstResultLayout.mLinesLayoutInfo.empty() )
713 const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
714 if( !line.mWordGroupsLayoutInfo.empty() )
716 firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
720 // Create layout info for the last part of the result (after split the group of words)
722 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
723 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
725 MarkupProcessor::StyledTextArray lastResultStyledText;
726 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
728 TextViewProcessor::CreateTextInfo( lastResultStyledText,
729 DEFAULT_LAYOUT_PARAMETERS,
732 // Get the last result group of words
733 TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
735 if( !lastResultLayout.mLinesLayoutInfo.empty() )
737 const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
738 if( !line.mWordGroupsLayoutInfo.empty() )
740 lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
744 // Split the group of words.
746 TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
748 TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
749 SplitWordGroup( indices,
750 inputWordGroupLayout,
751 lastWordGroupLayoutInfo );
754 if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
756 tet_printf( "Fail. different layout info. %s", location );
760 if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
762 tet_printf( "Fail. different layout info. %s", location );
770 * 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.
772 * If the test fails it prints a short description and the line where this function was called.
774 * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
775 * @param input The input word.
776 * @param groupPosition Index to the group of words within the line where to split the line.
777 * @param wordPosition Index to the word within the group where to split the group.
778 * @param position Where to split the word.
779 * @param lineHeightOffset Offset between lines.
780 * @param firstResult First part of the split line.
781 * @param lastResult Last part of the split line.
782 * @param location Where this function has been called.
784 * @return \e true if the experiment is successful. Otherwise returns \e false.
786 bool TestSplitLine( const std::string& description,
787 const std::string& input,
788 const size_t groupPosition,
789 const size_t wordPosition,
790 const size_t position,
791 const float lineHeightOffset,
792 const std::string& firstResult,
793 const std::string& lastResult,
794 const char* location )
796 tet_printf( "%s", description.c_str() );
798 // Create layout info for the input line.
799 Toolkit::Internal::TextView::RelayoutData relayoutData;
800 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
802 MarkupProcessor::StyledTextArray inputStyledText;
803 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
805 TextViewProcessor::CreateTextInfo( inputStyledText,
806 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
807 Toolkit::TextView::Original,
808 Toolkit::TextView::Original,
809 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
810 Toolkit::TextView::Center,
811 PointSize( lineHeightOffset ),
812 std::string( "..." ),
816 // Get the input line
817 TextViewProcessor::LineLayoutInfo inputLineLayout;
819 if( !inputLayout.mLinesLayoutInfo.empty() )
821 inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
824 // Create layout info for the first part of the result (after split the line)
826 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
827 TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
829 MarkupProcessor::StyledTextArray firstResultStyledText;
830 MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
832 TextViewProcessor::CreateTextInfo( firstResultStyledText,
833 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
834 Toolkit::TextView::Original,
835 Toolkit::TextView::Original,
836 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
837 Toolkit::TextView::Center,
838 PointSize( lineHeightOffset ),
839 std::string( "..." ),
843 // Get the first result line
844 TextViewProcessor::LineLayoutInfo firstResultLineLayout;
846 if( !firstResultLayout.mLinesLayoutInfo.empty() )
848 firstResultLineLayout = *firstResultLayout.mLinesLayoutInfo.begin();
851 // Create layout info for the last part of the result (after split the line)
853 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
854 TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
856 MarkupProcessor::StyledTextArray lastResultStyledText;
857 MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
859 TextViewProcessor::CreateTextInfo( lastResultStyledText,
860 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
861 Toolkit::TextView::Original,
862 Toolkit::TextView::Original,
863 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
864 Toolkit::TextView::Center,
865 PointSize( lineHeightOffset ),
870 // Get the last result line
871 TextViewProcessor::LineLayoutInfo lastResultLineLayout;
873 if( !lastResultLayout.mLinesLayoutInfo.empty() )
875 lastResultLineLayout = *lastResultLayout.mLinesLayoutInfo.begin();
880 TextViewProcessor::LineLayoutInfo lastLineLayoutInfo;
882 TextViewProcessor::TextInfoIndices indices( 0, groupPosition, wordPosition, position );
884 PointSize( lineHeightOffset ),
886 lastLineLayoutInfo );
889 if( !TestEqual( inputLineLayout, firstResultLineLayout ) )
891 tet_printf( "Fail. different layout info. %s", location );
895 if( !TestEqual( lastLineLayoutInfo, lastResultLineLayout ) )
897 tet_printf( "Fail. different layout info. %s", location );
905 * Merges the \e inputFirst word and the \e inputLast word, and checks the results with \e result.
907 * If the test fails it prints a short description and the line where this function was called.
909 * @param description Short description of the experiment. i.e. "Merge two words with same style".
910 * @param inputFirst The first part of the word.
911 * @param inputLast The last part of the word.
912 * @param result The merged word.
913 * @param location Where this function has been called.
915 * @return \e true if the experiment is successful. Otherwise returns \e false.
917 bool TestMergeWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
919 tet_printf( "%s", description.c_str() );
921 // Create layout info for the inputFirst word.
922 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
923 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
925 MarkupProcessor::StyledTextArray inputFirstStyledText;
926 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
928 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
929 DEFAULT_LAYOUT_PARAMETERS,
932 // Get the input word
933 TextViewProcessor::WordLayoutInfo inputFirstWordLayout;
935 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
937 const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
938 if( !line.mWordGroupsLayoutInfo.empty() )
940 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
941 if( !group.mWordsLayoutInfo.empty() )
943 inputFirstWordLayout = *( *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
948 // Create layout info for the inputLast word.
949 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
950 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
952 MarkupProcessor::StyledTextArray inputLastStyledText;
953 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
955 TextViewProcessor::CreateTextInfo( inputLastStyledText,
956 DEFAULT_LAYOUT_PARAMETERS,
959 // Get the input word
960 TextViewProcessor::WordLayoutInfo inputLastWordLayout;
962 if( !inputLastLayout.mLinesLayoutInfo.empty() )
964 const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
965 if( !line.mWordGroupsLayoutInfo.empty() )
967 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
968 if( !group.mWordsLayoutInfo.empty() )
970 inputLastWordLayout = *( *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
975 // Create layout info for the result word.
976 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
977 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
979 MarkupProcessor::StyledTextArray resultStyledText;
980 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
982 TextViewProcessor::CreateTextInfo( resultStyledText,
983 DEFAULT_LAYOUT_PARAMETERS,
984 resultRelayoutData );
986 // Get the result word
987 TextViewProcessor::WordLayoutInfo resultWordLayout;
989 if( !resultLayout.mLinesLayoutInfo.empty() )
991 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
992 if( !line.mWordGroupsLayoutInfo.empty() )
994 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
995 if( !group.mWordsLayoutInfo.empty() )
997 resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1002 MergeWord( inputFirstWordLayout,
1003 inputLastWordLayout );
1005 if( !TestEqual( inputFirstWordLayout, resultWordLayout ) )
1007 tet_printf( "Fail. different layout info. %s", location );
1015 * Merges the \e inputFirst group of words and the \e inputLast group of words, and checks the results with \e result.
1017 * If the test fails it prints a short description and the line where this function was called.
1019 * @param description Short description of the experiment.
1020 * @param inputFirst The first part of the group of words.
1021 * @param inputLast The last part of the group of words.
1022 * @param result The merged group of word.
1023 * @param location Where this function has been called.
1025 * @return \e true if the experiment is successful. Otherwise returns \e false.
1027 bool TestMergeGroupsOfWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
1029 tet_printf( "%s", description.c_str() );
1031 // Create layout info for the inputFirst group of word.
1032 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
1033 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
1035 MarkupProcessor::StyledTextArray inputFirstStyledText;
1036 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
1038 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
1039 DEFAULT_LAYOUT_PARAMETERS,
1040 firstRelayoutData );
1042 // Get the input group of words.
1043 TextViewProcessor::WordGroupLayoutInfo inputFirstWordGroupLayout;
1045 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
1047 const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
1048 if( !line.mWordGroupsLayoutInfo.empty() )
1050 inputFirstWordGroupLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1054 // Create layout info for the inputLast group of words.
1055 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
1056 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
1058 MarkupProcessor::StyledTextArray inputLastStyledText;
1059 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
1061 TextViewProcessor::CreateTextInfo( inputLastStyledText,
1062 DEFAULT_LAYOUT_PARAMETERS,
1065 // Get the input group of words
1066 TextViewProcessor::WordGroupLayoutInfo inputLastWordGroupLayout;
1068 if( !inputLastLayout.mLinesLayoutInfo.empty() )
1070 const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
1071 if( !line.mWordGroupsLayoutInfo.empty() )
1073 inputLastWordGroupLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1077 // Create layout info for the result group of words.
1078 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1079 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1081 MarkupProcessor::StyledTextArray resultStyledText;
1082 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1084 TextViewProcessor::CreateTextInfo( resultStyledText,
1085 DEFAULT_LAYOUT_PARAMETERS,
1086 resultRelayoutData );
1088 // Get the result word
1089 TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
1091 if( !resultLayout.mLinesLayoutInfo.empty() )
1093 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1094 if( !line.mWordGroupsLayoutInfo.empty() )
1096 resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1100 MergeWordGroup( inputFirstWordGroupLayout,
1101 inputLastWordGroupLayout );
1103 if( !TestEqual( inputFirstWordGroupLayout, resultWordGroupLayout ) )
1105 tet_printf( "Fail. different layout info. %s", location );
1113 * Merges the \e inputFirst line and the \e inputLast line, and checks the results with \e result.
1115 * If the test fails it prints a short description and the line where this function was called.
1117 * @param description Short description of the experiment.
1118 * @param inputFirst The first part of the line.
1119 * @param inputLast The last part of the line.
1120 * @param lineHeightOffset Offset between lines.
1121 * @param result The merged line.
1122 * @param location Where this function has been called.
1124 * @return \e true if the experiment is successful. Otherwise returns \e false.
1126 bool TestMergeLines( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const float lineHeightOffset, const std::string& result, const char* location )
1128 tet_printf( "%s", description.c_str() );
1130 // Create layout info for the inputFirst line.
1131 Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
1132 TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
1134 MarkupProcessor::StyledTextArray inputFirstStyledText;
1135 MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
1137 TextViewProcessor::CreateTextInfo( inputFirstStyledText,
1138 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1139 Toolkit::TextView::Original,
1140 Toolkit::TextView::Original,
1141 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1142 Toolkit::TextView::Center,
1143 PointSize( lineHeightOffset ),
1144 std::string( "..." ),
1146 firstRelayoutData );
1148 // Get the input word
1149 TextViewProcessor::LineLayoutInfo inputFirstLineLayout;
1151 if( !inputFirstLayout.mLinesLayoutInfo.empty() )
1153 inputFirstLineLayout = *inputFirstLayout.mLinesLayoutInfo.begin();
1156 // Create layout info for the inputLast line.
1157 Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
1158 TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
1160 MarkupProcessor::StyledTextArray inputLastStyledText;
1161 MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
1163 TextViewProcessor::CreateTextInfo( inputLastStyledText,
1164 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1165 Toolkit::TextView::Original,
1166 Toolkit::TextView::Original,
1167 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1168 Toolkit::TextView::Center,
1169 PointSize( lineHeightOffset ),
1170 std::string( "..." ),
1174 // Get the input word
1175 TextViewProcessor::LineLayoutInfo inputLastLineLayout;
1177 if( !inputLastLayout.mLinesLayoutInfo.empty() )
1179 inputLastLineLayout = *inputLastLayout.mLinesLayoutInfo.begin();
1182 // Create layout info for the result word.
1183 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1184 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1186 MarkupProcessor::StyledTextArray resultStyledText;
1187 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1189 TextViewProcessor::CreateTextInfo( resultStyledText,
1190 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1191 Toolkit::TextView::Original,
1192 Toolkit::TextView::Original,
1193 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1194 Toolkit::TextView::Center,
1195 PointSize( lineHeightOffset ),
1196 std::string( "..." ),
1198 resultRelayoutData );
1200 // Get the result word
1201 TextViewProcessor::LineLayoutInfo resultLineLayout;
1203 if( !resultLayout.mLinesLayoutInfo.empty() )
1205 resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
1208 MergeLine( inputFirstLineLayout,
1209 inputLastLineLayout );
1211 if( !TestEqual( inputFirstLineLayout, resultLineLayout ) )
1213 tet_printf( "Fail. different layout info. %s", location );
1221 * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result.
1223 * If the test fails it prints a short description and the line where this function was called.
1225 * @param description Short description of the experiment. i.e. "Remove a whole group of characters. Merge".
1226 * @param input The input word.
1227 * @param position Where to start to remove characters
1228 * @param numberOfCharacters The number of characters to remove.
1229 * @param result The word without the removed characters.
1230 * @param location Where this function has been called.
1232 * @return \e true if the experiment is successful. Otherwise returns \e false.
1234 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 )
1236 tet_printf( "%s", description.c_str() );
1238 // Create layout info for the input word.
1239 Toolkit::Internal::TextView::RelayoutData relayoutData;
1240 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1242 MarkupProcessor::StyledTextArray inputStyledText;
1243 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1245 TextViewProcessor::CreateTextInfo( inputStyledText,
1246 DEFAULT_LAYOUT_PARAMETERS,
1249 // Get the input word
1250 TextViewProcessor::WordLayoutInfo inputWordLayout;
1252 if( !inputLayout.mLinesLayoutInfo.empty() )
1254 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
1255 if( !line.mWordGroupsLayoutInfo.empty() )
1257 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
1258 if( !group.mWordsLayoutInfo.empty() )
1260 inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1265 // Create layout info for the result word.
1266 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1267 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1269 MarkupProcessor::StyledTextArray resultStyledText;
1270 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1272 TextViewProcessor::CreateTextInfo( resultStyledText,
1273 DEFAULT_LAYOUT_PARAMETERS,
1274 resultRelayoutData );
1276 // Get the result word
1277 TextViewProcessor::WordLayoutInfo resultWordLayout;
1279 if( !resultLayout.mLinesLayoutInfo.empty() )
1281 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1282 if( !line.mWordGroupsLayoutInfo.empty() )
1284 const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
1285 if( !group.mWordsLayoutInfo.empty() )
1287 resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
1292 RemoveCharactersFromWord( position,
1296 if( !TestEqual( inputWordLayout, resultWordLayout ) )
1298 tet_printf( "Fail. different layout info. %s", location );
1306 * 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.
1308 * If the test fails it prints a short description and the line where this function was called.
1310 * @param description Short description of the experiment.
1311 * @param input The input group of words.
1312 * @param wordIndex Where to start to remove words.
1313 * @param numberOfWords The number of words to remove.
1314 * @param result The group of words without the removed words.
1315 * @param location Where this function has been called.
1317 * @return \e true if the experiment is successful. Otherwise returns \e false.
1319 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 )
1321 tet_printf( "%s", description.c_str() );
1323 // Create layout info for the input group of words.
1324 Toolkit::Internal::TextView::RelayoutData relayoutData;
1325 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1327 MarkupProcessor::StyledTextArray inputStyledText;
1328 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1330 TextViewProcessor::CreateTextInfo( inputStyledText,
1331 DEFAULT_LAYOUT_PARAMETERS,
1334 // Get the input group of words
1335 TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
1337 if( !inputLayout.mLinesLayoutInfo.empty() )
1339 const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
1340 if( !line.mWordGroupsLayoutInfo.empty() )
1342 inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1346 // Create layout info for the result group of words.
1347 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1348 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1350 MarkupProcessor::StyledTextArray resultStyledText;
1351 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1353 TextViewProcessor::CreateTextInfo( resultStyledText,
1354 DEFAULT_LAYOUT_PARAMETERS,
1355 resultRelayoutData );
1357 // Get the result group of words.
1358 TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
1360 if( !resultLayout.mLinesLayoutInfo.empty() )
1362 const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
1363 if( !line.mWordGroupsLayoutInfo.empty() )
1365 resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
1369 RemoveWordsFromWordGroup( wordIndex,
1371 inputWordGroupLayout );
1373 if( !TestEqual( inputWordGroupLayout, resultWordGroupLayout ) )
1375 tet_printf( "Fail. different layout info. %s", location );
1384 * 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.
1386 * If the test fails it prints a short description and the line where this function was called.
1388 * @param description Short description of the experiment.
1389 * @param input The input line.
1390 * @param groupIndex Where to start to remove groups of words
1391 * @param numberOfGroups The number of groups of words to remove.
1392 * @param lineHeightOffset Offset between lines.
1393 * @param result The line without the removed groups of words.
1394 * @param location Where this function has been called.
1396 * @return \e true if the experiment is successful. Otherwise returns \e false.
1398 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 )
1400 tet_printf( "%s", description.c_str() );
1402 // Create layout info for the input line.
1403 Toolkit::Internal::TextView::RelayoutData relayoutData;
1404 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1406 MarkupProcessor::StyledTextArray inputStyledText;
1407 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1409 TextViewProcessor::CreateTextInfo( inputStyledText,
1410 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1411 Toolkit::TextView::Original,
1412 Toolkit::TextView::Original,
1413 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1414 Toolkit::TextView::Center,
1415 PointSize( lineHeightOffset ),
1416 std::string( "..." ),
1420 // Get the input line
1421 TextViewProcessor::LineLayoutInfo inputLineLayout;
1423 if( !inputLayout.mLinesLayoutInfo.empty() )
1425 inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
1428 // Create layout info for the result line.
1429 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1430 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1432 MarkupProcessor::StyledTextArray resultStyledText;
1433 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1435 TextViewProcessor::CreateTextInfo( resultStyledText,
1436 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1437 Toolkit::TextView::Original,
1438 Toolkit::TextView::Original,
1439 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1440 Toolkit::TextView::Center,
1441 PointSize( lineHeightOffset ),
1442 std::string( "..." ),
1444 resultRelayoutData );
1446 // Get the result line
1447 TextViewProcessor::LineLayoutInfo resultLineLayout;
1449 if( !resultLayout.mLinesLayoutInfo.empty() )
1451 resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
1454 RemoveWordGroupsFromLine( groupIndex,
1456 PointSize( lineHeightOffset ),
1459 if( !TestEqual( inputLineLayout, resultLineLayout ) )
1461 tet_printf( "Fail. different layout info. %s", location );
1469 * Tests inserts, removes and updates operation in the given \e input text and checks with the given \e result.
1471 * If the test fails it prints a short description and the line where this function was called.
1473 * @param description Short description of the experiment.
1474 * @param operation Type of update operation (insert, remove, replace)
1475 * @param input The input text.
1476 * @param position Where to insert, remove or replace text.
1477 * @param numberOfCharacters Number of characters to remove or replace.
1478 * @param inputText Inserted or updated text.
1479 * @param lineHeightOffset Offset between lines.
1480 * @param result Expected result.
1481 * @param location Where this function has been called.
1483 * @return \e true if the experiment is successful. Otherwise returns \e false.
1485 bool TestUpdateTextInfo( const std::string& description,
1486 const UpdateTextInfoOperation operation,
1487 const std::string& input,
1488 const std::size_t position,
1489 const std::size_t numberOfCharacters,
1490 const std::string& inputText,
1491 const float lineHeightOffset,
1492 const std::string& result,
1493 const char* location )
1495 tet_printf( "%s", description.c_str() );
1497 // Create layout info for the input.
1498 Toolkit::Internal::TextView::RelayoutData relayoutData;
1499 TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
1501 MarkupProcessor::StyledTextArray inputStyledText;
1502 MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
1504 TextViewProcessor::CreateTextInfo( inputStyledText,
1505 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1506 Toolkit::TextView::Original,
1507 Toolkit::TextView::Original,
1508 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1509 Toolkit::TextView::Center,
1510 PointSize( lineHeightOffset ),
1511 std::string( "..." ),
1515 // Create layout info for the result.
1516 Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
1517 TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
1519 MarkupProcessor::StyledTextArray resultStyledText;
1520 MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
1522 TextViewProcessor::CreateTextInfo( resultStyledText,
1523 Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
1524 Toolkit::TextView::Original,
1525 Toolkit::TextView::Original,
1526 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1527 Toolkit::TextView::Center,
1528 PointSize( lineHeightOffset ),
1529 std::string( "..." ),
1531 resultRelayoutData );
1533 // Choose operation and call appropiate UpdateTextInfo() method.
1534 const Toolkit::Internal::TextView::LayoutParameters layoutParameters( Toolkit::TextView::SplitByNewLineChar,
1535 Toolkit::TextView::Original,
1536 Toolkit::TextView::Original,
1537 static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
1538 Toolkit::TextView::Center,
1539 PointSize( lineHeightOffset ),
1540 std::string( "..." ),
1547 MarkupProcessor::StyledTextArray inputStyledText;
1548 MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
1550 TextViewProcessor::UpdateTextInfo( position,
1558 TextViewProcessor::UpdateTextInfo( position,
1562 TextViewProcessor::CLEAR_TEXT );
1567 MarkupProcessor::StyledTextArray inputStyledText;
1568 MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
1570 TextViewProcessor::UpdateTextInfo( position,
1579 tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location );
1584 if( !TestEqual( inputLayout, resultLayout ) )
1586 tet_printf( "Fail. different layout info. %s", location );
1588 std::cout << " result : "; Print( inputLayout );
1589 std::cout << " expected result : "; Print( resultLayout );
1599 int UtcDaliTextViewCreateTextInfo(void)
1601 ToolkitTestApplication application;
1603 tet_infoline("UtcDaliTextViewCreateTextInfo : ");
1605 // Metrics for characters
1608 // size : [9.48351, 9.48351]
1609 // advance : 9.48351
1610 // bearing : 8.53516
1611 // ascender : 8.53516
1614 // size : [11.3802, 11.3802]
1615 // advance : 11.3802
1616 // bearing : 10.2422
1617 // ascender : 10.2422
1620 // size : [13.2769, 13.2769]
1621 // advance : 13.2769
1622 // bearing : 11.9492
1623 // ascender : 11.9492
1625 const float WIDTH_10( 9.48351f );
1626 const float HEIGHT_10( 9.48351f );
1627 const float ADVANCE_10( 9.48351f );
1628 const float BEARING_10( 8.53516f );
1629 const float ASCENDER_10( 8.53516f );
1631 const float WIDTH_12( 11.3802f );
1632 const float HEIGHT_12( 11.3802f );
1633 const float ADVANCE_12( 11.3802f );
1634 const float BEARING_12( 10.2422f );
1635 const float ASCENDER_12( 10.2422f );
1639 Toolkit::Internal::TextView::RelayoutData relayoutData;
1640 TextViewProcessor::TextLayoutInfo& textLayoutInfo( relayoutData.mTextLayoutInfo );
1642 std::string text( "Hel<font size='10'>lo wo</font>rld!\n"
1645 MarkupProcessor::StyledTextArray styledText;
1646 MarkupProcessor::GetStyledTextArray( text, styledText, true );
1648 TextViewProcessor::CreateTextInfo( styledText,
1649 DEFAULT_LAYOUT_PARAMETERS,
1653 // Build the text info with metric values.
1657 TextViewProcessor::CharacterLayoutInfo layoutInfo10; // ( [lo wo])
1658 layoutInfo10.mHeight = HEIGHT_10;
1659 layoutInfo10.mAdvance = ADVANCE_10;
1660 layoutInfo10.mBearing = BEARING_10;
1661 layoutInfo10.mSize = Size( WIDTH_10, HEIGHT_10 );
1662 layoutInfo10.mAscender = ASCENDER_10;
1663 TextViewProcessor::CharacterLayoutInfo layoutInfo12; // ( [Hel], [rld!] and [CR])
1664 layoutInfo12.mHeight = HEIGHT_12;
1665 layoutInfo12.mAdvance = ADVANCE_12;
1666 layoutInfo12.mBearing = BEARING_12;
1667 layoutInfo12.mSize = Size( WIDTH_12, HEIGHT_12 );
1668 layoutInfo12.mAscender = ASCENDER_12;
1671 style10.SetFontPointSize( PointSize( 10.f ) );
1673 style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size.
1675 layoutInfo12.mStyledText.mStyle = style12;
1676 layoutInfo10.mStyledText.mStyle = style10;
1680 TextViewProcessor::WordLayoutInfo wordLayout1, wordLayout2, wordLayout3, wordLayout4;
1683 wordLayout1.mSize = Size( 3.f * WIDTH_12 + 2.f * WIDTH_10, HEIGHT_12 );
1684 wordLayout1.mAscender = ASCENDER_12;
1685 wordLayout1.mType = TextViewProcessor::NoSeparator;
1687 layoutInfo12.mStyledText.mText = Text( "H" );
1688 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // H
1689 layoutInfo12.mStyledText.mText = Text( "e" );
1690 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // e
1691 layoutInfo12.mStyledText.mText = Text( "l" );
1692 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
1693 layoutInfo10.mStyledText.mText = Text( "l" );
1694 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // l
1695 layoutInfo10.mStyledText.mText = Text( "o" );
1696 wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
1699 wordLayout2.mSize = Size( WIDTH_10, HEIGHT_10 );
1700 wordLayout2.mAscender = ASCENDER_10;
1701 wordLayout2.mType = TextViewProcessor::WordSeparator;
1702 layoutInfo10.mStyledText.mText = Text( " " );
1703 wordLayout2.mCharactersLayoutInfo.push_back( layoutInfo10 ); // (white space)
1706 wordLayout3.mSize = Size( 2.f * WIDTH_10 + 4.f * WIDTH_12, HEIGHT_12 );
1707 wordLayout3.mAscender = ASCENDER_12;
1708 wordLayout3.mType = TextViewProcessor::NoSeparator;
1709 layoutInfo10.mStyledText.mText = Text( "w" );
1710 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // w
1711 layoutInfo10.mStyledText.mText = Text( "o" );
1712 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
1713 layoutInfo12.mStyledText.mText = Text( "r" );
1714 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // r
1715 layoutInfo12.mStyledText.mText = Text( "l" );
1716 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
1717 layoutInfo12.mStyledText.mText = Text( "d" );
1718 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // d
1719 layoutInfo12.mStyledText.mText = Text( "!" );
1720 wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // !
1722 // (new line character)
1723 wordLayout4.mSize = Size( 0.f, HEIGHT_12 );
1724 wordLayout4.mAscender = ASCENDER_12;
1725 wordLayout4.mType = TextViewProcessor::LineSeparator;
1726 layoutInfo12.mStyledText.mText = Text( "\n" );
1727 layoutInfo12.mSize.width = 0.f;
1728 wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char)
1732 TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2;
1734 groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
1735 groupLayout1.mAscender = ASCENDER_12;
1736 groupLayout1.mDirection = TextViewProcessor::LTR;
1737 groupLayout1.mNumberOfCharacters = 13;
1738 groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
1739 groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
1740 groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
1741 groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
1743 groupLayout2.mSize = Size( 0.f, HEIGHT_12 );
1744 groupLayout2.mAscender = ASCENDER_12;
1745 groupLayout2.mDirection = TextViewProcessor::LTR;
1746 groupLayout2.mNumberOfCharacters = 1;
1747 groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
1751 TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3;
1753 lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
1754 lineLayout1.mAscender = ASCENDER_12;
1755 lineLayout1.mNumberOfCharacters = 13;
1756 lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 );
1758 lineLayout2.mSize = Size( 0.f, HEIGHT_12 );
1759 lineLayout2.mAscender = ASCENDER_12;
1760 lineLayout2.mNumberOfCharacters = 1;
1761 lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 );
1763 lineLayout3.mSize = Size( 0.f, HEIGHT_12 );
1766 TextViewProcessor::TextLayoutInfo textLayout;
1768 textLayout.mWholeTextSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, 3.f * HEIGHT_12 );
1769 textLayout.mMaxWordWidth = 2.f * WIDTH_10 + 4.f * WIDTH_12;
1770 textLayout.mNumberOfCharacters = 14;
1771 textLayout.mLinesLayoutInfo.push_back( lineLayout1 );
1772 textLayout.mLinesLayoutInfo.push_back( lineLayout2 );
1773 textLayout.mLinesLayoutInfo.push_back( lineLayout3 );
1775 if(!TestEqual( textLayout, textLayoutInfo ))
1777 std::cout << "Layout fails" << std::endl;
1778 Print(textLayout); std::cout << std::endl;
1779 Print(textLayoutInfo); std::cout << std::endl;
1782 DALI_TEST_CHECK( TestEqual( textLayout, textLayoutInfo ) );
1786 int UtcDaliTextViewSplitWord(void)
1788 ToolkitTestApplication application;
1790 tet_infoline("UtcDaliTextViewSplitWord : ");
1792 struct SplitWordTest splitWordTests[] =
1795 std::string( "Split word, position 0." ),
1796 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1799 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1802 std::string( "Split word, position 8." ),
1803 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1805 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1809 std::string( "Split word, position 2." ),
1810 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1812 std::string( "<font size='10'>He</font>" ),
1813 std::string( "<font size='12'>ll</font><font size='10'>oooo</font>" ),
1816 std::string( "Split word, position 3." ),
1817 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1819 std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
1820 std::string( "<font size='12'>l</font><font size='10'>oooo</font>" ),
1823 std::string( "Split word, position 4." ),
1824 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
1826 std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
1827 std::string( "<font size='10'>oooo</font>" ),
1830 const std::size_t numberOfTests( 5 );
1832 for( std::size_t index = 0; index < numberOfTests; ++index )
1834 const SplitWordTest& test = splitWordTests[index];
1836 if( !TestSplitWord( test.description, test.input, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
1838 tet_result( TET_FAIL );
1842 tet_result( TET_PASS );
1846 int UtcDaliTextViewUpdateTextInfo(void)
1848 ToolkitTestApplication application;
1850 tet_infoline("UtcDaliTextViewUpdateTextInfo : ");
1852 struct UpdateTextInfoTest updateTextInfoTest[] =
1854 // Remove operations
1857 std::string( "Remove from new line character to first character next line." ),
1859 std::string("Hello world\nhello world."),
1864 std::string("Hello worldello world."),
1867 std::string( "Replace style from new line character to first character next line." ),
1869 std::string("Hello world\nhello world."),
1872 std::string("<b>\nh</b>"),
1874 std::string("Hello world<b>\nh</b>ello world."),
1877 std::string( "Remove from the beginning to the middle of last word." ),
1879 std::string("Hello world, hello world."),
1882 std::string(), // Not used.
1887 std::string( "Remove from the beginning to the middle of the text." ),
1889 std::string("Hello world hello world."),
1892 std::string(), // Not used.
1894 std::string("hello world."),
1896 // Remove within the same word:
1897 // * within the same group of characters.
1899 std::string( "Remove within the same word, within the same group of characters" ),
1901 std::string("Hello <font size='30'>world\nhello</font> world"),
1904 std::string(), // Not used.
1906 std::string( "Hello <font size='30'>wd\nhello</font> world" )
1908 // * whole group of characters (merge adjacent group of characters)
1910 std::string( "Remove within the same word, whole group of characters (merge adjacent group of characters)" ),
1912 std::string("Hello <font size='30'>w<font size='20'>orl</font>d\nhello</font> world"),
1915 std::string(), // Not used.
1917 std::string( "Hello <font size='30'>wd\nhello</font> world" )
1919 // * whole group of characters (don't merge adjacent gtoup of characters)
1921 std::string( "Remove within the same word, whole group of characters (don't merge adjacent gtoup of characters)" ),
1923 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1926 std::string(), // Not used.
1928 std::string( "Hello <font size='30'>w</font><font size='10'>d\nhello</font> world" )
1930 // * Remove whole word (merge words)
1932 std::string( "Remove within the same word, whole word (merge words)" ),
1934 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1937 std::string(), // Not used.
1939 std::string( "Hello<font size='30'>w</font>orl<font size='10'>d\nhello</font> world" )
1941 // * Remove whole word (don't merge words)
1943 std::string( "Remove within the same word, whole word (don't merge words)" ),
1945 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1948 std::string(), // Not used.
1950 std::string( "Hello <font size='10'>\nhello</font> world" )
1952 // * Remove whole word (merge lines)
1954 std::string( "Remove within the same word, whole word (merge lines)" ),
1956 std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
1959 std::string(), // Not used.
1961 std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> world" )
1963 // * Remove whole group of words
1964 /* TODO check this when RTL text is working
1966 std::string( "Remove within the same line, whole group of words (merge groups)" ),
1968 std::string("Hello world, שלום עולם, hello world"),
1971 std::string(), // Not used.
1973 std::string( "Hello worlello world" )
1976 // * Remove whole line
1978 std::string( "Remove whole line" ),
1980 std::string("Hello world, hello world\n"
1981 "Hello world, hello world\n"
1982 "Hello world, hello world\n"
1983 "Hello world, hello world\n"),
1986 std::string(), // Not used.
1988 std::string("Hello world, hello world\n"
1989 "Hello world, hello world\n"
1990 "Hello world, hello world\n"),
1993 std::string( "Remove whole line" ),
1995 std::string("Hello world, hello world\n"
1999 std::string(), // Not used.
2001 std::string("Hello world, hello world\n"),
2005 // Insert operations
2007 std::string( "insert some text" ),
2009 std::string("inpuext"),
2012 std::string( "t t" ),
2014 std::string( "input text" )
2017 std::string( "Insert text at the end" ),
2019 std::string("touch "),
2022 std::string("me\nhello"),
2024 std::string("touch me\nhello")
2027 // Replace operations.
2029 std::string( "Replace style from the beginning to some point in the middle of the text." ),
2031 std::string( "Hello <font color='green'>world</font>" ),
2034 std::string( "<font color='red'>Hello w</font>" ),
2036 std::string( "<font color='red'>Hello w</font><font color='green'>orld</font>" )
2039 std::string( "Replace style from the middle of the text to the end." ),
2041 std::string( "Touch me\nhello" ),
2044 std::string( "<b>me\nhello</b>" ),
2046 std::string( "Touch <b>me\nhello</b>" )
2049 std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 1." ),
2051 std::string( "Touch me\nhello\nworld" ),
2056 std::string( "Touch \nworld" )
2059 std::string( "Insert styled text in the middle of a text. Previous: Replace style from the middle of the text 1." ),
2061 std::string( "Touch \nworld" ),
2064 std::string( "<b>me\nhello</b>" ),
2066 std::string( "Touch <b>me\nhello</b>\nworld" )
2069 std::string( "Replace style from the middle of the text 1." ),
2071 std::string( "Touch me\nhello\nworld" ),
2074 std::string( "<b>me\nhello</b>" ),
2076 std::string( "Touch <b>me\nhello</b>\nworld" )
2079 std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 2." ),
2081 std::string( "Touch me\nhello\nworld" ),
2086 std::string( "Touch world" )
2089 std::string( "Replace style from the middle of the text 2." ),
2091 std::string( "Touch me\nhello\nworld" ),
2094 std::string( "<b>me\nhello\n</b>" ),
2096 std::string( "Touch <b>me\nhello\n</b>world" )
2099 const std::size_t numberOfTests( 21 );
2101 for( std::size_t index = 0; index < numberOfTests; ++index )
2103 const UpdateTextInfoTest& test = updateTextInfoTest[index];
2105 if( !TestUpdateTextInfo( test.description, test.operation, test.input, test.position, test.numberOfCharacters, test.inputText, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2107 tet_result( TET_FAIL );
2111 tet_result( TET_PASS );
2115 int UtcDaliTextViewSplitWordGroup(void)
2117 ToolkitTestApplication application;
2119 tet_infoline("UtcDaliTextViewSplitWordGroup : ");
2121 struct SplitWordGroupTest splitWordGroupTests[] =
2124 std::string( "Split word group, wordPosition 0, position 0." ),
2125 std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
2129 std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
2132 std::string( "Split word group, wordPosition 2, position 8." ),
2133 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2136 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2140 std::string( "Split word group, wordPosition 0, position 2." ),
2141 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2144 std::string( "<font size='10'>He</font>" ),
2145 std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
2148 std::string( "Split word group, wordPosition 0, position 3." ),
2149 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2152 std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
2153 std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
2156 std::string( "Split word group, wordPosition 0, position 4." ),
2157 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2160 std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
2161 std::string( "<font size='10'>oooo wooorld</font>" ),
2164 std::string( "Split word group, wordPosition 1, position 0." ),
2165 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
2168 std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
2169 std::string( "<font size='10'> wooorld</font>" ),
2172 const std::size_t numberOfTests( 6 );
2174 for( std::size_t index = 0; index < numberOfTests; ++index )
2176 const SplitWordGroupTest& test = splitWordGroupTests[index];
2178 if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
2180 tet_result( TET_FAIL );
2184 tet_result( TET_PASS );
2188 int UtcDaliTextViewSplitLine(void)
2190 ToolkitTestApplication application;
2192 tet_infoline("UtcDaliTextViewSplitLine : ");
2194 struct SplitLineTest splitLineTests[] =
2197 std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ),
2198 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2204 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2207 std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
2208 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2213 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2216 /* TODO check when RTL is working.
2218 std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
2219 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2224 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
2225 std::string( " עולם text text" ),
2228 std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
2229 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2234 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
2235 std::string( "שלום עולם text text" ),
2239 std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
2240 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
2245 std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
2246 std::string( "text text" ),
2249 const std::size_t numberOfTests( 3 );
2251 for( std::size_t index = 0; index < numberOfTests; ++index )
2253 const SplitLineTest& test = splitLineTests[index];
2255 if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) )
2257 tet_result( TET_FAIL );
2261 tet_result( TET_PASS );
2265 int UtcDaliTextViewMergeWord01(void)
2267 ToolkitTestApplication application;
2269 tet_infoline("UtcDaliTextViewMergeWord01 : ");
2271 struct MergeWordsTest mergeWordsTests[] =
2274 std::string( "Merge words with same style." ),
2275 std::string( "Hel" ),
2276 std::string( "lo" ),
2277 std::string( "Hello" ),
2280 std::string( "Merge words with different styles." ),
2281 std::string( "<font size='10>Hel</font>" ),
2282 std::string( "<font size='20'>lo</font>" ),
2283 std::string( "<font size='10'>Hel</font><font size='20'>lo</font>" )
2286 const std::size_t numberOfTests( 2 );
2288 for( std::size_t index = 0; index < numberOfTests; ++index )
2290 const MergeWordsTest& test = mergeWordsTests[index];
2292 if( !TestMergeWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
2294 tet_result( TET_FAIL );
2298 tet_result( TET_PASS );
2302 int UtcDaliTextViewMergeWord02(void)
2305 // It test white spaces and new line characters can't be merged to other words.
2307 ToolkitTestApplication application;
2309 tet_infoline("UtcDaliTextViewMergeWord02 : ");
2311 // Generate three words
2313 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2314 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2315 Toolkit::Internal::TextView::RelayoutData relayoutData03;
2316 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2317 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2318 TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
2320 std::string text01( " " );
2321 std::string text02( "\n" );
2322 std::string text03( "a" );
2323 MarkupProcessor::StyledTextArray styledText01;
2324 MarkupProcessor::StyledTextArray styledText02;
2325 MarkupProcessor::StyledTextArray styledText03;
2326 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2327 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2328 MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
2330 TextViewProcessor::CreateTextInfo( styledText01,
2331 DEFAULT_LAYOUT_PARAMETERS,
2334 TextViewProcessor::WordLayoutInfo wordLayoutInfo01;
2336 wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2338 TextViewProcessor::CreateTextInfo( styledText02,
2339 DEFAULT_LAYOUT_PARAMETERS,
2342 TextViewProcessor::WordLayoutInfo wordLayoutInfo02;
2344 wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2346 TextViewProcessor::CreateTextInfo( styledText03,
2347 DEFAULT_LAYOUT_PARAMETERS,
2350 TextViewProcessor::WordLayoutInfo wordLayoutInfo03;
2352 wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
2354 // Test MergeWord() asserts if white spaces or new line chars are merged.
2355 bool assert1 = false;
2356 bool assert2 = false;
2357 bool assert3 = false;
2358 bool assert4 = false;
2359 bool assert5 = false;
2360 bool assert6 = false;
2364 MergeWord( wordLayoutInfo01,
2367 catch( Dali::DaliException& e )
2369 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2370 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2375 MergeWord( wordLayoutInfo01,
2378 catch( Dali::DaliException& e )
2380 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2381 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2386 MergeWord( wordLayoutInfo02,
2389 catch( Dali::DaliException& e )
2391 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2392 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2397 MergeWord( wordLayoutInfo02,
2400 catch( Dali::DaliException& e )
2402 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2403 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2408 MergeWord( wordLayoutInfo03,
2411 catch( Dali::DaliException& e )
2413 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2414 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2419 MergeWord( wordLayoutInfo03,
2422 catch( Dali::DaliException& e )
2424 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2425 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
2429 if( assert1 && assert2 && assert3 && assert4 && assert5 && assert6 )
2431 tet_result( TET_PASS );
2435 tet_result( TET_FAIL );
2440 int UtcDaliTextViewMergeGroup01(void)
2442 ToolkitTestApplication application;
2444 tet_infoline("UtcDaliTextViewMergeGroup01 : ");
2446 struct MergeWordGroupsTest mergeWordGroupssTests[] =
2449 std::string( "Merge a void first group." ),
2451 std::string( "Hello world" ),
2452 std::string( "Hello world" ),
2455 std::string( "Merge a void last group." ),
2456 std::string( "Hello world" ),
2458 std::string( "Hello world" ),
2461 std::string( "Merge groups and merge last and first words." ),
2462 std::string( "Hello wor" ),
2463 std::string( "ld, hello world" ),
2464 std::string( "Hello world, hello world" ),
2467 std::string( "Merge groups and don't merge last and first words." ),
2468 std::string( "Hello world, " ),
2469 std::string( "hello world" ),
2470 std::string( "Hello world, hello world" )
2473 const std::size_t numberOfTests( 4 );
2475 for( std::size_t index = 0; index < numberOfTests; ++index )
2477 const MergeWordGroupsTest& test = mergeWordGroupssTests[index];
2479 if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
2481 tet_result( TET_FAIL );
2485 tet_result(TET_PASS);
2489 int UtcDaliTextViewMergeGroup02(void)
2491 ToolkitTestApplication application;
2493 tet_infoline("UtcDaliTextViewMergeGroup02 : ");
2495 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2496 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2497 Toolkit::Internal::TextView::RelayoutData relayoutData03;
2498 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2499 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2500 TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
2502 std::string text01( "Hello \n" );
2503 std::string text02( "world" );
2504 std::string text03( "السلام عليكم" );
2505 MarkupProcessor::StyledTextArray styledText01;
2506 MarkupProcessor::StyledTextArray styledText02;
2507 MarkupProcessor::StyledTextArray styledText03;
2508 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2509 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2510 MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
2512 TextViewProcessor::CreateTextInfo( styledText01,
2513 DEFAULT_LAYOUT_PARAMETERS,
2516 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01;
2518 wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2520 TextViewProcessor::CreateTextInfo( styledText02,
2521 DEFAULT_LAYOUT_PARAMETERS,
2524 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02;
2526 wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2528 TextViewProcessor::CreateTextInfo( styledText03,
2529 DEFAULT_LAYOUT_PARAMETERS,
2532 TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03;
2534 wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
2536 bool assert1 = false;
2537 bool assert2 = false;
2541 MergeWordGroup( wordGroupLayoutInfo01,
2542 wordGroupLayoutInfo02 );
2544 catch( Dali::DaliException& e )
2546 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2547 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 );
2553 MergeWordGroup( wordGroupLayoutInfo03,
2554 wordGroupLayoutInfo02 );
2556 catch( Dali::DaliException& e )
2558 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2559 DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION );
2563 if( assert1 && assert2 )
2565 tet_result( TET_PASS );
2569 tet_result( TET_FAIL );
2574 int UtcDaliTextViewMergeLine01(void)
2576 ToolkitTestApplication application;
2578 tet_infoline("UtcDaliTextViewMergeLine01 : ");
2580 struct MergeLinesTest mergeLinesTests[] =
2583 std::string( "Merge a void first line." ),
2585 std::string( "Hello world, this is a whole line" ),
2587 std::string( "Hello world, this is a whole line" )
2590 std::string( "Merge a void last line." ),
2591 std::string( "Hello world, this is a whole line" ),
2594 std::string( "Hello world, this is a whole line" )
2596 /* TODO: check when RTL text is working.
2598 std::string( "Merge lines and merge last and first groups" ),
2599 std::string( "Hello world, שלום" ),
2600 std::string( " עולם, hello world." ),
2602 std::string( "Hello world, שלום עולם, hello world." )
2605 std::string( "Merge lines and don't merge last and first words." ),
2606 std::string( "Hello world, " ),
2607 std::string( "שלום עולם, hello world." ),
2609 std::string( "Hello world, שלום עולם, hello world." )
2613 std::string( "Merge lines. Don't merge words" ),
2614 std::string( "Hello world," ),
2615 std::string( " this is a whole line" ),
2617 std::string( "Hello world, this is a whole line" )
2620 std::string( "Merge lines. Merge words" ),
2621 std::string( "Hello world, th" ),
2622 std::string( "is is a whole line" ),
2624 std::string( "Hello world, this is a whole line" )
2627 const std::size_t numberOfTests( 4 );
2629 for( std::size_t index = 0; index < numberOfTests; ++index )
2631 const MergeLinesTest& test = mergeLinesTests[index];
2633 if( !TestMergeLines( test.description, test.inputFirst, test.inputLast, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2635 tet_result( TET_FAIL );
2639 tet_result( TET_PASS );
2643 int UtcDaliTextViewMergeLine02(void)
2645 ToolkitTestApplication application;
2647 tet_infoline("UtcDaliTextViewMergeLine02 : ");
2649 Toolkit::Internal::TextView::RelayoutData relayoutData01;
2650 Toolkit::Internal::TextView::RelayoutData relayoutData02;
2651 TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
2652 TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
2654 std::string text01( "Hello world\n" );
2655 std::string text02( "hello world" );
2656 MarkupProcessor::StyledTextArray styledText01;
2657 MarkupProcessor::StyledTextArray styledText02;
2658 MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
2659 MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
2661 TextViewProcessor::CreateTextInfo( styledText01,
2662 DEFAULT_LAYOUT_PARAMETERS,
2665 TextViewProcessor::LineLayoutInfo lineLayoutInfo01;
2667 lineLayoutInfo01 = *textLayoutInfo01.mLinesLayoutInfo.begin();
2669 TextViewProcessor::CreateTextInfo( styledText02,
2670 DEFAULT_LAYOUT_PARAMETERS,
2673 TextViewProcessor::LineLayoutInfo lineLayoutInfo02;
2675 lineLayoutInfo02 = *textLayoutInfo02.mLinesLayoutInfo.begin();
2677 bool assert1 = false;
2681 MergeLine( lineLayoutInfo01,
2684 catch( Dali::DaliException& e )
2686 tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
2687 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 );
2693 tet_result( TET_PASS );
2697 tet_result( TET_FAIL );
2702 int UtcDaliTextViewRemoveCharactersFromWord(void)
2704 ToolkitTestApplication application;
2706 tet_infoline("UtcDaliTextViewMergeWord02 : ");
2708 struct RemoveCharactersFromWordTest removeCharactersFromWordTests[] =
2711 std::string( "Delete 0 characters." ),
2712 std::string( "Hello" ),
2715 std::string( "Hello" ),
2718 std::string( "Delete within the same group of characters. Starting from the beginning" ),
2719 std::string( "Hello" ),
2722 std::string( "lo" ),
2725 std::string( "Delete within the same group of characters. Somewhere in the middle" ),
2726 std::string( "Hello" ),
2729 std::string( "Heo" ),
2732 std::string( "Delete within the same group of characters. Starting somewhere in the middle to the end" ),
2733 std::string( "Hello" ),
2736 std::string( "Hel" ),
2739 std::string( "Delete within the same group of characters. Finish just before a new one." ),
2740 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2743 std::string( "<font size='10'>H</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2746 std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
2747 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2750 std::string( "<font size='10'>He</font><font size='20'>Wo</font><font size='30'>rld</font>" ),
2753 std::string( "Delete within the same group of characters. Starting just after a different one." ),
2754 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2757 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>d</font>" ),
2760 std::string( "Delete whole group of characters. No merge" ),
2761 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2764 std::string( "<font size='10'>Hel</font><font size='30'>rld</font>" ),
2767 std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
2768 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
2771 std::string( "<font size='10'>He</font><font size='30'>ld</font>" ),
2774 std::string( "Delete whole group of characters. Merge" ),
2775 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
2778 std::string( "<font size='10'>Helrld</font>" ),
2781 std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
2782 std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
2785 std::string( "<font size='10'>Held</font>" ),
2788 const std::size_t numberOfTests( 11 );
2790 for( std::size_t index = 0; index < numberOfTests; ++index )
2792 const RemoveCharactersFromWordTest& test = removeCharactersFromWordTests[index];
2794 if( !TestRemoveCharactersFromWord( test.description, test.input, test.position, test.numberOfCharacters, test.result, TEST_LOCATION ) )
2796 tet_result( TET_FAIL );
2800 tet_result( TET_PASS );
2804 int UtcDaliTextViewRemoveWordsFromGroup(void)
2806 // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or
2807 // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so
2808 // tehere isn't any TET case to cover these cases. To be done if needed.
2810 ToolkitTestApplication application;
2812 tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : ");
2813 struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] =
2816 std::string( "Delete 0 words." ),
2817 std::string( "Hello world, hello world" ),
2820 std::string( "Hello world, hello world" ),
2823 std::string( "Delete some words in the middle. Don't merge words" ),
2824 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
2827 std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
2830 std::string( "Delete words up to the end" ),
2831 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
2834 std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
2837 std::string( "Delete words from the beginning." ),
2838 std::string( "Hello world, hello world" ),
2841 std::string( " hello world" ),
2844 const std::size_t numberOfTests( 4 );
2846 for( std::size_t index = 0; index < numberOfTests; ++index )
2848 const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index];
2850 if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) )
2852 tet_result( TET_FAIL );
2856 tet_result( TET_PASS );
2860 int UtcDaliTextViewRemoveGroupsFromLine(void)
2862 // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or
2863 // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so
2864 // tehere isn't any TET case to cover these cases. To be done if needed.
2866 ToolkitTestApplication application;
2868 tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : ");
2869 struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] =
2872 std::string( "Delete 0 groups of words." ),
2873 std::string( "Hello hello, שלום עולם hello hello" ),
2877 std::string( "Hello hello, שלום עולם hello hello" ),
2880 std::string( "Delete from the middle to the end." ),
2881 std::string( "Hello hello, שלום עולם hello hello" ),
2885 std::string( "Hello hello, " ),
2888 std::string( "Delete from the beginning to the middle." ),
2889 std::string( "Hello hello, שלום עולם hello hello" ),
2893 std::string( "hello hello" ),
2896 const std::size_t numberOfTests( 3 );
2898 for( std::size_t index = 0; index < numberOfTests; ++index )
2900 const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index];
2902 if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) )
2904 tet_result( TET_FAIL );
2908 tet_result( TET_PASS );