Exemplo n.º 1
0
        public void RefGridSlidersSample()
        {
            var    model      = ViewModel.Model;
            string samplePath = Path.Combine(workingDirectory, @".\Samples\refgridsliders.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

            // check all the nodes and connectors are loaded
            Assert.GreaterOrEqual(8, model.CurrentWorkspace.Nodes.Count());
            Assert.GreaterOrEqual(10, model.CurrentWorkspace.Connectors.Count());
            AssertNoDummyNodes();

            // evaluate graph
            RunCurrentModel();

            var refPtNodeId = "69dcdcdc-941f-46f9-8e8b-242b61e74e80";

            AssertPreviewCount(refPtNodeId, 36);

            var refPt = GetPreviewValueAtIndex(refPtNodeId, 23) as ReferencePoint;

            Assert.IsNotNull(refPt);
            Assert.AreEqual(57, refPt.Y, 0.000001);

            // change slider value and re-evaluate graph
            DoubleSlider slider = model.CurrentWorkspace.NodeFromWorkspace("5adff29b-3cac-4387-8d1d-b75ceb9c6dec") as DoubleSlider;

            slider.Value = 3.5;

            RunCurrentModel();
            AssertPreviewCount(refPtNodeId, 16);
        }
Exemplo n.º 2
0
        public void SliderValueResetsMax()
        {
            var slider = new DoubleSlider();
            Assert.NotNull(slider);

            slider.Value = 200;
            Assert.AreEqual(200.0, slider.Max);
        }
Exemplo n.º 3
0
        public void SliderValueResetsMin()
        {
            var slider = new DoubleSlider();
            Assert.NotNull(slider);

            slider.Value = -5;
            Assert.AreEqual(-5.0, slider.Min);
        }
Exemplo n.º 4
0
        public void SliderMaxNeverLessThanMin()
        {
            var slider = new DoubleSlider();
            Assert.NotNull(slider);

            slider.Max = -5;
            Assert.AreEqual(-5.0, slider.Min);
        }
Exemplo n.º 5
0
        public void SliderMinNeverGreaterThanMax()
        {
            var slider = new DoubleSlider();
            Assert.NotNull(slider);

            slider.Min = 101;
            Assert.AreEqual(101.0, slider.Max);
        }
Exemplo n.º 6
0
        public void SliderValueResetsMin()
        {
            var slider = new DoubleSlider();

            Assert.NotNull(slider);

            slider.Value = -5;
            Assert.AreEqual(-5.0, slider.Min);
        }
Exemplo n.º 7
0
        public void SliderValueResetsMax()
        {
            var slider = new DoubleSlider();

            Assert.NotNull(slider);

            slider.Value = 200;
            Assert.AreEqual(200.0, slider.Max);
        }
Exemplo n.º 8
0
        public void SliderMaxNeverLessThanMin()
        {
            var slider = new DoubleSlider();

            Assert.NotNull(slider);

            slider.Max = -5;
            Assert.AreEqual(-5.0, slider.Min);
        }
Exemplo n.º 9
0
        public void SliderMinNeverGreaterThanMax()
        {
            var slider = new DoubleSlider();

            Assert.NotNull(slider);

            slider.Min = 101;
            Assert.AreEqual(101.0, slider.Max);
        }
Exemplo n.º 10
0
        public void CreatePointEndSample()
        {
            var model = ViewModel.Model;

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

            ViewModel.OpenCommand.Execute(testPath);

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

            RunCurrentModel();

            // test copying and pasting the workflow
            DynamoSelection.Instance.ClearSelection();
            DynamoSelection.Instance.Selection.AddRange(ViewModel.Model.CurrentWorkspace.Nodes);
            model.Copy();
            model.Paste();

            // evaluate graph
            var refPtNodeId = "16d1ceb2-c780-45d1-9dfb-d9c49836a931";
            var refPt       = GetPreviewValue(refPtNodeId) as ReferencePoint;

            Assert.IsNotNull(refPt);
            Assert.AreEqual(63.275, refPt.Z, 0.0000001);

            // change slider value and re-evaluate graph
            DoubleSlider slider = model.CurrentWorkspace.NodeFromWorkspace
                                      ("2eb70bdb-773d-4cf4-a10e-828dd39a0cca") as DoubleSlider;

            slider.Value = 56.78;

            RunCurrentModel();

            refPt = GetPreviewValue(refPtNodeId) as ReferencePoint;
            Assert.IsNotNull(refPt);
            Assert.AreEqual(56.78, refPt.Z);
        }
Exemplo n.º 11
0
        public void DivideSelectedCurveSample()
        {
            var    model      = ViewModel.Model;
            string samplePath = Path.Combine(workingDirectory, @".\Samples\divideselectedcurve.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

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

            // evaluate graph
            RunCurrentModel();

            var refPtNodeId = "7e23ea22-600f-4263-89af-defa541e90f2";

            AssertPreviewCount(refPtNodeId, 33);

            var refPt = GetPreviewValueAtIndex(refPtNodeId, 3) as ReferencePoint;

            Assert.IsNotNull(refPt);
            //Assert.AreEqual(57, refPt.Y, 0.000001);

            // change slider value and re-evaluate graph
            DoubleSlider slider = model.CurrentWorkspace.NodeFromWorkspace
                                      ("a1844c0d-99bd-4a32-84f8-2e94685f3229") as DoubleSlider;

            slider.Value = 15.0;

            RunCurrentModel();
            AssertPreviewCount(refPtNodeId, 15);
            var refPt1 = GetPreviewValueAtIndex(refPtNodeId, 3) as ReferencePoint;

            Assert.IsNotNull(refPt1);
        }
Exemplo n.º 12
0
        public void TestDoubleSliderInput()
        {
            var numNode = new DoubleSlider {
                X = 400, Value = 50.0, Max = 100.0, Min = 0.0
            };

            //To check if NodeModel base Serialization method is being called
            //To check if Double class's Serialization methods work

            //Assert initial values
            Assert.AreEqual(400, numNode.X);
            Assert.AreEqual(50.0, numNode.Value);
            Assert.AreEqual(0.0, numNode.Min);
            Assert.AreEqual(100.0, numNode.Max);

            //Serialize node and then change values
            XmlDocument xmlDoc       = new XmlDocument();
            XmlElement  serializedEl = numNode.Serialize(xmlDoc, SaveContext.Undo);

            numNode.X     = 250;
            numNode.Value = 4.0;
            numNode.Max   = 189.0;
            numNode.Min   = 2.0;

            //Assert new changes
            Assert.AreEqual(250, numNode.X);
            Assert.AreEqual(4.0, numNode.Value);
            Assert.AreEqual(2.0, numNode.Min);
            Assert.AreEqual(189.0, numNode.Max);

            //Deserialize and aasert old values
            numNode.Deserialize(serializedEl, SaveContext.Undo);
            Assert.AreEqual(400, numNode.X);
            Assert.AreEqual(50.0, numNode.Value);
            Assert.AreEqual(0.0, numNode.Min);
            Assert.AreEqual(100.0, numNode.Max);
        }
Exemplo n.º 13
0
 public void CanConstructDoubleSlider()
 {
     var slider = new DoubleSlider();
     Assert.NotNull(slider);
 }
Exemplo n.º 14
0
        public void CanConstructDoubleSlider()
        {
            var slider = new DoubleSlider();

            Assert.NotNull(slider);
        }
Exemplo n.º 15
0
        public void TestDoubleSliderInput()
        {
            var numNode = new DoubleSlider { X = 400, Value = 50.0, Max = 100.0, Min = 0.0 };

            //To check if NodeModel base Serialization method is being called
            //To check if Double class's Serialization methods work

            //Assert initial values
            Assert.AreEqual(400, numNode.X);
            Assert.AreEqual(50.0, numNode.Value);
            Assert.AreEqual(0.0, numNode.Min);
            Assert.AreEqual(100.0, numNode.Max);

            //Serialize node and then change values
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement serializedEl = numNode.Serialize(xmlDoc, SaveContext.Undo);
            numNode.X = 250;
            numNode.Value = 4.0;
            numNode.Max = 189.0;
            numNode.Min = 2.0;

            //Assert new changes
            Assert.AreEqual(250, numNode.X);
            Assert.AreEqual(4.0, numNode.Value);
            Assert.AreEqual(2.0, numNode.Min);
            Assert.AreEqual(189.0, numNode.Max);

            //Deserialize and aasert old values
            numNode.Deserialize(serializedEl, SaveContext.Undo);
            Assert.AreEqual(400, numNode.X);
            Assert.AreEqual(50.0, numNode.Value);
            Assert.AreEqual(0.0, numNode.Min);
            Assert.AreEqual(100.0, numNode.Max);
        }