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
+37 -37
View File
@@ -11,17 +11,17 @@ TEST(CommonOIIOUtils, BaseTypeFromPixelFormat)
{
using olive::core::PixelFormat;
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::U8),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::u8),
OIIO::TypeDesc::UINT8);
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::U16),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::u16),
OIIO::TypeDesc::UINT16);
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::F16),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::f16),
OIIO::TypeDesc::HALF);
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::F32),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::f32),
OIIO::TypeDesc::FLOAT);
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::U10),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::u10),
OIIO::TypeDesc::UNKNOWN);
EXPECT_EQ(olive::OIIOUtils::GetOIIOBaseTypeFromFormat(PixelFormat::INVALID),
EXPECT_EQ(olive::OIIOUtils::get_oiio_base_type_from_format(PixelFormat::invalid),
OIIO::TypeDesc::UNKNOWN);
}
@@ -29,22 +29,22 @@ TEST(CommonOIIOUtils, PixelFormatFromBaseType)
{
using olive::core::PixelFormat;
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::UINT8),
PixelFormat::U8);
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::UINT8),
PixelFormat::u8);
EXPECT_EQ(
olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::UINT16),
PixelFormat::U16);
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::HALF),
PixelFormat::F16);
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::FLOAT),
PixelFormat::F32);
olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::UINT16),
PixelFormat::u16);
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::HALF),
PixelFormat::f16);
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::FLOAT),
PixelFormat::f32);
EXPECT_EQ(
olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::UNKNOWN),
PixelFormat::INVALID);
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::DOUBLE),
PixelFormat::INVALID);
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(OIIO::TypeDesc::STRING),
PixelFormat::INVALID);
olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::UNKNOWN),
PixelFormat::invalid);
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::DOUBLE),
PixelFormat::invalid);
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(OIIO::TypeDesc::STRING),
PixelFormat::invalid);
}
TEST(CommonOIIOUtils, FormatRoundTripIsSymmetric)
@@ -52,10 +52,10 @@ TEST(CommonOIIOUtils, FormatRoundTripIsSymmetric)
using olive::core::PixelFormat;
for (PixelFormat fmt :
{ PixelFormat::U8, PixelFormat::U16, PixelFormat::F16,
PixelFormat::F32 }) {
EXPECT_EQ(olive::OIIOUtils::GetFormatFromOIIOBasetype(
olive::OIIOUtils::GetOIIOBaseTypeFromFormat(fmt)),
{ PixelFormat::u8, PixelFormat::u16, PixelFormat::f16,
PixelFormat::f32 }) {
EXPECT_EQ(olive::OIIOUtils::get_format_from_oiio_basetype(
olive::OIIOUtils::get_oiio_base_type_from_format(fmt)),
fmt);
}
}
@@ -64,10 +64,10 @@ TEST(CommonOIIOUtils, PixelAspectRatioDefaultsToOne)
{
OIIO::ImageSpec spec(16, 16, 4, OIIO::TypeDesc::FLOAT);
const olive::core::rational par =
olive::OIIOUtils::GetPixelAspectRatioFromOIIO(spec);
const olive::core::Rational par =
olive::OIIOUtils::get_pixel_aspect_ratio_from_oiio(spec);
EXPECT_EQ(par, olive::core::rational(1, 1));
EXPECT_EQ(par, olive::core::Rational(1, 1));
}
TEST(CommonOIIOUtils, PixelAspectRatioIsReadFromAttribute)
@@ -75,20 +75,20 @@ TEST(CommonOIIOUtils, PixelAspectRatioIsReadFromAttribute)
OIIO::ImageSpec spec(16, 16, 4, OIIO::TypeDesc::FLOAT);
spec.attribute("PixelAspectRatio", 2.0f);
const olive::core::rational par =
olive::OIIOUtils::GetPixelAspectRatioFromOIIO(spec);
const olive::core::Rational par =
olive::OIIOUtils::get_pixel_aspect_ratio_from_oiio(spec);
EXPECT_EQ(par, olive::core::rational(2, 1));
EXPECT_EQ(par, olive::core::Rational(2, 1));
}
TEST(CommonOIIOUtils, FrameBufferRoundTripPreservesPixels)
{
using olive::core::PixelFormat;
const olive::VideoParams params(8, 8, PixelFormat::F32,
olive::VideoParams::kRGBAChannelCount);
const olive::VideoParams params(8, 8, PixelFormat::f32,
olive::VideoParams::k_rgba_channel_count);
auto frame = olive::Frame::Create();
auto frame = olive::Frame::create();
frame->set_video_params(params);
frame->allocate();
@@ -97,20 +97,20 @@ TEST(CommonOIIOUtils, FrameBufferRoundTripPreservesPixels)
OIIO::ImageSpec spec(params.effective_width(), params.effective_height(),
params.channel_count(),
olive::OIIOUtils::GetOIIOBaseTypeFromFormat(
olive::OIIOUtils::get_oiio_base_type_from_format(
params.format()));
OIIO::ImageBuf buf(spec);
ASSERT_TRUE(buf.initialized());
olive::OIIOUtils::FrameToBuffer(frame.get(), &buf);
olive::OIIOUtils::frame_to_buffer(frame.get(), &buf);
auto out = olive::Frame::Create();
auto out = olive::Frame::create();
out->set_video_params(params);
out->allocate();
// Poison the output so a failed transfer is visible.
std::memset(out->data(), 0xFF, out->allocated_size());
olive::OIIOUtils::BufferToFrame(&buf, out.get());
olive::OIIOUtils::buffer_to_frame(&buf, out.get());
const olive::Color a = out->get_pixel(0, 0);
EXPECT_NEAR(a.red(), 0.1f, 1e-5f);