예제 #1
0
        public void TestViewsSharingGrandparent()
        {
            var grandparent = new TestView();
            var parentA     = new TestView();
            var parentB     = new TestView();
            var childA      = new TestView();
            var childB      = new TestView();

            grandparent.AddSubview(parentA);
            grandparent.AddSubview(parentB);
            parentA.AddSubview(childA);
            parentB.AddSubview(childB);

            Constrain(childA, childB, (a, b) =>
            {
                a.Width.Equal(b.Width);
            });

            Assert.That(grandparent.Constraints.Length, Is.EqualTo(1), "Should handle views that share a grandparent");
        }
예제 #2
0
        public void SetUp()
        {
            var superview = new TestView(new CGRect(0, 0, 400, 400));

            var viewA = new TestView(new CGRect(0, 0, 200, 200));

            superview.AddSubview(viewA);

            var viewB = new TestView(new CGRect(0, 0, 200, 200));

            superview.AddSubview(viewB);

            Constrain(viewA, viewB, (a, b) =>
            {
                a.Top.Equal(b.Top);
                a.Bottom.Equal(b.Bottom);
            });

            weak_viewA     = new WeakReference <TestView>(viewA);
            weak_viewB     = new WeakReference <TestView>(viewB);
            weak_superview = new WeakReference <TestView>(superview);
        }
예제 #3
0
        public void SetUp()
        {
            window = new TestWindow(
                CGRect.FromLTRB(0, 0, 400, 400)
                );

            viewA = new TestView();
            window.AddSubview(viewA);

            viewB = new TestView();
            window.AddSubview(viewB);

            viewC = new TestView();
            window.AddSubview(viewC);

            Constrain(viewA, (a) =>
            {
                a.Width.Equal(100);
                a.Height.Equal(200);

                a.Top.Equal(a.Superview.Top + 10);
                a.Left.Equal(a.Superview.Left + 10);
            });
        }