3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Common/CustomActorImpl")]
13 public class InternalCustomActorImplTest
15 private const string tag = "NUITEST";
16 private View actor = null;
18 internal class MyCustomActorImpl : CustomActorImpl
20 public MyCustomActorImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
28 tlog.Info(tag, "Init() is called!");
29 actor = new View() { Size = new Size(100, 200) };
36 tlog.Info(tag, "Destroy() is called!");
41 [Description("CustomActorImpl constructor.")]
42 [Property("SPEC", "Tizen.NUI.CustomActorImpl.CustomActorImpl C")]
43 [Property("SPEC_URL", "-")]
44 [Property("CRITERIA", "CONSTR")]
45 [Property("AUTHOR", "guowei.wang@samsung.com")]
46 public void CustomActorImplConstructor()
48 tlog.Debug(tag, $"CustomActorImplConstructor START");
50 var testingTarget = new CustomActorImpl(actor.SwigCPtr.Handle, false);
51 Assert.IsNotNull(testingTarget, "Should be not null!");
52 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
54 testingTarget.Dispose();
55 tlog.Debug(tag, $"CustomActorImplConstructor END (OK)");
60 [Description("CustomActorImpl IsRelayoutEnabled.")]
61 [Property("SPEC", "Tizen.NUI.CustomActorImpl.IsRelayoutEnabled M")]
62 [Property("SPEC_URL", "-")]
63 [Property("CRITERIA", "MR")]
64 [Property("AUTHOR", "guowei.wang@samsung.com")]
65 public void CustomActorImplIsRelayoutEnabled()
67 tlog.Debug(tag, $"CustomActorImplIsRelayoutEnabled START");
69 using (View view = new View())
71 var testingTarget = NDalic.GetImplementation(view);
72 Assert.IsNotNull(testingTarget, "Should be not null!");
73 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
75 tlog.Debug(tag, "getCPtr : " + CustomActorImpl.getCPtr(testingTarget));
77 var result = testingTarget.IsRelayoutEnabled();
78 tlog.Debug(tag, "IsRelayoutEnabled : " + result);
80 testingTarget.Dispose();
83 tlog.Debug(tag, $"CustomActorImplIsRelayoutEnabled END (OK)");
88 [Description("CustomActorImpl RelayoutDependentOnChildren.")]
89 [Property("SPEC", "Tizen.NUI.CustomActorImpl.RelayoutDependentOnChildren M")]
90 [Property("SPEC_URL", "-")]
91 [Property("CRITERIA", "MR")]
92 [Property("AUTHOR", "guowei.wang@samsung.com")]
93 public void CustomActorImplRelayoutDependentOnChildren()
95 tlog.Debug(tag, $"CustomActorImplRelayoutDependentOnChildren START");
97 using (View view = new View())
99 var testingTarget = NDalic.GetImplementation(view);
100 Assert.IsNotNull(testingTarget, "Should be not null!");
101 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
103 var result = testingTarget.RelayoutDependentOnChildren();
104 tlog.Debug(tag, "RelayoutDependentOnChildren : " + result);
106 result = testingTarget.RelayoutDependentOnChildren(DimensionType.Height);
107 tlog.Debug(tag, "RelayoutDependentOnChildren : " + result);
109 testingTarget.Dispose();
112 tlog.Debug(tag, $"CustomActorImplRelayoutDependentOnChildren END (OK)");
118 [Description("CustomActorImpl Self.")]
119 [Property("SPEC", "Tizen.NUI.CustomActorImpl.Self M")]
120 [Property("SPEC_URL", "-")]
121 [Property("CRITERIA", "MR")]
122 [Property("AUTHOR", "guowei.wang@samsung.com")]
123 public void CustomActorImplSelf()
125 tlog.Debug(tag, $"CustomActorImplSelf START");
127 using (View view = new View())
129 var testingTarget = NDalic.GetImplementation(view).Self();
130 Assert.IsNotNull(testingTarget, "Should be not null!");
131 Assert.IsInstanceOf<CustomActor>(testingTarget, "Should be an Instance of CustomActor!");
133 testingTarget.Dispose();
136 tlog.Debug(tag, $"CustomActorImplSelf END (OK)");
141 [Description("CustomActorImpl OnSceneConnection.")]
142 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnSceneConnection M")]
143 [Property("SPEC_URL", "-")]
144 [Property("CRITERIA", "MR")]
145 [Property("AUTHOR", "guowei.wang@samsung.com")]
146 public void CustomActorImplOnSceneConnection()
148 tlog.Debug(tag, $"CustomActorImplOnSceneConnection START");
150 using (View view = new View())
152 var testingTarget = NDalic.GetImplementation(view);
153 Assert.IsNotNull(testingTarget, "Should be not null!");
154 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
158 testingTarget.OnSceneConnection(1);
159 testingTarget.OnSceneDisconnection();
163 tlog.Debug(tag, e.Message.ToString());
164 Assert.Fail("Caught Exception : Failed!");
167 testingTarget.Dispose();
170 tlog.Debug(tag, $"CustomActorImplOnSceneConnection END (OK)");
175 [Description("CustomActorImpl OnChildAdd.")]
176 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnChildAdd M")]
177 [Property("SPEC_URL", "-")]
178 [Property("CRITERIA", "MR")]
179 [Property("AUTHOR", "guowei.wang@samsung.com")]
180 public void CustomActorImplOnChildAdd()
182 tlog.Debug(tag, $"CustomActorImplOnChildAdd START");
184 using (View view = new View())
186 var testingTarget = NDalic.GetImplementation(view);
187 Assert.IsNotNull(testingTarget, "Should be not null!");
188 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
190 using (View child = new View())
194 testingTarget.OnChildAdd(child);
196 var result = testingTarget.CalculateChildSize(child, DimensionType.Width);
197 tlog.Debug(tag, "CalculateChildSize : " + result);
199 testingTarget.OnChildRemove(child);
203 tlog.Debug(tag, e.Message.ToString());
204 Assert.Fail("Caught Exception : Failed!");
208 testingTarget.Dispose();
211 tlog.Debug(tag, $"CustomActorImplOnChildAdd END (OK)");
216 [Description("CustomActorImpl OnPropertySet.")]
217 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnPropertySet M")]
218 [Property("SPEC_URL", "-")]
219 [Property("CRITERIA", "MR")]
220 [Property("AUTHOR", "guowei.wang@samsung.com")]
221 public void CustomActorImplOnPropertySet()
223 tlog.Debug(tag, $"CustomActorImplOnPropertySet START");
225 using (View view = new View())
227 var testingTarget = NDalic.GetImplementation(view);
228 Assert.IsNotNull(testingTarget, "Should be not null!");
229 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
234 testingTarget.OnPropertySet(View.Property.OPACITY, new PropertyValue(0.3f));
238 tlog.Debug(tag, e.Message.ToString());
239 Assert.Fail("Caught Exception : Failed!");
242 testingTarget.Dispose();
245 tlog.Debug(tag, $"CustomActorImplOnPropertySet END (OK)");
250 [Description("CustomActorImpl OnLayoutNegotiated.")]
251 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnLayoutNegotiated M")]
252 [Property("SPEC_URL", "-")]
253 [Property("CRITERIA", "MR")]
254 [Property("AUTHOR", "guowei.wang@samsung.com")]
255 public void CustomActorImplOnLayoutNegotiated()
257 tlog.Debug(tag, $"CustomActorImplOnLayoutNegotiated START");
259 using (View view = new View())
261 var testingTarget = NDalic.GetImplementation(view);
262 Assert.IsNotNull(testingTarget, "Should be not null!");
263 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
267 testingTarget.OnLayoutNegotiated(100.0f, DimensionType.Width);
271 tlog.Debug(tag, e.Message.ToString());
272 Assert.Fail("Caught Exception : Failed!");
275 testingTarget.Dispose();
278 tlog.Debug(tag, $"CustomActorImplOnLayoutNegotiated END (OK)");
283 [Description("CustomActorImpl OnSetResizePolicy.")]
284 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnSetResizePolicy M")]
285 [Property("SPEC_URL", "-")]
286 [Property("CRITERIA", "MR")]
287 [Property("AUTHOR", "guowei.wang@samsung.com")]
288 public void CustomActorImplOnSetResizePolicy()
290 tlog.Debug(tag, $"CustomActorImplOnSetResizePolicy START");
292 using (View view = new View())
294 var testingTarget = NDalic.GetImplementation(view);
295 Assert.IsNotNull(testingTarget, "Should be not null!");
296 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
300 testingTarget.OnSetResizePolicy(ResizePolicyType.Fixed, DimensionType.Width);
304 tlog.Debug(tag, e.Message.ToString());
305 Assert.Fail("Caught Exception : Failed!");
308 testingTarget.Dispose();
311 tlog.Debug(tag, $"CustomActorImplOnSetResizePolicy END (OK)");
316 [Description("CustomActorImpl OnCalculateRelayoutSize.")]
317 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnCalculateRelayoutSize M")]
318 [Property("SPEC_URL", "-")]
319 [Property("CRITERIA", "MR")]
320 [Property("AUTHOR", "guowei.wang@samsung.com")]
321 public void CustomActorImplOnCalculateRelayoutSize()
323 tlog.Debug(tag, $"CustomActorImplOnCalculateRelayoutSize START");
325 using (View view = new View())
327 var testingTarget = NDalic.GetImplementation(view);
328 Assert.IsNotNull(testingTarget, "Should be not null!");
329 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
333 testingTarget.OnCalculateRelayoutSize(DimensionType.AllDimensions);
337 tlog.Debug(tag, e.Message.ToString());
338 Assert.Fail("Caught Exception : Failed!");
341 testingTarget.Dispose();
344 tlog.Debug(tag, $"CustomActorImplOnCalculateRelayoutSize END (OK)");
349 [Description("CustomActorImpl GetHeightForWidth.")]
350 [Property("SPEC", "Tizen.NUI.CustomActorImpl.GetHeightForWidth M")]
351 [Property("SPEC_URL", "-")]
352 [Property("CRITERIA", "MR")]
353 [Property("AUTHOR", "guowei.wang@samsung.com")]
354 public void CustomActorImplGetHeightForWidth()
356 tlog.Debug(tag, $"CustomActorImplGetHeightForWidth START");
358 using (View view = new View())
360 var testingTarget = NDalic.GetImplementation(view);
361 Assert.IsNotNull(testingTarget, "Should be not null!");
362 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
364 var size = testingTarget.GetNaturalSize();
365 Assert.IsInstanceOf<Vector3>(size, "Should be an Instance of Vector3!");
367 var result = testingTarget.GetHeightForWidth(100.0f);
368 tlog.Debug(tag, "GetHeightForWidth : " + result);
370 result = testingTarget.GetWidthForHeight(50.0f);
371 tlog.Debug(tag, "GetWidthForHeight : " + result);
373 testingTarget.Dispose();
376 tlog.Debug(tag, $"CustomActorImplGetHeightForWidth END (OK)");
381 [Description("CustomActorImpl OnSizeAnimation.")]
382 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnSizeAnimation M")]
383 [Property("SPEC_URL", "-")]
384 [Property("CRITERIA", "MR")]
385 [Property("AUTHOR", "guowei.wang@samsung.com")]
386 public void CustomActorImplOnSizeAnimation()
388 tlog.Debug(tag, $"CustomActorImplOnSizeAnimation START");
390 using (View view = new View())
392 var testingTarget = NDalic.GetImplementation(view);
393 Assert.IsNotNull(testingTarget, "Should be not null!");
394 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
398 using (Animation ani = new Animation(300))
400 using (Vector3 vector = new Vector3(100.0f, 20.0f, 80.0f))
402 testingTarget.OnSizeAnimation(ani, vector);
408 tlog.Debug(tag, e.Message.ToString());
409 Assert.Fail("Caught Exception : Failed!");
412 testingTarget.Dispose();
415 tlog.Debug(tag, $"CustomActorImplOnSizeAnimation END (OK)");
420 [Description("CustomActorImpl OnSizeSet.")]
421 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnSizeSet M")]
422 [Property("SPEC_URL", "-")]
423 [Property("CRITERIA", "MR")]
424 [Property("AUTHOR", "guowei.wang@samsung.com")]
425 public void CustomActorImplOnSizeSet()
427 tlog.Debug(tag, $"CustomActorImplOnSizeSet START");
429 using (View view = new View())
431 var testingTarget = NDalic.GetImplementation(view);
432 Assert.IsNotNull(testingTarget, "Should be not null!");
433 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
437 using (Vector3 vector = new Vector3(100.0f, 20.0f, 80.0f))
439 testingTarget.OnSizeSet(vector);
444 tlog.Debug(tag, e.Message.ToString());
445 Assert.Fail("Caught Exception : Failed!");
448 testingTarget.Dispose();
451 tlog.Debug(tag, $"CustomActorImplOnSizeSet END (OK)");
456 [Description("CustomActorImpl OnRelayout.")]
457 [Property("SPEC", "Tizen.NUI.CustomActorImpl.OnRelayout M")]
458 [Property("SPEC_URL", "-")]
459 [Property("CRITERIA", "MR")]
460 [Property("AUTHOR", "guowei.wang@samsung.com")]
461 public void CustomActorImplOnRelayout()
463 tlog.Debug(tag, $"CustomActorImplOnRelayout START");
465 using (View view = new View())
467 var testingTarget = NDalic.GetImplementation(view);
468 Assert.IsNotNull(testingTarget, "Should be not null!");
469 Assert.IsInstanceOf<CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!");
471 using (Vector2 vector = new Vector2(100.0f, 20.0f))
473 using (RelayoutContainer container = new RelayoutContainer(view.SwigCPtr.Handle, false))
477 testingTarget.OnRelayout(vector, container);
481 tlog.Debug(tag, e.Message.ToString());
482 Assert.Fail("Caught Exception : Failed!");
487 testingTarget.Dispose();
490 tlog.Debug(tag, $"CustomActorImplOnRelayout END (OK)");