From a0842b13578bcc6caaab27528e66ba9d47129d7e Mon Sep 17 00:00:00 2001 From: niksedk Date: Sun, 24 Aug 2014 08:12:31 +0200 Subject: [PATCH] Fixed bug in "Fix invalid italic tags" - thx XhmikosR :) --- src/Logic/Utilities.cs | 2 +- src/Test/UtilitiesTest.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index 66b48f053..ce9722d92 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -2714,7 +2714,7 @@ namespace Nikse.SubtitleEdit.Logic isStart = true; if (text.EndsWith(endTag) || text.EndsWith(e1) || text.EndsWith(e2) || text.EndsWith(e3) || text.EndsWith(e4) || text.EndsWith(e5)) isEnd = true; - return isStart == isEnd; + return isStart && isEnd; } public static Paragraph GetOriginalParagraph(int index, Paragraph paragraph, List originalParagraphs) diff --git a/src/Test/UtilitiesTest.cs b/src/Test/UtilitiesTest.cs index 6db658137..2922239d3 100644 --- a/src/Test/UtilitiesTest.cs +++ b/src/Test/UtilitiesTest.cs @@ -71,6 +71,24 @@ namespace Test Assert.AreEqual(s2, "Line 1." + Environment.NewLine + "Line 2."); } + [TestMethod] + [DeploymentItem("SubtitleEdit.exe")] + public void FixInvalidItalicTags4() + { + string s1 = "It is a telegram," + Environment.NewLine + "it is ordering an advance,"; + string s2 = Utilities.FixInvalidItalicTags(s1); + Assert.AreEqual(s2, s1); + } + + [TestMethod] + [DeploymentItem("SubtitleEdit.exe")] + public void FixInvalidItalicTags5() + { + string s1 = "- It is a telegram?" + Environment.NewLine + "- It is."; + string s2 = Utilities.FixInvalidItalicTags(s1); + Assert.AreEqual(s2, "- It is a telegram?" + Environment.NewLine + "- It is."); + } + [TestMethod] [DeploymentItem("SubtitleEdit.exe")] public void FixUnneededSpacesDoubleSpace1()