Author: toshok
Date: 2007-06-29 16:59:11 -0400 (Fri, 29 Jun 2007)
New Revision: 81082
Added:
trunk/moon/test/cs/tests/ZIndexChangeTest.cs
Modified:
trunk/moon/test/cs/Makefile
trunk/moon/test/cs/demo.cs
Log:
add a test for programmatically setting the ZIndex of elements after they've
been added to the canvas
Modified: trunk/moon/test/cs/Makefile
===================================================================
--- trunk/moon/test/cs/Makefile 2007-06-29 20:58:39 UTC (rev 81081)
+++ trunk/moon/test/cs/Makefile 2007-06-29 20:59:11 UTC (rev 81082)
@@ -5,6 +5,7 @@
tests/LinearBrushTest.cs \
tests/RadialBrushTest.cs \
tests/LineColorTest.cs \
+ tests/ZIndexChangeTest.cs \
-pkg:gtk-sharp-2.0 -pkg:silver -r:../gtksilver.dll
run: demo.exe
Modified: trunk/moon/test/cs/demo.cs
===================================================================
--- trunk/moon/test/cs/demo.cs 2007-06-29 20:58:39 UTC (rev 81081)
+++ trunk/moon/test/cs/demo.cs 2007-06-29 20:59:11 UTC (rev 81082)
@@ -67,6 +67,7 @@
tests.Add(new LinearBrushTest());
tests.Add(new RadialBrushTest());
tests.Add(new AnimationLineTest());
+ tests.Add(new ZIndexChangeTest());
Load (tests[0]);
Application.Run ();
Added: trunk/moon/test/cs/tests/ZIndexChangeTest.cs
===================================================================
--- trunk/moon/test/cs/tests/ZIndexChangeTest.cs 2007-06-29 20:58:39 UTC
(rev 81081)
+++ trunk/moon/test/cs/tests/ZIndexChangeTest.cs 2007-06-29 20:59:11 UTC
(rev 81082)
@@ -0,0 +1,59 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+
+public class ZIndexChangeTest : TestBase
+{
+ public ZIndexChangeTest ()
+ {
+ Rectangle r1, r2;
+
+ canvas = new Canvas();
+ r1 = CreateRectangle(new Point(1, 1), new Point(0,0));
+ canvas.Children.Add(r1);
+
+ r2 = CreateRectangle(new Point(0, 0), new Point(1,0));
+ r2.SetValue<double>(Canvas.LeftProperty, 10);
+ canvas.Children.Add(r2);
+
+ /* by default, r2 should draw on top of r1, since they both
have a
+ zindex of 0 and r2 was added later. */
+ r1.ZIndex = 10;
+ }
+
+ private Rectangle CreateRectangle(Point start, Point end)
+ {
+ LinearGradientBrush brush;
+ Rectangle rect;
+ GradientStop stop;
+
+ brush = new LinearGradientBrush();
+ brush.StartPoint = start;
+ brush.EndPoint = end;
+
+ stop = new GradientStop();
+ stop.Color = Colors.Red;
+ stop.Offset = 0;
+ brush.GradientStops.Add(stop);
+
+ stop = new GradientStop();
+ stop.Color = Colors.Green;
+ stop.Offset = 0.5;
+ brush.GradientStops.Add(stop);
+
+ stop = new GradientStop();
+ stop.Color = Colors.Blue;
+ stop.Offset = 1;
+ brush.GradientStops.Add(stop);
+
+ rect = new Rectangle();
+ rect.Fill = brush;
+ rect.Width = 100;
+ rect.Height = 100;
+ return rect;
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches