public void GridLayoutOnMeasure() { tlog.Debug(tag, $"GridLayoutOnMeasure START"); flagOnMeasureOverride = false; Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial"); var testingTarget = new MyGridLayout(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <GridLayout>(testingTarget, "Should be an instance of GridLayout type."); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); testingTarget.OnMeasureTest(measureWidth, measureHeight); Assert.True(flagOnMeasureOverride, "GridLayout overridden method not invoked."); // !MeasureSpecification.ModeType.Exactly flagOnMeasureOverride = false; Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial"); MeasureSpecification measureWidth2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost); MeasureSpecification measureHeight2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified); testingTarget.OnMeasureTest(measureWidth2, measureHeight2); Assert.True(flagOnMeasureOverride, "GridLayout overridden method not invoked."); testingTarget.Dispose(); tlog.Debug(tag, $"GridLayoutOnMeasure END (OK)"); }
public void GridLayoutOnLayout() { tlog.Debug(tag, $"GridLayoutOnLayout START"); flagOnLayoutOverride = false; Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial"); LayoutItem layoutItem = new LinearLayout(); View view = new View() { ExcludeLayouting = false, Size = new Size(100, 150), Layout = new AbsoluteLayout() }; layoutItem.AttachToOwner(view); var testingTarget = new MyGridLayout(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <GridLayout>(testingTarget, "Should be an instance of GridLayout type."); testingTarget.AttachToOwner(view); testingTarget.Add(layoutItem); MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); testingTarget.OnMeasureTest(measureWidth, measureHeight); testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); Assert.True(flagOnLayoutOverride, "GridLayout 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, "GridLayout overridden method not invoked."); testingTarget.Dispose(); tlog.Debug(tag, $"GridLayoutOnLayout END (OK)"); }