Browse Source

Removed Ignore attribute from WhitespaceTests so the tests in the class will be executed.

Made some modifications to XamlParser so it aligns with the official XamlReader and the WhitespaceTests will pass.
pull/43/head
Tobias Gummesson 12 years ago
parent
commit
84053d7d84
  1. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/WhitespaceTests.cs
  2. 15
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/WhitespaceTests.cs

@ -7,7 +7,6 @@ using NUnit.Framework; @@ -7,7 +7,6 @@ using NUnit.Framework;
namespace ICSharpCode.WpfDesign.Tests.XamlDom
{
[TestFixture]
[Ignore("Broken on .NET 4")]
public class WhitespaceTests : TestHelper
{
[Test]

15
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

@ -275,15 +275,6 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -275,15 +275,6 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
foreach (XmlNode childNode in GetNormalizedChildNodes(element)) {
// I don't know why the official XamlReader runs the property getter
// here, but let's try to imitate it as good as possible
if (defaultProperty != null && !defaultProperty.IsCollection) {
for (; combinedNormalizedChildNodes > 0; combinedNormalizedChildNodes--) {
defaultProperty.GetValue(obj.Instance);
}
}
XmlElement childElement = childNode as XmlElement;
if (childElement != null) {
if (childElement.NamespaceURI == XamlConstants.XamlNamespace)
@ -314,9 +305,7 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -314,9 +305,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
}
}
int combinedNormalizedChildNodes;
IEnumerable<XmlNode> GetNormalizedChildNodes(XmlElement element)
{
XmlNode node = element.FirstChild;
@ -334,8 +323,6 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -334,8 +323,6 @@ namespace ICSharpCode.WpfDesign.XamlDom
&& (node.NodeType == XmlNodeType.Text
|| node.NodeType == XmlNodeType.CDATA
|| node.NodeType == XmlNodeType.SignificantWhitespace)) {
combinedNormalizedChildNodes++;
if (text != null) text.Value += node.Value;
else cData.Value += node.Value;
XmlNode nodeToDelete = node;

Loading…
Cancel
Save