feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization
This commit is contained in:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
74
tests/Paca.Tests/Core/VideoIntroOutroTrimmerGateTests.cs
Normal file
74
tests/Paca.Tests/Core/VideoIntroOutroTrimmerGateTests.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Paca.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Core;
|
||||
|
||||
public class VideoIntroOutroTrimmerGateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Gate373_VideoIntroOutroTrimmer_ParsesSilenceSpans_FromFfmpegStderr()
|
||||
{
|
||||
var stderr = @"
|
||||
[silencedetect @ 0000021c1c68f140] silence_start: 0
|
||||
[silencedetect @ 0000021c1c68f140] silence_end: 4.2 | silence_duration: 4.2
|
||||
[silencedetect @ 0000021c1c68f140] silence_start: 115.8
|
||||
[silencedetect @ 0000021c1c68f140] silence_end: 120.0 | silence_duration: 4.2
|
||||
";
|
||||
|
||||
var spans = VideoIntroOutroTrimmer.ParseSilenceSpans(stderr);
|
||||
|
||||
Assert.Equal(2, spans.Count);
|
||||
Assert.Equal(0.0, spans[0].StartSec);
|
||||
Assert.Equal(4.2, spans[0].EndSec);
|
||||
Assert.Equal(4.2, spans[0].DurationSec);
|
||||
|
||||
Assert.Equal(115.8, spans[1].StartSec);
|
||||
Assert.Equal(120.0, spans[1].EndSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate374_VideoIntroOutroTrimmer_CalculatesPlaybackTrimWindow()
|
||||
{
|
||||
var totalDuration = 180.0; // 3 minutes
|
||||
var skipIntro = 10.0; // Skip first 10s
|
||||
var skipOutro = 20.0; // Skip last 20s
|
||||
|
||||
var window = VideoIntroOutroTrimmer.CalculateTrimWindow(totalDuration, skipIntro, skipOutro);
|
||||
|
||||
Assert.Equal(10.0, window.StartSec);
|
||||
Assert.Equal(160.0, window.EndSec);
|
||||
Assert.Equal(150.0, window.DurationSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate375_VideoIntroOutroTrimmer_ClampsExcessiveSkips_ToMinimumOneSecond()
|
||||
{
|
||||
var totalDuration = 30.0;
|
||||
var excessiveIntro = 25.0;
|
||||
var excessiveOutro = 20.0; // sum = 45 > 30
|
||||
|
||||
var window = VideoIntroOutroTrimmer.CalculateTrimWindow(totalDuration, excessiveIntro, excessiveOutro);
|
||||
|
||||
// Should clamp so duration is at least 1.0s
|
||||
Assert.True(window.DurationSec >= 1.0);
|
||||
Assert.True(window.EndSec <= totalDuration);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate376_VideoIntroOutroTrimmer_BuildsLosslessTrimCommandLine()
|
||||
{
|
||||
var cmd = VideoIntroOutroTrimmer.BuildLosslessTrimCommandLine(
|
||||
inputPath: "C:\\videos\\full.mp4",
|
||||
outputPath: "C:\\videos\\trimmed.mp4",
|
||||
startSec: 10.5,
|
||||
durationSec: 150.0
|
||||
);
|
||||
|
||||
Assert.Contains("-ss 10.50 -i \"C:\\videos\\full.mp4\"", cmd);
|
||||
Assert.Contains("-t 150.00", cmd);
|
||||
Assert.Contains("-c copy", cmd);
|
||||
Assert.EndsWith("\"C:\\videos\\trimmed.mp4\" -y", cmd);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue