Improved pan gesture prediction
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-DistanceField.cpp
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 #include <algorithm>
20
21 #include <stdlib.h>
22
23 #include <dali/public-api/dali-core.h>
24 #include <dali-test-suite-utils.h>
25
26 using std::max;
27 using namespace Dali;
28
29 namespace
30 {
31
32 static const float ROTATION_EPSILON = 0.0001f;
33
34 static unsigned char sourceImage[] =
35 {
36  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
37  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
38  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
39  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
40  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
41  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
42  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
43  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
44 };
45
46 } // anonymous namespace
47
48
49
50 int UtcDaliGenerateDistanceField(void)
51 {
52   unsigned char distanceField[4*4];
53
54   GenerateDistanceFieldMap(sourceImage, Size(8.0f, 8.0f), distanceField, Size(4.0f, 4.0f), 0, Size(4.0f, 4.0f));
55
56   if(distanceField[0]  <= distanceField[5] &&
57      distanceField[5]  <= distanceField[10] &&
58      distanceField[10] <= distanceField[15])
59   {
60     tet_result(TET_PASS);
61   }
62   else
63   {
64     tet_result(TET_FAIL);
65   }
66   END_TEST;
67 }