[NUI] Update NUI.Devel to fix block and crash issues.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Transition / TSTransitionSet.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("Internal/Transition/TransitionSet")]
13     public class InternalTransitionSetTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("TransitionSet constructor.")]
32         [Property("SPEC", "Tizen.NUI.TransitionSet.TransitionSet C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void TransitionSetConstructor()
37         {
38             tlog.Debug(tag, $"TransitionSetConstructor START");
39
40             var testingTarget = new TransitionSet();
41             Assert.IsNotNull(testingTarget, "Should be not null!");
42             Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"TransitionSetConstructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("TransitionSet DownCast.")]
51         [Property("SPEC", "Tizen.NUI.TransitionSet.DownCast M")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "MR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void TransitionSetDownCast()
56         {
57             tlog.Debug(tag, $"TransitionSetDownCast START");
58
59             using (TransitionSet transitionSet = new TransitionSet())
60             {
61                 var testingTarget = TransitionSet.DownCast(transitionSet);
62                 Assert.IsNotNull(testingTarget, "Should be not null!");
63                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
64
65                 testingTarget.Dispose();
66             }
67
68             tlog.Debug(tag, $"TransitionSetDownCast END (OK)");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("TransitionSet AddTransition.")]
74         [Property("SPEC", "Tizen.NUI.TransitionSet.AddTransition M")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "MR")]
77         [Property("AUTHOR", "guowei.wang@samsung.com")]
78         public void TransitionSetAddTransition()
79         {
80             tlog.Debug(tag, $"TransitionSetAddTransition START");
81
82             View view = new View()
83             {
84                 Name = "view",
85                 TransitionOptions = new TransitionOptions(Window.Instance)
86             };
87             view.TransitionOptions.TransitionTag = "Transition";
88             view.TransitionOptions.EnableTransition = true;
89
90             TransitionItemBase transitionItemBase = null;
91             using (TimePeriod timePeriod = new TimePeriod(500))
92             {
93                 using (AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default))
94                 {
95                     transitionItemBase = new TransitionItemBase(view, true, timePeriod, alphaFunction);
96                 }
97             }
98
99             var testingTarget = new TransitionSet();
100             Assert.IsNotNull(testingTarget, "Should be not null!");
101             Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
102
103             try
104             {
105                 testingTarget.AddTransition(transitionItemBase);
106             }
107             catch (Exception e)
108             {
109                 tlog.Error(tag, "Caught Exception" + e.ToString());
110                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
111                 Assert.Fail("Caught Exception" + e.ToString());
112             }
113
114             view.Dispose();
115             transitionItemBase.Dispose();
116             testingTarget.Dispose();
117             tlog.Debug(tag, $"TransitionSetAddTransition END (OK)");
118         }
119
120         [Test]
121         [Category("P1")]
122         [Description("TransitionSet Finished.")]
123         [Property("SPEC", "Tizen.NUI.TransitionSet.Finished A")]
124         [Property("SPEC_URL", "-")]
125         [Property("CRITERIA", "PRW")]
126         [Property("AUTHOR", "guowei.wang@samsung.com")]
127         public void TransitionSetFinished()
128         {
129             tlog.Debug(tag, $"TransitionSetFinished START");
130
131             View view = new View()
132             {
133                 Name = "view",
134                 TransitionOptions = new TransitionOptions(Window.Instance)
135             };
136             view.TransitionOptions.TransitionTag = "Transition";
137             view.TransitionOptions.EnableTransition = true;
138
139             TransitionItemBase transitionItemBase = null;
140             using (TimePeriod timePeriod = new TimePeriod(500))
141             {
142                 using (AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default))
143                 {
144                     transitionItemBase = new TransitionItemBase(view, true, timePeriod, alphaFunction);
145                 }
146             }
147
148             var testingTarget = new TransitionSet();
149             Assert.IsNotNull(testingTarget, "Should be not null!");
150             Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
151
152             testingTarget.AddTransition(transitionItemBase);
153
154             testingTarget.Finished += MyOnFinished;
155             testingTarget.Finished -= MyOnFinished;
156
157             testingTarget.Dispose();
158             tlog.Debug(tag, $"TransitionSetFinished END (OK)");
159         }
160
161         private void MyOnFinished(object sender, EventArgs e) { }
162
163         [Test]
164         [Category("P1")]
165         [Description("TransitionSet GetTransitionAt.")]
166         [Property("SPEC", "Tizen.NUI.TransitionSet.GetTransitionAt M")]
167         [Property("SPEC_URL", "-")]
168         [Property("CRITERIA", "MR")]
169         [Property("AUTHOR", "guowei.wang@samsung.com")]
170         public void TransitionSetGetTransitionAt()
171         {
172             tlog.Debug(tag, $"TransitionSetGetTransitionAt START");
173
174             using (View view = new View())
175             {
176                 var testingTarget = new TransitionSet(view.SwigCPtr.Handle, false);
177                 Assert.IsNotNull(testingTarget, "Should be not null!");
178                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
179
180                 try
181                 {
182                     testingTarget.GetTransitionAt(0);
183                 }
184                 catch (Exception e)
185                 {
186                     tlog.Error(tag, "Caught Exception" + e.ToString());
187                     LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
188                     Assert.Fail("Caught Exception" + e.ToString());
189                 }
190             }
191
192             tlog.Debug(tag, $"TransitionSetGetTransitionAt END (OK)");
193         }
194
195         [Test]
196         [Category("P1")]
197         [Description("TransitionSet GetTransitionCount.")]
198         [Property("SPEC", "Tizen.NUI.TransitionSet.GetTransitionCount M")]
199         [Property("SPEC_URL", "-")]
200         [Property("CRITERIA", "MR")]
201         [Property("AUTHOR", "guowei.wang@samsung.com")]
202         public void TransitionSetGetTransitionCount()
203         {
204             tlog.Debug(tag, $"TransitionSetGetTransitionCount START");
205
206             using (View view = new View())
207             {
208                 var testingTarget = new TransitionSet(view.SwigCPtr.Handle, false);
209                 Assert.IsNotNull(testingTarget, "Should be not null!");
210                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
211
212                 try
213                 {
214                     testingTarget.GetTransitionCount();
215                 }
216                 catch (Exception e)
217                 {
218                     tlog.Error(tag, "Caught Exception" + e.ToString());
219                     LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
220                     Assert.Fail("Caught Exception" + e.ToString());
221                 }
222             }
223
224             tlog.Debug(tag, $"TransitionSetGetTransitionCount END (OK)");
225         }
226
227         [Test]
228         [Category("P1")]
229         [Description("TransitionSet Play.")]
230         [Property("SPEC", "Tizen.NUI.TransitionSet.Play M")]
231         [Property("SPEC_URL", "-")]
232         [Property("CRITERIA", "MR")]
233         [Property("AUTHOR", "guowei.wang@samsung.com")]
234         public void TransitionSetPlay()
235         {
236             tlog.Debug(tag, $"TransitionSetPlay START");
237
238             using (View view = new View())
239             {
240                 var testingTarget = new TransitionSet(view.SwigCPtr.Handle, false);
241                 Assert.IsNotNull(testingTarget, "Should be not null!");
242                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
243
244                 try
245                 {
246                     testingTarget.Play();
247                 }
248                 catch (Exception e)
249                 {
250                     tlog.Error(tag, "Caught Exception" + e.ToString());
251                     LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
252                     Assert.Fail("Caught Exception" + e.ToString());
253                 }
254             }
255
256             tlog.Debug(tag, $"TransitionSetPlay END (OK)");
257         }
258
259         [Test]
260         [Category("P1")]
261         [Description("TransitionSet Assign.")]
262         [Property("SPEC", "Tizen.NUI.TransitionSet.Assign M")]
263         [Property("SPEC_URL", "-")]
264         [Property("CRITERIA", "MR")]
265         [Property("AUTHOR", "guowei.wang@samsung.com")]
266         public void TransitionSetAssign()
267         {
268             tlog.Debug(tag, $"TransitionSetAssign START");
269
270             using (View view = new View())
271             {
272                 var testingTarget = new TransitionSet(view.SwigCPtr.Handle, false);
273                 Assert.IsNotNull(testingTarget, "Should be not null!");
274                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
275
276                 try
277                 {
278                     testingTarget.Assign(testingTarget);
279                 }
280                 catch (Exception e)
281                 {
282                     tlog.Error(tag, "Caught Exception" + e.ToString());
283                     LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
284                     Assert.Fail("Caught Exception" + e.ToString());
285                 }
286             }
287
288             tlog.Debug(tag, $"TransitionSetAssign END (OK)");
289         }
290
291         [Test]
292         [Category("P1")]
293         [Description("TransitionSet FinishedSignal.")]
294         [Property("SPEC", "Tizen.NUI.TransitionSet.FinishedSignal M")]
295         [Property("SPEC_URL", "-")]
296         [Property("CRITERIA", "MR")]
297         [Property("AUTHOR", "guowei.wang@samsung.com")]
298         public void TransitionSetFinishedSignal()
299         {
300             tlog.Debug(tag, $"TransitionSetFinishedSignal START");
301
302             using (View view = new View())
303             {
304                 var testingTarget = new TransitionSet(view.SwigCPtr.Handle, false);
305                 Assert.IsNotNull(testingTarget, "Should be not null!");
306                 Assert.IsInstanceOf<TransitionSet>(testingTarget, "Should be an Instance of TransitionSet!");
307
308                 try
309                 {
310                     testingTarget.FinishedSignal();
311                 }
312                 catch (Exception e)
313                 {
314                     tlog.Error(tag, "Caught Exception" + e.ToString());
315                     LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
316                     Assert.Fail("Caught Exception" + e.ToString());
317                 }
318             }
319
320             tlog.Debug(tag, $"TransitionSetFinishedSignal END (OK)");
321         }
322     }
323 }