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.
22 #include <dali/dali.h>
23 #include <dali-test-suite-utils.h>
24 #include <dali/internal/text-abstraction/font-client-helper.h>
28 int UtcDaliFontClient(void)
30 const int ORDERED_VALUES[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 };
32 const unsigned int NUM_OF_ORDERED_VALUES = sizeof( ORDERED_VALUES ) / sizeof( int );
34 TestApplication application;
38 tet_infoline("UtcDaliFontClient center range");
40 result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
41 DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
43 tet_infoline("UtcDaliFontClient start of range");
45 result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
46 DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
48 tet_infoline("UtcDaliFontClient end of range");
50 result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
51 DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION );
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 );
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 );
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 );