You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.2 KiB
84 lines
2.2 KiB
// 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.DialogLoading |
|
{ |
|
/// <summary> |
|
/// Tests the loading of a simple Wix dialog that contains a selection tree. |
|
/// </summary> |
|
[TestFixture] |
|
public class SelectionTreeTestFixture : DialogLoadingTestFixtureBase |
|
{ |
|
string name; |
|
Point location; |
|
Size size; |
|
|
|
[TestFixtureSetUp] |
|
public void SetUpFixture() |
|
{ |
|
CreatedComponents.Clear(); |
|
WixDocument doc = new WixDocument(); |
|
doc.LoadXml(GetWixXml()); |
|
WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); |
|
using (Form dialog = wixDialog.CreateDialog(this)) { |
|
TreeView treeView = (TreeView)dialog.Controls[0]; |
|
name = treeView.Name; |
|
location = treeView.Location; |
|
size = treeView.Size; |
|
} |
|
} |
|
|
|
[Test] |
|
public void Name() |
|
{ |
|
Assert.AreEqual("ControlId", name); |
|
} |
|
|
|
[Test] |
|
public void TwoControlsCreated() |
|
{ |
|
Assert.AreEqual(2, CreatedComponents.Count); |
|
} |
|
|
|
[Test] |
|
public void Location() |
|
{ |
|
int expectedX = Convert.ToInt32(10 * WixDialog.InstallerUnit); |
|
int expectedY = Convert.ToInt32(10 * WixDialog.InstallerUnit); |
|
Point expectedPoint = new Point(expectedX, expectedY); |
|
Assert.AreEqual(expectedPoint, location); |
|
} |
|
|
|
[Test] |
|
public void Size() |
|
{ |
|
int expectedWidth = Convert.ToInt32(50 * WixDialog.InstallerUnit); |
|
int expectedHeight = Convert.ToInt32(50 * WixDialog.InstallerUnit); |
|
Size expectedSize = new Size(expectedWidth, expectedHeight); |
|
|
|
Assert.AreEqual(expectedSize, size); |
|
} |
|
|
|
string GetWixXml() |
|
{ |
|
return "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" + |
|
"\t<Fragment>\r\n" + |
|
"\t\t<UI>\r\n" + |
|
"\t\t\t<Dialog Id='WelcomeDialog' Height='270' Width='370'>\r\n" + |
|
"\t\t\t\t<Control Id='ControlId' Type='SelectionTree' X='10' Y='10' Width='50' Height='50' Text='Text'/>\r\n" + |
|
"\t\t\t</Dialog>\r\n" + |
|
"\t\t</UI>\r\n" + |
|
"\t</Fragment>\r\n" + |
|
"</Wix>"; |
|
} |
|
} |
|
}
|
|
|