diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/PackageFilesView.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/PackageFilesView.cs
index a036215aaa..c3fc76717d 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/PackageFilesView.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/PackageFilesView.cs
@@ -218,14 +218,8 @@ namespace ICSharpCode.WixBinding
return;
}
- // Find the product end element location.
- XmlElement productElement = document.GetProduct();
- StringReader reader = new StringReader(textEditor.Document.Text);
- string productId = productElement.GetAttribute("Id");
- WixDocumentReader wixReader = new WixDocumentReader(reader);
- Location location = wixReader.GetEndElementLocation("Product", productId);
+ Location location = FindProductElementEndLocation(textEditor, document);
if (!location.IsEmpty) {
- // Insert the xml with an extra new line at the end.
documentEditor.InsertIndented(location, String.Concat(xml, "\r\n"));
}
}
@@ -238,5 +232,13 @@ namespace ICSharpCode.WixBinding
WixDocumentEditor documentEditor = new WixDocumentEditor(textEditor);
documentEditor.ReplaceElement(rootDirectoryRef.Id, WixDirectoryRefElement.DirectoryRefElementName, xml);
}
+
+ Location FindProductElementEndLocation(ITextEditor textEditor, WixDocument document)
+ {
+ XmlElement productElement = document.GetProduct();
+ string productId = productElement.GetAttribute("Id");
+ WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
+ return wixReader.GetEndElementLocation("Product", productId);
+ }
}
}
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs
index cea941cc5c..5ce868b741 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs
@@ -189,7 +189,6 @@ namespace ICSharpCode.WixBinding
{
try {
setupDialogListView.BeginUpdate();
- // TODO: Intelligent updating.
ShowDialogList();
} finally {
setupDialogListView.EndUpdate();
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
index 6eba959202..decd820ccf 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
@@ -68,9 +68,9 @@ namespace ICSharpCode.WixBinding
JumpToDialogElement(id);
if (base.Host != null) {
// Reload so the correct dialog is displayed.
- this.MergeAndUnloadDesigner();
+ MergeAndUnloadDesigner();
DialogId = id;
- this.ReloadDesignerFromMemory();
+ ReloadDesignerFromMemory();
} else {
// Need to open the designer.
DialogId = id;
@@ -148,7 +148,7 @@ namespace ICSharpCode.WixBinding
/// Gets the Wix document filename.
///
public string DocumentFileName {
- get { return this.PrimaryFileName; }
+ get { return PrimaryFileName; }
}
///
@@ -163,19 +163,15 @@ namespace ICSharpCode.WixBinding
///
public string GetDocumentXml()
{
- return this.DesignerCodeFileContent;
+ return DesignerCodeFileContent;
}
///
/// Gets or sets the dialog id currently being designed.
///
public string DialogId {
- get {
- return dialogId;
- }
- set {
- dialogId = value;
- }
+ get { return dialogId; }
+ set { dialogId = value; }
}
///
@@ -200,8 +196,7 @@ namespace ICSharpCode.WixBinding
{
ITextEditor textEditor = ActiveTextEditor;
if (textEditor != null) {
- StringReader reader = new StringReader(textEditor.Document.Text);
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+ WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
return wixReader.GetDialogId(textEditor.Caret.Line);
}
return null;
@@ -214,8 +209,7 @@ namespace ICSharpCode.WixBinding
{
ITextEditor textEditor = ActiveTextEditor;
if (textEditor != null) {
- StringReader reader = new StringReader(textEditor.Document.Text);
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+ WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
ReadOnlyCollection ids = wixReader.GetDialogIds();
if (ids.Count > 0) {
return ids[0];
@@ -274,8 +268,7 @@ namespace ICSharpCode.WixBinding
if (dialogId != null) {
ITextEditor textEditor = ActiveTextEditor;
if (textEditor != null) {
- StringReader reader = new StringReader(textEditor.Document.Text);
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+ WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
Location location = wixReader.GetStartElementLocation("Dialog", dialogId);
textEditor.JumpTo(location.Y, 1);
}
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs
index 3a3fca65d1..44d88a4106 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs
@@ -91,8 +91,7 @@ namespace ICSharpCode.WixBinding
DomRegion GetTextEditorRegionForDialogElement(string dialogId)
{
IDocument document = view.DesignerCodeFileDocument;
- StringReader reader = new StringReader(document.Text);
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+ WixDocumentReader wixReader = new WixDocumentReader(document.Text);
return wixReader.GetElementRegion("Dialog", dialogId);
}
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDocumentEditor.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDocumentEditor.cs
index 81202a53ae..deb5684e77 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDocumentEditor.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDocumentEditor.cs
@@ -29,7 +29,6 @@ namespace ICSharpCode.WixBinding
this.document = textEditor.Document;
}
-
///
/// Tries to replace the element defined by element name and its Id attribute in the
/// text editor with the specified xml.
@@ -39,7 +38,7 @@ namespace ICSharpCode.WixBinding
/// The replacement xml.
public DomRegion ReplaceElement(string elementAttributeId, string elementName, string replacementXml)
{
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(document.Text));
+ WixDocumentReader wixReader = new WixDocumentReader(document.Text);
DomRegion region = wixReader.GetElementRegion(elementName, elementAttributeId);
if (!region.IsEmpty) {
Replace(region, replacementXml);
@@ -67,7 +66,7 @@ namespace ICSharpCode.WixBinding
int insertedCharacterCount = IndentAllLinesTheSame(region.BeginLine + 1, region.EndLine + addedLineCount, initialIndent);
// Make sure the text inserted is visible.
- textEditor.JumpTo(region.BeginLine + 1, 1);
+ textEditor.JumpTo(region.BeginLine, 1);
// Select the text just inserted.
int textInsertedLength = insertedCharacterCount + xml.Length;
@@ -84,16 +83,16 @@ namespace ICSharpCode.WixBinding
/// Inserts and indents the xml at the specified location.
///
///
- /// Lines and columns are zero based.
+ /// Lines and columns are one based.
///
public void InsertIndented(int line, int column, string xml)
{
using (textEditor.Document.OpenUndoGroup()) {
// Insert the xml and indent it.
- IDocumentLine documentLine = document.GetLine(line + 1);
+ IDocumentLine documentLine = document.GetLine(line);
int initialIndent = GetIndent(line);
- int offset = documentLine.Offset + column;
+ int offset = documentLine.Offset + column - 1;
int originalLineCount = document.TotalNumberOfLines;
document.Insert(offset, xml);
int addedLineCount = document.TotalNumberOfLines - originalLineCount;
@@ -102,7 +101,7 @@ namespace ICSharpCode.WixBinding
int insertedCharacterCount = IndentLines(line, line + addedLineCount, initialIndent);
// Make sure the text inserted is visible.
- textEditor.JumpTo(line + 1, 1);
+ textEditor.JumpTo(line, 1);
// Select the text just inserted.
int textInsertedLength = xml.Length + insertedCharacterCount;
@@ -158,13 +157,13 @@ namespace ICSharpCode.WixBinding
string GetLineAsString(int line)
{
- IDocumentLine documentLine = document.GetLine(line + 1);
+ IDocumentLine documentLine = document.GetLine(line);
return documentLine.Text;
}
int IndentLine(int line, int howManyIndents)
{
- IDocumentLine documentLine = document.GetLine(line + 1);
+ IDocumentLine documentLine = document.GetLine(line);
int offset = documentLine.Offset;
string indentationString = GetIndentationString(howManyIndents);
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentLineSegment.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentLineSegment.cs
index 371c237641..839e5b6d80 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentLineSegment.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentLineSegment.cs
@@ -67,9 +67,9 @@ namespace ICSharpCode.WixBinding
static WixDocumentLineSegment ConvertRegionToSingleLineSegment(IDocument document, DomRegion region)
{
- IDocumentLine documentLine = document.GetLine(region.BeginLine + 1);
- return new WixDocumentLineSegment(documentLine.Offset + region.BeginColumn,
- region.EndColumn + 1 - region.BeginColumn);
+ IDocumentLine documentLine = document.GetLine(region.BeginLine);
+ return new WixDocumentLineSegment(documentLine.Offset + region.BeginColumn - 1,
+ region.EndColumn - region.BeginColumn + 1);
}
static WixDocumentLineSegment ConvertRegionToMultiLineSegment(IDocument document, DomRegion region)
@@ -77,10 +77,10 @@ namespace ICSharpCode.WixBinding
int length = 0;
int startOffset = 0;
for (int line = region.BeginLine; line <= region.EndLine; ++line) {
- IDocumentLine currentDocumentLine = document.GetLine(line + 1);
+ IDocumentLine currentDocumentLine = document.GetLine(line);
if (line == region.BeginLine) {
length += currentDocumentLine.TotalLength - region.BeginColumn;
- startOffset = currentDocumentLine.Offset + region.BeginColumn;
+ startOffset = currentDocumentLine.Offset + region.BeginColumn - 1;
} else if (line < region.EndLine) {
length += currentDocumentLine.TotalLength;
} else {
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentReader.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentReader.cs
index 87fef84c63..01bb12d188 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentReader.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocumentReader.cs
@@ -43,6 +43,11 @@ namespace ICSharpCode.WixBinding
}
}
+ public WixDocumentReader(string document)
+ : this(new StringReader(document))
+ {
+ }
+
public WixDocumentReader(TextReader textReader)
{
reader = new XmlTextReader(textReader);
@@ -127,8 +132,8 @@ namespace ICSharpCode.WixBinding
{
// Store the column and line position since the call to GetIdFromCurrentNode will
// move to the
+ ///
+ /// The lines and columns in the region are one based.
+ ///
/// The name of the element.
/// The id attribute value of the element.
public DomRegion GetElementRegion(string name, string id)
@@ -260,11 +268,11 @@ namespace ICSharpCode.WixBinding
Location GetEmptyElementEnd()
{
reader.ReadStartElement();
- int line = reader.LineNumber - 1;
+ int line = reader.LineNumber;
- // Take off two as we have moved passed the end tag
+ // Take off one as we have moved passed the end tag
// column.
- int column = reader.LinePosition - 2;
+ int column = reader.LinePosition - 1;
return new Location(column, line);
}
@@ -276,10 +284,10 @@ namespace ICSharpCode.WixBinding
Location GetEndElementEnd()
{
reader.ReadEndElement();
- int line = reader.LineNumber - 1;
+ int line = reader.LineNumber;
- // Take off two as we have moved passed the end tag column.
- int column = reader.LinePosition - 2;
+ // Take off one as we have moved passed the end tag column.
+ int column = reader.LinePosition - 1;
// If ReadEndElement has moved to the start of another element
// take off one from the column value otherwise the column
diff --git a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin
index d9f29f187c..47938d8081 100644
--- a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin
+++ b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin
@@ -72,7 +72,7 @@
-
-
@@ -171,7 +171,7 @@
+ class = "ICSharpCode.WixBinding.OpenDialogCommand"/>
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogElementRegionTests.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogElementRegionTests.cs
index e3b6c8a087..8ca520319e 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogElementRegionTests.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogElementRegionTests.cs
@@ -33,10 +33,10 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- StringReader reader = new StringReader(xml);
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog");
- DomRegion expectedRegion = new DomRegion(3, 3, 4, 11);
+ DomRegion expectedRegion = new DomRegion(4, 4, 5, 12);
Assert.AreEqual(expectedRegion, region);
}
@@ -50,9 +50,10 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog");
- DomRegion expectedRegion = new DomRegion(3, 0, 3, 35);
+ DomRegion expectedRegion = new DomRegion(4, 1, 4, 36);
Assert.AreEqual(expectedRegion, region);
}
@@ -66,9 +67,10 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog");
- DomRegion expectedRegion = new DomRegion(3, 0, 3, 27);
+ DomRegion expectedRegion = new DomRegion(4, 1, 4, 28);
Assert.AreEqual(expectedRegion, region);
}
@@ -82,9 +84,10 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog");
- DomRegion expectedRegion = new DomRegion(3, 0, 3, 35);
+ DomRegion expectedRegion = new DomRegion(4, 1, 4, 36);
Assert.AreEqual(expectedRegion, region);
}
@@ -101,9 +104,9 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog");
- DomRegion expectedRegion = new DomRegion(5, 3, 6, 11);
+ DomRegion expectedRegion = new DomRegion(6, 4, 7, 12);
Assert.AreEqual(expectedRegion, region);
}
}
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogIdAtLineTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogIdAtLineTestFixture.cs
index df93b71c41..f860e507d1 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogIdAtLineTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDialogIdAtLineTestFixture.cs
@@ -21,51 +21,49 @@ namespace WixBinding.Tests.Document
[TestFixture]
public class GetDialogIdAtLineTestFixture
{
- StringReader reader;
string expectedDialogId = "WelcomeDialog";
WixDocumentReader wixReader;
[SetUp]
public void SetUpFixture()
{
- reader = new StringReader(GetWixXml());
- wixReader = new WixDocumentReader(reader);
+ wixReader = new WixDocumentReader(GetWixXml());
}
[Test]
public void OnDialogStartTagLine()
{
- Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(8));
+ Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(9));
}
[Test]
public void StartOfDocument()
{
- Assert.IsNull(wixReader.GetDialogId(0));
+ Assert.IsNull(wixReader.GetDialogId(1));
}
[Test]
public void LineBeforeDialogStartTag()
{
- Assert.IsNull(wixReader.GetDialogId(7));
+ Assert.IsNull(wixReader.GetDialogId(8));
}
[Test]
public void FirstLineAfterDialogStartTag()
{
- Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(9));
+ Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(10));
}
[Test]
public void DialogEndTagLine()
{
- Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(15));
+ Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(16));
}
[Test]
public void FirstLineAfterDialogEndTag()
{
- Assert.IsNull(wixReader.GetDialogId(16));
+ Assert.IsNull(wixReader.GetDialogId(17));
}
string GetWixXml()
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDirectoryElementRegionTests.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDirectoryElementRegionTests.cs
index 5bcb285ee6..b4231360e0 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDirectoryElementRegionTests.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetDirectoryElementRegionTests.cs
@@ -31,9 +31,9 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Directory", "TARGETDIR");
- DomRegion expectedRegion = new DomRegion(2, 2, 3, 13);
+ DomRegion expectedRegion = new DomRegion(3, 3, 4, 14);
Assert.AreEqual(expectedRegion, region);
}
@@ -48,9 +48,9 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Directory", "TARGETDIR");
- DomRegion expectedRegion = new DomRegion(2, 2, 5, 13);
+ DomRegion expectedRegion = new DomRegion(3, 3, 6, 14);
Assert.AreEqual(expectedRegion, region);
}
@@ -64,9 +64,9 @@ namespace WixBinding.Tests.Document
"\t\t\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
DomRegion region = wixReader.GetElementRegion("Directory", "TARGETDIR");
- DomRegion expectedRegion = new DomRegion(2, 2, 4, 13);
+ DomRegion expectedRegion = new DomRegion(3, 3, 5, 14);
Assert.AreEqual(expectedRegion, region);
}
}
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetEmptyElementDialogIdAtLineTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetEmptyElementDialogIdAtLineTestFixture.cs
index edcc8af4cf..0346e03f27 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetEmptyElementDialogIdAtLineTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetEmptyElementDialogIdAtLineTestFixture.cs
@@ -21,39 +21,37 @@ namespace WixBinding.Tests.Document
[TestFixture]
public class GetEmptyElementDialogIdAtLineTestFixture
{
- StringReader reader;
string expectedDialogId = "WelcomeDialog";
WixDocumentReader wixReader;
[SetUp]
public void SetUpFixture()
{
- reader = new StringReader(GetWixXml());
- wixReader = new WixDocumentReader(reader);
+ wixReader = new WixDocumentReader(GetWixXml());
}
[Test]
public void OnDialogStartTagLine()
{
- Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(8));
+ Assert.AreEqual(expectedDialogId, wixReader.GetDialogId(9));
}
[Test]
public void StartOfDocument()
{
- Assert.IsNull(wixReader.GetDialogId(0));
+ Assert.IsNull(wixReader.GetDialogId(1));
}
[Test]
public void LineBeforeDialogStartTag()
{
- Assert.IsNull(wixReader.GetDialogId(7));
+ Assert.IsNull(wixReader.GetDialogId(8));
}
[Test]
public void LineAfterDialogStartTag()
{
- Assert.IsNull(wixReader.GetDialogId(9));
+ Assert.IsNull(wixReader.GetDialogId(10));
}
string GetWixXml()
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetProductEndElementLocationTests.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetProductEndElementLocationTests.cs
index 4a6f41af2d..000ff3421a 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetProductEndElementLocationTests.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetProductEndElementLocationTests.cs
@@ -33,9 +33,9 @@ namespace WixBinding.Tests.Document
"\t Id='????????-????-????-????-????????????'>\r\n" +
"\t\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
Location location = wixReader.GetEndElementLocation("Product", "????????-????-????-????-????????????");
- Location expectedLocation = new Location(1, 6);
+ Location expectedLocation = new Location(2, 7);
Assert.AreEqual(expectedLocation, location);
}
@@ -52,7 +52,7 @@ namespace WixBinding.Tests.Document
"\t Manufacturer='#develop' \r\n" +
"\t Id='????????-????-????-????-????????????'/>\r\n" +
"";
- WixDocumentReader wixReader = new WixDocumentReader(new StringReader(xml));
+ WixDocumentReader wixReader = new WixDocumentReader(xml);
Location location = wixReader.GetEndElementLocation("Product", "????????-????-????-????-????????????");
Location expectedLocation = Location.Empty;
Assert.AreEqual(expectedLocation, location);
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetTwoDialogIdsFromWixDocumentTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetTwoDialogIdsFromWixDocumentTestFixture.cs
index 557c2161d7..cc1ed3da92 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/GetTwoDialogIdsFromWixDocumentTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/GetTwoDialogIdsFromWixDocumentTestFixture.cs
@@ -34,18 +34,15 @@ namespace WixBinding.Tests.Document
[TestFixtureSetUpAttribute]
public void SetUpFixture()
{
- StringReader reader = new StringReader(GetWixXml());
- WixDocumentReader wixReader = new WixDocumentReader(reader);
+ WixDocumentReader wixReader = new WixDocumentReader(GetWixXml());
dialogIds = wixReader.GetDialogIds();
welcomeDialogId = dialogIds[0];
progressDialogId = dialogIds[1];
- reader = new StringReader(GetWixXml());
- wixReader = new WixDocumentReader(reader);
+ wixReader = new WixDocumentReader(GetWixXml());
welcomeDialogLocation = wixReader.GetStartElementLocation("Dialog", welcomeDialogId);
- reader = new StringReader(GetWixXml());
- wixReader = new WixDocumentReader(reader);
+ wixReader = new WixDocumentReader(GetWixXml());
missingDialogLocation = wixReader.GetStartElementLocation("Dialog", "missingDialogId");
}
@@ -70,13 +67,13 @@ namespace WixBinding.Tests.Document
[Test]
public void WelcomeDialogElementLine()
{
- Assert.AreEqual(8, welcomeDialogLocation.Y);
+ Assert.AreEqual(9, welcomeDialogLocation.Y);
}
[Test]
public void WelcomeDialogElementColumn()
{
- Assert.AreEqual(3, welcomeDialogLocation.X);
+ Assert.AreEqual(4, welcomeDialogLocation.X);
}
[Test]
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Document/RegionToOffsetTests.cs b/src/AddIns/BackendBindings/WixBinding/Test/Document/RegionToOffsetTests.cs
index 98a0989ea3..35f6bdf4ff 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Document/RegionToOffsetTests.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Document/RegionToOffsetTests.cs
@@ -29,7 +29,7 @@ namespace WixBinding.Tests.Document
[Test]
public void SingleLineRegionConvertedToSegment()
{
- DomRegion region = new DomRegion(0, 0, 0, 5);
+ DomRegion region = new DomRegion(1, 1, 1, 6);
document.Text = "1234567890";
WixDocumentLineSegment segment = WixDocumentLineSegment.ConvertRegionToSegment(document, region);
@@ -41,7 +41,7 @@ namespace WixBinding.Tests.Document
[Test]
public void TwoLineRegionConvertedToSegment()
{
- DomRegion region = new DomRegion(0, 1, 1, 0);
+ DomRegion region = new DomRegion(1, 2, 2, 1);
document.Text = "1234567890\r\n1234567890";
WixDocumentLineSegment segment = WixDocumentLineSegment.ConvertRegionToSegment(document, region);
@@ -53,7 +53,7 @@ namespace WixBinding.Tests.Document
[Test]
public void ThreeLineRegionConvertedToSegment()
{
- DomRegion region = new DomRegion(0, 2, 2, 1);
+ DomRegion region = new DomRegion(1, 3, 3, 2);
document.Text = "1234567890\r\n1234567890\r\n1234567890";
WixDocumentLineSegment segment = WixDocumentLineSegment.ConvertRegionToSegment(document, region);
@@ -65,7 +65,7 @@ namespace WixBinding.Tests.Document
[Test]
public void ThreeLineRegionWithoutCarriageReturnConvertedToSegment()
{
- DomRegion region = new DomRegion(0, 2, 2, 1);
+ DomRegion region = new DomRegion(1, 3, 3, 2);
document.Text = "1234567890\n1234567890\n1234567890";
WixDocumentLineSegment segment = WixDocumentLineSegment.ConvertRegionToSegment(document, region);
@@ -77,7 +77,7 @@ namespace WixBinding.Tests.Document
[Test]
public void RegionWithBeginLineOnSecondLineConvertedToSegment()
{
- DomRegion region = new DomRegion(1, 0, 2, 0);
+ DomRegion region = new DomRegion(2, 1, 3, 1);
document.Text = "1234567890\r\n1234567890\r\n1234567890";
WixDocumentLineSegment segment = WixDocumentLineSegment.ConvertRegionToSegment(document, region);
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertTextTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertTextTestFixture.cs
index ed643b24d6..d7c3654ec0 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertTextTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertTextTestFixture.cs
@@ -45,8 +45,8 @@ namespace WixBinding.Tests.Gui
"\r\n" +
"\r\n";
- int line = 2;
- int column = 1;
+ int line = 3;
+ int column = 2;
editor.InsertIndented(line, column, xmlToInsert);
document = textEditor.Document;
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertUsesTextEditorPropertiesTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertUsesTextEditorPropertiesTestFixture.cs
index 150295ae16..118dd8e609 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertUsesTextEditorPropertiesTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorInsertUsesTextEditorPropertiesTestFixture.cs
@@ -45,8 +45,8 @@ namespace WixBinding.Tests.Gui
"\r\n" +
"\r\n";
- int line = 2;
- int column = 4;
+ int line = 3;
+ int column = 5;
editor.InsertIndented(line, column, xmlToInsert);
document = textEditor.Document;
diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorReplaceTextTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorReplaceTextTestFixture.cs
index 6dd4811cb3..78dda6f8a0 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorReplaceTextTestFixture.cs
+++ b/src/AddIns/BackendBindings/WixBinding/Test/Gui/WixDocumentEditorReplaceTextTestFixture.cs
@@ -48,12 +48,12 @@ namespace WixBinding.Tests.Gui
"\r\n" +
"";
- int line = 1;
- int column = 1;
- int endLine = 2;
+ int line = 2;
+ int column = 2;
+ int endLine = 3;
// End column is the column containing the '>' of the element.
- int endColumn = 8;
+ int endColumn = 9;
DomRegion region = new DomRegion(line, column, endLine, endColumn);