Added a few unit tests + updated change log

This commit is contained in:
Nikolaj Olsson 2016-03-31 21:37:03 +02:00
parent f91fc418af
commit b05d6386ae
2 changed files with 37 additions and 50 deletions

View File

@ -4,16 +4,19 @@
* NEW:
* Added new subtitle format - thx Oli
* IMPROVED:
* Updated Finnish translation - thx Teijo S.
* Some updates for format "sif"
* Some updates for format "Cavena 890" - thx Elad
* FIXED:
* Fix updating of main list view after "Remove text for HI" + "Apply" - thx Henry
* Spell check "change" / "change all" issue regarding brackets/dash - thx jc
* Fixed issue where current frame rate was lost when loading new sub - thx elad
* Fixed issue where current frame rate was lost when loading new sub - thx Elad
* Remove bad chars when saving TTML 1.0
* Minor fix for "Toggle dashed" inside italic tag - thx Bryan
* Sometimes Dutch was detected as English
* Fixed bug regarding double line italic in format "iTunes Timed Text" - thx Ajax
* Restore video position after "Reopen" - thx vmb
* Set video position after "Reopen" - thx vmb
* Fix for border size in vobsub export via cmd line - thx S_E_New
* + Many minor fixes from ivandrofly and xylographe

View File

@ -27,7 +27,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLine3()
{
string s1 = "- We're gonna lose him." + Environment.NewLine + "- He's left him four signals in the last week.";
@ -36,7 +35,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLine4()
{
Configuration.Settings.General.SubtitleLineMaximumLength = 43;
@ -47,18 +45,16 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLine5()
{
Configuration.Settings.General.SubtitleLineMaximumLength = 43;
const string s1 = "<i>30 years ago I'd found</i> The Book of the Dead.";
var s2 = Utilities.AutoBreakLine(s1);
var Expected = "<i>30 years ago I'd found</i>" + Environment.NewLine + "The Book of the Dead.";
Assert.AreEqual(Expected, s2);
var expected = "<i>30 years ago I'd found</i>" + Environment.NewLine + "The Book of the Dead.";
Assert.AreEqual(expected, s2);
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLine5DoNoBreakAtPeriod()
{
Configuration.Settings.General.SubtitleLineMaximumLength = 43;
@ -69,7 +65,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLineDoNotBreakAfterDashDash()
{
Configuration.Settings.General.SubtitleLineMaximumLength = 43;
@ -79,7 +74,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLineDialog1()
{
const string s1 = "- Qu'est ce qui se passe ? - Je veux voir ce qu'ils veulent être.";
@ -88,7 +82,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void AutoBreakLineDialog2()
{
const string s1 = "- Je veux voir ce qu'ils veulent être. - Qu'est ce qui se passe ?";
@ -97,7 +90,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags2()
{
const string s1 = "Gledaj prema kameri i rici <i>zdravo!";
@ -106,7 +98,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags3()
{
string s1 = "<i>Line 1.</i>" + Environment.NewLine + "<i>Line 2.";
@ -115,7 +106,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags4()
{
string s1 = "It <i>is</i> a telegram," + Environment.NewLine + "it <i>is</i> ordering an advance,";
@ -124,7 +114,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags5()
{
string s1 = "- <i>It is a telegram?</i>" + Environment.NewLine + "<i>- It is.</i>";
@ -133,7 +122,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags6()
{
string s1 = "- <i>Text1!</i>" + Environment.NewLine + "- <i>Text2.</i>";
@ -142,7 +130,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags7()
{
string s1 = "<i>- You think they're they gone?<i>" + Environment.NewLine + "<i>- That can't be.</i>";
@ -151,7 +138,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags8()
{
string s1 = "<i>- You think they're they gone?</i>" + Environment.NewLine + "<i>- That can't be.<i>";
@ -160,7 +146,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags9()
{
const string s1 = "FALCONE:<i> I didn't think</i>\r\n<i>it was going to be you,</i>";
@ -169,7 +154,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags10()
{
const string s1 = "< I>Hallo!</I>";
@ -178,7 +162,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags11()
{
const string s1 = "< I >Hallo!< /I>";
@ -187,7 +170,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags12()
{
const string s1 = "< I >Hallo!<I/>";
@ -196,7 +178,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesDoubleSpace1()
{
const string s1 = "This is a test";
@ -205,7 +186,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesDoubleSpace2()
{
const string s1 = "This is a test ";
@ -214,7 +194,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesItalics1()
{
const string s1 = "<i> This is a test</i>";
@ -223,7 +202,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesItalics2()
{
const string s1 = "<i>This is a test </i>";
@ -232,7 +210,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphen1()
{
const string s1 = "This is a low- budget job";
@ -241,7 +218,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphen2()
{
const string s1 = "This is a low- budget job";
@ -250,7 +226,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphenDoNotChange1()
{
const string s1 = "This is it - and he likes it!";
@ -259,7 +234,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphenDoNotChange2()
{
const string s1 = "What are your long- and altitude stats?";
@ -268,7 +242,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphenDoNotChange3()
{
const string s1 = "Did you buy that first- or second-handed?";
@ -277,7 +250,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphenDoNotChangeDutch1()
{
const string s1 = "Wat zijn je voor- en familienaam?";
@ -286,7 +258,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesHyphenDoNotChangeDutch2()
{
const string s1 = "Was het in het voor- of najaar?";
@ -295,7 +266,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesDialogDotDotDotLine1()
{
string s = Utilities.RemoveUnneededSpaces("- ... Careful", "en");
@ -303,7 +273,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesDialogDotDotDotLine2()
{
string s = Utilities.RemoveUnneededSpaces("- Hi!" + Environment.NewLine + "- ... Careful", "en");
@ -311,7 +280,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesFontTag1()
{
string s = Utilities.RemoveUnneededSpaces("<font color=\"#808080\"> (PEOPLE SPEAKING INDISTINCTLY) </font>", "en");
@ -319,7 +287,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesFontTag2()
{
string s = Utilities.RemoveUnneededSpaces("Foobar\r\n<font color=\"#808080\"> (PEOPLE SPEAKING INDISTINCTLY) </font>", "en");
@ -327,7 +294,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixUnneededSpacesFontTag3()
{
string s = Utilities.RemoveUnneededSpaces("<FONT COLOR=\"#808080\">- Foobar! </FONT>\r\n<font color=\"#808080\"> (PEOPLE SPEAKING INDISTINCTLY) </font>", "en");
@ -335,7 +301,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void CountTagInTextStringOneLetterString()
{
int count = Utilities.CountTagInText("HHH", "H");
@ -343,7 +308,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void CountTagInTextStringNotThere()
{
int count = Utilities.CountTagInText("HHH", "B");
@ -351,7 +315,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void CountTagInTextCharNormal()
{
int count = Utilities.CountTagInText("HHH", 'H');
@ -359,7 +322,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void CountTagInTextCharNotThere()
{
int count = Utilities.CountTagInText("HHH", 'B');
@ -367,7 +329,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixHyphensAddTest()
{
string test1 = "<font color=\"#008080\">- Foobar." + Environment.NewLine + "Foobar.</font>";
@ -388,7 +349,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixHyphensAddTestAssTag()
{
string test1 = "{\\an5}- At least I was going back to Hawaii." + Environment.NewLine + "Woody.";
@ -402,7 +362,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixHyphensAddTestItalic()
{
string test1 = "<i>- At least I was going back to Hawaii.</i>" + Environment.NewLine + "<i>Woody.</i>";
@ -416,7 +375,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveLineBreaks1()
{
string result = Utilities.RemoveLineBreaks("Hey" + Environment.NewLine + "you!");
@ -424,7 +382,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveLineBreaks2()
{
string result = Utilities.RemoveLineBreaks("<i>Foobar " + Environment.NewLine + "</i> foobar.");
@ -432,7 +389,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveLineBreaks3()
{
string result = Utilities.RemoveLineBreaks("<i>Foobar " + Environment.NewLine + "</i>foobar.");
@ -440,7 +396,6 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveLineBreaks4()
{
string result = Utilities.RemoveLineBreaks("<i>Hey</i>" + Environment.NewLine + "<i>you!</i>");
@ -448,12 +403,41 @@ namespace Test.Logic
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveLineBreaks5()
{
string result = Utilities.RemoveLineBreaks("<i>Foobar" + Environment.NewLine + "</i>");
Assert.AreEqual(result, "<i>Foobar</i>");
}
[TestMethod]
public void IsValidRegexOk1()
{
Assert.IsTrue(Utilities.IsValidRegex(@"^(?![\s\S])"));
}
[TestMethod]
public void IsValidRegexOk2()
{
Assert.IsTrue(Utilities.IsValidRegex(@"\d+"));
}
[TestMethod]
public void IsValidRegexBad1()
{
Assert.IsFalse(Utilities.IsValidRegex(@"[\s\S(\()()(()\)"));
}
[TestMethod]
public void ReverseNumbers1()
{
Assert.AreEqual(Utilities.ReverseNumbers("Hallo 009"), "Hallo 900");
}
[TestMethod]
public void ReverseNumbers2()
{
Assert.AreEqual(Utilities.ReverseNumbers("Hallo 009 001 Bye"), "Hallo 900 100 Bye");
}
}
}