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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
26 void utc_dali_character_startup(void)
28 test_return_value = TET_UNDEF;
31 void utc_dali_character_cleanup(void)
33 test_return_value = TET_PASS;
36 int UtcDaliCharacterCopyConstructor(void)
38 tet_infoline("UtcDaliCharacterCopyConstructor ");
39 TestApplication application;
41 Text text( std::string("12") );
43 Character c1 = text[0];
44 Character c2 = text[1];
49 DALI_TEST_CHECK( (c1==c3) && (c2==c4) );
53 int UtcDaliCharacterComparissonOperators(void)
55 tet_infoline("UtcDaliCharacterComparissonOperators ");
56 TestApplication application;
58 Text text( std::string("12") );
60 Character c1 = text[0];
61 Character c2 = text[1];
66 DALI_TEST_CHECK( (c1==c3) && (c2==c4) && (c1!=c2) && (c1!=c4) );
70 int UtcDaliCharacterAssignmentOperator(void)
72 tet_infoline("UtcDaliCharacterAssignmentOperator ");
73 TestApplication application;
75 Text text( std::string("12") );
76 Character c1 = text[0];
77 Character c2 = text[1];
79 DALI_TEST_CHECK( c1 == c1);
81 // this should do nothing
83 DALI_TEST_CHECK( c1 == c2);
88 int UtcDaliCharacterIsLeftToRight(void)
90 tet_infoline("UtcDaliCharacterIsLeftToRight ");
91 TestApplication application;
93 Text text( std::string("12בא") );
95 Character c1 = text[0];
96 Character c2 = text[1];
97 Character c3 = text[2];
98 Character c4 = text[3];
100 DALI_TEST_CHECK( c1.GetCharacterDirection() != Character::RightToLeft &&
101 c2.GetCharacterDirection() != Character::RightToLeft &&
102 c3.GetCharacterDirection() == Character::RightToLeft &&
103 c4.GetCharacterDirection() == Character::RightToLeft );
107 int UtcDaliGetCharacterDirection(void)
109 tet_infoline("UtcDaliGetCharacterDirection ");
110 TestApplication application;
112 Text text( std::string("Aבא ") );
114 Character c1 = text[0];
115 Character c2 = text[1];
116 Character c3 = text[2];
117 Character c4 = text[3];
119 DALI_TEST_EQUALS( c1.GetCharacterDirection(), Character::LeftToRight, TEST_LOCATION );
120 DALI_TEST_EQUALS( c2.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
121 DALI_TEST_EQUALS( c3.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
122 DALI_TEST_EQUALS( c4.GetCharacterDirection(), Character::Neutral, TEST_LOCATION );
126 int UtcDaliCharacterIsWhiteSpace(void)
128 tet_infoline("UtcDaliCharacterIsWhiteSpace ");
129 TestApplication application;
131 Text text( std::string("ab c\n\tdef") );
133 DALI_TEST_CHECK(!text[0].IsWhiteSpace()); // 'a'
134 DALI_TEST_CHECK(!text[1].IsWhiteSpace()); // 'b'
135 DALI_TEST_CHECK(text[2].IsWhiteSpace()); // ' '
136 DALI_TEST_CHECK(!text[3].IsWhiteSpace()); // 'c'
137 DALI_TEST_CHECK(text[4].IsWhiteSpace()); // '\n'
138 DALI_TEST_CHECK(text[5].IsWhiteSpace()); // '\t'
139 DALI_TEST_CHECK(!text[6].IsWhiteSpace()); // 'd'
140 DALI_TEST_CHECK(!text[7].IsWhiteSpace()); // 'e'
141 DALI_TEST_CHECK(!text[8].IsWhiteSpace()); // 'f'
145 int UtcDaliCharacterIsNewLine(void)
147 tet_infoline("UtcDaliCharacterIsWhiteSpace ");
148 TestApplication application;
150 Text text( std::string("ab c\n\tdef") );
152 DALI_TEST_CHECK(!text[0].IsNewLine()); // 'a'
153 DALI_TEST_CHECK(!text[1].IsNewLine()); // 'b'
154 DALI_TEST_CHECK(!text[2].IsNewLine()); // ' '
155 DALI_TEST_CHECK(!text[3].IsNewLine()); // 'c'
156 DALI_TEST_CHECK( text[4].IsNewLine()); // '\n'
157 DALI_TEST_CHECK(!text[5].IsNewLine()); // '\t'
158 DALI_TEST_CHECK(!text[6].IsNewLine()); // 'd'
159 DALI_TEST_CHECK(!text[7].IsNewLine()); // 'e'
160 DALI_TEST_CHECK(!text[8].IsNewLine()); // 'f'