ed510d319e7d9e19787955c2c7d1f6eebed18d13
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Layouting / TSFlexLayout.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 using System.Collections.Generic;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("public/Layouting/FlexLayout")]
14     public class PublicFlexLayoutTest
15     {
16         private const string tag = "NUITEST";
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22         }
23
24         [TearDown]
25         public void Destroy()
26         {
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         private static bool flagOnMeasureOverride;
31         private static bool flagOnLayoutOverride;
32         private static bool flagOnChildAddOverride;
33         private static bool flagOnChildRemoveOverride;
34         internal class MyFlexLayout : FlexLayout
35         {
36             public MyFlexLayout() : base()
37             { }
38
39             public void OnMeasureTest(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
40             {
41                 OnMeasure(widthMeasureSpec, heightMeasureSpec);
42             }
43             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
44             {
45                 flagOnMeasureOverride = true;
46                 base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
47             }
48
49             public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
50             {
51                 OnLayout(changed, left, top, right, bottom);
52             }
53             protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
54             {
55                 flagOnLayoutOverride = true;
56                 base.OnLayout(changed, left, top, right, bottom);
57             }
58
59             public void OnChildAddTest(LayoutItem child)
60             {
61                 OnChildAdd(child);
62             }
63             protected override void OnChildAdd(LayoutItem child)
64             {
65                 flagOnChildAddOverride = true;
66                 base.OnChildAdd(child);
67             }
68
69             public void OnChildRemoveTest(LayoutItem child)
70             {
71                 OnChildRemove(child);
72             }
73             protected override void OnChildRemove(LayoutItem child)
74             {
75                 flagOnChildRemoveOverride = true;
76                 base.OnChildRemove(child);
77             }
78         }
79
80         [Test]
81         [Category("P1")]
82         [Description("FlexLayout constructor")]
83         [Property("SPEC", "Tizen.NUI.FlexLayout.FlexLayout C")]
84         [Property("SPEC_URL", "-")]
85         [Property("CRITERIA", "CONSTR")]
86         [Property("AUTHOR", "guowei.wang@samsung.com")]
87         public void FlexLayoutConstructor()
88         {
89             tlog.Debug(tag, $"FlexLayoutConstructor START");
90
91             var testingTarget = new FlexLayout();
92             Assert.IsNotNull(testingTarget, "null handle");
93             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
94
95             testingTarget.Dispose();
96             tlog.Debug(tag, $"FlexLayoutConstructor END (OK)");
97         }
98
99         [Test]
100         [Category("P1")]
101         [Description("FlexLayout SetFlexAlignmentSelf")]
102         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexAlignmentSelf M")]
103         [Property("SPEC_URL", "-")]
104         [Property("CRITERIA", "MR")]
105         [Property("AUTHOR", "guowei.wang@samsung.com")]
106         public void FlexLayoutSetFlexAlignmentSelf()
107         {
108             tlog.Debug(tag, $"FlexLayoutSetFlexAlignmentSelf START");
109
110             View view = new View()
111             {
112                 Size = new Size(400, 400),
113                 BackgroundColor = Color.White,
114                 Layout = new FlexLayout()
115                 {
116                     Direction = FlexLayout.FlexDirection.Column,
117                 }
118             };
119
120             try
121             {
122                 FlexLayout.SetFlexAlignmentSelf(view, FlexLayout.AlignmentType.FlexStart);
123             }
124             catch (Exception e)
125             {
126                 tlog.Error(tag, "Caught Exception" + e.ToString());
127                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
128                 Assert.Fail("Caught Exception" + e.ToString());
129             }
130
131             view.Dispose();
132             tlog.Debug(tag, $"FlexLayoutSetFlexAlignmentSelf END (OK)");
133         }
134
135         [Test]
136         [Category("P1")]
137         [Description("FlexLayout GetFlexAlignmentSelf")]
138         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexAlignmentSelf M")]
139         [Property("SPEC_URL", "-")]
140         [Property("CRITERIA", "MR")]
141         [Property("AUTHOR", "guowei.wang@samsung.com")]
142         public void FlexLayoutGetFlexAlignmentSelf()
143         {
144             tlog.Debug(tag, $"FlexLayoutGetFlexAlignmentSelf START");
145
146             View view = new View()
147             {
148                 Size = new Size(400, 400),
149                 BackgroundColor = Color.White,
150                 Layout = new FlexLayout()
151                 {
152                     Direction = FlexLayout.FlexDirection.Column,
153                 }
154             };
155
156             FlexLayout.SetFlexAlignmentSelf(view, FlexLayout.AlignmentType.FlexStart);
157             var result = FlexLayout.GetFlexAlignmentSelf(view);
158             Assert.AreEqual(FlexLayout.AlignmentType.FlexStart, result, "should be equal!");
159
160             view.Dispose();
161             tlog.Debug(tag, $"FlexLayoutGetFlexAlignmentSelf END (OK)");
162         }
163
164         [Test]
165         [Category("P1")]
166         [Description("FlexLayout SetFlexPositionType")]
167         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexPositionType M")]
168         [Property("SPEC_URL", "-")]
169         [Property("CRITERIA", "MR")]
170         [Property("AUTHOR", "guowei.wang@samsung.com")]
171         public void FlexLayoutSetFlexPositionType()
172         {
173             tlog.Debug(tag, $"FlexLayoutSetFlexPositionType START");
174
175             View view = new View()
176             {
177                 Size = new Size(400, 400),
178                 BackgroundColor = Color.White,
179                 Layout = new FlexLayout()
180                 {
181                     Direction = FlexLayout.FlexDirection.Column,
182                 }
183             };
184
185             try
186             {
187                 FlexLayout.SetFlexPositionType(view, FlexLayout.PositionType.Relative);
188             }
189             catch (Exception e)
190             {
191                 tlog.Error(tag, "Caught Exception" + e.ToString());
192                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
193                 Assert.Fail("Caught Exception" + e.ToString());
194             }
195
196             view.Dispose();
197             tlog.Debug(tag, $"FlexLayoutSetFlexPositionType END (OK)");
198         }
199
200         [Test]
201         [Category("P1")]
202         [Description("FlexLayout GetFlexPositionType")]
203         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexPositionType M")]
204         [Property("SPEC_URL", "-")]
205         [Property("CRITERIA", "MR")]
206         [Property("AUTHOR", "guowei.wang@samsung.com")]
207         public void FlexLayoutGetFlexPositionType()
208         {
209             tlog.Debug(tag, $"FlexLayoutGetFlexPositionType START");
210
211             View view = new View()
212             {
213                 Size = new Size(400, 400),
214                 BackgroundColor = Color.White,
215                 Layout = new FlexLayout()
216                 {
217                     Direction = FlexLayout.FlexDirection.Column,
218                 }
219             };
220
221             FlexLayout.SetFlexPositionType(view, FlexLayout.PositionType.Relative);
222             var result = FlexLayout.GetFlexPositionType(view);
223             Assert.AreEqual(FlexLayout.PositionType.Relative, result, "should be equal!");
224
225             view.Dispose();
226             tlog.Debug(tag, $"FlexLayoutGetFlexPositionType END (OK)");
227         }
228
229         [Test]
230         [Category("P1")]
231         [Description("FlexLayout SetFlexAspectRatio")]
232         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexAspectRatio M")]
233         [Property("SPEC_URL", "-")]
234         [Property("CRITERIA", "MR")]
235         [Property("AUTHOR", "guowei.wang@samsung.com")]
236         public void FlexLayoutSetFlexAspectRatio()
237         {
238             tlog.Debug(tag, $"FlexLayoutSetFlexAspectRatio START");
239
240             View view = new View()
241             {
242                 Size = new Size(400, 400),
243                 BackgroundColor = Color.White,
244                 Layout = new FlexLayout()
245                 {
246                     Direction = FlexLayout.FlexDirection.Column,
247                 }
248             };
249
250             try
251             {
252                 FlexLayout.SetFlexAspectRatio(view, 0.3f);
253             }
254             catch (Exception e)
255             {
256                 tlog.Error(tag, "Caught Exception" + e.ToString());
257                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
258                 Assert.Fail("Caught Exception" + e.ToString());
259             }
260
261             view.Dispose();
262             tlog.Debug(tag, $"FlexLayoutSetFlexAspectRatio END (OK)");
263         }
264
265         [Test]
266         [Category("P1")]
267         [Description("FlexLayout GetFlexAspectRatio")]
268         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexAspectRatio M")]
269         [Property("SPEC_URL", "-")]
270         [Property("CRITERIA", "MR")]
271         [Property("AUTHOR", "guowei.wang@samsung.com")]
272         public void FlexLayoutGetFlexAspectRatio()
273         {
274             tlog.Debug(tag, $"FlexLayoutGetFlexAspectRatio START");
275
276             View view = new View()
277             {
278                 Size = new Size(400, 400),
279                 BackgroundColor = Color.White,
280                 Layout = new FlexLayout()
281                 {
282                     Direction = FlexLayout.FlexDirection.Column,
283                 }
284             };
285
286             FlexLayout.SetFlexAspectRatio(view, 0.3f);
287             var result = FlexLayout.GetFlexAspectRatio(view);
288             Assert.AreEqual(0.3f, result, "should be equal!");
289
290             view.Dispose();
291             tlog.Debug(tag, $"FlexLayoutGetFlexAspectRatio END (OK)");
292         }
293
294         [Test]
295         [Category("P1")]
296         [Description("FlexLayout SetFlexBasis")]
297         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexBasis M")]
298         [Property("SPEC_URL", "-")]
299         [Property("CRITERIA", "MR")]
300         [Property("AUTHOR", "guowei.wang@samsung.com")]
301         public void FlexLayoutSetFlexBasis()
302         {
303             tlog.Debug(tag, $"FlexLayoutSetFlexBasis START");
304
305             View view = new View()
306             {
307                 Size = new Size(400, 400),
308                 BackgroundColor = Color.White,
309                 Layout = new FlexLayout()
310                 {
311                     Direction = FlexLayout.FlexDirection.Column,
312                 }
313             };
314
315             try
316             {
317                 FlexLayout.SetFlexBasis(view, 0.6f);
318             }
319             catch (Exception e)
320             {
321                 tlog.Error(tag, "Caught Exception" + e.ToString());
322                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
323                 Assert.Fail("Caught Exception" + e.ToString());
324             }
325
326             view.Dispose();
327             tlog.Debug(tag, $"FlexLayoutSetFlexBasis END (OK)");
328         }
329
330         [Test]
331         [Category("P1")]
332         [Description("FlexLayout GetFlexBasis")]
333         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexBasis M")]
334         [Property("SPEC_URL", "-")]
335         [Property("CRITERIA", "MR")]
336         [Property("AUTHOR", "guowei.wang@samsung.com")]
337         public void FlexLayoutGetFlexBasis()
338         {
339             tlog.Debug(tag, $"FlexLayoutGetFlexBasis START");
340
341             View view = new View()
342             {
343                 Size = new Size(400, 400),
344                 BackgroundColor = Color.White,
345                 Layout = new FlexLayout()
346                 {
347                     Direction = FlexLayout.FlexDirection.Column,
348                 }
349             };
350
351             FlexLayout.SetFlexBasis(view, 0.6f);
352             var result = FlexLayout.GetFlexBasis(view);
353             Assert.AreEqual(0.6f, result, "should be equal!");
354
355             view.Dispose();
356             tlog.Debug(tag, $"FlexLayoutGetFlexBasis END (OK)");
357         }
358
359         [Test]
360         [Category("P1")]
361         [Description("FlexLayout SetFlexShrink")]
362         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexShrink M")]
363         [Property("SPEC_URL", "-")]
364         [Property("CRITERIA", "MR")]
365         [Property("AUTHOR", "guowei.wang@samsung.com")]
366         public void FlexLayoutSetFlexShrink()
367         {
368             tlog.Debug(tag, $"FlexLayoutSetFlexShrink START");
369
370             View view = new View()
371             {
372                 Size = new Size(400, 400),
373                 BackgroundColor = Color.White,
374                 Layout = new FlexLayout()
375                 {
376                     Direction = FlexLayout.FlexDirection.Column,
377                 }
378             };
379
380             try
381             {
382                 FlexLayout.SetFlexShrink(view, 0.9f);
383             }
384             catch (Exception e)
385             {
386                 tlog.Error(tag, "Caught Exception" + e.ToString());
387                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
388                 Assert.Fail("Caught Exception" + e.ToString());
389             }
390
391             view.Dispose();
392             tlog.Debug(tag, $"FlexLayoutSetFlexShrink END (OK)");
393         }
394
395         [Test]
396         [Category("P1")]
397         [Description("FlexLayout GetFlexShrink")]
398         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexShrink M")]
399         [Property("SPEC_URL", "-")]
400         [Property("CRITERIA", "MR")]
401         [Property("AUTHOR", "guowei.wang@samsung.com")]
402         public void FlexLayoutGetFlexShrink()
403         {
404             tlog.Debug(tag, $"FlexLayoutGetFlexShrink START");
405
406             View view = new View()
407             {
408                 Size = new Size(400, 400),
409                 BackgroundColor = Color.White,
410                 Layout = new FlexLayout()
411                 {
412                     Direction = FlexLayout.FlexDirection.Column,
413                 }
414             };
415
416             FlexLayout.SetFlexShrink(view, 0.9f);
417             var result = FlexLayout.GetFlexShrink(view);
418             Assert.AreEqual(0.9f, result, "should be equal!");
419
420             view.Dispose();
421             tlog.Debug(tag, $"FlexLayoutGetFlexShrink END (OK)");
422         }
423
424         [Test]
425         [Category("P1")]
426         [Description("FlexLayout SetFlexGrow")]
427         [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexGrow M")]
428         [Property("SPEC_URL", "-")]
429         [Property("CRITERIA", "MR")]
430         [Property("AUTHOR", "guowei.wang@samsung.com")]
431         public void FlexLayoutSetFlexGrow()
432         {
433             tlog.Debug(tag, $"FlexLayoutSetFlexGrow START");
434
435             View view = new View()
436             {
437                 Size = new Size(400, 400),
438                 BackgroundColor = Color.White,
439                 Layout = new FlexLayout()
440                 {
441                     Direction = FlexLayout.FlexDirection.Column,
442                 }
443             };
444
445             try
446             {
447                 FlexLayout.SetFlexGrow(view, 0.2f);
448             }
449             catch (Exception e)
450             {
451                 tlog.Error(tag, "Caught Exception" + e.ToString());
452                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
453                 Assert.Fail("Caught Exception" + e.ToString());
454             }
455
456             view.Dispose();
457             tlog.Debug(tag, $"FlexLayoutSetFlexGrow END (OK)");
458         }
459
460         [Test]
461         [Category("P1")]
462         [Description("FlexLayout GetFlexGrow")]
463         [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexGrow M")]
464         [Property("SPEC_URL", "-")]
465         [Property("CRITERIA", "MR")]
466         [Property("AUTHOR", "guowei.wang@samsung.com")]
467         public void FlexLayoutGetFlexGrow()
468         {
469             tlog.Debug(tag, $"FlexLayoutGetFlexGrow START");
470
471             View view = new View()
472             {
473                 Size = new Size(400, 400),
474                 BackgroundColor = Color.White,
475                 Layout = new FlexLayout()
476                 {
477                     Direction = FlexLayout.FlexDirection.Column,
478                 }
479             };
480
481             FlexLayout.SetFlexGrow(view, 0.2f);
482             var result = FlexLayout.GetFlexGrow(view);
483             Assert.AreEqual(0.2f, result, "should be equal!");
484
485             view.Dispose();
486             tlog.Debug(tag, $"FlexLayoutGetFlexGrow END (OK)");
487         }
488
489         [Test]
490         [Category("P1")]
491         [Description("FlexLayout DownCast")]
492         [Property("SPEC", "Tizen.NUI.FlexLayout.DownCast M")]
493         [Property("SPEC_URL", "-")]
494         [Property("CRITERIA", "MR")]
495         [Property("AUTHOR", "guowei.wang@samsung.com")]
496         public void FlexLayoutDownCast()
497         {
498             tlog.Debug(tag, $"FlexLayoutDownCast START");
499
500             View view = new View()
501             {
502                 Size = new Size(400, 400),
503                 BackgroundColor = Color.White,
504                 Layout = new FlexLayout()
505                 {
506                     Direction = FlexLayout.FlexDirection.Column,
507                 }
508             };
509
510             var testingTarget = FlexLayout.DownCast(view);
511             Assert.IsNotNull(testingTarget, "null handle");
512             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
513
514             view.Dispose();
515             testingTarget.Dispose();
516             tlog.Debug(tag, $"FlexLayoutDownCast END (OK)");
517         }
518
519         [Test]
520         [Category("P1")]
521         [Description("FlexLayout Direction")]
522         [Property("SPEC", "Tizen.NUI.FlexLayout.Direction A")]
523         [Property("SPEC_URL", "-")]
524         [Property("CRITERIA", "PRW")]
525         [Property("AUTHOR", "guowei.wang@samsung.com")]
526         public void FlexLayoutDirection()
527         {
528             tlog.Debug(tag, $"FlexLayoutDirection START");
529
530             var testingTarget = new FlexLayout();
531             Assert.IsNotNull(testingTarget, "null handle");
532             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
533
534             testingTarget.Direction = FlexLayout.FlexDirection.Column;
535             Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.Column, "Should be Column.");
536
537             testingTarget.Direction = FlexLayout.FlexDirection.Row;
538             Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.Row, "Should be Row.");
539
540             testingTarget.Direction = FlexLayout.FlexDirection.ColumnReverse;
541             Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.ColumnReverse, "Should be ColumnReverse.");
542
543             testingTarget.Direction = FlexLayout.FlexDirection.RowReverse;
544             Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.RowReverse, "Should be RowReverse.");
545
546             testingTarget.Dispose();
547             tlog.Debug(tag, $"FlexLayoutDirection END (OK)");
548         }
549
550         [Test]
551         [Category("P1")]
552         [Description("FlexLayout Justification")]
553         [Property("SPEC", "Tizen.NUI.FlexLayout.Justification A")]
554         [Property("SPEC_URL", "-")]
555         [Property("CRITERIA", "PRW")]
556         [Property("AUTHOR", "guowei.wang@samsung.com")]
557         public void FlexLayoutJustification()
558         {
559             tlog.Debug(tag, $"FlexLayoutJustification START");
560
561             var testingTarget = new FlexLayout();
562             Assert.IsNotNull(testingTarget, "null handle");
563             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
564
565             testingTarget.Justification = FlexLayout.FlexJustification.FlexStart;
566             Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.FlexStart, "Should be FlexStart.");
567
568             testingTarget.Justification = FlexLayout.FlexJustification.FlexEnd;
569             Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.FlexEnd, "Should be FlexEnd.");
570
571             testingTarget.Justification = FlexLayout.FlexJustification.Center;
572             Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.Center, "Should be Center.");
573
574             testingTarget.Justification = FlexLayout.FlexJustification.SpaceBetween;
575             Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.SpaceBetween, "Should be SpaceBetween.");
576
577             testingTarget.Justification = FlexLayout.FlexJustification.SpaceAround;
578             Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.SpaceAround, "Should be SpaceAround.");
579
580             testingTarget.Dispose();
581             tlog.Debug(tag, $"FlexLayoutJustification END (OK)");
582         }
583
584         [Test]
585         [Category("P1")]
586         [Description("FlexLayout WrapType")]
587         [Property("SPEC", "Tizen.NUI.FlexLayout.WrapType A")]
588         [Property("SPEC_URL", "-")]
589         [Property("CRITERIA", "PRW")]
590         [Property("AUTHOR", "guowei.wang@samsung.com")]
591         public void FlexLayoutWrapType()
592         {
593             tlog.Debug(tag, $"FlexLayoutWrapType START");
594
595             var testingTarget = new FlexLayout();
596             Assert.IsNotNull(testingTarget, "null handle");
597             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
598
599             testingTarget.WrapType = FlexLayout.FlexWrapType.NoWrap;
600             Assert.AreEqual(testingTarget.WrapType, FlexLayout.FlexWrapType.NoWrap, "Should be NoWrap.");
601
602             testingTarget.WrapType = FlexLayout.FlexWrapType.Wrap;
603             Assert.AreEqual(testingTarget.WrapType, FlexLayout.FlexWrapType.Wrap, "Should be Wrap.");
604
605             testingTarget.Dispose();
606             tlog.Debug(tag, $"FlexLayoutWrapType END (OK)");
607         }
608
609         [Test]
610         [Category("P1")]
611         [Description("FlexLayout Alignment")]
612         [Property("SPEC", "Tizen.NUI.FlexLayout.Alignment A")]
613         [Property("SPEC_URL", "-")]
614         [Property("CRITERIA", "PRW")]
615         [Property("AUTHOR", "guowei.wang@samsung.com")]
616         public void FlexLayoutAlignment()
617         {
618             tlog.Debug(tag, $"FlexLayoutAlignment START");
619
620             var testingTarget = new FlexLayout();
621             Assert.IsNotNull(testingTarget, "null handle");
622             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
623
624             testingTarget.Alignment = FlexLayout.AlignmentType.FlexStart;
625             Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart.");
626
627             testingTarget.Alignment = FlexLayout.AlignmentType.FlexEnd;
628             Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd.");
629
630             testingTarget.Alignment = FlexLayout.AlignmentType.Auto;
631             Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Auto, "Should be Auto.");
632
633             testingTarget.Alignment = FlexLayout.AlignmentType.Center;
634             Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Center, "Should be Center.");
635
636             testingTarget.Alignment = FlexLayout.AlignmentType.Stretch;
637             Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Stretch, "Should be Stretch.");
638
639             testingTarget.Dispose();
640             tlog.Debug(tag, $"FlexLayoutAlignment END (OK)");
641         }
642
643         [Test]
644         [Category("P1")]
645         [Description("FlexLayout ItemsAlignment")]
646         [Property("SPEC", "Tizen.NUI.FlexLayout.ItemsAlignment A")]
647         [Property("SPEC_URL", "-")]
648         [Property("CRITERIA", "PRW")]
649         [Property("AUTHOR", "guowei.wang@samsung.com")]
650         public void FlexLayoutItemsAlignment()
651         {
652             tlog.Debug(tag, $"FlexLayoutItemsAlignment START");
653
654             var testingTarget = new FlexLayout();
655             Assert.IsNotNull(testingTarget, "null handle");
656             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
657
658             testingTarget.ItemsAlignment = FlexLayout.AlignmentType.FlexStart;
659             Assert.AreEqual(testingTarget.ItemsAlignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart.");
660
661             testingTarget.ItemsAlignment = FlexLayout.AlignmentType.FlexEnd;
662             Assert.AreEqual(testingTarget.ItemsAlignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd.");
663
664             testingTarget.Dispose();
665             tlog.Debug(tag, $"FlexLayoutItemsAlignment END (OK)");
666         }
667
668         [Test]
669         [Category("P1")]
670         [Description("FlexLayout OnMeasure")]
671         [Property("SPEC", "Tizen.NUI.FlexLayout.OnMeasure M")]
672         [Property("SPEC_URL", "-")]
673         [Property("CRITERIA", "MCST")]
674         [Property("AUTHOR", "guowei.wang@samsung.com")]
675         public void FlexLayoutOnMeasure()
676         {
677             tlog.Debug(tag, $"FlexLayoutOnMeasure START");
678
679             flagOnMeasureOverride = false;
680             Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
681
682             LayoutItem layoutItem = new LinearLayout();
683
684             View view = new View()
685             {
686                 ExcludeLayouting = false,
687                 Size = new Size(100, 150),
688                 Layout = new FlexLayout()
689             };
690
691             layoutItem.AttachToOwner(view);
692
693             var testingTarget = new MyFlexLayout();
694             Assert.IsNotNull(testingTarget, "null handle");
695             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should be an instance of FlexLayout type.");
696
697             testingTarget.AttachToOwner(view);
698             testingTarget.Add(layoutItem);
699
700             MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
701             MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
702
703             testingTarget.OnMeasureTest(measureWidth, measureHeight);
704             Assert.True(flagOnMeasureOverride, "FlexLayout overridden method not invoked.");
705
706             tlog.Debug(tag, $"FlexLayoutOnMeasure END (OK)");
707         }
708
709         [Test]
710         [Category("P1")]
711         [Description("FlexLayout OnLayout")]
712         [Property("SPEC", "Tizen.NUI.FlexLayout.OnLayout M")]
713         [Property("SPEC_URL", "-")]
714         [Property("CRITERIA", "MCST")]
715         [Property("AUTHOR", "guowei.wang@samsung.com")]
716         public void FlexLayoutOnLayout()
717         {
718             tlog.Debug(tag, $"FlexLayoutOnLayout START");
719
720             flagOnLayoutOverride = false;
721             Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
722
723             LayoutItem layoutItem = new LinearLayout();
724
725             View view = new View()
726             {
727                 ExcludeLayouting = false,
728                 Size = new Size(100, 150),
729                 Layout = new FlexLayout()
730             };
731
732             layoutItem.AttachToOwner(view);
733
734             var testingTarget = new MyFlexLayout();
735             Assert.IsNotNull(testingTarget, "null handle");
736             Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should be an instance of FlexLayout type.");
737
738             testingTarget.AttachToOwner(view);
739             testingTarget.Add(layoutItem);
740
741             testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
742             Assert.True(flagOnLayoutOverride, "FlexLayout overridden method not invoked.");
743
744             // Test with false parameter
745             flagOnLayoutOverride = false;
746             Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
747             testingTarget.OnLayoutTest(false, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
748             Assert.True(flagOnLayoutOverride, "FlexLayout overridden method not invoked with false parameter.");
749
750             tlog.Debug(tag, $"FlexLayoutOnLayout END (OK)");
751         }
752     }
753 }