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); }
public void SliderASTGeneration() { var sliderNode = new DoubleSlider() { Value = 10 }; var buildOutput = sliderNode.BuildOutputAst(new List<AssociativeNode>()); Assert.AreEqual( 10, ((DoubleNode)((BinaryExpressionNode)buildOutput.First()).RightNode).Value); }
public void SliderMaxValueWithBigNum() { var sliderNode = new DoubleSlider() { Value = 500 }; var updateValueParams = new UpdateValueParams("Max", "2.14748364712346E+15"); sliderNode.UpdateValue(updateValueParams); Assert.AreEqual( 2.14748364712346E+15, sliderNode.Max); }
public void SliderASTGeneration() { var sliderNode = new DoubleSlider() { Value = 10 }; var buildOutput = sliderNode.BuildOutputAst(new List <AssociativeNode>()); Assert.AreEqual( 10, ((DoubleNode)((BinaryExpressionNode)buildOutput.First()).RightNode).Value); }
public void SliderMaxValue() { var sliderNode = new DoubleSlider() { Value = 500 }; var updateValueParams = new UpdateValueParams("Value", "1000"); sliderNode.UpdateValue(updateValueParams); Assert.AreEqual( 1000, sliderNode.Max); updateValueParams = new UpdateValueParams("Value", "-1"); sliderNode.UpdateValue(updateValueParams); Assert.AreEqual( -1, sliderNode.Min); }
public void Rotation_MAGN_8056() { var model = ViewModel.Model; string filePath = Path.Combine(workingDirectory, @".\Bugs\MAGN_8056.dyn"); string testPath = Path.GetFullPath(filePath); ViewModel.OpenCommand.Execute(testPath); AssertNoDummyNodes(); RunCurrentModel(); string locationNodeId = "8c9dbf40-73d7-4788-84b2-ccf015fa47de"; var locations = GetPreviewCollection(locationNodeId); var point = locations[0] as Point; point.X.ShouldBeApproximately(2.0); string numberSliderNodeId = "971b7986-59e2-4ad1-b087-0e9e4158506a"; DoubleSlider slider = GetNode <DoubleSlider>(numberSliderNodeId) as DoubleSlider; slider.Value = 10.0; // Set the new rotation RunCurrentModel(); locations = GetPreviewCollection(locationNodeId); point = locations[0] as Point; point.X.ShouldBeApproximately(2.0); // The x coordination of the column should not change point.Y.ShouldBeApproximately(0.0); // The x coordination of the column should not change point.Z.ShouldBeApproximately(0.0); // The x coordination of the column should not change //After updating the rotation angle, check that all family instances are rotated for 10.0 degrees var objects = GetPreviewCollection("2af2362b-38a7-4db7-976d-39f4e74c8e07"); foreach (var obj in objects) { var instance = obj as Revit.Elements.FamilyInstance; Assert.IsNotNull(instance); double[] rotationAngles; var familyInstance = instance.InternalElement as Autodesk.Revit.DB.FamilyInstance; var transform = familyInstance.GetTransform(); TransformUtils.ExtractEularAnglesFromTransform(transform, out rotationAngles); (10.0).ShouldBeApproximately(rotationAngles[0] * 180 / Math.PI); } }
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); }
public void MAGN_2589() { // Details are available in defect // http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-2589 var model = ViewModel.Model; string samplePath = Path.Combine(workingDirectory, @".\Bugs\MAGN_2589.dyn"); string testPath = Path.GetFullPath(samplePath); ViewModel.OpenCommand.Execute(testPath); AssertNoDummyNodes(); RunCurrentModel(); // check all the nodes and connectors are loaded Assert.AreEqual(20, model.CurrentWorkspace.Nodes.Count); Assert.AreEqual(29, model.CurrentWorkspace.Connectors.Count()); // Validation for Geometry Instance import. var geometryInstance = "d017525b-2b02-44c4-88cf-2ed887c14a17"; var solid = GetPreviewValue(geometryInstance) as ImportInstance; Assert.IsNotNull(solid); // change slider (Resolution) value and re-evaluate graph DoubleSlider slider = model.CurrentWorkspace.NodeFromWorkspace ("f6c91ebf-7eac-426c-81a9-97a0d5121fa5") as DoubleSlider; slider.Value = 35; RunCurrentModel(); var solid1 = GetPreviewValue(geometryInstance) as ImportInstance; Assert.IsNotNull(solid1); }
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); }
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); }
private static void SetSliderInputParams(DoubleSlider inputNode, double min, double max) { }