mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-27 04:48:27 +00:00
Text3D variable bindings.
This commit is contained in:
parent
5726b63dec
commit
047a6472b1
@ -83,5 +83,19 @@ namespace OSCADSharp.UnitTests
|
|||||||
Assert.IsTrue(script.Contains(String.Format("direction = {0}", direction.Name)));
|
Assert.IsTrue(script.Contains(String.Format("direction = {0}", direction.Name)));
|
||||||
Assert.IsTrue(script.Contains(String.Format("language = {0}", language.Name)));
|
Assert.IsTrue(script.Contains(String.Format("language = {0}", language.Name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void Text_BindingConstructorAffectsOutput()
|
||||||
|
{
|
||||||
|
var text = new Variable("txt", "Greetings, Earthlings");
|
||||||
|
var size = new Variable("txtSize", 82);
|
||||||
|
|
||||||
|
var txt = new Text3D(text, size);
|
||||||
|
|
||||||
|
string script = txt.ToString();
|
||||||
|
|
||||||
|
Assert.IsTrue(script.Contains(String.Format("text(\"{0}\"", text.Name)));
|
||||||
|
Assert.IsTrue(script.Contains(String.Format("size = {0}", size.Name)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,26 @@ namespace OSCADSharp.Solids
|
|||||||
this.Text = text;
|
this.Text = text;
|
||||||
this.Size = size;
|
this.Size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a 3d text object with pre-bound variables
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="size"></param>
|
||||||
|
/// <param name="font"></param>
|
||||||
|
/// <param name="spacing"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="textdirection"></param>
|
||||||
|
public Text3D(Variable text = null, Variable size = null, Variable font = null,
|
||||||
|
Variable spacing = null, Variable language = null, Variable textdirection = null)
|
||||||
|
{
|
||||||
|
this.BindIfVariableNotNull("text", text);
|
||||||
|
this.BindIfVariableNotNull("size", size);
|
||||||
|
this.BindIfVariableNotNull("font", font);
|
||||||
|
this.BindIfVariableNotNull("spacing", spacing);
|
||||||
|
this.BindIfVariableNotNull("language", language);
|
||||||
|
this.BindIfVariableNotNull("textdirection", textdirection);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Overrides
|
#region Overrides
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user