X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-BidirectionalSupport.cpp;h=191ead13410d6ef345125c2f285ac79fdd1f937a;hp=37b5277ec873b3d3a5ed2255c84c1d0e330e4c3f;hb=1143e3d6b82789fae32f897d3a416b32fdbf0ef3;hpb=ee431c9e2b342243f9e0e2b6bafca7505d321457 diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp index 37b5277..191ead1 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,11 +101,12 @@ struct GetMirroredTextData struct GetCharactersDirectionData { - std::string description; ///< Description of the test. - std::string text; ///< Input text. - unsigned int startIndex; ///< The index from where the model is updated. - unsigned int numberOfCharacters; ///< The number of characters. - bool* directions; ///< The expected directions. + std::string description; ///< Description of the test. + std::string text; ///< Input text. + unsigned int startIndex; ///< The index from where the model is updated. + unsigned int numberOfCharacters; ///< The number of characters. + bool* directions; ///< The expected directions. + bool markupProcessorEnabled; ///< Enable markup processor to use markup text. }; bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data ) @@ -127,7 +128,8 @@ bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data ) layoutSize, logicalModel, visualModel, - metrics ); + metrics, + false ); // 2) Clear the bidirectional paragraph info data. Vector& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo; @@ -233,7 +235,8 @@ bool ReorderLinesTest( const ReorderLinesData& data ) layoutSize, logicalModel, visualModel, - metrics ); + metrics, + false ); // 2) Clear the bidirectional line info data. uint32_t startRemoveIndex = logicalModel->mBidirectionalLineInfo.Count(); @@ -358,7 +361,8 @@ bool GetMirroredTextTest( const GetMirroredTextData& data ) layoutSize, logicalModel, visualModel, - metrics ); + metrics, + false ); // 2) Call the GetMirroredText() function for the whole text Vector mirroredText; @@ -432,15 +436,19 @@ bool GetCharactersDirectionTest( const GetCharactersDirectionData& data ) layoutSize, logicalModel, visualModel, - metrics ); + metrics, + data.markupProcessorEnabled ); Vector& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo; // 2) Clear the direction info data. Vector& directions = logicalModel->mCharacterDirections; - directions.Erase( directions.Begin() + data.startIndex, - directions.Begin() + data.startIndex + data.numberOfCharacters ); + if( directions.Count() >= data.startIndex + data.numberOfCharacters ) + { + directions.Erase( directions.Begin() + data.startIndex, + directions.Begin() + data.startIndex + data.numberOfCharacters ); + } // 3) Call GetCharactersDirection() function. @@ -927,6 +935,11 @@ int UtcDaliGetCharactersDirection(void) true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false }; + bool directions06[] = { + true, true, true, true, true, true, true, true, true, true, + false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false }; + struct GetCharactersDirectionData data[] = { { @@ -934,28 +947,32 @@ int UtcDaliGetCharactersDirection(void) "", 0u, 0u, - directions01 + directions01, + false }, { "Left to right characters only", "Hello world\nhello world demo", 0u, 28u, - directions02 + directions02, + false }, { "Right to left characters only", "שלום עולם\nשלום עולם", 0u, 19u, - directions03 + directions03, + false }, { "Mix of bidirectional text", "Hello world\nhello world שלום עולם\nשלום עולם hello world", 0u, 55u, - directions04 + directions04, + false }, { "Mix of bidirectional text. With more paragraphs.", @@ -963,7 +980,8 @@ int UtcDaliGetCharactersDirection(void) " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello", 0u, 227u, - directions05 + directions05, + false }, { "Mix of bidirectional text. With more paragraphs. Update first paragraph.", @@ -971,7 +989,8 @@ int UtcDaliGetCharactersDirection(void) " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello", 0u, 17u, - directions05 + directions05, + false }, { "Mix of bidirectional text. With more paragraphs. Update from character 29", @@ -979,7 +998,8 @@ int UtcDaliGetCharactersDirection(void) " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello", 29u, 134u, - directions05 + directions05, + false }, { "Mix of bidirectional text. With more paragraphs. Update from character 163", @@ -987,10 +1007,19 @@ int UtcDaliGetCharactersDirection(void) " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello", 163u, 35u, - directions05 + directions05, + false + }, + { + "Mix of bidirectional text. With brackets and LRM", + "שלום עולם ‎(hello)[world]‎", + 0u, + 26u, + directions06, + true } }; - const unsigned int numberOfTests = 8u; + const unsigned int numberOfTests = 9u; for( unsigned int index = 0u; index < numberOfTests; ++index ) {