Compare commits

..

1 commit

Author SHA1 Message Date
Pete
7f85dcf593
Merge 85e7170fd9 into 70668ce623 2025-10-16 14:04:14 +02:00
7 changed files with 46 additions and 41 deletions

View file

@ -682,25 +682,4 @@ public class ArgumentBuilderTest
// Act & Assert // Act & Assert
Assert.ThrowsExactly<FileNotFoundException>(() => argument.Pre()); Assert.ThrowsExactly<FileNotFoundException>(() => argument.Pre());
} }
[TestMethod]
public void Concat_Escape()
{
var arg = new DemuxConcatArgument([@"Heaven's River\05 - Investigation.m4b"]);
CollectionAssert.AreEquivalent(new[] { @"file 'Heaven'\''s River\05 - Investigation.m4b'" }, arg.Values.ToArray());
}
[TestMethod]
public void Audible_Aaxc_Test()
{
var arg = new AudibleEncryptionKeyArgument("123", "456");
Assert.AreEqual("-audible_key 123 -audible_iv 456", arg.Text);
}
[TestMethod]
public void Audible_Aax_Test()
{
var arg = new AudibleEncryptionKeyArgument("62689101");
Assert.AreEqual("-activation_bytes 62689101", arg.Text);
}
} }

View file

@ -1 +1 @@
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] [assembly: Parallelize]

View file

@ -1,4 +1,6 @@
namespace FFMpegCore.Test; using FFMpegCore.Arguments;
namespace FFMpegCore.Test;
[TestClass] [TestClass]
public class FFMpegArgumentProcessorTest public class FFMpegArgumentProcessorTest
@ -11,9 +13,9 @@ public class FFMpegArgumentProcessorTest
} }
[TestMethod] [TestMethod]
public void ZZZ_Processor_GlobalOptions_GetUsed() public void Processor_GlobalOptions_GetUsed()
{ {
var globalWorkingDir = "Whatever"; var globalWorkingDir = "Whatever1";
var processor = CreateArgumentProcessor(); var processor = CreateArgumentProcessor();
try try
@ -43,9 +45,9 @@ public class FFMpegArgumentProcessorTest
} }
[TestMethod] [TestMethod]
public void ZZZ_Processor_Options_CanBeOverridden_And_Configured() public void Processor_Options_CanBeOverridden_And_Configured()
{ {
var globalConfig = "Whatever"; var globalConfig = "Whatever2";
try try
{ {
@ -57,14 +59,14 @@ public class FFMpegArgumentProcessorTest
var overrideOptions = new FFOptions { WorkingDirectory = "override" }; var overrideOptions = new FFOptions { WorkingDirectory = "override" };
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalConfig, TemporaryFilesFolder = globalConfig, BinaryFolder = globalConfig }); GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalConfig, TemporaryFilesFolder = globalConfig, BinaryFolder = globalConfig });
var options = processor.GetConfiguredOptions(overrideOptions); var configuredOptions = processor.GetConfiguredOptions(overrideOptions);
Assert.AreEqual(options.WorkingDirectory, overrideOptions.WorkingDirectory); Assert.AreEqual(configuredOptions.WorkingDirectory, overrideOptions.WorkingDirectory);
Assert.AreEqual(options.TemporaryFilesFolder, overrideOptions.TemporaryFilesFolder); Assert.AreEqual(configuredOptions.TemporaryFilesFolder, overrideOptions.TemporaryFilesFolder);
Assert.AreEqual(options.BinaryFolder, overrideOptions.BinaryFolder); Assert.AreEqual(configuredOptions.BinaryFolder, overrideOptions.BinaryFolder);
Assert.AreEqual(sessionTempDir, options.TemporaryFilesFolder); Assert.AreEqual(sessionTempDir, configuredOptions.TemporaryFilesFolder);
Assert.AreNotEqual(globalConfig, options.BinaryFolder); Assert.AreNotEqual(globalConfig, configuredOptions.BinaryFolder);
} }
finally finally
{ {
@ -73,9 +75,9 @@ public class FFMpegArgumentProcessorTest
} }
[TestMethod] [TestMethod]
public void ZZZ_Options_Global_And_Session_Options_Can_Differ() public void Options_Global_And_Session_Options_Can_Differ()
{ {
var globalWorkingDir = "Whatever"; var globalWorkingDir = "Whatever3";
try try
{ {
@ -95,4 +97,25 @@ public class FFMpegArgumentProcessorTest
GlobalFFOptions.Configure(new FFOptions()); GlobalFFOptions.Configure(new FFOptions());
} }
} }
[TestMethod]
public void Concat_Escape()
{
var arg = new DemuxConcatArgument([@"Heaven's River\05 - Investigation.m4b"]);
CollectionAssert.AreEquivalent(new[] { @"file 'Heaven'\''s River\05 - Investigation.m4b'" }, arg.Values.ToArray());
}
[TestMethod]
public void Audible_Aaxc_Test()
{
var arg = new AudibleEncryptionKeyArgument("123", "456");
Assert.AreEqual("-audible_key 123 -audible_iv 456", arg.Text);
}
[TestMethod]
public void Audible_Aax_Test()
{
var arg = new AudibleEncryptionKeyArgument("62689101");
Assert.AreEqual("-activation_bytes 62689101", arg.Text);
}
} }

View file

@ -5,7 +5,6 @@
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<LangVersion>default</LangVersion> <LangVersion>default</LangVersion>
<OrderTestsByNameInClass>true</OrderTestsByNameInClass>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -27,16 +27,20 @@ public class FFMpegOptionsTest
} }
[TestMethod] [TestMethod]
public void ZZZ_Options_Set_Programmatically() public void Options_Set_Programmatically()
{ {
var original = GlobalFFOptions.Current;
try try
{ {
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "Whatever" }); GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "Whatever" });
Assert.AreEqual("Whatever", GlobalFFOptions.Current.BinaryFolder); Assert.AreEqual(
"Whatever",
GlobalFFOptions.Current.BinaryFolder
);
} }
finally finally
{ {
GlobalFFOptions.Configure(new FFOptions()); GlobalFFOptions.Configure(original);
} }
} }
} }

View file

@ -824,6 +824,7 @@ public class VideoTest
using var outputFile = new TemporaryFile("out.mp4"); using var outputFile = new TemporaryFile("out.mp4");
var dataReceived = false; var dataReceived = false;
GlobalFFOptions.Configure(opt => opt.Encoding = Encoding.UTF8);
var success = FFMpegArguments var success = FFMpegArguments
.FromFileInput(TestResources.Mp4Video) .FromFileInput(TestResources.Mp4Video)
.WithGlobalOptions(options => options .WithGlobalOptions(options => options
@ -831,7 +832,6 @@ public class VideoTest
.OutputToFile(outputFile, false, opt => opt .OutputToFile(outputFile, false, opt => opt
.WithDuration(TimeSpan.FromSeconds(2))) .WithDuration(TimeSpan.FromSeconds(2)))
.NotifyOnError(_ => dataReceived = true) .NotifyOnError(_ => dataReceived = true)
.Configure(opt => opt.Encoding = Encoding.UTF8)
.ProcessSynchronously(); .ProcessSynchronously();
Assert.IsTrue(dataReceived); Assert.IsTrue(dataReceived);

View file

@ -1,3 +1,3 @@
{ {
"BinaryFolder": "" "RootDirectory": ""
} }