Fixed remove test for HI issue - thx Boulder08 :)

Fix #2109
This commit is contained in:
Nikolaj Olsson 2016-11-27 13:27:07 +01:00
parent a7b24f6eca
commit 63c8ed0302
3 changed files with 35 additions and 2 deletions

View File

@ -390,7 +390,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
else if (newText.Contains('-') && !newText.Contains(Environment.NewLine))
{
var st = new StrippableText(newText);
if (st.Pre.Contains('-'))
if (st.Pre.Contains('-') && !st.Pre.Contains("--"))
newText = st.Pre.Replace("-", string.Empty) + st.StrippedText + st.Post;
}
else if (removedInSecondLine && !removedInFirstLine && Utilities.GetNumberOfLines(newText) == 2)

View File

@ -1599,6 +1599,39 @@ namespace Test.Logic.Forms
Assert.AreEqual("Captain's log, stardate 1514. 1:", actual);
}
[TestMethod]
public void DontRemoveDoubleDashInSecondLine()
{
var target = GetRemoveTextForHiLib();
target.Settings.RemoveTextBetweenSquares = true;
target.Settings.RemoveInterjections = false;
target.Settings.RemoveTextBetweenCustomTags = false;
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>--and trespassed into our star systems.</i>");
Assert.AreEqual("<i>--and trespassed into our star systems.</i>", actual);
}
[TestMethod]
public void DontRemoveDoubleDashInSecondLine2()
{
var target = GetRemoveTextForHiLib();
target.Settings.RemoveTextBetweenSquares = true;
target.Settings.RemoveInterjections = false;
target.Settings.RemoveTextBetweenCustomTags = false;
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "--and trespassed into our star systems.");
Assert.AreEqual("--and trespassed into our star systems.", actual);
}
[TestMethod]
public void DontRemoveDoubleDashInSecondLine3()
{
var target = GetRemoveTextForHiLib();
target.Settings.RemoveTextBetweenSquares = true;
target.Settings.RemoveInterjections = false;
target.Settings.RemoveTextBetweenCustomTags = false;
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>—and trespassed into our star systems.</i>");
Assert.AreEqual("<i>—and trespassed into our star systems.</i>", actual);
}
#region Additional test attributes
//

View File

@ -22,7 +22,7 @@ namespace Test.Logic
if (Directory.Exists(Path.Combine(Configuration.BaseDirectory, "Languages")))
{
string[] versionInfo = Utilities.AssemblyVersion.Split('.');
string currentVersion = String.Format("{0}.{1}.{2}", versionInfo[0], versionInfo[1], versionInfo[2]);
string currentVersion = string.Format("{0}.{1}.{2}", versionInfo[0], versionInfo[1], versionInfo[2]);
foreach (string fileName in Directory.GetFiles(Path.Combine(Configuration.BaseDirectory, "Languages"), "*.xml"))
{