Fix in "Remove text for HI" - thx Thunderbolt8 :)

This commit is contained in:
niksedk 2015-05-25 19:23:13 +02:00
parent 28de81f0c2
commit b9dc8d354f
2 changed files with 30 additions and 2 deletions

View File

@ -272,7 +272,8 @@ namespace Nikse.SubtitleEdit.Logic.Forms
insertDash = false;
}
if (arr0.Length > 0 && arr1.Length > 1 && !(arr[0].EndsWith('.') || arr[0].EndsWith('!') || arr[0].EndsWith('?') || arr[0].EndsWith("</i>", StringComparison.Ordinal)) &&
string tempArr0QuoteTrimmed = arr[0].TrimEnd('"');
if (arr0.Length > 0 && arr1.Length > 1 && !(tempArr0QuoteTrimmed.EndsWith('.') || tempArr0QuoteTrimmed.EndsWith('!') || tempArr0QuoteTrimmed.EndsWith('?') || tempArr0QuoteTrimmed.EndsWith("</i>", StringComparison.Ordinal)) &&
!(new StripableText(arr[1]).Pre.Contains('-')))
{
insertDash = false;

View File

@ -1166,7 +1166,6 @@ namespace Test.Logic.Forms
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveTextSpeakerWithColonPlusLineWithHyphenAlsoRemoveInterjections()
{
RemoveTextForHI target = GetRemoveTextForHiLib();
@ -1179,6 +1178,34 @@ namespace Test.Logic.Forms
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void RemoveTextQuotesInFirstLine()
{
RemoveTextForHI target = GetRemoveTextForHiLib();
target.Settings.RemoveTextBeforeColon = true;
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
target.Settings.RemoveInterjections = true;
string text = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "EAMES: Exactly.";
string expected = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "- Exactly.";
string actual = target.RemoveTextFromHearImpaired(text);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void RemoveTextQuotesInFirstLine2()
{
RemoveTextForHI target = GetRemoveTextForHiLib();
target.Settings.RemoveIfAllUppercase = false;
target.Settings.RemoveInterjections = true;
target.Settings.OnlyIfInSeparateLine = false;
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
target.Settings.ColonSeparateLine = false;
string text = "- \"Ballpark.\"" + Environment.NewLine + "-Hmm.";
const string expected = "\"Ballpark.\"";
string actual = target.RemoveInterjections(text);
Assert.AreEqual(expected, actual);
}
#region Additional test attributes
//