public void LayoutGroupOnLayoutIndependentChildren() { tlog.Debug(tag, $"LayoutGroupOnLayoutIndependentChildren START"); using (View owner = new View()) { TextLabel textLabel = new TextLabel() { ExcludeLayouting = false, Size = new Size(100, 150), Layout = new AbsoluteLayout(), }; owner.Add(textLabel); using (MyLayoutGroup testingTarget = new MyLayoutGroup()) { testingTarget.AttachToOwner(owner); try { testingTarget.OnLayoutIndependentChildren(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(5), new LayoutLength(5)); } 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()); } } textLabel.Dispose(); } tlog.Debug(tag, $"LayoutGroupOnLayoutIndependentChildren END (OK)"); }
public void LayoutGroupOnMeasure() { tlog.Debug(tag, $"LayoutGroupOnMeasure START"); flagOnMeasureOverride = false; Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial"); LayoutItem layoutItem = new LinearLayout(); View view = new View() { ExcludeLayouting = false, Size = new Size(100, 150) }; layoutItem.AttachToOwner(view); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); testingTarget.AttachToOwner(view); testingTarget.Add(layoutItem); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost); testingTarget.OnMeasureTest(measureWidth, measureHeight); Assert.True(flagOnMeasureOverride, "LayoutGroup overridden method not invoked."); // Test LayoutChildren.Count == 0 flagOnMeasureOverride = false; Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial"); testingTarget.Remove(layoutItem); testingTarget.OnMeasureTest(measureWidth, measureHeight); Assert.True(flagOnMeasureOverride, "LayoutGroup overridden method not invoked."); testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupOnMeasure END (OK)"); }