コード例 #1
0
ファイル: PipelineGraphTest.cs プロジェクト: Kha/YUV.KA
		public void TestAddNode()
		{
			// create some nodes and initialize graph
			BlurNode blur0 = new BlurNode();
			BlurNode blur1 = new BlurNode();
			BlurNode blur2 = new BlurNode();
			BlurNode blur3 = new BlurNode();
			BlurNode blur4 = new BlurNode();
			NoiseInputNode noise0 = new NoiseInputNode();
			NoiseInputNode noise1 = new NoiseInputNode();
			PipelineGraph graph = new PipelineGraph();

			graph.AddNode(blur0);
			graph.AddNode(blur1);
			graph.AddNode(noise0);
			graph.AddNode(blur2);
			graph.AddNode(noise1);

			Assert.Equal("Blur", blur0.Name);
			Assert.Equal("Blur 2", blur1.Name);
			Assert.Equal("Blur 3", blur2.Name);
			Assert.Equal("Noise", noise0.Name);
			Assert.Equal("Noise 2", noise1.Name);

			graph.RemoveNode(blur1);
			graph.AddNode(blur3);
			graph.AddNode(blur4);

			Assert.Equal("Blur 2", blur3.Name);
			Assert.Equal("Blur 4", blur4.Name);
		}
コード例 #2
0
ファイル: PipelineGraphTest.cs プロジェクト: Kha/YUV.KA
		public void TestRemoveNode()
		{
			// create graph
			AnonymousNode node0 = new AnonymousNode() { Name = "node0" };
			AnonymousNode node1 = new AnonymousNode() { Name = "node1" };
			AnonymousNode node2 = new AnonymousNode(node0, node1) { Name = "node2" };
			AnonymousNode node3 = new AnonymousNode(node2) { Name = "node3" };
			AnonymousNode node4 = new AnonymousNode(node2) { Name = "node4" };
			PipelineGraph graph = new PipelineGraph {
				Nodes = { node0, node1, node2, node3, node4 }
			};

			graph.RemoveNode(node2);

			foreach (Node.Input input in node3.Inputs) {
				Assert.Equal(null, input.Source);
			}

			foreach (Node.Input input in node4.Inputs) {
				Assert.Equal(null, input.Source);
			}
		}