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;
namespace ICSharpCode.WpfDesign.Tests.XamlDom namespace ICSharpCode.WpfDesign.Tests.XamlDom
{ {
[TestFixture] [TestFixture]
[Ignore("Broken on .NET 4")]
public class WhitespaceTests : TestHelper public class WhitespaceTests : TestHelper
{ {
[Test] [Test]

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

@ -275,15 +275,6 @@ namespace ICSharpCode.WpfDesign.XamlDom
} }
foreach (XmlNode childNode in GetNormalizedChildNodes(element)) { 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; XmlElement childElement = childNode as XmlElement;
if (childElement != null) { if (childElement != null) {
if (childElement.NamespaceURI == XamlConstants.XamlNamespace) if (childElement.NamespaceURI == XamlConstants.XamlNamespace)
@ -314,9 +305,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
} }
} }
} }
int combinedNormalizedChildNodes;
IEnumerable<XmlNode> GetNormalizedChildNodes(XmlElement element) IEnumerable<XmlNode> GetNormalizedChildNodes(XmlElement element)
{ {
XmlNode node = element.FirstChild; XmlNode node = element.FirstChild;
@ -334,8 +323,6 @@ namespace ICSharpCode.WpfDesign.XamlDom
&& (node.NodeType == XmlNodeType.Text && (node.NodeType == XmlNodeType.Text
|| node.NodeType == XmlNodeType.CDATA || node.NodeType == XmlNodeType.CDATA
|| node.NodeType == XmlNodeType.SignificantWhitespace)) { || node.NodeType == XmlNodeType.SignificantWhitespace)) {
combinedNormalizedChildNodes++;
if (text != null) text.Value += node.Value; if (text != null) text.Value += node.Value;
else cData.Value += node.Value; else cData.Value += node.Value;
XmlNode nodeToDelete = node; XmlNode nodeToDelete = node;

Loading…
Cancel
Save