public void LayoutGroupRemove() { tlog.Debug(tag, $"LayoutGroupRemove START"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should return LayoutGroup instance."); using (LayoutItem layoutItem = new LayoutItem()) { testingTarget.LayoutWithTransition = true; testingTarget.Add(layoutItem); Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 1 for the added child."); using (LayoutItem siblingLayoutItem = new LayoutItem()) { testingTarget.Add(siblingLayoutItem); Assert.AreEqual(testingTarget.ChildCount(), 2, "Should 1 for the added child."); testingTarget.Remove(layoutItem); Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 0 as child removed"); } } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupRemove 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 LayoutGroupIterateLayoutChildren() { tlog.Debug(tag, $"LayoutGroupIterateLayoutChildren START"); LayoutItem layoutItem = new LinearLayout(); View view = new View() { ExcludeLayouting = false, }; layoutItem.AttachToOwner(view); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should return LayoutGroup instance."); testingTarget.Add(layoutItem); var result = testingTarget.ForeachLayoutChildren(); Assert.AreEqual(1, result.Count(), "should be equal!"); tlog.Debug(tag, $"LayoutGroupIterateLayoutChildren END (OK)"); }
public void LayoutGroupLayoutChildren() { tlog.Debug(tag, $"LayoutGroupLayoutChildren START"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should return LayoutGroup instance."); using (LayoutItem layoutItem = new LayoutItem()) { testingTarget.Add(layoutItem); Assert.AreEqual(1, testingTarget.ChildCount(), "Should number of children added"); } testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupLayoutChildren 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)"); }
public void LayoutGroupAddWithNullArgument() { tlog.Debug(tag, $"LayoutGroupAddWithNullArgument START"); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should return LayoutGroup instance."); try { testingTarget.Add(null); Assert.Fail("Should return null argument exception"); } catch (ArgumentNullException) { testingTarget.Dispose(); tlog.Debug(tag, $"LayoutGroupAddWithNullArgument END (OK)"); Assert.Pass("ArgumentNullException: passed!"); } }
public void LayoutGroupRemoveChildFromLayoutGroup() { tlog.Debug(tag, $"LayoutGroupRemoveChildFromLayoutGroup START"); LayoutItem layoutItem = new AbsoluteLayout(); View parent = new View(); View child = new View() { ExcludeLayouting = false, Layout = new AbsoluteLayout() }; parent.Add(child); layoutItem.AttachToOwner(child); var testingTarget = new MyLayoutGroup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type."); testingTarget.Add(layoutItem); try { testingTarget.RemoveChildFromLayoutGroup(child); } 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()); } tlog.Debug(tag, $"LayoutGroupRemoveChildFromLayoutGroup 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)"); }