projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Basic support of keyboard focus for multiple windows
[platform/core/uifw/dali-toolkit.git]
/
automated-tests
/
src
/
dali-toolkit-internal
/
utc-Dali-BidirectionalSupport.cpp
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
f61e539
..
191ead1
100644
(file)
--- 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) 201
6
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
8
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-24,7
+24,7
@@
#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-
model
.h>
+#include <toolkit-text-
utils
.h>
using namespace Dali;
using namespace Toolkit;
using namespace Dali;
using namespace Toolkit;
@@
-101,18
+101,20
@@
struct GetMirroredTextData
struct GetCharactersDirectionData
{
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 )
{
// 1) Create the model.
};
bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
{
// 1) Create the model.
- LogicalModelPtr logicalModel = LogicalModel::New();
- VisualModelPtr visualModel = VisualModel::New();
+ LogicalModelPtr logicalModel;
+ VisualModelPtr visualModel;
+ MetricsPtr metrics;
Size textArea(100.f, 60.f);
Size layoutSize;
Size textArea(100.f, 60.f);
Size layoutSize;
@@
-125,7
+127,9
@@
bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
options,
layoutSize,
logicalModel,
options,
layoutSize,
logicalModel,
- visualModel );
+ visualModel,
+ metrics,
+ false );
// 2) Clear the bidirectional paragraph info data.
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
// 2) Clear the bidirectional paragraph info data.
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
@@
-215,8
+219,9
@@
void FreeBidirectionalLineInfoResources( Vector<BidirectionalLineInfoRun> bidire
bool ReorderLinesTest( const ReorderLinesData& data )
{
// 1) Create the model.
bool ReorderLinesTest( const ReorderLinesData& data )
{
// 1) Create the model.
- LogicalModelPtr logicalModel = LogicalModel::New();
- VisualModelPtr visualModel = VisualModel::New();
+ LogicalModelPtr logicalModel;
+ VisualModelPtr visualModel;
+ MetricsPtr metrics;
Size textArea(100.f, 300.f);
Size layoutSize;
Size textArea(100.f, 300.f);
Size layoutSize;
@@
-229,7
+234,9
@@
bool ReorderLinesTest( const ReorderLinesData& data )
options,
layoutSize,
logicalModel,
options,
layoutSize,
logicalModel,
- visualModel );
+ visualModel,
+ metrics,
+ false );
// 2) Clear the bidirectional line info data.
uint32_t startRemoveIndex = logicalModel->mBidirectionalLineInfo.Count();
// 2) Clear the bidirectional line info data.
uint32_t startRemoveIndex = logicalModel->mBidirectionalLineInfo.Count();
@@
-338,8
+345,9
@@
bool ReorderLinesTest( const ReorderLinesData& data )
bool GetMirroredTextTest( const GetMirroredTextData& data )
{
// 1) Create the model.
bool GetMirroredTextTest( const GetMirroredTextData& data )
{
// 1) Create the model.
- LogicalModelPtr logicalModel = LogicalModel::New();
- VisualModelPtr visualModel = VisualModel::New();
+ LogicalModelPtr logicalModel;
+ VisualModelPtr visualModel;
+ MetricsPtr metrics;
Size textArea(100.f, 60.f);
Size layoutSize;
Size textArea(100.f, 60.f);
Size layoutSize;
@@
-352,7
+360,9
@@
bool GetMirroredTextTest( const GetMirroredTextData& data )
options,
layoutSize,
logicalModel,
options,
layoutSize,
logicalModel,
- visualModel );
+ visualModel,
+ metrics,
+ false );
// 2) Call the GetMirroredText() function for the whole text
Vector<Character> mirroredText;
// 2) Call the GetMirroredText() function for the whole text
Vector<Character> mirroredText;
@@
-410,8
+420,9
@@
bool GetMirroredTextTest( const GetMirroredTextData& data )
bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
{
// 1) Create the model.
bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
{
// 1) Create the model.
- LogicalModelPtr logicalModel = LogicalModel::New();
- VisualModelPtr visualModel = VisualModel::New();
+ LogicalModelPtr logicalModel;
+ VisualModelPtr visualModel;
+ MetricsPtr metrics;
Size textArea(100.f, 60.f);
Size layoutSize;
Size textArea(100.f, 60.f);
Size layoutSize;
@@
-424,15
+435,20
@@
bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
options,
layoutSize,
logicalModel,
options,
layoutSize,
logicalModel,
- visualModel );
+ visualModel,
+ metrics,
+ data.markupProcessorEnabled );
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
// 2) Clear the direction info data.
Vector<CharacterDirection>& directions = logicalModel->mCharacterDirections;
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
// 2) Clear the direction info data.
Vector<CharacterDirection>& 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.
// 3) Call GetCharactersDirection() function.
@@
-459,7
+475,6
@@
bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
int UtcDaliSetBidirectionalInfo(void)
{
int UtcDaliSetBidirectionalInfo(void)
{
- ToolkitTestApplication application;
tet_infoline(" UtcDaliSetBidirectionalInfo");
unsigned int indices01[] = {};
tet_infoline(" UtcDaliSetBidirectionalInfo");
unsigned int indices01[] = {};
@@
-594,6
+609,7
@@
int UtcDaliSetBidirectionalInfo(void)
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
+ ToolkitTestApplication application;
if( !SetBidirectionalInfoTest( data[index] ) )
{
tet_result(TET_FAIL);
if( !SetBidirectionalInfoTest( data[index] ) )
{
tet_result(TET_FAIL);
@@
-606,7
+622,6
@@
int UtcDaliSetBidirectionalInfo(void)
int UtcDaliReorderLines(void)
{
int UtcDaliReorderLines(void)
{
- ToolkitTestApplication application;
tet_infoline(" UtcDaliSetBidirectionalInfo");
unsigned int visualToLogical0301[] = { 0u, 1u, 2u, 3u, 4u, 5u, 9u, 8u, 7u, 6u, 10u };
tet_infoline(" UtcDaliSetBidirectionalInfo");
unsigned int visualToLogical0301[] = { 0u, 1u, 2u, 3u, 4u, 5u, 9u, 8u, 7u, 6u, 10u };
@@
-781,6
+796,7
@@
int UtcDaliReorderLines(void)
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
+ ToolkitTestApplication application;
if( !ReorderLinesTest( data[index] ) )
{
tet_result(TET_FAIL);
if( !ReorderLinesTest( data[index] ) )
{
tet_result(TET_FAIL);
@@
-793,7
+809,6
@@
int UtcDaliReorderLines(void)
int UtcDaliGetMirroredText(void)
{
int UtcDaliGetMirroredText(void)
{
- ToolkitTestApplication application;
tet_infoline(" UtcDaliGetMirroredText");
struct GetMirroredTextData data[] =
tet_infoline(" UtcDaliGetMirroredText");
struct GetMirroredTextData data[] =
@@
-865,6
+880,7
@@
int UtcDaliGetMirroredText(void)
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
+ ToolkitTestApplication application;
if( !GetMirroredTextTest( data[index] ) )
{
tet_result(TET_FAIL);
if( !GetMirroredTextTest( data[index] ) )
{
tet_result(TET_FAIL);
@@
-877,7
+893,6
@@
int UtcDaliGetMirroredText(void)
int UtcDaliGetCharactersDirection(void)
{
int UtcDaliGetCharactersDirection(void)
{
- ToolkitTestApplication application;
tet_infoline(" UtcDaliGetCharactersDirection");
bool directions01[] = {};
tet_infoline(" UtcDaliGetCharactersDirection");
bool directions01[] = {};
@@
-920,6
+935,11
@@
int UtcDaliGetCharactersDirection(void)
true, true, true, true, true, true, true, true, true, true,
true, true, false, false, false, false, false };
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[] =
{
{
struct GetCharactersDirectionData data[] =
{
{
@@
-927,28
+947,32
@@
int UtcDaliGetCharactersDirection(void)
"",
0u,
0u,
"",
0u,
0u,
- directions01
+ directions01,
+ false
},
{
"Left to right characters only",
"Hello world\nhello world demo",
0u,
28u,
},
{
"Left to right characters only",
"Hello world\nhello world demo",
0u,
28u,
- directions02
+ directions02,
+ false
},
{
"Right to left characters only",
"שלום עולם\nשלום עולם",
0u,
19u,
},
{
"Right to left characters only",
"שלום עולם\nשלום עולם",
0u,
19u,
- directions03
+ directions03,
+ false
},
{
"Mix of bidirectional text",
"Hello world\nhello world שלום עולם\nשלום עולם hello world",
0u,
55u,
},
{
"Mix of bidirectional text",
"Hello world\nhello world שלום עולם\nשלום עולם hello world",
0u,
55u,
- directions04
+ directions04,
+ false
},
{
"Mix of bidirectional text. With more paragraphs.",
},
{
"Mix of bidirectional text. With more paragraphs.",
@@
-956,7
+980,8
@@
int UtcDaliGetCharactersDirection(void)
" مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
0u,
227u,
" مرحبا بالعالم שלום עולם 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.",
},
{
"Mix of bidirectional text. With more paragraphs. Update first paragraph.",
@@
-964,7
+989,8
@@
int UtcDaliGetCharactersDirection(void)
" مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
0u,
17u,
" مرحبا بالعالم שלום עולם 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",
},
{
"Mix of bidirectional text. With more paragraphs. Update from character 29",
@@
-972,7
+998,8
@@
int UtcDaliGetCharactersDirection(void)
" مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
29u,
134u,
" مرحبا بالعالم שלום עולם 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",
},
{
"Mix of bidirectional text. With more paragraphs. Update from character 163",
@@
-980,13
+1007,23
@@
int UtcDaliGetCharactersDirection(void)
" مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
163u,
35u,
" مرحبا بالعالم שלום עולם 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 =
8
u;
+ const unsigned int numberOfTests =
9
u;
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
+ ToolkitTestApplication application;
if( !GetCharactersDirectionTest( data[index] ) )
{
tet_result(TET_FAIL);
if( !GetCharactersDirectionTest( data[index] ) )
{
tet_result(TET_FAIL);