public void Test_CalcHeight() { { var support = new GridLayoutSupport(new Vector2(30f, 70f), 100f); Assert.That(support.CalcHeight(0), Is.EqualTo(0f).Within(Epsilon)); Assert.That(support.CalcHeight(1), Is.EqualTo(70f).Within(Epsilon)); Assert.That(support.CalcHeight(3), Is.EqualTo(70f).Within(Epsilon)); Assert.That(support.CalcHeight(4), Is.EqualTo(140f).Within(Epsilon)); Assert.That(support.CalcHeight(10), Is.EqualTo(280f).Within(Epsilon)); } }
public void Test_CalcHeight_2() { { // areaWidth : 200 - (40 + 20) = 140 // 30 + (10 + 30)*3 > 140 なのでカラム数 = 3 var support = new GridLayoutSupport( new Vector2(30f, 70f), 200f, new Vector2(10f, 20f), new Vector4(3f, 40f, 4f, 20f) ); Assert.That(support.CalcHeight(0), Is.EqualTo(7f).Within(Epsilon)); Assert.That(support.CalcHeight(1), Is.EqualTo(77f).Within(Epsilon)); Assert.That(support.CalcHeight(3), Is.EqualTo(77f).Within(Epsilon)); Assert.That(support.CalcHeight(4), Is.EqualTo(167f).Within(Epsilon)); } }