mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-02-01 05:21:40 +01:00
More testing & improving logic
This commit is contained in:
parent
0cbdcc6cf8
commit
1aa3d3fba9
@ -2163,7 +2163,7 @@ Continue?</RestoreDefaultSettingsMsg>
|
||||
<UncheckInsertsAllCaps>Detect and uncheck single titles in all-caps (for example: NO ENTRY)</UncheckInsertsAllCaps>
|
||||
<UncheckInsertsItalic>Detect and uncheck italic single titles, or lyrics</UncheckInsertsItalic>
|
||||
<UncheckInsertsLowercase>Detect and uncheck single titles, or lyrics, in lowercase</UncheckInsertsLowercase>
|
||||
<HideInterruptionContinuationCandidatesWithoutName>Hide unlikely continuation sentences after interruptions</HideInterruptionContinuationCandidatesWithoutName>
|
||||
<HideContinuationCandidatesWithoutName>Hide unlikely continuation sentences</HideContinuationCandidatesWithoutName>
|
||||
</Settings>
|
||||
<SettingsMpv>
|
||||
<Title>Settings for mpv</Title>
|
||||
|
@ -19,6 +19,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static string SanitizeString(string input, bool removeDashes)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return input;
|
||||
@ -39,6 +40,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
checkString = checkString.Substring(0, checkString.Length - 1).Trim();
|
||||
}
|
||||
|
||||
// Return if empty string by now
|
||||
if (string.IsNullOrEmpty(checkString))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// Remove >> from the beginning
|
||||
while (checkString.StartsWith(">"))
|
||||
{
|
||||
@ -51,7 +58,11 @@ namespace Nikse.SubtitleEdit.Core
|
||||
string[] split = checkString.Split(':');
|
||||
if (IsAllCaps(split[0]))
|
||||
{
|
||||
checkString = string.Join(":", split.Skip(1)).Trim();
|
||||
var newCheckString = string.Join(":", split.Skip(1)).Trim();
|
||||
if (!string.IsNullOrEmpty(newCheckString))
|
||||
{
|
||||
checkString = newCheckString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +89,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
|
||||
// Remove double-char quotes from the beginning
|
||||
if (DoubleQuotes.Contains(checkString.Substring(0, 2)))
|
||||
if (checkString.Length > 1 && DoubleQuotes.Contains(checkString.Substring(0, 2)))
|
||||
{
|
||||
checkString = checkString.Substring(2).Trim();
|
||||
}
|
||||
@ -101,7 +112,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
|
||||
// Remove double-char quotes from the ending
|
||||
if (DoubleQuotes.Contains(checkString.Substring(checkString.Length - 2, 2)))
|
||||
if (checkString.Length > 1 && DoubleQuotes.Contains(checkString.Substring(checkString.Length - 2, 2)))
|
||||
{
|
||||
checkString = checkString.Substring(0, checkString.Length - 2).Trim();
|
||||
}
|
||||
@ -164,13 +175,19 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static string GetFirstWord(string input)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string[] split = input.Split(' ');
|
||||
string firstWord = split.First();
|
||||
|
||||
// For "... this is a test" we would only have the prefix in the first split item
|
||||
foreach (string prefix in Prefixes)
|
||||
{
|
||||
if (firstWord == prefix)
|
||||
if (firstWord == prefix && split.Length > 1)
|
||||
{
|
||||
firstWord = split[0] + " " + split[1];
|
||||
break;
|
||||
@ -182,13 +199,19 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static string GetLastWord(string input)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string[] split = input.Split(' ');
|
||||
string lastWord = split.Last();
|
||||
|
||||
// For "This is a test ..." we would only have the suffix in the last split item
|
||||
foreach (string suffix in Suffixes)
|
||||
{
|
||||
if (lastWord == suffix)
|
||||
if (lastWord == suffix && split.Length > 1)
|
||||
{
|
||||
lastWord = split[split.Length - 2] + " " + split[split.Length - 1];
|
||||
break;
|
||||
@ -202,7 +225,13 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
string text = sanitize ? SanitizeString(input) : input;
|
||||
|
||||
if ((!IsEndOfSentence(text) || text.EndsWith(",") || HasSuffix(text, profile)) && !text.EndsWith("--") && !text.EndsWith(":"))
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((EndsWithNothing(text, profile) || text.EndsWith(",") || HasSuffix(text, profile)) && !text.EndsWith("--") && !text.EndsWith(":") && !text.EndsWith(";"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -217,8 +246,21 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static string AddSuffixIfNeeded(string originalText, ContinuationProfile profile, bool gap, bool addComma)
|
||||
{
|
||||
// Get last word
|
||||
string text = SanitizeString(originalText);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Return if only suffix/prefix
|
||||
if (IsOnlySuffix(text, profile) || IsOnlyPrefix(text, profile))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Get last word
|
||||
string lastWord = GetLastWord(text);
|
||||
string newLastWord = lastWord;
|
||||
|
||||
@ -292,6 +334,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
// Decide if we need to remove dashes
|
||||
string textWithDash = SanitizeString(originalText, false);
|
||||
string textWithoutDash = SanitizeString(originalText, true);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(textWithDash) && string.IsNullOrEmpty(textWithoutDash))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// If we're using a profile with dashes, count those as dashes instead of dialog dashes.
|
||||
if (removeDashesDuringSanitization)
|
||||
@ -331,9 +379,22 @@ namespace Nikse.SubtitleEdit.Core
|
||||
removeDashesDuringSanitization = false;
|
||||
}
|
||||
}
|
||||
|
||||
string text = removeDashesDuringSanitization ? textWithoutDash : textWithDash;
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Return if only suffix/prefix
|
||||
if (IsOnlySuffix(text, profile) || IsOnlyPrefix(text, profile))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Get first word of the paragraph
|
||||
string text = removeDashesDuringSanitization ? textWithoutDash : textWithDash;
|
||||
string firstWord = GetFirstWord(text);
|
||||
string newFirstWord = firstWord;
|
||||
|
||||
@ -394,8 +455,15 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static string RemoveSuffix(string originalText, ContinuationProfile profile, List<string> additionalSuffixes, bool addComma)
|
||||
{
|
||||
// Get last word
|
||||
string text = SanitizeString(originalText);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Get last word
|
||||
string lastWord = GetLastWord(text);
|
||||
string newLastWord = lastWord;
|
||||
|
||||
@ -413,18 +481,28 @@ namespace Nikse.SubtitleEdit.Core
|
||||
newLastWord = newLastWord + ",";
|
||||
}
|
||||
|
||||
string result;
|
||||
|
||||
// If we can find it...
|
||||
if (originalText.LastIndexOf(lastWord, StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
// Replace it
|
||||
return ReplaceLastOccurrence(originalText, lastWord, newLastWord);
|
||||
result = ReplaceLastOccurrence(originalText, lastWord, newLastWord);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just remove whatever suffix we need to remove
|
||||
var suffix = lastWord.Replace(newLastWord, "");
|
||||
return ReplaceLastOccurrence(originalText, suffix, "");
|
||||
result = ReplaceLastOccurrence(originalText, suffix, "");
|
||||
}
|
||||
|
||||
// Return original if empty string
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RemoveSuffix(string originalText, ContinuationProfile profile)
|
||||
@ -444,6 +522,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
string textWithoutDash = SanitizeString(originalText, true);
|
||||
string leadingDialogDash = null;
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(textWithDash) && string.IsNullOrEmpty(textWithoutDash))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// If we're using a profile with dashes, count those as dashes instead of dialog dashes.
|
||||
if (removeDashesDuringSanitization)
|
||||
{
|
||||
@ -484,8 +568,15 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
}
|
||||
|
||||
// Get first word of the paragraph
|
||||
string text = removeDashesDuringSanitization ? textWithoutDash : textWithDash;
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
// Get first word of the paragraph
|
||||
string firstWord = GetFirstWord(text);
|
||||
string newFirstWord = firstWord;
|
||||
|
||||
@ -503,18 +594,28 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
newFirstWord = newFirstWord.Trim();
|
||||
|
||||
string result;
|
||||
|
||||
// If we can find it...
|
||||
if (originalText.IndexOf(firstWord, StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
// Replace it
|
||||
return ReplaceFirstOccurrence(originalText, firstWord, newFirstWord);
|
||||
result = ReplaceFirstOccurrence(originalText, firstWord, newFirstWord);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just remove whatever prefix we need to remove
|
||||
var prefix = firstWord.Replace(newFirstWord, "");
|
||||
return ReplaceFirstOccurrence(originalText, prefix, "");
|
||||
result = ReplaceFirstOccurrence(originalText, prefix, "");
|
||||
}
|
||||
|
||||
// Return original if empty string
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RemovePrefix(string originalText, ContinuationProfile profile, bool gap)
|
||||
@ -530,6 +631,13 @@ namespace Nikse.SubtitleEdit.Core
|
||||
public static string RemoveAllPrefixes(string originalText, ContinuationProfile profile)
|
||||
{
|
||||
var text = originalText;
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
|
||||
while (HasPrefix(SanitizeString(text, false), profile))
|
||||
{
|
||||
text = RemovePrefix(text, profile, false, false /* Not used because of false before */);
|
||||
@ -539,6 +647,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool IsNewSentence(string input)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (char.IsLetter(input[0]) && char.IsUpper(input[0]))
|
||||
{
|
||||
// First letter
|
||||
@ -568,6 +682,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool IsEndOfSentence(string input)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (input.EndsWith('.') && !input.EndsWith("..", StringComparison.Ordinal)) ||
|
||||
input.EndsWith('?') ||
|
||||
input.EndsWith('!') ||
|
||||
@ -575,8 +695,25 @@ namespace Nikse.SubtitleEdit.Core
|
||||
input.EndsWith("--", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public static bool EndsWithNothing(string input, ContinuationProfile profile)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return !HasSuffixUnsafe(input, profile) && !IsEndOfSentence(input) && !input.EndsWith(",") && !input.EndsWith(":") && !input.EndsWith(";") && !input.EndsWith("-");
|
||||
}
|
||||
|
||||
public static bool IsAllCaps(string input)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int totalCount = 0;
|
||||
int allCapsCount = 0;
|
||||
|
||||
@ -601,6 +738,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
input = ExtractParagraphOnly(input);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
while (input.IndexOf("<i>", StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
var startIndex = input.IndexOf("<i>", StringComparison.Ordinal);
|
||||
@ -624,6 +767,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
input = ExtractParagraphOnly(input);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var lineStartIndex = (position > 0 && position < input.Length) ? input.LastIndexOf("\n", position, StringComparison.Ordinal) : 0;
|
||||
if (lineStartIndex == -1)
|
||||
{
|
||||
@ -671,8 +820,72 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsOnlyPrefix(string input, ContinuationProfile profile)
|
||||
{
|
||||
var checkString = input;
|
||||
|
||||
if (string.IsNullOrEmpty(input.Trim()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profile.Prefix.Length > 0)
|
||||
{
|
||||
checkString = checkString.Replace(profile.Prefix, "");
|
||||
}
|
||||
|
||||
if (profile.UseDifferentStyleGap && profile.GapPrefix.Length > 0)
|
||||
{
|
||||
checkString = checkString.Replace(profile.GapPrefix, "");
|
||||
}
|
||||
|
||||
foreach (string prefix in Prefixes)
|
||||
{
|
||||
checkString = checkString.Replace(prefix, "");
|
||||
}
|
||||
|
||||
checkString = checkString.Trim();
|
||||
|
||||
return string.IsNullOrEmpty(checkString);
|
||||
}
|
||||
|
||||
public static bool IsOnlySuffix(string input, ContinuationProfile profile)
|
||||
{
|
||||
var checkString = input;
|
||||
|
||||
if (string.IsNullOrEmpty(input.Trim()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profile.Suffix.Length > 0)
|
||||
{
|
||||
checkString = checkString.Replace(profile.Suffix, "");
|
||||
}
|
||||
|
||||
if (profile.UseDifferentStyleGap && profile.GapSuffix.Length > 0)
|
||||
{
|
||||
checkString = checkString.Replace(profile.GapSuffix, "");
|
||||
}
|
||||
|
||||
foreach (string suffix in Suffixes)
|
||||
{
|
||||
checkString = checkString.Replace(suffix, "");
|
||||
}
|
||||
|
||||
checkString = checkString.Trim();
|
||||
|
||||
return string.IsNullOrEmpty(checkString);
|
||||
}
|
||||
|
||||
public static bool HasPrefix(string input, ContinuationProfile profile)
|
||||
{
|
||||
// Return if only prefix
|
||||
if (IsOnlyPrefix(input, profile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profile.Prefix.Length > 0 && input.StartsWith(profile.Prefix))
|
||||
{
|
||||
return true;
|
||||
@ -696,6 +909,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool HasSuffix(string input, ContinuationProfile profile)
|
||||
{
|
||||
// Return if only suffix
|
||||
if (IsOnlySuffix(input, profile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profile.Suffix.Length > 0 && input.EndsWith(profile.Suffix))
|
||||
{
|
||||
return true;
|
||||
@ -717,8 +936,37 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool HasSuffixUnsafe(string input, ContinuationProfile profile)
|
||||
{
|
||||
if (profile.Suffix.Length > 0 && input.EndsWith(profile.Suffix))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.UseDifferentStyleGap && profile.GapSuffix.Length > 0 && input.EndsWith(profile.GapSuffix))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (string suffix in Suffixes)
|
||||
{
|
||||
if (input.EndsWith(suffix) && input.Length > suffix.Length)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool StartsWithConjunction(string input, string language)
|
||||
{
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<string> conjunctions = null;
|
||||
|
||||
if (language == "nl")
|
||||
@ -768,7 +1016,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
// - Title 1 ends with a suffix AND title 2 starts with a prefix
|
||||
// - Title 2 is a continuing sentence
|
||||
if (HasSuffix(thisText, profile) && HasPrefix(nextTextWithDash, profile)
|
||||
|| !IsNewSentence(nextText))
|
||||
|| !IsNewSentence(nextText) && !string.IsNullOrEmpty(nextText))
|
||||
{
|
||||
var newNextText = RemoveAllPrefixes(nextInput, profile);
|
||||
var newText = RemoveSuffix(input, profile, StartsWithConjunction(newNextText, language));
|
||||
|
@ -88,8 +88,8 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
string lastWord = ContinuationUtilities.GetLastWord(text);
|
||||
|
||||
|
||||
// If ends with dots (possible interruptions), check if next sentence is new sentence, otherwise don't check by default
|
||||
if (text.EndsWith("..") || text.EndsWith("…"))
|
||||
// If ends with dots (possible interruptions), or nothing, check if next sentence is new sentence, otherwise don't check by default
|
||||
if (text.EndsWith("..") || text.EndsWith("…") || ContinuationUtilities.EndsWithNothing(text, _continuationProfile))
|
||||
{
|
||||
if (!HasPrefix(textNext) && ContinuationUtilities.IsNewSentence(textNext))
|
||||
{
|
||||
@ -97,9 +97,10 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
|
||||
// If set, we'll hide interruption continuation candidates that don't start with a name,
|
||||
// to prevent clogging up the window with a lot of unchecked items.
|
||||
// For example, a candidate we DO want to list: But wait... Marty is still there!
|
||||
// For example, a candidate we DO want to list: But wait... Marty is still there!
|
||||
// or: This is something Marty can do.
|
||||
// If both sentences are all caps, DO show them.
|
||||
if (Configuration.Settings.General.FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName
|
||||
if (Configuration.Settings.General.FixContinuationStyleHideContinuationCandidatesWithoutName
|
||||
&& !StartsWithName(textNextWithoutPrefix, callbacks.Language)
|
||||
&& (!ContinuationUtilities.IsAllCaps(text) && !ContinuationUtilities.IsAllCaps(textNext)))
|
||||
{
|
||||
|
@ -2457,7 +2457,7 @@ can edit in same subtitle file (collaboration)",
|
||||
UncheckInsertsAllCaps = "Detect and uncheck single titles in all-caps (for example: NO ENTRY)",
|
||||
UncheckInsertsItalic = "Detect and uncheck italic single titles, or lyrics",
|
||||
UncheckInsertsLowercase = "Detect and uncheck single titles, or lyrics, in lowercase",
|
||||
HideInterruptionContinuationCandidatesWithoutName = "Hide unlikely continuation sentences after interruptions"
|
||||
HideContinuationCandidatesWithoutName = "Hide unlikely continuation sentences"
|
||||
};
|
||||
|
||||
SettingsMpv = new LanguageStructure.SettingsMpv
|
||||
|
@ -5899,8 +5899,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/UncheckInsertsLowercase":
|
||||
language.Settings.UncheckInsertsLowercase = reader.Value;
|
||||
break;
|
||||
case "Settings/HideInterruptionContinuationCandidatesWithoutName":
|
||||
language.Settings.HideInterruptionContinuationCandidatesWithoutName = reader.Value;
|
||||
case "Settings/HideContinuationCandidatesWithoutName":
|
||||
language.Settings.HideContinuationCandidatesWithoutName = reader.Value;
|
||||
break;
|
||||
case "SettingsMpv/Title":
|
||||
language.SettingsMpv.Title = reader.Value;
|
||||
|
@ -2325,7 +2325,7 @@
|
||||
public string UncheckInsertsAllCaps { get; set; }
|
||||
public string UncheckInsertsItalic { get; set; }
|
||||
public string UncheckInsertsLowercase { get; set; }
|
||||
public string HideInterruptionContinuationCandidatesWithoutName { get; set; }
|
||||
public string HideContinuationCandidatesWithoutName { get; set; }
|
||||
}
|
||||
|
||||
public class SettingsMpv
|
||||
|
@ -779,7 +779,7 @@ $HorzAlign = Center
|
||||
public bool FixContinuationStyleUncheckInsertsAllCaps { get; set; }
|
||||
public bool FixContinuationStyleUncheckInsertsItalic { get; set; }
|
||||
public bool FixContinuationStyleUncheckInsertsLowercase { get; set; }
|
||||
public bool FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName { get; set; }
|
||||
public bool FixContinuationStyleHideContinuationCandidatesWithoutName { get; set; }
|
||||
public string SpellCheckLanguage { get; set; }
|
||||
public string VideoPlayer { get; set; }
|
||||
public int VideoPlayerDefaultVolume { get; set; }
|
||||
@ -925,7 +925,7 @@ $HorzAlign = Center
|
||||
FixContinuationStyleUncheckInsertsAllCaps = true;
|
||||
FixContinuationStyleUncheckInsertsItalic = true;
|
||||
FixContinuationStyleUncheckInsertsLowercase = true;
|
||||
FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName = true;
|
||||
FixContinuationStyleHideContinuationCandidatesWithoutName = true;
|
||||
SpellCheckLanguage = null;
|
||||
VideoPlayer = string.Empty;
|
||||
VideoPlayerDefaultVolume = 75;
|
||||
@ -2585,10 +2585,10 @@ $HorzAlign = Center
|
||||
settings.General.FixContinuationStyleUncheckInsertsLowercase = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName");
|
||||
subNode = node.SelectSingleNode("FixContinuationStyleHideContinuationCandidatesWithoutName");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.General.FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
settings.General.FixContinuationStyleHideContinuationCandidatesWithoutName = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("SpellCheckLanguage");
|
||||
@ -6775,7 +6775,7 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("FixContinuationStyleUncheckInsertsAllCaps", settings.General.FixContinuationStyleUncheckInsertsAllCaps.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("FixContinuationStyleUncheckInsertsItalic", settings.General.FixContinuationStyleUncheckInsertsItalic.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("FixContinuationStyleUncheckInsertsLowercase", settings.General.FixContinuationStyleUncheckInsertsLowercase.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName", settings.General.FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("FixContinuationStyleHideContinuationCandidatesWithoutName", settings.General.FixContinuationStyleHideContinuationCandidatesWithoutName.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("SpellCheckLanguage", settings.General.SpellCheckLanguage);
|
||||
textWriter.WriteElementString("VideoPlayer", settings.General.VideoPlayer);
|
||||
textWriter.WriteElementString("VideoPlayerDefaultVolume", settings.General.VideoPlayerDefaultVolume.ToString(CultureInfo.InvariantCulture));
|
||||
|
28
src/Forms/SettingsFixContinuationStyle.Designer.cs
generated
28
src/Forms/SettingsFixContinuationStyle.Designer.cs
generated
@ -33,7 +33,7 @@
|
||||
this.checkBoxUncheckInsertsAllCaps = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxUncheckInsertsItalic = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxUncheckInsertsLowercase = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxHideContinuationCandidatesWithoutName = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
@ -41,7 +41,7 @@
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(397, 128);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(351, 128);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 10;
|
||||
@ -53,7 +53,7 @@
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(316, 128);
|
||||
this.buttonOK.Location = new System.Drawing.Point(270, 128);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 9;
|
||||
@ -91,15 +91,15 @@
|
||||
this.checkBoxUncheckInsertsLowercase.Text = "Try to detect and uncheck inserts or lyrics in lowercase";
|
||||
this.checkBoxUncheckInsertsLowercase.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxHideInterruptionContinuationCandidatesWithoutName
|
||||
// checkBoxHideContinuationCandidatesWithoutName
|
||||
//
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.AutoSize = true;
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.Location = new System.Drawing.Point(12, 81);
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.Name = "checkBoxHideInterruptionContinuationCandidatesWithoutName";
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.Size = new System.Drawing.Size(349, 17);
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.TabIndex = 4;
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.Text = "Hide interruption continuation candidates that don\'t start with a name";
|
||||
this.checkBoxHideInterruptionContinuationCandidatesWithoutName.UseVisualStyleBackColor = true;
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.AutoSize = true;
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.Location = new System.Drawing.Point(12, 81);
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.Name = "checkBoxHideContinuationCandidatesWithoutName";
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.Size = new System.Drawing.Size(349, 17);
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.TabIndex = 4;
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.Text = "Hide interruption continuation candidates that don\'t start with a name";
|
||||
this.checkBoxHideContinuationCandidatesWithoutName.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SettingsFixContinuationStyle
|
||||
//
|
||||
@ -107,8 +107,8 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.buttonCancel;
|
||||
this.ClientSize = new System.Drawing.Size(484, 163);
|
||||
this.Controls.Add(this.checkBoxHideInterruptionContinuationCandidatesWithoutName);
|
||||
this.ClientSize = new System.Drawing.Size(438, 163);
|
||||
this.Controls.Add(this.checkBoxHideContinuationCandidatesWithoutName);
|
||||
this.Controls.Add(this.checkBoxUncheckInsertsLowercase);
|
||||
this.Controls.Add(this.checkBoxUncheckInsertsItalic);
|
||||
this.Controls.Add(this.checkBoxUncheckInsertsAllCaps);
|
||||
@ -135,6 +135,6 @@
|
||||
private System.Windows.Forms.CheckBox checkBoxUncheckInsertsAllCaps;
|
||||
private System.Windows.Forms.CheckBox checkBoxUncheckInsertsItalic;
|
||||
private System.Windows.Forms.CheckBox checkBoxUncheckInsertsLowercase;
|
||||
private System.Windows.Forms.CheckBox checkBoxHideInterruptionContinuationCandidatesWithoutName;
|
||||
private System.Windows.Forms.CheckBox checkBoxHideContinuationCandidatesWithoutName;
|
||||
}
|
||||
}
|
@ -25,12 +25,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
checkBoxUncheckInsertsAllCaps.Text = language.UncheckInsertsAllCaps;
|
||||
checkBoxUncheckInsertsItalic.Text = language.UncheckInsertsItalic;
|
||||
checkBoxUncheckInsertsLowercase.Text = language.UncheckInsertsLowercase;
|
||||
checkBoxHideInterruptionContinuationCandidatesWithoutName.Text = language.HideInterruptionContinuationCandidatesWithoutName;
|
||||
checkBoxHideContinuationCandidatesWithoutName.Text = language.HideContinuationCandidatesWithoutName;
|
||||
|
||||
checkBoxUncheckInsertsAllCaps.Checked = settings.FixContinuationStyleUncheckInsertsAllCaps;
|
||||
checkBoxUncheckInsertsItalic.Checked = settings.FixContinuationStyleUncheckInsertsItalic;
|
||||
checkBoxUncheckInsertsLowercase.Checked = settings.FixContinuationStyleUncheckInsertsLowercase;
|
||||
checkBoxHideInterruptionContinuationCandidatesWithoutName.Checked = settings.FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName;
|
||||
checkBoxHideContinuationCandidatesWithoutName.Checked = settings.FixContinuationStyleHideContinuationCandidatesWithoutName;
|
||||
|
||||
buttonOK.Text = Configuration.Settings.Language.General.Ok;
|
||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||
@ -42,7 +42,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.General.FixContinuationStyleUncheckInsertsAllCaps = checkBoxUncheckInsertsAllCaps.Checked;
|
||||
Configuration.Settings.General.FixContinuationStyleUncheckInsertsItalic = checkBoxUncheckInsertsItalic.Checked;
|
||||
Configuration.Settings.General.FixContinuationStyleUncheckInsertsLowercase = checkBoxUncheckInsertsLowercase.Checked;
|
||||
Configuration.Settings.General.FixContinuationStyleHideInterruptionContinuationCandidatesWithoutName = checkBoxHideInterruptionContinuationCandidatesWithoutName.Checked;
|
||||
Configuration.Settings.General.FixContinuationStyleHideContinuationCandidatesWithoutName = checkBoxHideContinuationCandidatesWithoutName.Checked;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
@ -2164,7 +2164,7 @@ of tijdens het exporteren naar op beeld gebaseerde formaten.</FontNote>
|
||||
<UncheckInsertsAllCaps>Beeldtitels in hoofdletters detecteren en uitvinken (bijvoorbeeld: GEEN TOEGANG)</UncheckInsertsAllCaps>
|
||||
<UncheckInsertsItalic>Cursieve beeldtitels of songteksten detecteren en uitvinken</UncheckInsertsItalic>
|
||||
<UncheckInsertsLowercase>Beeldtitels of songteksten in kleine letters detecteren en uitvinken</UncheckInsertsLowercase>
|
||||
<HideInterruptionContinuationCandidatesWithoutName>Onwaarschijnlijke vervolgzinnen na onderbrekingen verbergen</HideInterruptionContinuationCandidatesWithoutName>
|
||||
<HideContinuationCandidatesWithoutName>Onwaarschijnlijke vervolgzinnen verbergen</HideContinuationCandidatesWithoutName>
|
||||
</Settings>
|
||||
<SettingsMpv>
|
||||
<Title>mpv instellingen</Title>
|
||||
|
@ -2674,6 +2674,71 @@ namespace Test.FixCommonErrors
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixContinuationStyle18()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "This is a test", "to see if it works.");
|
||||
Configuration.Settings.General.ContinuationStyle = ContinuationStyle.LeadingTrailingDots;
|
||||
new FixContinuationStyle().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("This is a test...", _subtitle.Paragraphs[0].Text);
|
||||
Assert.AreEqual("...to see if it works.", _subtitle.Paragraphs[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixContinuationStyle19()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "This is a test", "To see if it works.");
|
||||
Configuration.Settings.General.ContinuationStyle = ContinuationStyle.LeadingTrailingDots;
|
||||
new FixContinuationStyle().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("This is a test", _subtitle.Paragraphs[0].Text);
|
||||
Assert.AreEqual("To see if it works.", _subtitle.Paragraphs[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixContinuationStyle20()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "<i>This is a test</i>", "to see if it works.");
|
||||
Configuration.Settings.General.ContinuationStyle = ContinuationStyle.LeadingTrailingDots;
|
||||
new FixContinuationStyle().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("<i>This is a test...</i>", _subtitle.Paragraphs[0].Text);
|
||||
Assert.AreEqual("...to see if it works.", _subtitle.Paragraphs[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixContinuationStyle21()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "This is a <i>test</i>", "to see if it works.");
|
||||
Configuration.Settings.General.ContinuationStyle = ContinuationStyle.LeadingTrailingDots;
|
||||
new FixContinuationStyle().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("This is a <i>test</i>...", _subtitle.Paragraphs[0].Text);
|
||||
Assert.AreEqual("...to see if it works.", _subtitle.Paragraphs[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixContinuationStyle22()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "This is a <i>test</i>", "To see if it works.");
|
||||
Configuration.Settings.General.ContinuationStyle = ContinuationStyle.LeadingTrailingDots;
|
||||
new FixContinuationStyle().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("This is a <i>test</i>", _subtitle.Paragraphs[0].Text);
|
||||
Assert.AreEqual("To see if it works.", _subtitle.Paragraphs[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Fix continuation style
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,24 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SanitizeString9()
|
||||
{
|
||||
string line1 = "";
|
||||
string line1Actual = ContinuationUtilities.SanitizeString(line1, false);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SanitizeString10()
|
||||
{
|
||||
string line1 = "<i></i>";
|
||||
string line1Actual = ContinuationUtilities.SanitizeString(line1, false);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ExtractParagraphOnly1()
|
||||
{
|
||||
@ -117,6 +135,15 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ReplaceFirstOccurrence2()
|
||||
{
|
||||
string line1 = "Mark and Fred. Mark is the strongest.";
|
||||
string line1Actual = ContinuationUtilities.ReplaceFirstOccurrence(line1, "John", "...John");
|
||||
string line1Expected = "Mark and Fred. Mark is the strongest.";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ReplaceLastOccurrence1()
|
||||
{
|
||||
@ -126,6 +153,15 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ReplaceLastOccurrence2()
|
||||
{
|
||||
string line1 = "You ask who's the strongest. Mark is the strongest";
|
||||
string line1Actual = ContinuationUtilities.ReplaceLastOccurrence(line1, "tallest", "tallest...");
|
||||
string line1Expected = "You ask who's the strongest. Mark is the strongest";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddSuffix1()
|
||||
{
|
||||
@ -153,6 +189,42 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddSuffix4()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.ShouldAddSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddSuffix4B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.ShouldAddSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddSuffix5()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.ShouldAddSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddSuffix6()
|
||||
{
|
||||
string line1 = "<i>...</i>";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.ShouldAddSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded1()
|
||||
{
|
||||
@ -333,8 +405,58 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
/*[TestMethod]
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded12()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddSuffixIfNeeded(line1, profile, false);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded12B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddSuffixIfNeeded(line1, profile, false);
|
||||
string line1Expected = " ";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded13()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddSuffixIfNeeded(line1, profile, false);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded14()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
string line1Actual = ContinuationUtilities.AddSuffixIfNeeded(line1, profile, false);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddSuffixIfNeeded15()
|
||||
{
|
||||
string line1 = "妈";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddSuffixIfNeeded(line1, profile, false);
|
||||
string line1Expected = "妈...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
/*[TestMethod]
|
||||
public void AddSuffixIfNeeded13()
|
||||
{
|
||||
string line1 = "What are you <i>do</i>ing,";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
@ -462,6 +584,66 @@ namespace Test.Logic
|
||||
string line1Expected = "- ...<i>this</i> is a test.\n- Okay.";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded10()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded10B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = " ";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded10C()
|
||||
{
|
||||
string line1 = "象";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = "...象";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded11()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded12()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPrefixIfNeeded13()
|
||||
{
|
||||
string line1 = "<i>...</i>";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.AddPrefixIfNeeded(line1, profile, true);
|
||||
string line1Expected = "<i>...</i>";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
/*[TestMethod]
|
||||
public void AddPrefixIfNeeded8()
|
||||
@ -543,6 +725,36 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveSuffix6()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemoveSuffix(line1, profile);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveSuffix6B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemoveSuffix(line1, profile);
|
||||
string line1Expected = " ";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveSuffix7()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemoveSuffix(line1, profile);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemovePrefix1()
|
||||
{
|
||||
@ -613,6 +825,36 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemovePrefix7()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemovePrefix(line1, profile);
|
||||
string line1Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemovePrefix7B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemovePrefix(line1, profile);
|
||||
string line1Expected = " ";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemovePrefix8()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
string line1Actual = ContinuationUtilities.RemovePrefix(line1, profile);
|
||||
string line1Expected = "...";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsNewSentence1()
|
||||
{
|
||||
@ -669,6 +911,22 @@ namespace Test.Logic
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsNewSentence8()
|
||||
{
|
||||
string line1 = "";
|
||||
bool line1Actual = ContinuationUtilities.IsNewSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsNewSentence9()
|
||||
{
|
||||
string line1 = " ";
|
||||
bool line1Actual = ContinuationUtilities.IsNewSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsEndOfSentence1()
|
||||
{
|
||||
@ -749,6 +1007,164 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsEndOfSentence11()
|
||||
{
|
||||
string line1 = "";
|
||||
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsEndOfSentence11B()
|
||||
{
|
||||
string line1 = " ";
|
||||
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsEndOfSentence12()
|
||||
{
|
||||
string line1 = "Hey...";
|
||||
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsEndOfSentence13()
|
||||
{
|
||||
string line1 = "...";
|
||||
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing1()
|
||||
{
|
||||
string line1 = "This ends with nothing";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing2()
|
||||
{
|
||||
string line1 = "THIS ENDS WITH NOTHING";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing3()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing3B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing4()
|
||||
{
|
||||
string line1 = "This ends with something,";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing5()
|
||||
{
|
||||
string line1 = "This ends with something..";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing6()
|
||||
{
|
||||
string line1 = "This ends with something--";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing7()
|
||||
{
|
||||
string line1 = "This ends with something --";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing8()
|
||||
{
|
||||
string line1 = "This ends with something:";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing9()
|
||||
{
|
||||
string line1 = "This ends with something;";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing9B()
|
||||
{
|
||||
string line1 = "Ψάξατε πραγματικά αυτό;";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing10()
|
||||
{
|
||||
string line1 = "This ends with something?";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing11()
|
||||
{
|
||||
string line1 = "This ends with something...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EndsWithNothing12()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsAllCaps1()
|
||||
{
|
||||
@ -781,6 +1197,22 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsAllCaps5()
|
||||
{
|
||||
string line1 = "";
|
||||
bool line1Actual = ContinuationUtilities.IsAllCaps(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsAllCaps5B()
|
||||
{
|
||||
string line1 = " ";
|
||||
bool line1Actual = ContinuationUtilities.IsAllCaps(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic1()
|
||||
{
|
||||
@ -853,6 +1285,46 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic10()
|
||||
{
|
||||
string line1 = "";
|
||||
bool line1Actual = ContinuationUtilities.IsItalic(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic10B()
|
||||
{
|
||||
string line1 = " ";
|
||||
bool line1Actual = ContinuationUtilities.IsItalic(line1);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic11()
|
||||
{
|
||||
string line1 = "<i>";
|
||||
bool line1Actual = ContinuationUtilities.IsItalic(line1);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic12()
|
||||
{
|
||||
string line1 = "<i></i>";
|
||||
bool line1Actual = ContinuationUtilities.IsItalic(line1);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsItalic13()
|
||||
{
|
||||
string line1 = "<i> </i>";
|
||||
bool line1Actual = ContinuationUtilities.IsItalic(line1);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix1()
|
||||
{
|
||||
@ -890,6 +1362,78 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix5()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix5B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix6()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix7()
|
||||
{
|
||||
string line1 = "<i>...</i>";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix8()
|
||||
{
|
||||
string line1 = "...a";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix8B()
|
||||
{
|
||||
string line1 = "... a";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix9()
|
||||
{
|
||||
string line1 = "-a";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasPrefix10()
|
||||
{
|
||||
string line1 = "- a";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
bool line1Actual = ContinuationUtilities.HasPrefix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix1()
|
||||
{
|
||||
@ -927,6 +1471,177 @@ namespace Test.Logic
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix5()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix5B()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix6()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix6B()
|
||||
{
|
||||
string line1 = " ...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix6C()
|
||||
{
|
||||
string line1 = "象...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix7()
|
||||
{
|
||||
string line1 = "a...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix7B()
|
||||
{
|
||||
string line1 = "a ...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix7C()
|
||||
{
|
||||
string line1 = "a-";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix7D()
|
||||
{
|
||||
string line1 = "a -";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDash);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HasSuffix8()
|
||||
{
|
||||
string line1 = "<i>...</i>";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix1()
|
||||
{
|
||||
string line1 = "...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix2()
|
||||
{
|
||||
string line1 = "-";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix3()
|
||||
{
|
||||
string line1 = "a...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix4()
|
||||
{
|
||||
string line1 = " ... ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsTrue(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix5()
|
||||
{
|
||||
string line1 = "!...";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix6()
|
||||
{
|
||||
string line1 = "?";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix7()
|
||||
{
|
||||
string line1 = "象";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix8()
|
||||
{
|
||||
string line1 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnlySuffix9()
|
||||
{
|
||||
string line1 = " ";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StartsWithConjunction1()
|
||||
{
|
||||
@ -959,6 +1674,22 @@ namespace Test.Logic
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StartsWithConjunction5()
|
||||
{
|
||||
string line1 = "";
|
||||
bool line1Actual = ContinuationUtilities.StartsWithConjunction(line1, "nl");
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StartsWithConjunction6()
|
||||
{
|
||||
string line1 = " ";
|
||||
bool line1Actual = ContinuationUtilities.StartsWithConjunction(line1, "nl");
|
||||
Assert.IsFalse(line1Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MergeHelper1()
|
||||
{
|
||||
@ -1108,5 +1839,35 @@ namespace Test.Logic
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
Assert.AreEqual(line2Expected, line2Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MergeHelper10()
|
||||
{
|
||||
string line1 = "This needs to be merged...";
|
||||
string line2 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
var result = ContinuationUtilities.MergeHelper(line1, line2, profile, "en");
|
||||
string line1Actual = result.Item1;
|
||||
string line2Actual = result.Item2;
|
||||
string line1Expected = "This needs to be merged...";
|
||||
string line2Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
Assert.AreEqual(line2Expected, line2Actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MergeHelper11()
|
||||
{
|
||||
string line1 = "This needs to be merged";
|
||||
string line2 = "";
|
||||
var profile = ContinuationUtilities.GetContinuationProfile(ContinuationStyle.LeadingTrailingDots);
|
||||
var result = ContinuationUtilities.MergeHelper(line1, line2, profile, "en");
|
||||
string line1Actual = result.Item1;
|
||||
string line2Actual = result.Item2;
|
||||
string line1Expected = "This needs to be merged";
|
||||
string line2Expected = "";
|
||||
Assert.AreEqual(line1Expected, line1Actual);
|
||||
Assert.AreEqual(line2Expected, line2Actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user