2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
20 #include <dali/dali.h>
21 #include <dali-test-suite-utils.h>
25 void utc_dali_character_startup(void)
27 test_return_value = TET_UNDEF;
30 void utc_dali_character_cleanup(void)
32 test_return_value = TET_PASS;
35 int UtcDaliCharacterCopyConstructor(void)
37 tet_infoline("UtcDaliCharacterCopyConstructor ");
38 TestApplication application;
40 Text text( std::string("12") );
42 Character c1 = text[0];
43 Character c2 = text[1];
48 DALI_TEST_CHECK( (c1==c3) && (c2==c4) );
52 int UtcDaliCharacterComparissonOperators(void)
54 tet_infoline("UtcDaliCharacterComparissonOperators ");
55 TestApplication application;
57 Text text( std::string("12") );
59 Character c1 = text[0];
60 Character c2 = text[1];
65 DALI_TEST_CHECK( (c1==c3) && (c2==c4) && (c1!=c2) && (c1!=c4) );
69 int UtcDaliCharacterAssignmentOperator(void)
71 tet_infoline("UtcDaliCharacterAssignmentOperator ");
72 TestApplication application;
74 Text text( std::string("12") );
75 Character c1 = text[0];
76 Character c2 = text[1];
78 DALI_TEST_CHECK( c1 == c1);
80 // this should do nothing
82 DALI_TEST_CHECK( c1 == c2);
87 int UtcDaliCharacterIsLeftToRight(void)
89 tet_infoline("UtcDaliCharacterIsLeftToRight ");
90 TestApplication application;
92 Text text( std::string("12בא") );
94 Character c1 = text[0];
95 Character c2 = text[1];
96 Character c3 = text[2];
97 Character c4 = text[3];
99 DALI_TEST_CHECK( c1.GetCharacterDirection() != Character::RightToLeft &&
100 c2.GetCharacterDirection() != Character::RightToLeft &&
101 c3.GetCharacterDirection() == Character::RightToLeft &&
102 c4.GetCharacterDirection() == Character::RightToLeft );
106 int UtcDaliGetCharacterDirection(void)
108 tet_infoline("UtcDaliGetCharacterDirection ");
109 TestApplication application;
111 Text text( std::string("Aבא ") );
113 Character c1 = text[0];
114 Character c2 = text[1];
115 Character c3 = text[2];
116 Character c4 = text[3];
118 DALI_TEST_EQUALS( c1.GetCharacterDirection(), Character::LeftToRight, TEST_LOCATION );
119 DALI_TEST_EQUALS( c2.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
120 DALI_TEST_EQUALS( c3.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
121 DALI_TEST_EQUALS( c4.GetCharacterDirection(), Character::Neutral, TEST_LOCATION );
125 int UtcDaliCharacterIsWhiteSpace(void)
127 tet_infoline("UtcDaliCharacterIsWhiteSpace ");
128 TestApplication application;
130 Text text( std::string("ab c\n\tdef") );
132 DALI_TEST_CHECK(!text[0].IsWhiteSpace()); // 'a'
133 DALI_TEST_CHECK(!text[1].IsWhiteSpace()); // 'b'
134 DALI_TEST_CHECK(text[2].IsWhiteSpace()); // ' '
135 DALI_TEST_CHECK(!text[3].IsWhiteSpace()); // 'c'
136 DALI_TEST_CHECK(text[4].IsWhiteSpace()); // '\n'
137 DALI_TEST_CHECK(text[5].IsWhiteSpace()); // '\t'
138 DALI_TEST_CHECK(!text[6].IsWhiteSpace()); // 'd'
139 DALI_TEST_CHECK(!text[7].IsWhiteSpace()); // 'e'
140 DALI_TEST_CHECK(!text[8].IsWhiteSpace()); // 'f'
144 int UtcDaliCharacterIsNewLine(void)
146 tet_infoline("UtcDaliCharacterIsWhiteSpace ");
147 TestApplication application;
149 Text text( std::string("ab c\n\tdef") );
151 DALI_TEST_CHECK(!text[0].IsNewLine()); // 'a'
152 DALI_TEST_CHECK(!text[1].IsNewLine()); // 'b'
153 DALI_TEST_CHECK(!text[2].IsNewLine()); // ' '
154 DALI_TEST_CHECK(!text[3].IsNewLine()); // 'c'
155 DALI_TEST_CHECK( text[4].IsNewLine()); // '\n'
156 DALI_TEST_CHECK(!text[5].IsNewLine()); // '\t'
157 DALI_TEST_CHECK(!text[6].IsNewLine()); // 'd'
158 DALI_TEST_CHECK(!text[7].IsNewLine()); // 'e'
159 DALI_TEST_CHECK(!text[8].IsNewLine()); // 'f'