Exemplo n.º 1
0
        public void IntegerSliderMaxValue()
        {
            var integerSliderNode = new IntegerSlider() { Value = 500 };
            var updateValueParams = new UpdateValueParams("Value", "1000");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 1000,
                 integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-1");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 -1,
                 integerSliderNode.Min);

            updateValueParams = new UpdateValueParams("Value", "2147483648");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                2147483647,
                integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-2147483649");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                -2147483648,
                integerSliderNode.Min);
        }
Exemplo n.º 2
0
        public void IntegerSliderMaxValue()
        {
            var integerSliderNode = new IntegerSlider()
            {
                Value = 500
            };
            var updateValueParams = new UpdateValueParams("Value", "1000");

            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                1000,
                integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-1");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                -1,
                integerSliderNode.Min);

            updateValueParams = new UpdateValueParams("Value", "2147483648");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                2147483647,
                integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-2147483649");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                -2147483648,
                integerSliderNode.Min);
        }
Exemplo n.º 3
0
        public void MAGN_3784()
        {
            // Details are available in defect
            // http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3784

            var model = ViewModel.Model;

            string samplePath = Path.Combine(workingDirectory, @".\\Bugs\MAGN_3784.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

            AssertNoDummyNodes();

            RunCurrentModel();

            // check all the nodes and connectors are loaded
            Assert.AreEqual(5, model.CurrentWorkspace.Nodes.Count());
            Assert.AreEqual(3, model.CurrentWorkspace.Connectors.Count());

            // evaluate graph
            var refPtNodeId = "92774673-e265-4378-b8ba-aef86c1a616e";
            var refPt       = GetPreviewValue(refPtNodeId) as ReferencePoint;

            Assert.IsNotNull(refPt);
            Assert.AreEqual(0, refPt.X);

            // change slider value and re-evaluate graph
            IntegerSlider slider = model.CurrentWorkspace.NodeFromWorkspace
                                       ("55a992c9-8f16-4c07-a049-b0627d78c93c") as IntegerSlider;

            slider.Value = 10;

            RunCurrentModel();

            refPt = GetPreviewValue(refPtNodeId) as ReferencePoint;
            Assert.IsNotNull(refPt);
            (10.0).ShouldBeApproximately(refPt.X);

            RunCurrentModel();

            // Cross check from Revit side.
            var selectElementType = "4a99826a-eb73-4831-857c-909579c7eb12";
            var refPt1            = GetPreviewValueAtIndex(selectElementType, 0) as ReferencePoint;

            AssertPreviewCount(selectElementType, 1);

            Assert.IsNotNull(refPt1);
            (10.0).ShouldBeApproximately(refPt1.X, 1.0e-6);
        }
Exemplo n.º 4
0
        public void MAGN_3784()
        {
            // Additional Info: https://github.com/DynamoDS/Dynamo/pull/1845
            // Verify that reference point is updating when its input value is changed

            var model = ViewModel.Model;

            string samplePath = Path.Combine(workingDirectory, @".\\Bugs\MAGN_3784.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

            AssertNoDummyNodes();

            RunCurrentModel();

            // check all the nodes and connectors are loaded
            Assert.AreEqual(5, model.CurrentWorkspace.Nodes.Count());
            Assert.AreEqual(3, model.CurrentWorkspace.Connectors.Count());

            // evaluate graph
            var refPtNodeId = "92774673-e265-4378-b8ba-aef86c1a616e";
            var refPt       = GetPreviewValue(refPtNodeId) as ReferencePoint;

            Assert.IsNotNull(refPt);
            Assert.AreEqual(0, refPt.X);

            // change slider value and re-evaluate graph
            IntegerSlider slider = model.CurrentWorkspace.NodeFromWorkspace
                                       ("55a992c9-8f16-4c07-a049-b0627d78c93c") as IntegerSlider;

            slider.Value = 10;

            RunCurrentModel();

            refPt = GetPreviewValue(refPtNodeId) as ReferencePoint;
            Assert.IsNotNull(refPt);
            (10.0).ShouldBeApproximately(refPt.X);

            RunCurrentModel();

            // Cross check from Revit side.
            var selectElementType = "4a99826a-eb73-4831-857c-909579c7eb12";
            var refPt1            = GetPreviewValueAtIndex(selectElementType, 0) as ReferencePoint;

            AssertPreviewCount(selectElementType, 1);

            Assert.IsNotNull(refPt1);
            (10.0).ShouldBeApproximately(refPt1.X, 1.0e-6);
        }
Exemplo n.º 5
0
        public void EleBindingTest_MAGN_7937()
        {
            var model = ViewModel.Model;

            string filePath = Path.Combine(workingDirectory, @".\Bugs\EleBindingTest_MAGN-7937.dyn");
            string testPath = Path.GetFullPath(filePath);

            ViewModel.OpenCommand.Execute(testPath);
            AssertNoDummyNodes();

            // check all the nodes and connectors are loaded
            Assert.AreEqual(2, model.CurrentWorkspace.Nodes.Count());
            Assert.AreEqual(1, model.CurrentWorkspace.Connectors.Count());

            RunCurrentModel();

            string refPtNodeId = "23e2f77c-bd3f-4376-83aa-45dedde795b8";
            var    refPt       = GetPreviewValue(refPtNodeId) as ReferencePoint;

            Assert.IsNotNull(refPt);
            refPt.Z.ShouldBeApproximately(7);

            // Count all Reference points in Revit.
            var refPoints = GetAllReferencePoints();

            Assert.AreEqual(1, refPoints.Count);

            // change slider value and re-evaluate graph
            IntegerSlider slider = model.CurrentWorkspace.NodeFromWorkspace
                                       ("bdcd9b06-989f-4bac-a94d-b84a432d33ea") as IntegerSlider;

            slider.Value = 10;

            RunCurrentModel();

            var modifiedRefPt = GetPreviewValue(refPtNodeId) as ReferencePoint;

            Assert.IsNotNull(modifiedRefPt);
            modifiedRefPt.Z.ShouldBeApproximately(10);

            // This is to validate there is no dulicate point in revit.
            // After slider update there should be only one ref point in revit.
            var modifiedRefPoints1 = GetAllReferencePoints();

            Assert.AreEqual(1, modifiedRefPoints1.Count);
        }