Distinguish NativeImage from Image & Clean PixelFormat from ImageAttribute and Texture
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-ImageAttributes.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 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23
24 using std::max;
25 using namespace Dali;
26
27 void utc_dali_image_attributes_startup(void)
28 {
29   test_return_value = TET_UNDEF;
30 }
31
32 void utc_dali_image_attributes_cleanup(void)
33 {
34   test_return_value = TET_PASS;
35 }
36
37 int UtcDaliImageAttributesConstructor(void)
38 {
39   TestApplication application;
40
41   tet_infoline("UtcDaliImageAttributesConstructor");
42
43   // invoke default handle constructor
44   ImageAttributes imageAttributes;
45
46   DALI_TEST_CHECK( imageAttributes.GetWidth() == 0);
47   END_TEST;
48 }
49
50 int UtcDaliImageAttributesLessThan(void)
51 {
52   TestApplication application;
53
54   tet_infoline("UtcDaliImageAttributesLessThan");
55
56   // invoke default handle constructor
57   ImageAttributes imageAttributes;
58
59   ImageAttributes imageAttributesWidth;
60   imageAttributesWidth.SetSize(2,1);
61   DALI_TEST_CHECK(imageAttributes < imageAttributesWidth);
62
63   ImageAttributes imageAttributesHeight;
64   imageAttributesHeight.SetSize(1,2);
65   DALI_TEST_CHECK(imageAttributes < imageAttributesHeight);
66
67   imageAttributesWidth.SetSize(Size(2,1));
68   DALI_TEST_CHECK(imageAttributes < imageAttributesWidth);
69
70   imageAttributesHeight.SetSize(Size(1,2));
71   DALI_TEST_CHECK(imageAttributes < imageAttributesHeight);
72
73
74   ImageAttributes imageAttributesScaling;
75   imageAttributesScaling.SetScalingMode(ImageAttributes::FitHeight);
76   DALI_TEST_CHECK(imageAttributes < imageAttributesScaling);
77   END_TEST;
78 }
79
80 int UtcDaliImageAttributesEquality(void)
81 {
82   TestApplication application;
83
84   tet_infoline("UtcDaliImageAttributesEquality");
85
86   // invoke default handle constructor
87   ImageAttributes imageAttributes01;
88   ImageAttributes imageAttributes02;
89
90   DALI_TEST_CHECK(imageAttributes02 == imageAttributes01);
91   END_TEST;
92 }
93
94 int UtcDaliImageAttributesInEquality(void)
95 {
96   TestApplication application;
97
98   tet_infoline("UtcDaliImageAttributesInEquality");
99
100   // invoke default handle constructor
101   ImageAttributes imageAttributes01;
102   ImageAttributes imageAttributes02;
103
104   DALI_TEST_CHECK((imageAttributes02 != imageAttributes01) == false);
105   END_TEST;
106 }