             height: l3.sideLength))
     }
     
+    func testHorizontalMatchingParent() {
+        l1 = TestLayoutable(sideLength: 30, layoutModes: BayaLayoutModes(width: .matchParent, height: .matchParent))
+        l2 = TestLayoutable(sideLength: 60, layoutModes: BayaLayoutModes(width: .matchParent, height: .matchParent))
+        l3 = TestLayoutable(sideLength: 90, layoutModes: BayaLayoutModes(width: .matchParent, height: .matchParent))
+        var layout = [l1, l2, l3]
+            .layoutAsEqualSegments(
+                orientation: .horizontal,
+                gutter: spacing)
+        
+        layout.startLayout(with: layoutRect)
+        let maxHeight = max(
+            l1.sideLength + l1.verticalMargins,
+            l2.sideLength + l2.verticalMargins,
+            l3.sideLength + l3.verticalMargins)
+        let maxWidth = max(
+            l1.sideLength + l1.horizontalMargins,
+            l2.sideLength + l2.horizontalMargins,
+            l3.sideLength + l3.horizontalMargins)
+        
+        XCTAssertEqual(
+            l1.frame,
+            CGRect(
+                x: layoutRect.minX + l1.layoutMargins.left,
+                y: layoutRect.minY + l1.layoutMargins.top,
+                width: maxWidth - l1.horizontalMargins,
+                height: maxHeight - l1.verticalMargins))
+        XCTAssertEqual(
+            l2.frame,
+            CGRect(
+                x: layoutRect.minX
+                    + maxWidth
+                    + spacing
+                    + l2.layoutMargins.left,
+                y: layoutRect.minY + l2.layoutMargins.top,
+                width: maxWidth - l2.horizontalMargins,
+                height: maxHeight - l2.verticalMargins))
+        XCTAssertEqual(
+            l3.frame,
+            CGRect(
+                x: layoutRect.minX
+                    + maxWidth * 2
+                    + spacing * 2
+                    + l3.layoutMargins.left,
+                y: layoutRect.minY + l3.layoutMargins.top,
+                width: maxWidth - l3.horizontalMargins,
+                height: maxHeight - l3.verticalMargins))
+    }
+    
     func testHorizontalSmallEnforcedFrame() {
         var layout = [l1, l2, l3]
             .layoutAsEqualSegments(

        layout.startLayout(with: layoutRect)
        let availableSideLength = (l3.sideLength + l3.verticalMargins) // Largest element as base.
        
        XCTAssertEqual(l1.frame, CGRect(
            x: layoutRect.origin.x + l1.layoutMargins.left,
            y: layoutRect.origin.y + l1.layoutMargins.top,
            width: l1.sideLength,
            height: l1.sideLength))
        XCTAssertEqual(l2.frame, CGRect(
            x: layoutRect.origin.x + l2.layoutMargins.left,
            y: layoutRect.origin.y
                + availableSideLength
                + spacing
                + l2.layoutMargins.top,
            width: l2.sideLength,
            height: l2.sideLength))
        XCTAssertEqual(l3.frame,CGRect(
            x: layoutRect.origin.x + l3.layoutMargins.left,
            y: layoutRect.origin.y
                + availableSideLength * 2
                + spacing * 2
                + l3.layoutMargins.top,
            width: l3.sideLength,
            height: l3.sideLength))
    }

    func testMeasureHorizontal() {

        layout.startLayout(with: layoutRectTooSmall)
        let availableSideLength = (layoutRectTooSmall.width - spacing * 2) / 3 // Rect now dictates the size
        
        XCTAssertEqual(
            l1.frame,
            CGRect(
                x: layoutRectTooSmall.origin.x + l1.layoutMargins.left,
                y: layoutRectTooSmall.origin.y + l1.layoutMargins.top,
                width: min(
                    (availableSideLength - l1.horizontalMargins) > 0 ? (availableSideLength - l1.horizontalMargins) : 0,
                    l1.sideLength),
                height: l1.sideLength))
        XCTAssertEqual(
            l2.frame,
            CGRect(
                x: layoutRectTooSmall.origin.x
                    + availableSideLength
                    + spacing
                    + l2.layoutMargins.left,
                y: layoutRectTooSmall.origin.y + l2.layoutMargins.top,
                width: min(
                    (availableSideLength - l2.horizontalMargins) > 0 ? (availableSideLength - l2.horizontalMargins) : 0,
                    l2.sideLength),
                height: l2.sideLength))
        XCTAssertEqual(
            l3.frame,
            CGRect(
                x: layoutRectTooSmall.origin.x
                    + availableSideLength * 2
                    + spacing * 2
                    + l3.layoutMargins.left,
                y: layoutRectTooSmall.origin.y + l3.layoutMargins.top,
                width: min(
                    (availableSideLength - l3.horizontalMargins) > 0 ? (availableSideLength - l3.horizontalMargins) : 0,
                    l3.sideLength),
                height: l3.sideLength))
    }

    func testVertical() {
