Browse Source

Two tree nodes with their NodeFont property set can now be loaded into the python forms designer.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4540 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 16 years ago
parent
commit
399bf9df9e
  1. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs
  2. 26
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs

6
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs

@ -355,8 +355,10 @@ namespace ICSharpCode.PythonBinding @@ -355,8 +355,10 @@ namespace ICSharpCode.PythonBinding
/// </summary>
string GetInstanceName(PythonControlFieldExpression fieldExpression)
{
if (!HasPropertyValue(fieldExpression.MemberName)) {
return PythonControlFieldExpression.GetVariableName(fieldExpression.MemberName);
if (fieldExpression.IsSelfReference) {
if (!HasPropertyValue(fieldExpression.MemberName)) {
return PythonControlFieldExpression.GetVariableName(fieldExpression.MemberName);
}
}
return null;
}

26
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs

@ -43,6 +43,7 @@ namespace PythonBinding.Tests.Designer @@ -43,6 +43,7 @@ namespace PythonBinding.Tests.Designer
" [treeNode2]))\r\n" +
" treeNode2.Name = \"ChildNode0\"\r\n" +
" treeNode2.Text = \"ChildNode0.Text\"\r\n" +
" treeNode2.NodeFont = System.Drawing.Font(\"Garamond\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)\r\n" +
" treeNode2.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" +
" [treeNode3]))\r\n" +
" treeNode3.Name = \"ChildNode1\"\r\n" +
@ -72,6 +73,10 @@ namespace PythonBinding.Tests.Designer @@ -72,6 +73,10 @@ namespace PythonBinding.Tests.Designer
get { return TreeView.Nodes[0]; }
}
public TreeNode FirstChildTreeNode {
get { return RootTreeNode.Nodes[0]; }
}
[Test]
public void OneRootNode()
{
@ -114,5 +119,26 @@ namespace PythonBinding.Tests.Designer @@ -114,5 +119,26 @@ namespace PythonBinding.Tests.Designer
{
Assert.IsTrue(RootTreeNode.Checked);
}
[Test]
public void ChildTreeNodeFontProperty()
{
Font font = new Font("Garamond", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
Assert.AreEqual(font, FirstChildTreeNode.NodeFont);
}
/// <summary>
/// Ensures that we are not creating an instance with a name of NodeFont.
/// </summary>
[Test]
public void InstancesCreated()
{
foreach (CreatedInstance instance in ComponentCreator.CreatedInstances) {
if (instance.InstanceType == typeof(Font)) {
Assert.IsNull(instance.Name);
}
}
Assert.IsTrue(ComponentCreator.CreatedInstances.Count > 0);
}
}
}

Loading…
Cancel
Save