Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1764 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
18 changed files with 499 additions and 54 deletions
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Core; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
/// <summary>
|
||||
/// Adds a directory and all its contents to the currently selected directory
|
||||
/// node.
|
||||
/// </summary>
|
||||
public class AddDirectoryCommand : AbstractMenuCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
PackageFilesView.ActiveView.AddDirectory(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.WixBinding; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Specialized; |
||||
using System.IO; |
||||
using System.Xml; |
||||
using WixBinding.Tests.PackageFiles; |
||||
using WixBinding.Tests.Utils; |
||||
|
||||
namespace WixBinding.Tests.DirectoryImport |
||||
{ |
||||
/// <summary>
|
||||
/// This test fixture checks that unique short directory names are generated.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class DuplicateShortDirectoryNameTestFixture : PackageFilesTestFixtureBase |
||||
{ |
||||
WixDirectoryElement appDirectoryElement; |
||||
WixDirectoryElement directoryElementA; |
||||
WixDirectoryElement directoryElementB; |
||||
WixDirectoryElement directoryElementC; |
||||
WixDirectoryElement directoryElementD; |
||||
|
||||
string directory = @"C:\Projects\Test\MyApp"; |
||||
string[] directories = new string[] {"DirectoryA", "DirectoryB", "DirectoryC", "Dire.ctoryD"}; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
base.InitFixture(); |
||||
view.SelectedElement = editor.Document.RootDirectory; |
||||
editor.AddDirectory(directory); |
||||
|
||||
WixNamespaceManager nsManager = new WixNamespaceManager(editor.Document.NameTable); |
||||
appDirectoryElement = (WixDirectoryElement)editor.Document.RootDirectory.SelectSingleNode("w:Directory[@Name='MyApp']", nsManager);; |
||||
|
||||
directoryElementA = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@LongName='DirectoryA']", nsManager); |
||||
directoryElementB = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@LongName='DirectoryB']", nsManager); |
||||
directoryElementC = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@LongName='DirectoryC']", nsManager); |
||||
directoryElementD = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@LongName='Dire.ctoryD']", nsManager); |
||||
} |
||||
|
||||
[Test] |
||||
public void DirectoryElementAShortName() |
||||
{ |
||||
Assert.AreEqual("Director", directoryElementA.ShortName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DirectoryElementBShortName() |
||||
{ |
||||
Assert.AreEqual("Directo1", directoryElementB.ShortName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DirectoryElementCShortName() |
||||
{ |
||||
Assert.AreEqual("Directo2", directoryElementC.ShortName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DirectoryElementDShortName() |
||||
{ |
||||
Assert.AreEqual("Directo3", directoryElementD.ShortName); |
||||
} |
||||
|
||||
public override string[] GetFiles(string path) |
||||
{ |
||||
return new string[0]; |
||||
} |
||||
|
||||
public override string[] GetDirectories(string path) |
||||
{ |
||||
if (path == directory) { |
||||
return directories; |
||||
} |
||||
return new string[0]; |
||||
} |
||||
|
||||
protected override string GetWixXml() |
||||
{ |
||||
return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2003/01/wi\">\r\n" + |
||||
"\t<Product Name=\"MySetup\" \r\n" + |
||||
"\t Manufacturer=\"\" \r\n" + |
||||
"\t Id=\"F4A71A3A-C271-4BE8-B72C-F47CC956B3AA\" \r\n" + |
||||
"\t Language=\"1033\" \r\n" + |
||||
"\t Version=\"1.0.0.0\">\r\n" + |
||||
"\t\t<Package Id=\"6B8BE64F-3768-49CA-8BC2-86A76424DFE9\"/>\r\n" + |
||||
"\t\t<Directory Id=\"TARGETDIR\" SourceName=\"SourceDir\">\r\n" + |
||||
"\t\t</Directory>\r\n" + |
||||
"\t</Product>\r\n" + |
||||
"</Wix>"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.WixBinding; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Specialized; |
||||
using System.IO; |
||||
using System.Xml; |
||||
using WixBinding.Tests.PackageFiles; |
||||
using WixBinding.Tests.Utils; |
||||
|
||||
namespace WixBinding.Tests.DirectoryImport |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that files and folders are ignored if they are on the package editor's
|
||||
/// ignore list.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class ExcludedItemsTestFixture : PackageFilesTestFixtureBase |
||||
{ |
||||
WixDirectoryElement appDirectoryElement; |
||||
WixDirectoryElement docsDirectoryElement; |
||||
WixDirectoryElement srcDirectoryElement; |
||||
WixFileElement readmeFileElement; |
||||
string docsDirectory = @"C:\Projects\Test\MyApp\docs"; |
||||
string objDirectory = @"C:\Projects\Test\MyApp\docs\obj"; |
||||
string srcDirectory = @"C:\Projects\Test\MyApp\src"; |
||||
string directory = @"C:\Projects\Test\MyApp"; |
||||
string myAppExeFile = "MyApp.exe"; |
||||
string[] srcFiles = new string[] {"MyProj.sln", "MyProj.csproj", "Main.cs"}; |
||||
string[] docFiles = new string[] {"readme.txt", "license.txt"}; |
||||
|
||||
[SetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
base.InitFixture(); |
||||
editor.ExcludedItems.AddRange(new string[] {"readme.txt", "obj"}); |
||||
editor.AddDirectory(directory); |
||||
|
||||
WixNamespaceManager nsManager = new WixNamespaceManager(editor.Document.NameTable); |
||||
appDirectoryElement = (WixDirectoryElement)editor.Document.RootDirectory.FirstChild; |
||||
docsDirectoryElement = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@Name='docs']", nsManager); |
||||
srcDirectoryElement = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@Name='src']", nsManager); |
||||
readmeFileElement = (WixFileElement)docsDirectoryElement.SelectSingleNode("w:Component/w:File[@Name='readme.txt']", nsManager); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReadmeFileNotAdded() |
||||
{ |
||||
Assert.IsNull(readmeFileElement); |
||||
} |
||||
|
||||
[Test] |
||||
public void ObjDirectoryNotAdded() |
||||
{ |
||||
Assert.AreEqual(0, docsDirectoryElement.GetDirectories().Length); |
||||
} |
||||
|
||||
public override string[] GetFiles(string path) |
||||
{ |
||||
if (path == docsDirectory) { |
||||
return docFiles; |
||||
} else if (path == srcDirectory) { |
||||
return srcFiles; |
||||
} else if (path == objDirectory) { |
||||
return new string[0]; |
||||
} |
||||
return new string[] {myAppExeFile}; |
||||
} |
||||
|
||||
public override string[] GetDirectories(string path) |
||||
{ |
||||
if (path == directory) { |
||||
return new string[] {docsDirectory, srcDirectory}; |
||||
} else if (path == docsDirectory) { |
||||
return new string[] {objDirectory}; |
||||
} |
||||
return new string[0]; |
||||
} |
||||
|
||||
protected override string GetWixXml() |
||||
{ |
||||
return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2003/01/wi\">\r\n" + |
||||
"\t<Product Name=\"MySetup\" \r\n" + |
||||
"\t Manufacturer=\"\" \r\n" + |
||||
"\t Id=\"F4A71A3A-C271-4BE8-B72C-F47CC956B3AA\" \r\n" + |
||||
"\t Language=\"1033\" \r\n" + |
||||
"\t Version=\"1.0.0.0\">\r\n" + |
||||
"\t\t<Package Id=\"6B8BE64F-3768-49CA-8BC2-86A76424DFE9\"/>\r\n" + |
||||
"\t\t<Directory Id=\"TARGETDIR\" SourceName=\"SourceDir\">\r\n" + |
||||
"\t\t</Directory>\r\n" + |
||||
"\t</Product>\r\n" + |
||||
"</Wix>"; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue