public void Size ()
		{
			BulletChrome b = new BulletChrome ();
			b.Measure (new Size (double.PositiveInfinity, double.PositiveInfinity));
			Assert.AreEqual (b.DesiredSize.Width, 11, "Width");
			Assert.AreEqual (b.DesiredSize.Height, 11, "Height");
			b.Measure (new Size (1, 1));
			Assert.AreEqual (b.DesiredSize.Width, 1, "Width with constraint");
			Assert.AreEqual (b.DesiredSize.Height, 1, "Height with constraint");
			b.Measure (new Size (1, 50));
			Assert.AreEqual (b.DesiredSize.Width, 1, "Width with constraint 2");
			Assert.AreEqual (b.DesiredSize.Height, 11, "Height with constraint 2");
			b.BorderThickness = new Thickness (1, 2, 3, 4);
			b.Measure (new Size (double.PositiveInfinity, double.PositiveInfinity));
			Assert.AreEqual (b.DesiredSize.Width, 15, "Width, border");
			Assert.AreEqual (b.DesiredSize.Height, 17, "Height, border");
		}
        private static void AnimateToIndeterminate(BulletChrome chrome)
        {
            DoubleAnimation da = new DoubleAnimation();
            Duration duration = new Duration(TimeSpan.FromSeconds(0.3));
            da.Duration = duration;

            chrome.GlyphStroke.Brush.BeginAnimation(SolidColorBrush.OpacityProperty, da);
            chrome.GlyphFill.BeginAnimation(SolidColorBrush.OpacityProperty, da);

            da = new DoubleAnimation(1.0, duration);
            chrome.HighlightStroke.Brush.BeginAnimation(LinearGradientBrush.OpacityProperty, da);

            ColorAnimation ca = new ColorAnimation(Color.FromRgb(0x2A, 0x62, 0x8D), duration);

            // Inner Border Pen
            GradientStopCollection stops = ((GradientBrush)chrome.InnerBorderPen.Brush).GradientStops;

            stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

            ca = new ColorAnimation(Color.FromRgb(0x24, 0x54, 0x79), duration);
            stops[1].BeginAnimation(GradientStop.ColorProperty, ca);

            ca = new ColorAnimation(Color.FromRgb(0x19, 0x3B, 0x55), duration);
            stops[2].BeginAnimation(GradientStop.ColorProperty, ca);

            // InnerFill
            ca = new ColorAnimation(Color.FromRgb(0x2F, 0xA8, 0xD5), duration);
            chrome.InnerFill.GradientStops[0].BeginAnimation(GradientStop.ColorProperty, ca);

            ca = new ColorAnimation(Color.FromRgb(0x25, 0x59, 0x8C), duration);
            chrome.InnerFill.GradientStops[1].BeginAnimation(GradientStop.ColorProperty, ca);

            // Highlight Brush
            stops = ((GradientBrush)chrome.HighlightStroke.Brush).GradientStops;

            ca = new ColorAnimation(Color.FromArgb(0x80, 0xFF, 0xFF, 0xFF), duration);
            stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

            ca = new ColorAnimation(Color.FromArgb(0x00, 0x33, 0x33, 0xA0), duration);
            stops[2].BeginAnimation(GradientStop.ColorProperty, ca);

            ca = new ColorAnimation(Color.FromArgb(0x00, 0x33, 0x33, 0xA0), duration);
            stops[3].BeginAnimation(GradientStop.ColorProperty, ca);
        }
        private static void AnimateToHover(BulletChrome chrome)
        {
            if (chrome._localResources == null)
            {
                chrome._localResources = new LocalResources();
                chrome.InvalidateVisual();
            }

            Duration duration = new Duration(TimeSpan.FromSeconds(0.3));

            DoubleAnimation da = new DoubleAnimation(1, duration);

            // Border and Background Overlay Opacity
            chrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.OpacityProperty, da);
            chrome.BackgroundOverlay.BeginAnimation(SolidColorBrush.OpacityProperty, da);

            // Background and Border Overlay Colors
            ColorAnimation ca = new ColorAnimation();
            ca.Duration = duration;
            chrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.ColorProperty, ca);
            chrome.BackgroundOverlay.BeginAnimation(SolidColorBrush.ColorProperty, ca);
            GradientStopCollection stops;


            if (chrome.IsChecked == null)
            {
                // InnerBorder 
                stops = ((GradientBrush)chrome.InnerBorderPen.Brush).GradientStops;

                ca = new ColorAnimation(Color.FromRgb(0x29, 0x62, 0x8D), duration);
                stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x24, 0x54, 0x79), duration);
                stops[1].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x19, 0x3B, 0x55), duration);
                stops[2].BeginAnimation(GradientStop.ColorProperty, ca);

                // InnerFill
                ca = new ColorAnimation(Color.FromRgb(0x33, 0xD7, 0xED), duration);
                chrome.InnerFill.GradientStops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x20, 0x94, 0xCE), duration);
                chrome.InnerFill.GradientStops[1].BeginAnimation(GradientStop.ColorProperty, ca);

                // Highlight Brush
                stops = ((GradientBrush)chrome.HighlightStroke.Brush).GradientStops;


                ca = new ColorAnimation(Color.FromArgb(0x80, 0xFF, 0xFF, 0xFF), duration);
                stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromArgb(0x00, 0x33, 0x33, 0xA0), duration);
                stops[2].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromArgb(0x80, 0x33, 0x33, 0xA0), duration);
                stops[3].BeginAnimation(GradientStop.ColorProperty, ca);
            }
            else
            {
                // Inner Border Gradient Stops
                stops = ((GradientBrush)chrome.InnerBorderPen.Brush).GradientStops;

                ca = new ColorAnimation(Color.FromRgb(0x79, 0xC6, 0xF9), duration);
                stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x79, 0xC6, 0xF9), duration);
                stops[1].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0xD2, 0xED, 0xFD), duration);
                stops[2].BeginAnimation(GradientStop.ColorProperty, ca);


                // Inner Fill
                ca = new ColorAnimation(Color.FromRgb(0xB1, 0xDF, 0xFD), duration);
                chrome.InnerFill.GradientStops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0xE9, 0xF7, 0xFE), duration);
                chrome.InnerFill.GradientStops[1].BeginAnimation(GradientStop.ColorProperty, ca);
            }


            // Glyph Fill
            if (chrome.IsRound && chrome.IsChecked == true)
            {
                stops = ((GradientBrush)chrome.GlyphFill).GradientStops;

                ca = new ColorAnimation(Color.FromRgb(0xFF, 0xFF, 0xFF), duration);
                stops[0].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x74, 0xFF, 0xFF), duration);
                stops[1].BeginAnimation(GradientStop.ColorProperty, ca);

                ca = new ColorAnimation(Color.FromRgb(0x0D, 0xA0, 0xF3), duration);
                stops[2].BeginAnimation(GradientStop.ColorProperty, ca);
            }
        }
		public void Drawing ()
		{
			BulletChrome c = new BulletChrome ();
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			Assert.IsNull (VisualTreeHelper.GetDrawing (c));
		}
		public void MeasureOverride ()
		{
			BulletChrome b = new BulletChrome ();
			b.Measure (new Size (double.PositiveInfinity, 10));
			Assert.AreEqual (b.DesiredSize.Width, 11, "Width");
			Assert.AreEqual (b.DesiredSize.Height, 10, "Height");
		}
		public void DrawingIsRoundBackgroundBorderBrushBorderThicknessIsCheckedRenderMouseOver ()
		{
			BulletChrome c = new BulletChrome ();
			c.IsRound = true;
			c.Background = new SolidColorBrush (Color.FromArgb (0x11, 0x11, 0x11, 0x11));
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.BorderThickness = new Thickness (1);
			c.IsChecked = true;
			c.RenderMouseOver = true;
			c.Width = 100;
			c.Height = 100;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.AreEqual (drawing_group.Children.Count, 4, "1");

			GeometryDrawing gd = (GeometryDrawing)drawing_group.Children [0];
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.Background).Color, "2");
			Assert.IsNull (gd.Pen, "3");
			EllipseGeometry eg = (EllipseGeometry)gd.Geometry;
			Assert.AreEqual (eg.Center, new Point (50, 50), "4");
			Assert.AreEqual (eg.RadiusX, 49, "5");
			Assert.AreEqual (eg.RadiusY, 49, "6");

			gd = (GeometryDrawing)drawing_group.Children [1];
			LinearGradientBrush lgb = (LinearGradientBrush)gd.Pen.Brush;
			Assert.AreEqual (lgb.StartPoint, new Point (0, 0), "6 1");
			Assert.AreEqual (lgb.EndPoint, new Point (1, 1), "6 2");
			Assert.AreEqual (lgb.GradientStops.Count, 2, "6 3");
			Assert.AreEqual (lgb.GradientStops [0].Color, Color.FromArgb (0xFF, 0xFE, 0xDF, 0x9C), "6 4");
			Assert.AreEqual (lgb.GradientStops [0].Offset, 0, "6 5");
			Assert.AreEqual (lgb.GradientStops [1].Color, Color.FromArgb (0xFF, 0xF9, 0xBB, 0x43), "6 6");
			Assert.AreEqual (lgb.GradientStops [1].Offset, 1, "6 7");
			Assert.IsNull (gd.Brush, "6 8");
			Assert.AreEqual (gd.Pen.Thickness, 2, "6 8 1");
			eg = (EllipseGeometry)gd.Geometry;
			Assert.AreEqual (eg.Center, new Point (50, 50), "6 9");
			Assert.AreEqual (eg.RadiusX, 48, "6 10");
			Assert.AreEqual (eg.RadiusY, 48, "6 11");

			gd = (GeometryDrawing)drawing_group.Children [2];
			lgb = (LinearGradientBrush)gd.Brush;
			Assert.AreEqual (lgb.StartPoint, new Point (0, 0), "7");
			Assert.AreEqual (lgb.EndPoint, new Point (1, 1), "8");
			Assert.AreEqual (lgb.GradientStops.Count, 3, "9");
			Assert.AreEqual (lgb.GradientStops [0].Color, Color.FromArgb (0xFF, 0x60, 0xCF, 0x5D), "10");
			Assert.AreEqual (lgb.GradientStops [0].Offset, 0, "11");
			Assert.AreEqual (lgb.GradientStops [1].Color, Color.FromArgb (0xFF, 0xAC, 0xEF, 0xAA), "12");
			Assert.AreEqual (lgb.GradientStops [1].Offset, 0.302469134, "13");
			Assert.AreEqual (lgb.GradientStops [2].Color, Color.FromArgb (0xFF, 0x13, 0x92, 0x10), "14");
			Assert.AreEqual (lgb.GradientStops [2].Offset, 1, "15");
			Assert.IsNull (gd.Pen, "16");
			eg = (EllipseGeometry)gd.Geometry;
			Assert.AreEqual (eg.Center, new Point (50, 50), "17");
			Assert.AreEqual (eg.RadiusX, 46, "18");
			Assert.AreEqual (eg.RadiusY, 46, "19");

			gd = (GeometryDrawing)drawing_group.Children [3];
			Assert.IsNull (gd.Brush, "20");
			Assert.AreEqual (((SolidColorBrush)gd.Pen.Brush).Color, ((SolidColorBrush)c.BorderBrush).Color, "21");
			Assert.AreEqual (gd.Pen.Thickness, 1, "22");
			eg = (EllipseGeometry)gd.Geometry;
			Assert.AreEqual (eg.Center, new Point (50, 50), "23");
			Assert.AreEqual (eg.RadiusX, 49.5, "24");
			Assert.AreEqual (eg.RadiusY, 49.5, "25");
		}
		public void DrawingBackgroundBorderBrushIsCheckedSmallSize2 ()
		{
			BulletChrome c = new BulletChrome ();
			c.Background = new SolidColorBrush (Color.FromArgb (0x11, 0x11, 0x11, 0x11));
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.IsChecked = true;
			c.Width = 2.1;
			c.Height = 2.1;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.IsNotNull (drawing_group);
		}
		public void DrawingBackgroundBorderBrushNonUniformVeryLargeBorderThicknessIsCheckedRenderPressed ()
		{
			BulletChrome c = new BulletChrome ();
			c.Background = new SolidColorBrush (Color.FromArgb (0x11, 0x11, 0x11, 0x11));
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.BorderThickness = new Thickness (1000, 2000, 3000, 4000);
			c.IsChecked = true;
			c.RenderPressed = true;
			c.Width = 100;
			c.Height = 100;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.AreEqual (drawing_group.Children.Count, 1, "1");

			GeometryDrawing gd = (GeometryDrawing)drawing_group.Children [0];
			Assert.IsNull (gd.Pen, "1");
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.BorderBrush).Color, "2");
			Assert.AreEqual (gd.Geometry.ToString (), "M0;0L100;0L100;100L0;100z M1000;2000L1000;2000L1000;2000L1000;2000z", "3");
		}
		public void DrawingBorderBrushNonUniformBorderThicknessIsCheckedRenderPressed ()
		{
			BulletChrome c = new BulletChrome ();
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.BorderThickness = new Thickness (1, 2, 3, 4);
			c.IsChecked = true;
			c.RenderPressed = true;
			c.Width = 100;
			c.Height = 100;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.AreEqual (drawing_group.Children.Count, 3, "1");

			GeometryDrawing gd = (GeometryDrawing)drawing_group.Children [0];
			LinearGradientBrush lgb = (LinearGradientBrush)gd.Brush;
			Assert.AreEqual (lgb.StartPoint, new Point (0, 0), "2");
			Assert.AreEqual (lgb.EndPoint, new Point (1, 1), "2 1");
			Assert.AreEqual (lgb.GradientStops.Count, 2, "2 2");
			Assert.AreEqual (lgb.GradientStops [0].Color, Color.FromArgb (0xFF, 0xB2, 0xB2, 0xA9), "2 3");
			Assert.AreEqual (lgb.GradientStops [0].Offset, 0, "2 4");
			Assert.AreEqual (lgb.GradientStops [1].Color, Color.FromArgb (0xFF, 0xEB, 0xEA, 0xDA), "2 5");
			Assert.AreEqual (lgb.GradientStops [1].Offset, 1, "2 6");
			Assert.IsNull (gd.Pen, "3");
			RectangleGeometry rg = (RectangleGeometry)gd.Geometry;
			Assert.AreEqual (rg.Rect, new Rect (1, 2, 96, 94), "4");
			Assert.AreEqual (rg.RadiusX, 0, "5");
			Assert.AreEqual (rg.RadiusY, 0, "6");

			Assert.AreEqual (((DrawingGroup)drawing_group.Children [1]).Children.Count, 1, "6 1");
			Assert.AreEqual (((TranslateTransform)((DrawingGroup)drawing_group.Children [1]).Transform).Value, new Matrix (1, 0, 0, 1, 0, 1), "6 2");
			gd = (GeometryDrawing)((DrawingGroup)drawing_group.Children [1]).Children [0];
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, Color.FromArgb (0xFF, 0x1A, 0x7E, 0x18), "7");
			Assert.IsNull (gd.Pen, "8");
			StreamGeometry sg = (StreamGeometry)gd.Geometry;
			Assert.AreEqual (sg.ToString (), "M3;5L3;7,8 5,5;10,4 10,1;5,8 10,1;3 5,5;7,6z", "9");

			gd = (GeometryDrawing)drawing_group.Children [2];
			Assert.IsNull (gd.Pen, "10");
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.BorderBrush).Color, "12");
			Assert.AreEqual (gd.Geometry.ToString (), "M0;0L100;0L100;100L0;100z M1;2L97;2L97;96L1;96z", "13");
		}
		public void Creation ()
		{
			BulletChrome b = new BulletChrome ();
			Assert.IsFalse (b.SnapsToDevicePixels, "SnapsToDevicePixels");
		}
		public void BorderThickness ()
		{
			BulletChrome b = new BulletChrome ();
			Thickness t = new Thickness (-1);
			b.BorderThickness = t;
		}
		public void DrawingBackgroundBorderBrushNonUniformBorderThicknessIsChecked2 ()
		{
			BulletChrome c = new BulletChrome ();
			c.Background = new SolidColorBrush (Color.FromArgb (0x11, 0x11, 0x11, 0x11));
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.BorderThickness = new Thickness (10, 20, 30, 40);
			c.IsChecked = true;
			c.Width = 100;
			c.Height = 100;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.AreEqual (drawing_group.Children.Count, 3, "1");

			GeometryDrawing gd = (GeometryDrawing)drawing_group.Children [0];
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.Background).Color, "2");
			Assert.IsNull (gd.Pen, "3");
			RectangleGeometry rg = (RectangleGeometry)gd.Geometry;
			Assert.AreEqual (rg.Rect, new Rect (10, 20, 60, 40), "4");
			Assert.AreEqual (rg.RadiusX, 0, "5");
			Assert.AreEqual (rg.RadiusY, 0, "6");

			Assert.AreEqual (((DrawingGroup)drawing_group.Children [1]).Children.Count, 1, "6 1");
			Assert.AreEqual (((TranslateTransform)((DrawingGroup)drawing_group.Children [1]).Transform).Value, new Matrix (1, 0, 0, 1, 9, 19), "6 2");
			gd = (GeometryDrawing)((DrawingGroup)drawing_group.Children [1]).Children [0];
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, Color.FromArgb (0xFF, 0x21, 0xA1, 0x21), "7");
			Assert.IsNull (gd.Pen, "8");
			StreamGeometry sg = (StreamGeometry)gd.Geometry;
			Assert.AreEqual (sg.ToString (), "M3;5L3;7,8 5,5;10,4 10,1;5,8 10,1;3 5,5;7,6z", "9");

			gd = (GeometryDrawing)drawing_group.Children [2];
			Assert.IsNull (gd.Pen, "10");
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.BorderBrush).Color, "12");
			Assert.AreEqual (gd.Geometry.ToString (), "M0;0L100;0L100;100L0;100z M10;20L70;20L70;60L10;60z", "13");
		}
		public void DrawingBackgroundBorderBrushBorderThicknessIsChecked ()
		{
			BulletChrome c = new BulletChrome ();
			c.Background = new SolidColorBrush (Color.FromArgb (0x11, 0x11, 0x11, 0x11));
			c.BorderBrush = new SolidColorBrush (Color.FromArgb (0x22, 0x22, 0x22, 0x22));
			c.BorderThickness = new Thickness (1);
			c.IsChecked = true;
			c.Width = 100;
			c.Height = 100;
			Window w = new Window ();
			w.Content = c;
			w.Show ();
			DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (c);
			Assert.AreEqual (drawing_group.Children.Count, 3, "1");

			GeometryDrawing gd = (GeometryDrawing)drawing_group.Children [0];
			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, ((SolidColorBrush)c.Background).Color, "2");
			Assert.IsNull (gd.Pen, "3");
			RectangleGeometry rg = (RectangleGeometry)gd.Geometry;
			Assert.AreEqual (rg.Rect, new Rect (1, 1, 98, 98), "4");
			Assert.AreEqual (rg.RadiusX, 0, "5");
			Assert.AreEqual (rg.RadiusY, 0, "6");

			gd = (GeometryDrawing)drawing_group.Children [1];

			Assert.AreEqual (((SolidColorBrush)gd.Brush).Color, Color.FromArgb (0xFF, 0x21, 0xA1, 0x21), "7");
			Assert.IsNull (gd.Pen, "8");
			StreamGeometry sg = (StreamGeometry)gd.Geometry;
			Assert.AreEqual (sg.ToString (), "M3;5L3;7,8 5,5;10,4 10,1;5,8 10,1;3 5,5;7,6z", "9");

			gd = (GeometryDrawing)drawing_group.Children [2];
			Assert.IsNull (gd.Brush, "10");
			Assert.AreEqual (gd.Pen.Thickness, 1, "11");
			Assert.AreEqual (((SolidColorBrush)gd.Pen.Brush).Color, ((SolidColorBrush)c.BorderBrush).Color, "12");
			rg = (RectangleGeometry)gd.Geometry;
			Assert.AreEqual (rg.Rect, new Rect (0.5, 0.5, 99, 99), "13");
			Assert.AreEqual (rg.RadiusX, 0, "14");
			Assert.AreEqual (rg.RadiusY, 0, "15");
		}