Improved pan gesture prediction
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-GlyphImage.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
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23
24 using namespace Dali;
25
26 int UtcDaliGlyphImageNew01(void)
27 {
28   TestApplication application;
29
30   tet_infoline("UtcDaliGlyphImageNew01");
31
32   GlyphImage image;
33
34   DALI_TEST_CHECK( !image );
35
36   image = GlyphImage::New( Text( std::string( "H" ) )[0] );
37
38   DALI_TEST_CHECK( image );
39   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::GetGlyphImageFunc ) );
40   END_TEST;
41 }
42
43 int UtcDaliGlyphImageNew02(void)
44 {
45   TestApplication application;
46
47   tet_infoline("UtcDaliGlyphImageNew02");
48
49   GlyphImage image;
50
51   DALI_TEST_CHECK( !image );
52
53   TextStyle style;
54   image = GlyphImage::New( Text( std::string( "H" ) )[0], style );
55
56   DALI_TEST_CHECK( image );
57   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::GetGlyphImageFunc ) );
58   END_TEST;
59 }
60
61 int UtcDaliGlyphImageDownCast(void)
62 {
63   TestApplication application;
64
65   tet_infoline("UtcDaliGlyphImageDownCast");
66
67   GlyphImage image = GlyphImage::New( Text( std::string( "H" ) )[0] );
68
69   DALI_TEST_CHECK( image );
70
71   BaseHandle object(image);
72
73   GlyphImage image2 = GlyphImage::DownCast(object);
74   DALI_TEST_CHECK(image2);
75
76   GlyphImage image3 = DownCast< GlyphImage >(object);
77   DALI_TEST_CHECK(image3);
78
79   BaseHandle unInitializedObject;
80   GlyphImage image4 = GlyphImage::DownCast(unInitializedObject);
81   DALI_TEST_CHECK(!image4);
82
83   GlyphImage image5 = DownCast< GlyphImage >(unInitializedObject);
84   DALI_TEST_CHECK(!image5);
85   END_TEST;
86 }
87
88 int UtcDaliGlyphImageIsColorGlyph(void)
89 {
90   TestApplication application;
91
92   tet_infoline("UtcDaliGlyphImageIsColorGlyph");
93
94   Character character = Text( std::string( "\xf0\x9f\x98\x81" ) )[0];
95
96   DALI_TEST_CHECK( GlyphImage::IsColorGlyph( character ) );
97   END_TEST;
98 }