public void Validate_Passes() { { var layout = new ParentFollowLayout(); Assert.IsFalse(layout.Validate()); Logger.Log(Logger.Priority.High, () => "Success when ILayout#Target is null!!"); } { var layout = new ParentFollowLayout(); layout.Target = new LayoutTargetObject(); Assert.IsTrue(layout.Validate()); } Logger.Log(Logger.Priority.High, () => "Success to be set ILayout#Target!!"); { var layout = new ParentFollowLayout(); layout.Target = new LayoutTargetObject(); var dummyLayout = new DummyLayout(); dummyLayout.OperationPriority = 10; layout.OperationPriority = dummyLayout.OperationPriority - 1; layout.Target.AddLayout(dummyLayout); Assert.IsFalse(layout.Validate()); } Logger.Log(Logger.Priority.High, () => "Success when Invalid Order in ILayoutTarget#Layouts !!"); }
public void UpdateLayout_Passes() { var parent = new LayoutTargetObject(); var target = new LayoutTargetObject(); var correct = new LayoutTargetObject(); parent.UpdateLocalSize(Vector3.one * 100f, Vector3.zero); correct.UpdateAnchorParam(Vector3.zero, Vector3.one, Vector3.zero, Vector3.zero); correct.IsAutoUpdate = false; correct.SetParent(parent); correct.FollowParent(); var(offsetMin, offsetMax) = correct.AnchorOffsetMinMax(); target.IsAutoUpdate = false; target.UpdateAnchorParam(correct.AnchorMin, correct.AnchorMax, offsetMin, offsetMax); target.SetParent(parent); //test point var layout = new ParentFollowLayout(); layout.Target = target; layout.UpdateLayout(); AssertionUtils.AreNearlyEqual(correct.LocalSize, target.LocalSize, LayoutDefines.POS_NUMBER_PRECISION); AssertionUtils.AreNearlyEqual(correct.Offset, target.Offset, LayoutDefines.POS_NUMBER_PRECISION); }
public void OperationTargetFlags_Value_Passes() { var layout = new ParentFollowLayout(); Assert.AreEqual( LayoutOperationTarget.Self_LocalSize | LayoutOperationTarget.Self_Offset, layout.OperationTargetFlags, "" ); }
public void OperationPriority_DefaultValue_Passes() { var layout = new ParentFollowLayout(); Assert.AreEqual(int.MaxValue, layout.OperationPriority); }