Files
oak-editor/tests/gtest/codec_exportcodec_test.cpp
T
Mike-Solar b7ff687220 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
2026-07-13 10:19:30 +08:00

52 lines
1.7 KiB
C++

#include <gtest/gtest.h>
#include "codec/exportcodec.h"
TEST(CodecExportCodec, NamesAndFlags)
{
using olive::ExportCodec;
EXPECT_EQ(ExportCodec::GetCodecName(ExportCodec::kCodecH264),
QStringLiteral("H.264"));
EXPECT_EQ(ExportCodec::GetCodecName(ExportCodec::kCodecCount),
QStringLiteral("Unknown"));
EXPECT_TRUE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecPNG));
EXPECT_FALSE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecH264));
EXPECT_TRUE(ExportCodec::IsCodecLossless(ExportCodec::kCodecPCM));
EXPECT_TRUE(ExportCodec::IsCodecLossless(ExportCodec::kCodecFLAC));
EXPECT_FALSE(ExportCodec::IsCodecLossless(ExportCodec::kCodecH265));
}
TEST(CodecExportCodec, VideoCodecNamesAreNonEmpty)
{
using olive::ExportCodec;
for (int i = 0; i < ExportCodec::kCodecCount; ++i) {
const auto codec = static_cast<ExportCodec::Codec>(i);
const QString name = ExportCodec::GetCodecName(codec);
EXPECT_FALSE(name.isEmpty()) << "Codec " << i;
}
}
TEST(CodecExportCodec, AudioCodecsAreNotStillImages)
{
using olive::ExportCodec;
EXPECT_FALSE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecPCM));
EXPECT_FALSE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecAAC));
EXPECT_FALSE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecFLAC));
EXPECT_FALSE(ExportCodec::IsCodecAStillImage(ExportCodec::kCodecOpus));
}
TEST(CodecExportCodec, LossyCodecsAreNotLossless)
{
using olive::ExportCodec;
EXPECT_FALSE(ExportCodec::IsCodecLossless(ExportCodec::kCodecH264));
EXPECT_FALSE(ExportCodec::IsCodecLossless(ExportCodec::kCodecH265));
EXPECT_FALSE(ExportCodec::IsCodecLossless(ExportCodec::kCodecVP9));
EXPECT_FALSE(ExportCodec::IsCodecLossless(ExportCodec::kCodecAAC));
}