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.
23 #include <dali/public-api/dali-core.h>
24 #include <dali/public-api/images/distance-field.h>
25 #include <dali-test-suite-utils.h>
30 static void Startup();
31 static void Cleanup();
34 void (*tet_startup)() = Startup;
35 void (*tet_cleanup)() = Cleanup;
38 static void UtcDaliGenerateDistanceField();
41 POSITIVE_TC_IDX = 0x01,
45 static const float ROTATION_EPSILON = 0.0001f;
47 // Add test functionality for all APIs in the class (Positive and Negative)
49 struct tet_testlist tet_testlist[] = {
50 { UtcDaliGenerateDistanceField, POSITIVE_TC_IDX },
55 static TestApplication* gApplication = NULL;
57 // Called only once before first test is run.
60 gApplication = new TestApplication();
63 // Called only once after last test is run
69 static unsigned char sourceImage[] =
71 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
72 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
73 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
74 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
75 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
76 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
77 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
78 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
81 static void UtcDaliGenerateDistanceField()
83 unsigned char distanceField[4*4];
85 GenerateDistanceFieldMap(sourceImage, Size(8.0f, 8.0f), distanceField, Size(4.0f, 4.0f), 0, Size(4.0f, 4.0f));
87 if(distanceField[0] <= distanceField[5] &&
88 distanceField[5] <= distanceField[10] &&
89 distanceField[10] <= distanceField[15])