License conversion from Flora to Apache 2.0
[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/dali.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   ImageAttributes imageAttributesCrop;
74   imageAttributesCrop.SetCrop(Rect<float>(0.0f, 0.0f, 8.0f, 8.0f));
75   DALI_TEST_CHECK(imageAttributes < imageAttributesCrop);
76
77   ImageAttributes imageAttributesFormat;
78   imageAttributesFormat.SetPixelFormat(Pixel::BGRA8888);
79   DALI_TEST_CHECK(imageAttributes < imageAttributesFormat);
80
81   ImageAttributes imageAttributesScaling;
82   imageAttributesScaling.SetScalingMode(ImageAttributes::FitHeight);
83   DALI_TEST_CHECK(imageAttributes < imageAttributesScaling);
84   END_TEST;
85 }
86
87 int UtcDaliImageAttributesEquality(void)
88 {
89   TestApplication application;
90
91   tet_infoline("UtcDaliImageAttributesEquality");
92
93   // invoke default handle constructor
94   ImageAttributes imageAttributes01;
95   ImageAttributes imageAttributes02;
96
97   DALI_TEST_CHECK(imageAttributes02 == imageAttributes01);
98   END_TEST;
99 }
100
101 int UtcDaliImageAttributesInEquality(void)
102 {
103   TestApplication application;
104
105   tet_infoline("UtcDaliImageAttributesInEquality");
106
107   // invoke default handle constructor
108   ImageAttributes imageAttributes01;
109   ImageAttributes imageAttributes02;
110
111   DALI_TEST_CHECK((imageAttributes02 != imageAttributes01) == false);
112   END_TEST;
113 }