Skip to content

Commit

Permalink
Rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Jan 14, 2025
1 parent b52dd64 commit ac206c8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 247 deletions.
2 changes: 1 addition & 1 deletion net/JavaToCSharp-temp
Submodule JavaToCSharp-temp updated from 783fe7 to c93b08
42 changes: 4 additions & 38 deletions net/TestVisualAssert/Giis.Visualassert/TestSoftAggregateDiffs.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 2 additions & 42 deletions net/TestVisualAssert/Giis.Visualassert/TestVisualAssert.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 27 additions & 67 deletions net/VisualAssert/Giis.Visualassert/AbstractVisualAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public virtual T SetNormalizeEol(bool normalizeEol)
}

/// <summary>
/// By default (hard), differences in whitespaces are rendered as whitespace html
/// entities and therefore, always visible in the html ouput; if set to true
/// (soft), some whitespace differences may be hidden from the html output
/// By default (hard), html differences are displayed inside a pre tag;
/// if set to true (soft), some whitespace differences and indentation
/// may be hidden from the html output
/// </summary>
/// <param name="useSoftDifferences">sets soft differences</param>
/// <returns>this object to allow fluent style</returns>
Expand Down Expand Up @@ -182,20 +182,6 @@ public virtual void AssertEquals(string expected, string actual, string message)
this.AssertEquals(expected, actual, message, "");
}

<<<<<<< HEAD
/// <summary>
/// By default (hard), html differences are displayed inside a pre tag;
/// if set to true (soft), some whitespace differences and indentation
/// may be hidden from the html output
/// </summary>
/// <param name="useSoftDifferences">sets soft differences</param>
/// <returns>this object to allow fluent style</returns>
public virtual T SetSoftDifferences(bool useSoftDifferences)
{
this.softDifferences = useSoftDifferences;
return (T)this;
}
=======
/// <summary>
/// Asserts that two large strings are equal; if they are not, generates an html
/// file with the 'fileName' provided highlighting the additions and deletions
Expand All @@ -218,7 +204,6 @@ protected virtual string Normalize(string value)
{
return value != null && this.normalizeEol ? value.Replace("\r", "") : value;
}
>>>>>>> 1fbf429 (Test net convert con JavaToCSharp)

// Always use this to check for equality with null handling
protected virtual bool StringsAreEqual(string expected, string actual)
Expand Down Expand Up @@ -287,8 +272,31 @@ public virtual string GetHtmlDiffs(string expected, string actual)
return diffs;
}

// customized method to display spaces as whtiespace entities
// customized method to display spaces as whitespace entities
protected virtual string diff_prettyHtmlHard(List<DiffMatchPatch.Diff> diffs)
{
StringBuilder html = new StringBuilder();
foreach (DiffMatchPatch.Diff aDiff in diffs)
{
string text = aDiff.text.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\r", " ").Replace("\n", "&para;\n"); // don't use br because everything will be insde pre
switch (aDiff.operation)
{
case DiffMatchPatch.Operation.INSERT:
html.Append("<ins style=\"background:#e6ffe6;\">").Append(text).Append("</ins>");
break;
case DiffMatchPatch.Operation.DELETE:
html.Append("<del style=\"background:#ffe6e6;\">").Append(text).Append("</del>");
break;
case DiffMatchPatch.Operation.EQUAL:
html.Append("<span>").Append(text).Append("</span>");
break;
}
}

return "<pre>\n" + html.ToString() + "\n</pre>";
}

protected virtual string diff_prettyHtmlHardOld(List<DiffMatchPatch.Diff> diffs)
{
StringBuilder html = new StringBuilder();
foreach (DiffMatchPatch.Diff aDiff in diffs)
Expand Down Expand Up @@ -351,53 +359,6 @@ public virtual string GetDiffLocation(string expected, string actual)
return "Actual is contained in expected";
}

<<<<<<< HEAD
// customized method to display spaces as whitespace entities
protected internal virtual string DiffPrettyHtmlHard(List<DiffMatchPatch.Diff> diffs)
{
StringBuilder html = new StringBuilder();
foreach (DiffMatchPatch.Diff aDiff in diffs)
{
string text = aDiff.text.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\r", " ").Replace("\n", "&para;\n");
switch (aDiff.operation)
{
case DiffMatchPatch.Operation.INSERT:
{
// don't use br because everything will be insde pre
html.Append("<ins style=\"background:#e6ffe6;\">").Append(text).Append("</ins>");
break;
}

case DiffMatchPatch.Operation.DELETE:
{
html.Append("<del style=\"background:#ffe6e6;\">").Append(text).Append("</del>");
break;
}

case DiffMatchPatch.Operation.EQUAL:
{
html.Append("<span>").Append(text).Append("</span>");
break;
}
}
}
return "<pre>\n" + html.ToString() + "\n</pre>";
}

protected internal virtual string DiffPrettyHtmlHardOld(List<DiffMatchPatch.Diff> diffs)
{
StringBuilder html = new StringBuilder();
foreach (DiffMatchPatch.Diff aDiff in diffs)
{
string text = aDiff.text.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\n", "&para;<br>");
switch (aDiff.operation)
{
case DiffMatchPatch.Operation.INSERT:
{
html.Append("<ins style=\"background:#e6ffe6;\">").Append(text.Replace(" ", "&nbsp;")).Append("</ins>");
break;
}
=======
if (current == '\n')
{
line++;
Expand All @@ -408,7 +369,6 @@ protected internal virtual string DiffPrettyHtmlHardOld(List<DiffMatchPatch.Diff
column++;
}
}
>>>>>>> 1fbf429 (Test net convert con JavaToCSharp)

if (expected.Length < actual.Length)
return "Expected is contained in actual";
Expand Down
Loading

0 comments on commit ac206c8

Please sign in to comment.