Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
80 lines
2.6 KiB
C++
80 lines
2.6 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include "codec/exportformat.h"
|
|
|
|
TEST(CodecExportFormat, NamesAndExtensions)
|
|
{
|
|
using olive::ExportFormat;
|
|
|
|
EXPECT_EQ(ExportFormat::get_name(ExportFormat::k_format_d_nx_hd),
|
|
QStringLiteral("DNxHD"));
|
|
EXPECT_EQ(ExportFormat::get_extension(ExportFormat::k_format_d_nx_hd),
|
|
QStringLiteral("mxf"));
|
|
EXPECT_EQ(ExportFormat::get_name(ExportFormat::k_format_count),
|
|
QStringLiteral("Unknown"));
|
|
EXPECT_TRUE(
|
|
ExportFormat::get_extension(ExportFormat::k_format_count).isEmpty());
|
|
}
|
|
|
|
TEST(CodecExportFormat, AllFormatsHaveNames)
|
|
{
|
|
using olive::ExportFormat;
|
|
|
|
for (int i = 0; i < ExportFormat::k_format_count; ++i) {
|
|
const auto fmt = static_cast<ExportFormat::Format>(i);
|
|
EXPECT_FALSE(ExportFormat::get_name(fmt).isEmpty()) << "Format " << i;
|
|
}
|
|
}
|
|
|
|
TEST(CodecExportFormat, AllFormatsHaveAtLeastOneCodecList)
|
|
{
|
|
using olive::ExportFormat;
|
|
|
|
for (int i = 0; i < ExportFormat::k_format_count; ++i) {
|
|
const auto fmt = static_cast<ExportFormat::Format>(i);
|
|
EXPECT_FALSE(ExportFormat::get_video_codecs(fmt).isEmpty() &&
|
|
ExportFormat::get_audio_codecs(fmt).isEmpty() &&
|
|
ExportFormat::get_subtitle_codecs(fmt).isEmpty())
|
|
<< "Format " << i;
|
|
}
|
|
}
|
|
|
|
TEST(CodecExportFormat, CodecLists)
|
|
{
|
|
using olive::ExportCodec;
|
|
using olive::ExportFormat;
|
|
|
|
const QList<ExportCodec::Codec> matroska_video =
|
|
ExportFormat::get_video_codecs(ExportFormat::k_format_matroska);
|
|
EXPECT_TRUE(matroska_video.contains(ExportCodec::k_codec_h264));
|
|
EXPECT_TRUE(matroska_video.contains(ExportCodec::k_codec_v_p9));
|
|
|
|
const QList<ExportCodec::Codec> ogg_audio =
|
|
ExportFormat::get_audio_codecs(ExportFormat::k_format_ogg);
|
|
EXPECT_TRUE(ogg_audio.contains(ExportCodec::k_codec_opus));
|
|
EXPECT_TRUE(ogg_audio.contains(ExportCodec::k_codec_vorbis));
|
|
|
|
const QList<ExportCodec::Codec> png_video =
|
|
ExportFormat::get_video_codecs(ExportFormat::k_format_png);
|
|
EXPECT_EQ(png_video, QList<ExportCodec::Codec>{ ExportCodec::k_codec_png });
|
|
|
|
const QList<ExportCodec::Codec> srt_subs =
|
|
ExportFormat::get_subtitle_codecs(ExportFormat::k_format_matroska);
|
|
EXPECT_EQ(srt_subs, QList<ExportCodec::Codec>{ ExportCodec::k_codec_srt });
|
|
|
|
const QList<ExportCodec::Codec> wav_audio =
|
|
ExportFormat::get_audio_codecs(ExportFormat::k_format_wav);
|
|
EXPECT_EQ(wav_audio, QList<ExportCodec::Codec>{ ExportCodec::k_codec_pcm });
|
|
}
|
|
|
|
TEST(CodecExportFormat, MPEG4ContainsH264AndAAC)
|
|
{
|
|
using olive::ExportCodec;
|
|
using olive::ExportFormat;
|
|
|
|
EXPECT_TRUE(ExportFormat::get_video_codecs(ExportFormat::k_format_mpe_g4_video)
|
|
.contains(ExportCodec::k_codec_h264));
|
|
EXPECT_TRUE(ExportFormat::get_audio_codecs(ExportFormat::k_format_mpe_g4_audio)
|
|
.contains(ExportCodec::k_codec_aac));
|
|
}
|