style: unify identifier naming per updated conventions

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.
This commit is contained in:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+39 -39
View File
@@ -11,7 +11,7 @@
namespace
{
QString ImgPath()
QString img_path()
{
return QDir(QStringLiteral(OAK_TEST_SOURCE_DIR))
.filePath(QStringLiteral("tests/img.png"));
@@ -21,19 +21,19 @@ QString ImgPath()
TEST(CodecOIIO, ProbePngReportsStillImage)
{
olive::OIIODecoder decoder;
olive::FootageDescription desc = decoder.Probe(ImgPath(), nullptr);
olive::FootageDescription desc = decoder.probe(img_path(), nullptr);
ASSERT_TRUE(desc.IsValid());
ASSERT_TRUE(desc.is_valid());
EXPECT_EQ(desc.decoder(), QStringLiteral("oiio"));
EXPECT_EQ(desc.GetStreamCount(), 1);
EXPECT_EQ(desc.get_stream_count(), 1);
const QVector<olive::VideoParams> &streams = desc.GetVideoStreams();
const QVector<olive::VideoParams> &streams = desc.get_video_streams();
ASSERT_EQ(streams.size(), 1);
EXPECT_EQ(streams.first().width(), 1920);
EXPECT_EQ(streams.first().height(), 1080);
EXPECT_EQ(streams.first().format(), olive::core::PixelFormat::U8);
EXPECT_EQ(streams.first().format(), olive::core::PixelFormat::u8);
EXPECT_EQ(streams.first().channel_count(), 4);
EXPECT_EQ(streams.first().video_type(), olive::VideoParams::kVideoTypeStill);
EXPECT_EQ(streams.first().video_type(), olive::VideoParams::k_video_type_still);
EXPECT_EQ(streams.first().stream_index(), 0);
EXPECT_TRUE(streams.first().enabled());
}
@@ -42,36 +42,36 @@ TEST(CodecOIIO, ProbeUnsupportedExtensionReturnsInvalid)
{
olive::OIIODecoder decoder;
olive::FootageDescription desc =
decoder.Probe(QStringLiteral("nonexistent.zzz"), nullptr);
decoder.probe(QStringLiteral("nonexistent.zzz"), nullptr);
EXPECT_FALSE(desc.IsValid());
EXPECT_TRUE(desc.GetVideoStreams().isEmpty());
EXPECT_FALSE(desc.is_valid());
EXPECT_TRUE(desc.get_video_streams().isEmpty());
}
TEST(CodecOIIO, DecodePngFrame)
{
const QString path = ImgPath();
const QString path = img_path();
ASSERT_TRUE(QFileInfo::exists(path));
olive::DecoderPtr decoder =
olive::Decoder::CreateFromID(QStringLiteral("oiio"));
olive::Decoder::create_from_id(QStringLiteral("oiio"));
ASSERT_TRUE(decoder);
ASSERT_TRUE(decoder->Open(olive::Decoder::CodecStream(path, 0, nullptr)));
ASSERT_TRUE(decoder->open(olive::Decoder::CodecStream(path, 0, nullptr)));
olive::Decoder::RetrieveVideoParams params;
params.time = olive::core::rational(0);
params.time = olive::core::Rational(0);
params.divider = 1;
olive::FramePtr frame = decoder->RetrieveVideoFrame(params);
olive::FramePtr frame = decoder->retrieve_video_frame(params);
ASSERT_TRUE(frame);
ASSERT_TRUE(frame->is_allocated());
EXPECT_EQ(frame->width(), 1920);
EXPECT_EQ(frame->height(), 1080);
// Still images are always converted to F32 by OIIODecoder
EXPECT_EQ(frame->format(), olive::core::PixelFormat::F32);
EXPECT_EQ(frame->format(), olive::core::PixelFormat::f32);
EXPECT_EQ(frame->channel_count(), 4);
EXPECT_EQ(frame->timestamp(), olive::core::rational(0));
EXPECT_EQ(frame->timestamp(), olive::core::Rational(0));
EXPECT_GT(frame->allocated_size(), 0);
bool has_nonzero_byte = false;
@@ -84,29 +84,29 @@ TEST(CodecOIIO, DecodePngFrame)
}
EXPECT_TRUE(has_nonzero_byte);
decoder->Close();
decoder->close();
}
TEST(CodecOIIO, DecodeWithDividerHalvesResolution)
{
olive::DecoderPtr decoder =
olive::Decoder::CreateFromID(QStringLiteral("oiio"));
olive::Decoder::create_from_id(QStringLiteral("oiio"));
ASSERT_TRUE(decoder);
ASSERT_TRUE(
decoder->Open(olive::Decoder::CodecStream(ImgPath(), 0, nullptr)));
decoder->open(olive::Decoder::CodecStream(img_path(), 0, nullptr)));
olive::Decoder::RetrieveVideoParams params;
params.time = olive::core::rational(0);
params.time = olive::core::Rational(0);
params.divider = 2;
olive::FramePtr frame = decoder->RetrieveVideoFrame(params);
olive::FramePtr frame = decoder->retrieve_video_frame(params);
ASSERT_TRUE(frame);
ASSERT_TRUE(frame->is_allocated());
EXPECT_EQ(frame->width(), 960);
EXPECT_EQ(frame->height(), 540);
decoder->Close();
decoder->close();
}
TEST(CodecOIIO, EncodePngAndDecodeBack)
@@ -119,16 +119,16 @@ TEST(CodecOIIO, EncodePngAndDecodeBack)
const int height = 32;
olive::EncodingParams params;
params.SetFilename(path);
params.EnableVideo(
olive::VideoParams(width, height, olive::core::PixelFormat::U8,
olive::VideoParams::kRGBAChannelCount),
olive::ExportCodec::kCodecPNG);
params.set_filename(path);
params.enable_video(
olive::VideoParams(width, height, olive::core::PixelFormat::u8,
olive::VideoParams::k_rgba_channel_count),
olive::ExportCodec::k_codec_png);
olive::OIIOEncoder encoder(params);
ASSERT_TRUE(encoder.Open());
ASSERT_TRUE(encoder.open());
olive::FramePtr frame = olive::Frame::Create();
olive::FramePtr frame = olive::Frame::create();
frame->set_video_params(params.video_params());
ASSERT_TRUE(frame->allocate());
for (int y = 0; y < height; y++) {
@@ -142,22 +142,22 @@ TEST(CodecOIIO, EncodePngAndDecodeBack)
}
}
EXPECT_TRUE(encoder.WriteFrame(frame, olive::core::rational(0)));
encoder.Close();
EXPECT_TRUE(encoder.write_frame(frame, olive::core::Rational(0)));
encoder.close();
ASSERT_TRUE(QFileInfo::exists(path));
// Decode the file we just wrote and verify dimensions and pixels
olive::DecoderPtr decoder =
olive::Decoder::CreateFromID(QStringLiteral("oiio"));
olive::Decoder::create_from_id(QStringLiteral("oiio"));
ASSERT_TRUE(decoder);
ASSERT_TRUE(decoder->Open(olive::Decoder::CodecStream(path, 0, nullptr)));
ASSERT_TRUE(decoder->open(olive::Decoder::CodecStream(path, 0, nullptr)));
olive::Decoder::RetrieveVideoParams rp;
rp.time = olive::core::rational(0);
rp.time = olive::core::Rational(0);
rp.divider = 1;
olive::FramePtr back = decoder->RetrieveVideoFrame(rp);
olive::FramePtr back = decoder->retrieve_video_frame(rp);
ASSERT_TRUE(back);
EXPECT_EQ(back->width(), width);
EXPECT_EQ(back->height(), height);
@@ -170,7 +170,7 @@ TEST(CodecOIIO, EncodePngAndDecodeBack)
EXPECT_NEAR(c.blue(), 200.0f / 255.0f, eps);
EXPECT_NEAR(c.alpha(), 1.0f, eps);
decoder->Close();
decoder->close();
}
TEST(CodecOIIO, EncoderRejectsAudioAndSubtitles)
@@ -179,6 +179,6 @@ TEST(CodecOIIO, EncoderRejectsAudioAndSubtitles)
olive::OIIOEncoder encoder(params);
olive::SampleBuffer buffer;
EXPECT_FALSE(encoder.WriteAudio(buffer));
EXPECT_FALSE(encoder.WriteSubtitle(nullptr));
EXPECT_FALSE(encoder.write_audio(buffer));
EXPECT_FALSE(encoder.write_subtitle(nullptr));
}