예제 #1
0
        public void LayoutGroupMeasureChildWithMarginsWithNullArgument()
        {
            tlog.Debug(tag, $"LayoutGroupMeasureChildWithMarginsWithNullArgument 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.");

            MeasureSpecification measureWidth  = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
            MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);

            try
            {
                testingTarget.MeasureChildWithMarginsTest(null, measureWidth, new LayoutLength(10), measureHeight, new LayoutLength(10));
                Assert.Fail("Should return null argument exception");
            }
            catch (ArgumentNullException)
            {
                testingTarget.Dispose();
                tlog.Debug(tag, $"LayoutGroupMeasureChildWithMarginsWithNullArgument END (OK)");
                Assert.Pass("ArgumentNullException: passed!");
            }
        }
예제 #2
0
        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)");
        }