mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Fix #2235
This commit is contained in:
parent
246ae3f88b
commit
da4e4dc2b8
@ -214,12 +214,11 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
string s = ToHHMMSSFF();
|
||||
int j = 0;
|
||||
if (s.StartsWith("0:00:", StringComparison.Ordinal))
|
||||
j = 5;
|
||||
if (s.StartsWith("00:", StringComparison.Ordinal))
|
||||
j += 3;
|
||||
if (s.StartsWith("00:", StringComparison.Ordinal))
|
||||
int len = s.Length;
|
||||
while (j + 6 < len && s[j] == '0' && s[j + 1] == '0' && s[j + 2] == ':')
|
||||
{
|
||||
j += 3;
|
||||
}
|
||||
return j > 0 ? s.Substring(j) : s;
|
||||
}
|
||||
|
||||
|
@ -132,5 +132,38 @@ namespace Test.Logic
|
||||
Assert.IsTrue(Math.Abs(tc.TotalMilliseconds - (tc.TotalSeconds * 1000.0)) < 0.001);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToShortStringHhmmssff1()
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 25;
|
||||
var res = new TimeCode(1, 2, 3, 0).ToShortStringHHMMSSFF();
|
||||
Assert.AreEqual("01:02:03:00", res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToShortStringHhmmssff2()
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 25;
|
||||
var res = new TimeCode(0, 2, 3, 0).ToShortStringHHMMSSFF();
|
||||
Assert.AreEqual(res, "02:03:00", res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToShortStringHhmmssff3()
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 25;
|
||||
var res = new TimeCode(0, 0, 3, 0).ToShortStringHHMMSSFF();
|
||||
Assert.AreEqual("03:00", res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToShortStringHhmmssff4()
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 25;
|
||||
var res = new TimeCode(0, 0, 0, 0).ToShortStringHHMMSSFF();
|
||||
Assert.AreEqual("00:00", res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user