Add sibling order property test for nui
authorxb.teng <xb.teng@samsung.com>
Fri, 19 May 2017 11:05:00 +0000 (19:05 +0800)
committerxb.teng <xb.teng@samsung.com>
Fri, 19 May 2017 11:05:00 +0000 (19:05 +0800)
Change-Id: I09bb9ae0ec9a25d5b4351db1ac190705c327b87f

NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj
NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs [changed mode: 0644->0755]
NUISamples/NUISamples/NUISamples.TizenTV/examples/sibling-order-test.cs [new file with mode: 0755]

index fd84a94abc4752bc93e8dacc0fab0529289fa085..07d8a150fea28057a2d67b8d1ad6884c951c3f45 100755 (executable)
@@ -69,6 +69,7 @@
     <Compile Include="examples\positionUsesAnchorPoint-test.cs" />\r
     <Compile Include="examples\relative-vector.cs" />\r
     <Compile Include="examples\scroll-view.cs" />\r
+    <Compile Include="examples\sibling-order-test.cs" />\r
     <Compile Include="examples\test1.cs" />\r
     <Compile Include="examples\user-alphafunction.cs" />\r
     <Compile Include="examples\view-navi-property.cs" />\r
       </FlavorProperties>\r
     </VisualStudio>\r
   </ProjectExtensions>\r
-</Project>
\ No newline at end of file
+</Project>\r
old mode 100644 (file)
new mode 100755 (executable)
index 6e2c143..bf32519
@@ -17,9 +17,10 @@ namespace NUISamples.TizenTV.examples
             //new ControlDashboard.Example().Run(args);                 //o
             //new DatePickerTest.Example().Run(args);                   //o
             //new DatePickerUsingJson.Example().Run(args);              //o
-            //new HelloTest.Example().Run(args);                        //o
-            new HelloWorldTest.Example().Run(args);                   //o
-            //new Test1.Example().Run(args);                            //o
+            // new HelloTest.Example().Run(args);                        //o
+            // new HelloWorldTest.Example().Run(args);                   //o
+            // new Test1.Example().Run(args);                            //o
+            new SiblingOrderTest.Example().Run(args);                 //o
             //new UserAlphaFunctionTest.Example().Run(args);            //o
             //new MyCSharpExample.Example().Run(args);                  //o
             //new CustomControlTest.Example().Run(args);                //o
diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/sibling-order-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/sibling-order-test.cs
new file mode 100755 (executable)
index 0000000..fbd1942
--- /dev/null
@@ -0,0 +1,193 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+
+// 1) sibling order test
+namespace SiblingOrderTest
+{
+    class Example : NUIApplication
+    {
+        public Example() : base()
+        {
+        }
+
+        public Example(string stylesheet) : base(stylesheet)
+        {
+        }
+
+        public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
+        {
+        }
+
+        protected override void OnCreate()
+        {
+            base.OnCreate();
+            Initialize();
+        }
+
+        Window _window;
+
+        public void Initialize()
+        {
+            _window = Window.Instance;
+            _window.BackgroundColor = Color.White;
+
+            // sibling order test
+            // By default, the SiblingOrder is 0.
+            SiblingTest1();
+
+            // sibling order test
+            // Set the SiblingOrder 0 -> 9
+            SiblingTest2();
+
+            // sibling order test
+            // Set the SiblingOrder 10 -> 1
+            SiblingTest3();
+
+            // sibling order test
+            // Set the SiblingOrder 5 -> 1 & 0 -> 4
+            SiblingTest4();
+
+            // sibling order test
+            // Set the SiblingOrder 0 -> 4 & 5 -> 1
+            SiblingTest5();
+        }
+
+        public void SiblingTest1()
+        {
+            Position2D _myPos = new Position2D(100, 30);
+
+            for (int i = 0; i < 10; i++)
+            {
+                PushButton _view = new PushButton();
+
+                _view.Name = "sibling" + i;
+                _view.LabelText = "view" + i;
+                _view.MinimumSize = new Size2D(100, 50);
+                _view.ParentOrigin = ParentOrigin.TopLeft;
+                _view.AnchorPoint = AnchorPoint.TopLeft;
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
+
+                _window.GetDefaultLayer().Add(_view);
+            }
+        }
+
+        public void SiblingTest2()
+        {
+            Position2D _myPos = new Position2D(100, 180);
+
+            for (int i = 0; i < 10; i++)
+            {
+                PushButton _view = new PushButton();
+
+                _view.Name = "sibling" + i;
+                _view.LabelText = "view" + i;
+                _view.MinimumSize = new Size2D(100, 50);
+                _view.ParentOrigin = ParentOrigin.TopLeft;
+                _view.AnchorPoint = AnchorPoint.TopLeft;
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
+                _view.SiblingOrder = i;
+
+                _window.GetDefaultLayer().Add(_view);
+            }
+        }
+
+        public void SiblingTest3()
+        {
+            Position2D _myPos = new Position2D(100, 330);
+
+            for (int i = 0; i < 10; i++)
+            {
+                PushButton _view = new PushButton();
+
+                _view.Name = "sibling" + i;
+                _view.LabelText = "view" + i;
+                _view.MinimumSize = new Size2D(100, 50);
+                _view.ParentOrigin = ParentOrigin.TopLeft;
+                _view.AnchorPoint = AnchorPoint.TopLeft;
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
+                _view.SiblingOrder = 10-i;
+
+                _window.GetDefaultLayer().Add(_view);
+            }
+        }
+
+        public void SiblingTest4()
+        {
+            Position2D _myPos = new Position2D(100, 480);
+
+            for (int i = 0; i < 10; i++)
+            {
+                PushButton _view = new PushButton();
+
+                _view.Name = "sibling" + i;
+                _view.LabelText = "view" + i;
+                _view.MinimumSize = new Size2D(100, 50);
+                _view.ParentOrigin = ParentOrigin.TopLeft;
+                _view.AnchorPoint = AnchorPoint.TopLeft;
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
+                if (i<5)
+                {
+                    _view.SiblingOrder = 5-i;
+                }
+                else
+                {
+                    _view.SiblingOrder = i-5;
+                }
+
+                _window.GetDefaultLayer().Add(_view);
+            }
+        }
+
+        public void SiblingTest5()
+        {
+            Position2D _myPos = new Position2D(100, 630);
+
+            for (int i = 0; i < 10; i++)
+            {
+                PushButton _view = new PushButton();
+
+                _view.Name = "sibling" + i;
+                _view.LabelText = "view" + i;
+                _view.MinimumSize = new Size2D(100, 50);
+                _view.ParentOrigin = ParentOrigin.TopLeft;
+                _view.AnchorPoint = AnchorPoint.TopLeft;
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
+                if (i<5)
+                {
+                    _view.SiblingOrder = i;
+                }
+                else
+                {
+                    _view.SiblingOrder = 10-i;
+                }
+
+                _window.GetDefaultLayer().Add(_view);
+            }
+        }
+
+        static void _Main(string[] args)
+        {
+            Example example = new Example();
+            example.Run(args);
+        }
+    }
+}