Added unit tests

Former-commit-id: d6bc6c92a5
This commit is contained in:
Jonas Kamsker 2022-01-12 00:34:52 +01:00
parent 7e6738edaf
commit f3031db17b
2 changed files with 20 additions and 2 deletions

View file

@ -334,7 +334,7 @@ public void Builder_BuildString_SubtitleHardBurnFilter()
.HardBurnSubtitle(SubtitleHardBurnOptions .HardBurnSubtitle(SubtitleHardBurnOptions
.Create(subtitlePath: "sample.srt") .Create(subtitlePath: "sample.srt")
.SetCharacterEncoding("UTF-8") .SetCharacterEncoding("UTF-8")
.SetOriginalSize(1366,768) .SetOriginalSize(1366, 768)
.SetSubtitleIndex(0) .SetSubtitleIndex(0)
.WithStyle(StyleOptions.Create() .WithStyle(StyleOptions.Create()
.WithParameter("FontName", "DejaVu Serif") .WithParameter("FontName", "DejaVu Serif")
@ -479,10 +479,21 @@ public void Builder_BuildString_DynamicAudioNormalizerWithValuesFormat()
{ {
var str = FFMpegArguments.FromFileInput("input.mp4") var str = FFMpegArguments.FromFileInput("input.mp4")
.OutputToFile("output.mp4", false, .OutputToFile("output.mp4", false,
opt => opt.WithAudioFilters(filterOptions => filterOptions.DynamicNormalizer(125, 13, 0.9215, 5.124, 0.5458,false,true,true, 0.3333333))) opt => opt.WithAudioFilters(filterOptions => filterOptions.DynamicNormalizer(125, 13, 0.9215, 5.124, 0.5458, false, true, true, 0.3333333)))
.Arguments; .Arguments;
Assert.AreEqual("-i \"input.mp4\" -af \"dynaudnorm=f=125:g=13:p=0.92:m=5.1:r=0.5:n=0:c=1:b=1:s=0.3\" \"output.mp4\"", str); Assert.AreEqual("-i \"input.mp4\" -af \"dynaudnorm=f=125:g=13:p=0.92:m=5.1:r=0.5:n=0:c=1:b=1:s=0.3\" \"output.mp4\"", str);
} }
[TestMethod]
public void Builder_BuildString_Audible_AAXC_Decryption()
{
var str = FFMpegArguments.FromFileInput("input.aaxc", false, x => x.WithAudibleEncryptionKeys("123", "456"))
.MapMetaData()
.OutputToFile("output.m4b", true, x => x.WithTagVersion(3).DisableChannel(Channel.Video).CopyChannel(Channel.Audio))
.Arguments;
Assert.AreEqual("-audible_key 123 -audible_iv 456 -i \"input.aaxc\" -map_metadata 0 -id3v2_version 3 -vn -c:a copy \"output.m4b\" -y", str);
}
} }
} }

View file

@ -94,5 +94,12 @@ public void Concat_Escape()
var arg = new DemuxConcatArgument(new[] { @"Heaven's River\05 - Investigation.m4b" }); var arg = new DemuxConcatArgument(new[] { @"Heaven's River\05 - Investigation.m4b" });
arg.Values.Should().BeEquivalentTo(new[] { @"file 'Heaven'\''s River\05 - Investigation.m4b'" }); arg.Values.Should().BeEquivalentTo(new[] { @"file 'Heaven'\''s River\05 - Investigation.m4b'" });
} }
[TestMethod]
public void Audible_Aaxc_Test()
{
var arg = new AudibleEncryptionKeyArgument("123", "456");
arg.Text.Should().Be($"-audible_key 123 -audible_iv 456");
}
} }
} }