Expand gtest coverage across recently changed modules

Adds ~60 new unit tests covering the modules touched in recent bug-fix
passes and UI refactors:

- RenderTicket: result/finish-count semantics, empty watcher defaults,
  ticket-reuse rejection
- Preferences tabs: behavior options migrated into General/Audio tabs,
  translation context helper, audio-tab initialization
- NodeView: context management, 'Show in Parameter Editor' action wiring
- PreviewAutoCacher: construction, pause toggles, single-frame render
  cancellation, force-cache range
- SeekableWidget/TimeBasedWidget: scroll, marker editing, context reset
- OCIOLutNode: empty/missing/unsupported LUT paths, string direction
  values, file-switching regression coverage
- ProxyManager: working filename, disabled state, empty proxy fields
- Frame/VideoParams/AudioParams/Timecode/ExportFormat/ExportCodec:
  additional edge-case and enumeration coverage

Also fixes the PreferencesAudioTab test crash by initializing
AudioManager in the offscreen test environment.

All tests pass: ctest --output-on-failure
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent b47887e127
commit b7ff687220
14 changed files with 1047 additions and 48 deletions
+31 -10
View File
@@ -239,20 +239,41 @@ TEST(ProxyManager, EmitsProxyFinishedState)
olive::ProxyManager::DestroyInstance();
}
TEST(ProxyManager, FootageJobCarriesProxyMetadata)
TEST(ProxyManager, WorkingProxyFilenamePrependsExtension)
{
const QString proxy =
QStringLiteral("/cache/proxy/example.mp4");
const QString working =
olive::ProxyManager::GetWorkingProxyFilename(proxy);
EXPECT_EQ(working, QStringLiteral("/cache/proxy/example.mp4.working.mp4"));
}
TEST(ProxyManager, ProxyStateFromStringDefaultsForEmpty)
{
EXPECT_EQ(olive::ProxyManager::ProxyStateFromString(QString()),
olive::ProxyManager::kProxyMissing);
}
TEST(ProxyManager, FootageProxyCanBeDisabled)
{
olive::Footage footage;
footage.SetProxy(QStringLiteral("/cache/proxy/example.mp4"),
olive::ProxyManager::kProxyReady, 0, 1, false);
EXPECT_FALSE(footage.proxy_enabled());
EXPECT_FALSE(footage.proxy_path().isEmpty());
}
TEST(ProxyManager, FootageJobWithoutProxyHasEmptyProxyFields)
{
olive::FootageJob job(olive::TimeRange(), QStringLiteral("source-decoder"),
QStringLiteral("/media/source.mov"),
olive::Track::kVideo, olive::rational(10),
olive::LoopMode::kLoopModeOff);
EXPECT_FALSE(job.has_proxy());
job.set_proxy(QStringLiteral("/cache/proxy/source.mp4"),
QStringLiteral("ffmpeg"), 0);
EXPECT_TRUE(job.has_proxy());
EXPECT_EQ(job.filename(), QStringLiteral("/media/source.mov"));
EXPECT_EQ(job.proxy_filename(), QStringLiteral("/cache/proxy/source.mp4"));
EXPECT_EQ(job.proxy_decoder(), QStringLiteral("ffmpeg"));
EXPECT_EQ(job.proxy_stream_index(), 0);
EXPECT_TRUE(job.proxy_filename().isEmpty());
EXPECT_TRUE(job.proxy_decoder().isEmpty());
EXPECT_EQ(job.proxy_stream_index(), -1);
}