Add support for Control keyboard navigation properties
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / examples / dali-test.cs
index 856a4dd..6e106ae 100644 (file)
@@ -108,6 +108,8 @@ namespace MyCSharpExample
 
         public void Initialize(object source, NUIApplicationInitEventArgs e)
         {
+            NavigationPropertiesTests();
+
             OperatorTests();
 
             CustomViewPropertyTest();
@@ -265,6 +267,83 @@ namespace MyCSharpExample
             }
         }
 
+        public void NavigationPropertiesTests()
+        {
+            View view = new View();
+            View leftView, rightView, upView, downView, tmpView;
+
+            leftView = new View();
+            leftView.Name = "leftView";
+            rightView = new View();
+            rightView.Name = "rightView";
+            upView = new View();
+            upView.Name = "upView";
+            downView = new View();
+            downView.Name = "downView";
+
+            Stage.Instance.Add(leftView);
+            Stage.Instance.Add(rightView);
+            Stage.Instance.Add(upView);
+            Stage.Instance.Add(downView);
+
+            view.LeftFocusableView = leftView;
+            tmpView = view.LeftFocusableView;
+            if (string.Compare(tmpView.Name, "leftView") == 0)
+            {
+                Console.WriteLine("Passed: LeftFocusedView = " + tmpView.Name);
+            }
+            else
+            {
+                Console.WriteLine("Failed: LeftFocusedView = " + tmpView.Name);
+            }
+
+            view.RightFocusableView = rightView;
+            tmpView = view.RightFocusableView;
+            if (string.Compare(tmpView.Name, "rightView") == 0)
+            {
+                Console.WriteLine("Passed: RightFocusedView = " + tmpView.Name);
+            }
+            else
+            {
+                Console.WriteLine("Failed: RightFocusedView = " + tmpView.Name);
+            }
+
+            Stage.Instance.Add(view);
+
+            view.UpFocusableView = upView;
+            tmpView = view.UpFocusableView;
+            if (string.Compare(tmpView.Name, "upView") == 0)
+            {
+                Console.WriteLine("Passed: UpFocusedView = " + tmpView.Name);
+            }
+            else
+            {
+                Console.WriteLine("Failed: UpFocusedView = " + tmpView.Name);
+            }
+
+            view.DownFocusableView = downView;
+            tmpView = view.DownFocusableView;
+            if (string.Compare(tmpView.Name, "downView") == 0)
+            {
+                Console.WriteLine("Passed: DownFocusedView = " + tmpView.Name);
+            }
+            else
+            {
+                Console.WriteLine("Failed: DownFocusedView = " + tmpView.Name);
+            }
+
+            Stage.Instance.Remove(leftView);
+            tmpView = view.LeftFocusableView;
+            if (!tmpView)
+            {
+                Console.WriteLine("Passed: NULL LeftFocusedView");
+            }
+            else
+            {
+                Console.WriteLine("Failed: LeftFocusedView = " + tmpView.Name);
+            }
+        }
+
         public void OperatorTests()
         {
             Actor actor = new Actor();
@@ -445,7 +524,7 @@ namespace MyCSharpExample
             // Background property
             Property.Map background = new Property.Map();
             background.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Color) )
-                .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) );
+                      .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) );
             spin.Background = background;
 
             background = spin.Background;
@@ -471,6 +550,17 @@ namespace MyCSharpExample
                 Console.WriteLine ("Custom View BackgroundColor property : test failed");
             }
 
+            // BackgroundImage property
+            spin.BackgroundImage = "background-image.jpg";
+            if(spin.BackgroundImage == "background-image.jpg")
+            {
+                Console.WriteLine ("Custom View BackgroundImage property : test passed");
+            }
+            else
+            {
+                Console.WriteLine ("Custom View BackgroundImage property : test failed");
+            }
+
             // StyleName property
             spin.StyleName = "MyCustomStyle";
             if(spin.StyleName == "MyCustomStyle")