X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Fdali-swig%2Fexamples%2Fdali-test.cs;h=274b97a0373cddd00819351a48c33658e4871005;hb=159563699a1d8ac7fb2fc516fdb0e9c5be69016a;hp=491bd9508a4f7d56cab6dd0922729b51fae050fb;hpb=2c223add632be0638418928056d5ac1421c47eb6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs index 491bd95..274b97a 100644 --- a/plugins/dali-swig/examples/dali-test.cs +++ b/plugins/dali-swig/examples/dali-test.cs @@ -37,35 +37,36 @@ namespace MyCSharpExample Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() ); } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { - OperatorTests(); + CustomViewPropertyTest(); + Handle handle = new Handle(); int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE); float myProperty = 0.0f; handle.GetProperty(myPropertyIndex).Get(ref myProperty); Console.WriteLine( "myProperty value: " + myProperty ); - int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Vector2(5.0f, 5.0f)), Property.AccessMode.READ_WRITE); - Vector2 myProperty2 = new Vector2(0.0f, 0.0f); + int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE); + Size myProperty2 = new Size(0.0f, 0.0f); handle.GetProperty(myPropertyIndex2).Get(myProperty2); - Console.WriteLine( "myProperty2 value: " + myProperty2.x + ", " + myProperty2.y ); + Console.WriteLine( "myProperty2 value: " + myProperty2.W + ", " + myProperty2.H ); Actor actor = new Actor(); - actor.Size = new Vector3(200.0f, 200.0f, 0.0f); + actor.Size = new Position(200.0f, 200.0f, 0.0f); actor.Name = "MyActor"; - actor.Color = new Vector4(1.0f, 0.0f, 1.0f, 0.8f); + actor.Color = new Color(1.0f, 0.0f, 1.0f, 0.8f); Console.WriteLine("Actor id: {0}", actor.GetId()); - Console.WriteLine("Actor size: " + actor.Size.x + ", " + actor.Size.y); + Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y); Console.WriteLine("Actor name: " + actor.Name); Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = NDalic.WHITE ; + stage.BackgroundColor = Color.White; - Vector2 stageSize = stage.Size; - Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y); + Size stageSize = stage.Size; + Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H); stage.Add(actor); TextLabel text = new TextLabel("Hello Mono World"); @@ -128,41 +129,39 @@ namespace MyCSharpExample Console.WriteLine( " Area = " + rd2.Area() ); Console.WriteLine( " *************************" ); - Vector2 vector2 = new Vector2(100, 50); - Console.WriteLine( " Created " + vector2 ); - Console.WriteLine( " Vector2 x = " + vector2.x + ", y = " + vector2.y ); - vector2 += new Vector2(20, 20); - Console.WriteLine( " Vector2 x = " + vector2[0] + ", y = " + vector2[1] ); - vector2.x += 10; - vector2.y += 10; - Console.WriteLine( " Vector2 width = " + vector2.width + ", height = " + vector2.height ); - vector2 += new Vector2(15, 15); - Console.WriteLine( " Vector2 width = " + vector2[0] + ", height = " + vector2[1] ); + Size Size = new Size(100, 50); + Console.WriteLine( " Created " + Size ); + Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H ); + Size += new Size(20, 20); + Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H ); + Size.W += 10; + Size.H += 10; + Console.WriteLine( " Size width = " + Size.W + ", height = " + Size.H ); Console.WriteLine( " *************************" ); - Vector3 vector3 = new Vector3(20, 100, 50); - Console.WriteLine( " Created " + vector3 ); - Console.WriteLine( " Vector3 x = " + vector3.x + ", y = " + vector3.y + ", z = " + vector3.z ); - vector3 += new Vector3(20, 20, 20); - Console.WriteLine( " Vector3 x = " + vector3[0] + ", y = " + vector3[1] + ", z = " + vector3[2] ); - vector3.x += 10; - vector3.y += 10; - vector3.z += 10; - Console.WriteLine( " Vector3 width = " + vector3.width + ", height = " + vector3.height + ", depth = " + vector3.depth ); - Vector3 parentOrigin = NDalic.ParentOriginBottomRight; - Console.WriteLine( " parentOrigin x = " + parentOrigin.x + ", y = " + parentOrigin.y + ", z = " + parentOrigin.z ); + Position Position = new Position(20, 100, 50); + Console.WriteLine( " Created " + Position ); + Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z ); + Position += new Position(20, 20, 20); + Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z ); + Position.X += 10; + Position.Y += 10; + Position.Z += 10; + Console.WriteLine( " Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z ); + Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight); + Console.WriteLine( " parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z ); Console.WriteLine( " *************************" ); - Vector4 vector4 = new Vector4(20, 100, 50, 200); - Console.WriteLine( " Created " + vector4 ); - Console.WriteLine( " Vector4 x = " + vector4.x + ", y = " + vector4.y + ", z = " + vector4.z + ", w = " + vector4.w ); - vector4 += new Vector4(20, 20, 20, 20); - Console.WriteLine( " Vector4 x = " + vector4[0] + ", y = " + vector4[1] + ", z = " + vector4[2] + ", w = " + vector4[3] ); - vector4.x += 10; - vector4.y += 10; - vector4.z += 10; - vector4.w += 10; - Console.WriteLine( " Vector4 r = " + vector4.r + ", g = " + vector4.g + ", b = " + vector4.b + ", a = " + vector4.a ); + Color color = new Color(20, 100, 50, 200); + Console.WriteLine( " Created " + color ); + Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A ); + color += new Color(20, 20, 20, 20); + Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A ); + color.R += 10; + color.G += 10; + color.B += 10; + color.A += 10; + Console.WriteLine( " Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A ); } @@ -340,6 +339,52 @@ namespace MyCSharpExample } + public void CustomViewPropertyTest() + { + // Create a Spin control + Spin spin = new Spin(); + + // 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) ); + spin.Background = background; + + background = spin.Background; + Vector4 backgroundColor = new Vector4(); + background.Find(Dali.Constants.ColorVisualProperty.MixColor).Get(backgroundColor); + if( backgroundColor == Color.Red ) + { + Console.WriteLine ("Custom View Background property : test passed"); + } + else + { + Console.WriteLine ("Custom View Background property : test failed"); + } + + // BackgroundColor property + spin.BackgroundColor = Color.Yellow; + if(spin.BackgroundColor == Color.Yellow) + { + Console.WriteLine ("Custom View BackgroundColor property : test passed"); + } + else + { + Console.WriteLine ("Custom View BackgroundColor property : test failed"); + } + + // StyleName property + spin.StyleName = "MyCustomStyle"; + if(spin.StyleName == "MyCustomStyle") + { + Console.WriteLine ("Custom View StyleName property : test passed"); + } + else + { + Console.WriteLine ("Custom View StyleName property : test failed"); + } + } + public void MainLoop() { _application.MainLoop ();