From cd29a15e0d3a521054bde8089ad3998fb4ad3953 Mon Sep 17 00:00:00 2001 From: gumme Date: Mon, 2 Dec 2013 14:00:19 +0100 Subject: [PATCH 1/2] Removes namespace attributes from child nodes in the pasted snippet if they are already present in the root where the snippet is pasted. Added a test "PasteCustomControlUsingMixedTypes" that failed before this fix. --- .../Tests/Designer/EditOperationTests.cs | 63 +++++++++++++++++++ .../Tests/Designer/ModelTestHelper.cs | 58 ++++++++++++----- .../WpfDesign.XamlDom/Project/XamlParser.cs | 54 ++++++++++------ 3 files changed, 141 insertions(+), 34 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs index 9df9884dcfc..8581342943b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs @@ -4,6 +4,8 @@ using System; using System.Threading; using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; using ICSharpCode.WpfDesign.Designer.Xaml; using ICSharpCode.WpfDesign.XamlDom; @@ -14,6 +16,15 @@ namespace ICSharpCode.WpfDesign.Tests.Designer [TestFixture] public class EditOperationTests : ModelTestHelper { + protected override XamlLoadSettings CreateXamlLoadSettings() + { + var settings = base.CreateXamlLoadSettings(); + + settings.TypeFinder.RegisterAssembly(typeof(NamespaceTests).Assembly); + + return settings; + } + Mutex mutex; [TestFixtureSetUp] @@ -204,5 +215,57 @@ public void PasteSameElementMultipleTimesCheckCopiesNames() Assert.IsNotNull(nameScope.FindName(_name + "_Copy3")); Assert.IsNull(nameScope.FindName(_name + "_Copy4")); } + + [Test] + public void PasteCustomControlUsingMixedTypes() + { + DesignItem grid = CreateGridContextWithDesignSurface("