Beispiel #1
0
        public void RelButtonClone2()
        {
            var button = new RelativeLayoutButton()
            {
                Size             = new Vector2(20, 30),
                Position         = new Point(40, 50),
                Horizontal       = HorizontalAlignment.Center,
                Vertical         = VerticalAlignment.Center,
                Scale            = 0.5f,
                Layer            = 1000,
                IsHighlighted    = true,
                DrawWhenInactive = true,
                Description      = "catpants!"
            };

            var original = new Shim()
            {
                Size             = new Vector2(20, 30),
                Position         = new Point(40, 50),
                Horizontal       = HorizontalAlignment.Center,
                Vertical         = VerticalAlignment.Center,
                Scale            = 0.5f,
                DrawWhenInactive = false,
                Layer            = 1000,
            };

            button.AddItem(original);

            var clone = button.DeepCopy() as RelativeLayoutButton;

            original.Size             = new Vector2(60, 70);
            original.Position         = new Point(80, 90);
            original.Horizontal       = HorizontalAlignment.Left;
            original.Vertical         = VerticalAlignment.Bottom;
            original.Scale            = 2.5f;
            original.DrawWhenInactive = true;
            original.Layer            = 2000;

            var copiedShim = clone.Layout.Items[0] as Shim;

            Assert.AreEqual(20, copiedShim.Size.X);
            Assert.AreEqual(30, copiedShim.Size.Y);
            Assert.AreEqual(40, copiedShim.Position.X);
            Assert.AreEqual(49, copiedShim.Position.Y);
            Assert.AreEqual(HorizontalAlignment.Center, copiedShim.Horizontal);
            Assert.AreEqual(VerticalAlignment.Center, copiedShim.Vertical);
            Assert.AreEqual(.5f, copiedShim.Scale);
            Assert.AreEqual(false, copiedShim.DrawWhenInactive);
            Assert.AreEqual(1000, copiedShim.Layer);
        }
Beispiel #2
0
        public void RelButtonClone_move()
        {
            var button = new RelativeLayoutButton()
            {
                Size             = new Vector2(20, 30),
                Position         = new Point(40, 50),
                Horizontal       = HorizontalAlignment.Center,
                Vertical         = VerticalAlignment.Center,
                Scale            = 0.5f,
                Layer            = 1000,
                IsHighlighted    = true,
                DrawWhenInactive = true,
                Description      = "catpants!"
            };

            var original = new Shim()
            {
                Size             = new Vector2(20, 30),
                Position         = new Point(40, 50),
                Horizontal       = HorizontalAlignment.Center,
                Vertical         = VerticalAlignment.Center,
                Scale            = 0.5f,
                DrawWhenInactive = false,
                Layer            = 1000,
            };

            button.AddItem(original);

            var buttonClone = button.DeepCopy() as RelativeLayoutButton;

            buttonClone.Position = new Point(50, 60);

            Assert.AreEqual(20, original.Size.X);
            Assert.AreEqual(30, original.Size.Y);
            Assert.AreEqual(40, original.Position.X);
            Assert.AreEqual(49, original.Position.Y);
            Assert.AreEqual(HorizontalAlignment.Center, original.Horizontal);
            Assert.AreEqual(VerticalAlignment.Center, original.Vertical);
            Assert.AreEqual(.5f, original.Scale);
            Assert.AreEqual(false, original.DrawWhenInactive);
            Assert.AreEqual(1000, original.Layer);
        }