Dali 3D User Interface Engine
utc-Dali-FontClient.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 
18 #include <iostream>
19 
20 #include <stdlib.h>
21 #include <stdint.h>
22 #include <dali/dali.h>
23 #include <dali-test-suite-utils.h>
24 #include <dali/internal/text-abstraction/font-client-helper.h>
25 
26 using namespace Dali;
27 
29 {
30  const int ORDERED_VALUES[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 };
31 
32  const unsigned int NUM_OF_ORDERED_VALUES = sizeof( ORDERED_VALUES ) / sizeof( int );
33 
34  TestApplication application;
35  int preciseIndex = 0;
36  int result=0;
37 
38  tet_infoline("UtcDaliFontClient center range");
39  preciseIndex = 4;
40  result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
41  DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
42 
43  tet_infoline("UtcDaliFontClient start of range");
44  preciseIndex = 0;
45  result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
46  DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
47 
48  tet_infoline("UtcDaliFontClient end of range");
49  preciseIndex = 8;
50  result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
51  DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
52 
53  tet_infoline("UtcDaliFontClient below of range");
54  result = TextAbstraction::Internal::ValueToIndex( 30, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
55  DALI_TEST_EQUALS( 0, result, TEST_LOCATION );
56 
57  tet_infoline("UtcDaliFontClient below of range");
58  result = TextAbstraction::Internal::ValueToIndex( 220, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
59  DALI_TEST_EQUALS( 8, result, TEST_LOCATION );
60 
61  tet_infoline("UtcDaliFontClient zero ");
62  result = TextAbstraction::Internal::ValueToIndex( 0, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
63  DALI_TEST_EQUALS( 0, result, TEST_LOCATION );
64 
65  END_TEST;
66 }
67 
68 
Dali Docs Home
Read more about Dali