Example #1
0
        public void LayoutGroupMeasureChildren()
        {
            tlog.Debug(tag, $"LayoutGroupMeasureChildren 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.MeasureChildrenTest(measureWidth, measureHeight);
                Assert.True(flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured.");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"LayoutGroupMeasureChildren END (OK)");
        }