Browse Source

Fix WiX icon control types being removed by designer.

Switching to the WiX dialog designer and back again was causing <Control Type="Icon" /> elements to be removed.
The WiX dialog designer now recognises control's with a type of Icon.
pull/28/head
Matt Ward 13 years ago
parent
commit
6adfe7ab02
  1. 8
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixTreeNode.cs
  2. 1
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixDialog.cs
  3. 63
      src/AddIns/BackendBindings/WixBinding/Test/DialogXmlGeneration/DialogWithIconControlTypeOpenedAndClosedInDesignerTests.cs
  4. 1
      src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

8
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixTreeNode.cs

@ -37,14 +37,6 @@ namespace ICSharpCode.WixBinding @@ -37,14 +37,6 @@ namespace ICSharpCode.WixBinding
}
}
/// <summary>
/// Gets whether this tree node has been initialized. If it has been
/// initialized then all the child nodes have been added to this node.
/// </summary>
public bool IsInitialized {
get { return isInitialized; }
}
/// <summary>
/// Can delete all Wix tree nodes.
/// </summary>

1
src/AddIns/BackendBindings/WixBinding/Project/Src/WixDialog.cs

@ -314,6 +314,7 @@ namespace ICSharpCode.WixBinding @@ -314,6 +314,7 @@ namespace ICSharpCode.WixBinding
controls.Add(CreateRadioButtonGroup(controlElement, componentCreator));
break;
case "Bitmap":
case "Icon":
controls.Add(CreatePictureBox(controlElement, componentCreator));
break;
case "ListBox":

63
src/AddIns/BackendBindings/WixBinding/Test/DialogXmlGeneration/DialogWithIconControlTypeOpenedAndClosedInDesignerTests.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using WixBinding;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.DialogXmlGeneration
{
/// <summary>
/// Tests that a Control with type Icon is not removed from the dialog xml
/// after viewing the dialog in the designer and then switching back to source code.
/// </summary>
[TestFixture]
public class DialogWithIconControlTypeOpenedAndClosedInDesignerTests
{
XmlElement dialogElement;
[TestFixtureSetUp]
public void SetUpFixture()
{
WixDocument doc = new WixDocument();
doc.LoadXml(GetWixXml());
WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());
using (Form dialog = wixDialog.CreateDialog()) {
dialog.Text = "New dialog title";
dialog.ClientSize = new Size(200, 100);
dialogElement = wixDialog.UpdateDialogElement(dialog);
}
}
[Test]
public void UpdateDialogElement_GetIconControl_IconControlStillExists()
{
var namespaceManager = new WixNamespaceManager(dialogElement.OwnerDocument.NameTable);
var control = dialogElement.SelectSingleNode("w:Control", namespaceManager) as XmlElement;
string id = control.GetAttribute("Id");
Assert.AreEqual("MyIcon", id);
}
string GetWixXml()
{
return
"<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
"\t<Fragment>\r\n" +
" <UI>\r\n" +
" <Dialog Id='WelcomeDialog' Height='270' Width='370' Title='Welcome Dialog Title'>\r\n" +
" <Control Id='MyIcon' Type='Icon' X='20' Y='60' Width='24' Height='24' FixedSize='yes' IconSize='16' Text='IconName'>\r\n" +
" </Control>\r\n" +
" </Dialog>\r\n" +
" </UI>\r\n" +
" </Fragment>\r\n" +
"</Wix>";
}
}
}

1
src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

@ -62,6 +62,7 @@ @@ -62,6 +62,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="DialogXmlGeneration\DialogWithIconControlTypeOpenedAndClosedInDesignerTests.cs" />
<Compile Include="Diff\MissingDirectoryTestFixture.cs" />
<Compile Include="DirectoryImport\AddDuplicateDirectoryIdTestFixture.cs" />
<Compile Include="Document\DuplicateBinaryIdTestFixture.cs" />

Loading…
Cancel
Save