Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-ConstraintSource.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 <dali-test-suite-utils.h>
19 #include <dali/public-api/dali-core.h>
20 #include <stdlib.h>
21
22 #include <iostream>
23
24 using namespace Dali;
25
26 ///////////////////////////////////////////////////////////////////////////////
27 void utc_dali_constraint_source_startup(void)
28 {
29   test_return_value = TET_UNDEF;
30 }
31
32 void utc_dali_constraint_source_cleanup(void)
33 {
34   test_return_value = TET_PASS;
35 }
36 ///////////////////////////////////////////////////////////////////////////////
37
38 ///////////////////////////////////////////////////////////////////////////////
39 // LocalSource
40 ///////////////////////////////////////////////////////////////////////////////
41 int UtcDaliLocalSource(void)
42 {
43   LocalSource source(Actor::Property::POSITION);
44
45   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
46
47   END_TEST;
48 }
49
50 ///////////////////////////////////////////////////////////////////////////////
51
52 ///////////////////////////////////////////////////////////////////////////////
53 // ParentSource
54 ///////////////////////////////////////////////////////////////////////////////
55 int UtcDaliParentSource(void)
56 {
57   ParentSource source(Actor::Property::POSITION);
58
59   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
60
61   END_TEST;
62 }
63
64 ///////////////////////////////////////////////////////////////////////////////
65
66 ///////////////////////////////////////////////////////////////////////////////
67 // Source
68 ///////////////////////////////////////////////////////////////////////////////
69 int UtcDaliSource1(void)
70 {
71   Actor  actor;
72   Source source(actor, Actor::Property::SIZE);
73
74   DALI_TEST_CHECK(!source.object);
75   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION);
76
77   END_TEST;
78 }
79
80 int UtcDaliSource2(void)
81 {
82   TestApplication application;
83
84   Actor actor = Actor::New();
85
86   Source source(actor, Actor::Property::SIZE);
87   DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION);
88   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION);
89
90   END_TEST;
91 }
92 ///////////////////////////////////////////////////////////////////////////////
93
94 ///////////////////////////////////////////////////////////////////////////////
95 // ConstraintSource
96 ///////////////////////////////////////////////////////////////////////////////
97 int UtcDaliConstraintSourceWithSource1(void)
98 {
99   Actor actor;
100
101   ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN));
102   DALI_TEST_CHECK(!source.object);
103   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
104   DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION);
105
106   END_TEST;
107 }
108
109 int UtcDaliConstraintSourceWithSource2(void)
110 {
111   TestApplication application;
112
113   Actor actor = Actor::New();
114
115   ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN));
116   DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION);
117   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
118   DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION);
119
120   END_TEST;
121 }
122
123 int UtcDaliConstraintSourceWithLocalSource(void)
124 {
125   Actor actor;
126
127   ConstraintSource source(LocalSource(Actor::Property::PARENT_ORIGIN));
128   DALI_TEST_CHECK(!source.object);
129   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
130   DALI_TEST_EQUALS(source.sourceType, LOCAL_PROPERTY, TEST_LOCATION);
131
132   END_TEST;
133 }
134
135 int UtcDaliConstraintSourceWithParentSource(void)
136 {
137   Actor actor;
138
139   ConstraintSource source(ParentSource(Actor::Property::PARENT_ORIGIN));
140   DALI_TEST_CHECK(!source.object);
141   DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
142   DALI_TEST_EQUALS(source.sourceType, PARENT_PROPERTY, TEST_LOCATION);
143
144   END_TEST;
145 }
146 ///////////////////////////////////////////////////////////////////////////////