public void TestBlockToDomFieldToDomTrivial() { SetupWithMockBlocks(); mWorkspace.CreateVariable("name1", "type1", "id1"); var block = BlockFactory.Instance.CreateBlock(mWorkspace, "field_variable_test_block"); block.InputList[0].FieldRow[0].SetValue("name1"); var resultFieldDom = Xml.BlockToDom(block).ChildNodes[0]; XmlTestCheckVariableFieldDomValues(resultFieldDom, "VAR", "type1", "id1", "name1"); TeardownWithMockBlocks(); }
public void TestBlockToDomDefaultCase() { SetupWithMockBlocks(); Utils.EditorDefaultGenUidValue = "1"; mWorkspace.CreateVariable("name1"); var block = BlockFactory.Instance.CreateBlock(mWorkspace, "field_variable_test_block"); block.InputList[0].FieldRow[0].SetValue("name1"); var resultFieldDom = Xml.BlockToDom(block).ChildNodes[0]; // Expect type is '' and is '1' since we don't specify type and id. XmlTestCheckVariableFieldDomValues(resultFieldDom, "VAR", "", "1", "name1"); TeardownWithMockBlocks(); }
public void TestBlockToDomFieldToDomNotAFieldVariable() { BlockFactory.Instance.AddJsonDefinitions(@"[{ 'type':'field_angle_test_block', 'message0':'%1', 'args0':[ { 'type':'field_angle', 'name':'VAR', 'angle':90 } ], }]"); SetupWithMockBlocks(); var block = BlockFactory.Instance.CreateBlock(mWorkspace, "field_angle_test_block"); var xmlDom = Xml.BlockToDom(block); var resultFieldDom = xmlDom.ChildNodes[0]; XmlTestCheckNonVariableField(resultFieldDom, "VAR", "90"); TeardownWithMockBlocks(); }