コード例 #1
0
        public void TestDefaultValues()
        {
            IManualLayout layout = GetEmptyLayout();

            Assert.IsNotNull(layout.GetTarget());
            Assert.IsNotNull(layout.GetXMode());
            Assert.IsNotNull(layout.GetYMode());
            Assert.IsNotNull(layout.GetHeightMode());
            Assert.IsNotNull(layout.GetWidthMode());

            /*
             * According to interface, 0.0 should be returned for
             * unInitialized double properties.
             */
            Assert.IsTrue(layout.GetX() == 0.0);
            Assert.IsTrue(layout.GetY() == 0.0);
            Assert.IsTrue(layout.GetWidthRatio() == 0.0);
            Assert.IsTrue(layout.GetHeightRatio() == 0.0);
        }
コード例 #2
0
        public void TestAccessorMethods()
        {
            double       newRatio         = 1.1;
            double       newCoordinate    = 0.3;
            LayoutMode   nonDefaultMode   = LayoutMode.Factor;
            LayoutTarget nonDefaultTarget = LayoutTarget.Outer;

            IManualLayout layout = GetEmptyLayout();

            layout.SetWidthRatio(newRatio);
            Assert.IsTrue(layout.GetWidthRatio() == newRatio);

            layout.SetHeightRatio(newRatio);
            Assert.IsTrue(layout.GetHeightRatio() == newRatio);

            layout.SetX(newCoordinate);
            Assert.IsTrue(layout.GetX() == newCoordinate);

            layout.SetY(newCoordinate);
            Assert.IsTrue(layout.GetY() == newCoordinate);

            layout.SetXMode(nonDefaultMode);
            Assert.IsTrue(layout.GetXMode() == nonDefaultMode);

            layout.SetYMode(nonDefaultMode);
            Assert.IsTrue(layout.GetYMode() == nonDefaultMode);

            layout.SetWidthMode(nonDefaultMode);
            Assert.IsTrue(layout.GetWidthMode() == nonDefaultMode);

            layout.SetHeightMode(nonDefaultMode);
            Assert.IsTrue(layout.GetHeightMode() == nonDefaultMode);

            layout.SetTarget(nonDefaultTarget);
            Assert.IsTrue(layout.GetTarget() == nonDefaultTarget);
        }