public void TestViewsSharingParent() { var parent = new TestView(); var childA = new TestView(); var childB = new TestView(); parent.AddSubview(childA); parent.AddSubview(childB); Constrain(childA, childB, (a, b) => { a.Width.Equal(b.Width); }); Assert.That(parent.Constraints.Length, Is.EqualTo(1), "Should handle views that share a parent"); }
public void TestAsymmetricViewHierarchies() { var grandparent = new TestView(); var parentA = new TestView(); var parentB = new TestView(); var childA = new TestView(); grandparent.AddSubview(parentA); grandparent.AddSubview(parentB); parentA.AddSubview(childA); Constrain(childA, parentB, (a, b) => { a.Width.Equal(b.Width); }); Assert.That(grandparent.Constraints.Length, Is.EqualTo(1), "Should handle asymmetric view hierachies"); }
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); }
public void TestParentChildRelationship() { var parent = new TestView(); var child = new TestView(); parent.AddSubview(child); Constrain(parent, child, (p, c) => { p.Width.Equal(c.Width); }); Assert.That(parent.Constraints.Length, Is.EqualTo(1), "Should handle a direct parent-child-relationship"); }
public void TestGrandparentChildRelationship() { var grandparent = new TestView(); var parent = new TestView(); var child = new TestView(); grandparent.AddSubview(parent); parent.AddSubview(child); Constrain(grandparent, child, (g, c) => { g.Width.Equal(c.Width); }); Assert.That(grandparent.Constraints.Length, Is.EqualTo(1), "Should handle a grandparent-child-relationship"); }