public void BoolSelectorClone() { tlog.Debug(tag, $"BoolSelectorClone START"); var testingTarget = new BoolSelector() { All = true, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <BoolSelector>(testingTarget, "Should return BoolSelector instance."); try { var result = testingTarget.Clone(); tlog.Debug(tag, "result : " + result); } catch (Exception) { // System.InvalidCastException : Unable to cast object // of type 'Tizen.NUI.BaseComponents.Selector`1[Tizen.NUI.Bool]' // to type 'Tizen.NUI.Components.BoolSelector' // To fix tlog.Debug(tag, $"BoolSelectorClone END (OK)"); Assert.Pass("Passed!"); } }
public void TestBool() { var boolNode = new BoolSelector { Value = false, X = 400 }; //To check if base Serialization method is being called //Assert initial values Assert.AreEqual(400, boolNode.X); Assert.AreEqual(false, boolNode.Value); //Serialize node and then change values XmlDocument xmlDoc = new XmlDocument(); XmlElement serializedEl = boolNode.Serialize(xmlDoc, SaveContext.Undo); boolNode.X = 250; boolNode.Value = true; //Assert new changes Assert.AreEqual(250, boolNode.X); Assert.AreEqual(true, boolNode.Value); //Deserialize and assert old values boolNode.Deserialize(serializedEl, SaveContext.Undo); Assert.AreEqual(400, boolNode.X); Assert.AreEqual(false, boolNode.Value); }
public void TestIfNodeForPreview() { string testFilePath = Path.Combine(testFolder, "testNewIf.dyn"); OpenModel(testFilePath); BoolSelector boolSelectorNode = (BoolSelector)this.CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace("886a464b-9b2b-4e66-a033-c18d0753c2cf"); boolSelectorNode.Value = true; AssertPreviewValue("886a464b-9b2b-4e66-a033-c18d0753c2cf", true); AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { "a1", "b1", "c1" }); boolSelectorNode.Value = false; AssertPreviewValue("886a464b-9b2b-4e66-a033-c18d0753c2cf", false); AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { new object[] { "a2" }, "b2" }); /* Test partially connected 'If' node. * The 'Function Apply' node has the following inputs: * function: partially connected 'If' node whose truevalue is [1,[2],3] and falsevalue is [4,5]. * argument0: [true,false] * * This 'Function Apply' node will call the partially connected "If" function 2 times. One for true and the other one for false. * So the output should be [[1,[2],3], [4,5]] */ AssertPreviewValue("d38be78d-1d6d-4c4d-a67f-e16208f5feb6", new object[] { new object[] { 1, new object[] { 2 }, 3 }, new object[] { 4, 5 } }); }
public void TestIfNodeLacingOptions() { string testFilePath = Path.Combine(testFolder, "testNewIf.dyn"); OpenModel(testFilePath); /* IF node inputs: * true value: ["a1","b1","c1"]; * false value: [["a2"],"b2"]; */ BoolSelector boolSelectorNode = (BoolSelector)this.CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace("886a464b-9b2b-4e66-a033-c18d0753c2cf"); /* ArgumentLacing: Auto * * expected output: if test value is true, output will be ["a1","b1","c1"] * if test value is false, output will be [["a2"],"b2"] */ NodeModel ifNode = this.CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace("f945529e-62e3-4c7a-b07a-0b18d7449f9b"); Assert.AreEqual(LacingStrategy.Auto, ifNode.ArgumentLacing); boolSelectorNode.Value = true; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { "a1", "b1", "c1" }); boolSelectorNode.Value = false; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { new object[] { "a2" }, "b2" }); /* ArgumentLacing: Longest * * expected output: if test value is true, output will be ["a1","b1","c1"] * if test value is false, output will be [["a2"],"b2","b2"] */ CurrentDynamoModel.CurrentWorkspace.UpdateModelValue(new List <Guid> { ifNode.GUID }, "ArgumentLacing", "Longest"); Assert.AreEqual(LacingStrategy.Longest, ifNode.ArgumentLacing); boolSelectorNode.Value = true; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { "a1", "b1", "c1" }); boolSelectorNode.Value = false; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { new object[] { "a2" }, "b2", "b2" }); /* ArgumentLacing: Shortest * * expected output: if test value is true, output will be ["a1"] * if test value is false, output will be [["a2"]] */ CurrentDynamoModel.CurrentWorkspace.UpdateModelValue(new List <Guid> { ifNode.GUID }, "ArgumentLacing", "Shortest"); Assert.AreEqual(LacingStrategy.Shortest, ifNode.ArgumentLacing); boolSelectorNode.Value = true; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { "a1" }); boolSelectorNode.Value = false; AssertPreviewValue("f945529e-62e3-4c7a-b07a-0b18d7449f9b", new object[] { new object[] { "a2" } }); }
public void Defect_MAGN_1905() { //Detail steps are here http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-1905 string openPath = Path.Combine(TestDirectory, @"core\DynamoDefects\Defect_MAGN_1905.dyn"); RunModel(openPath); AssertPreviewValue("c4b9077d-3e6c-40b9-a715-078083e29655", 11); BoolSelector b = CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace ("c9da5b60-9d52-453b-836d-0682687728bf") as BoolSelector; b.Value = true; BeginRun(); AssertPreviewValue("c4b9077d-3e6c-40b9-a715-078083e29655", 3); }
public void TestIfNodeListAtLevel() { string testFilePath = Path.Combine(testFolder, "testNewIf.dyn"); OpenModel(testFilePath); BoolSelector boolSelectorNode = (BoolSelector)this.CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace("886a464b-9b2b-4e66-a033-c18d0753c2cf"); /* IF node inputs: * true value: [1,[2],3]; List level set at L3 * false value: [4,5]; List level set at L3 * * expected output: if test value is true, output will be [[ 1, [2], 3]] * if test value is false, output will be [[[ 4 , 5 ]]] */ boolSelectorNode.Value = true; AssertPreviewValue("699f9236-9fb0-4b91-a6a3-fb5dd23ed70b", new object[] { new object[] { 1, new object[] { 2 }, 3 } }); boolSelectorNode.Value = false; AssertPreviewValue("699f9236-9fb0-4b91-a6a3-fb5dd23ed70b", new object[] { new object[] { new object[] { 4, 5 } } }); }