public void LayoutControllerRequestLayout() { tlog.Debug(tag, $"LayoutControllerRequestLayout START"); var testingTarget = new LayoutController(Window.Instance); Assert.IsNotNull(testingTarget, "Can't create success object LayoutController"); Assert.IsInstanceOf <LayoutController>(testingTarget, "Should be an instance of LayoutController type."); using (LayoutItem layoutItem = new LayoutItem()) { using (View view = new View()) { view.Name = "parentView"; layoutItem.AttachToOwner(view); try { testingTarget.RequestLayout(layoutItem); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } } } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutControllerRequestLayout END (OK)"); }
public void LayoutGroupMeasureChildWithMargins() { tlog.Debug(tag, $"LayoutGroupMeasureChildWithMargins START"); flagOnMeasureChild = false; Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); View view = new View() { ExcludeLayouting = false, Size = new Size(100, 150) }; using (LayoutItem child = new LayoutItem()) { child.AttachToOwner(view); testingTarget.Add(child); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); testingTarget.MeasureChildWithMarginsTest(child, measureWidth, new LayoutLength(10), measureHeight, new LayoutLength(10)); Assert.True(flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured."); } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupMeasureChildWithMargins END (OK)"); }
public void LayoutGroupOnLayout() { tlog.Debug(tag, $"LayoutGroupOnLayout START"); flagOnLayoutOverride = false; Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); using (LayoutItem child = new LayoutItem()) { testingTarget.Add(child); View view = new View() { Position = new Position(100, 150) }; child.AttachToOwner(view); testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); Assert.True(flagOnLayoutOverride, "LayoutGroup overridden method not invoked."); // Test with false parameter. flagOnLayoutOverride = false; Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial"); testingTarget.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20)); Assert.True(flagOnLayoutOverride, "LayoutGroup overridden method not invoked."); } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupOnLayout END (OK)"); }
public void LayoutGroupChangeLayoutSiblingOrder() { tlog.Debug(tag, $"LayoutGroupChangeLayoutSiblingOrder START"); View parent = new View() { Layout = new AbsoluteLayout() }; View child = new View() { Layout = new AbsoluteLayout(), }; parent.Add(child); LayoutItem layout = new LayoutItem(); layout.AttachToOwner(child); var testingTarget = layout.Owner.Layout as LayoutGroup; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should return LayoutGroup instance."); testingTarget.ChangeLayoutSiblingOrder(0); child.Dispose(); parent.Dispose(); layout.Dispose(); testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupChangeLayoutSiblingOrder END (OK)"); }
public void LayoutItemSetPositionByLayout() { tlog.Debug(tag, $"LayoutItemSetPositionByLayout START"); var testingTarget = new LayoutItem(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutItem>(testingTarget, "Should return LayoutItem instance."); Assert.IsTrue(testingTarget.SetPositionByLayout); View view = new View() { ExcludeLayouting = false, Size = new Size(100, 150), Layout = new LinearLayout() { LayoutWithTransition = true } }; testingTarget.AttachToOwner(view); testingTarget.SetPositionByLayout = false; Assert.IsFalse(testingTarget.SetPositionByLayout); Assert.IsTrue(testingTarget.Owner.ExcludeLayouting); view.Dispose(); testingTarget?.Dispose(); tlog.Debug(tag, $"LayoutItemSetPositionByLayout END (OK)"); }
public void LayoutGroupMeasureChild() { tlog.Debug(tag, $"LayoutGroupMeasureChild START"); flagOnMeasureChild = false; Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); View view = new View() { Size = new Size(100, 150), }; // MeasureSpecification.ModeType.Exactly using (LayoutItem child = new LayoutItem()) { child.AttachToOwner(view); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); testingTarget.MeasureChildTest(child, measureWidth, measureHeight); Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked."); } // MeasureSpecification.ModeType.AtMost using (LayoutItem child = new LayoutItem()) { child.AttachToOwner(view); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost); testingTarget.MeasureChildTest(child, measureWidth, measureHeight); Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked."); } // MeasureSpecification.ModeType.Unspecified using (LayoutItem child = new LayoutItem()) { child.AttachToOwner(view); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified); testingTarget.MeasureChildTest(child, measureWidth, measureHeight); Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked."); } view.Dispose(); testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupMeasureChild END (OK)"); }
public void LayoutGroupMeasureChildWithoutPadding() { tlog.Debug(tag, $"LayoutGroupMeasureChildWithoutPadding START"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); View view = new View() { ExcludeLayouting = false, Size = new Size(100, 150) }; using (LayoutItem child = new LayoutItem()) { child.AttachToOwner(view); testingTarget.Add(child); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); try { testingTarget.MeasureChildWithoutPaddingTest(child, measureWidth, measureHeight); } catch (Exception e) { tlog.Error(tag, "Caught Exception" + e.ToString()); LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupMeasureChildWithoutPadding END (OK)"); }
internal void SetLayout(LayoutItem layout) { _layout = layout; _layout?.AttachToOwner(this); _layout?.RequestLayout(); }