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
+50 -50
View File
@@ -5,96 +5,96 @@
TEST(TimelineCoordinate, DefaultAndSetters)
{
olive::TimelineCoordinate coord;
EXPECT_EQ(coord.GetTrack().type(), olive::Track::kNone);
EXPECT_EQ(coord.GetTrack().index(), 0);
EXPECT_EQ(coord.get_track().type(), olive::Track::k_none);
EXPECT_EQ(coord.get_track().index(), 0);
const olive::core::rational frame(10, 1);
olive::Track::Reference ref(olive::Track::kVideo, 2);
const olive::core::Rational frame(10, 1);
olive::Track::Reference ref(olive::Track::k_video, 2);
coord.SetFrame(frame);
coord.SetTrack(ref);
coord.set_frame(frame);
coord.set_track(ref);
EXPECT_EQ(coord.GetFrame(), frame);
EXPECT_EQ(coord.GetTrack(), ref);
EXPECT_EQ(coord.get_frame(), frame);
EXPECT_EQ(coord.get_track(), ref);
}
TEST(TimelineCoordinate, Constructors)
{
const olive::core::rational frame(5, 1);
olive::Track::Reference ref(olive::Track::kAudio, 1);
const olive::core::Rational frame(5, 1);
olive::Track::Reference ref(olive::Track::k_audio, 1);
olive::TimelineCoordinate with_ref(frame, ref);
EXPECT_EQ(with_ref.GetFrame(), frame);
EXPECT_EQ(with_ref.GetTrack(), ref);
EXPECT_EQ(with_ref.get_frame(), frame);
EXPECT_EQ(with_ref.get_track(), ref);
olive::TimelineCoordinate with_type(frame, olive::Track::kSubtitle, 3);
EXPECT_EQ(with_type.GetFrame(), frame);
EXPECT_EQ(with_type.GetTrack().type(), olive::Track::kSubtitle);
EXPECT_EQ(with_type.GetTrack().index(), 3);
olive::TimelineCoordinate with_type(frame, olive::Track::k_subtitle, 3);
EXPECT_EQ(with_type.get_frame(), frame);
EXPECT_EQ(with_type.get_track().type(), olive::Track::k_subtitle);
EXPECT_EQ(with_type.get_track().index(), 3);
}
TEST(TimelineCoordinate, CopyAndAssignment)
{
const olive::core::rational frame(7, 1);
olive::Track::Reference ref(olive::Track::kVideo, 4);
const olive::core::Rational frame(7, 1);
olive::Track::Reference ref(olive::Track::k_video, 4);
olive::TimelineCoordinate original(frame, ref);
olive::TimelineCoordinate copy(original);
EXPECT_EQ(copy.GetFrame(), frame);
EXPECT_EQ(copy.GetTrack(), ref);
EXPECT_EQ(copy.get_frame(), frame);
EXPECT_EQ(copy.get_track(), ref);
olive::TimelineCoordinate assigned;
assigned = original;
EXPECT_EQ(assigned.GetFrame(), frame);
EXPECT_EQ(assigned.GetTrack(), ref);
EXPECT_EQ(assigned.get_frame(), frame);
EXPECT_EQ(assigned.get_track(), ref);
}
TEST(TimelineCoordinate, Equality)
{
// TimelineCoordinate provides no operator== of its own; equality is
// observable through the real operators of its components (rational and
// observable through the real operators of its components (Rational and
// Track::Reference)
const olive::TimelineCoordinate a(
olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
olive::core::Rational(5, 1),
olive::Track::Reference(olive::Track::k_video, 1));
// Distinct objects with identical frame and track compare equal in both
// components
const olive::TimelineCoordinate b(
olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
EXPECT_TRUE(a.GetFrame() == b.GetFrame());
EXPECT_TRUE(a.GetTrack() == b.GetTrack());
EXPECT_FALSE(a.GetFrame() != b.GetFrame());
EXPECT_FALSE(a.GetTrack() != b.GetTrack());
olive::core::Rational(5, 1),
olive::Track::Reference(olive::Track::k_video, 1));
EXPECT_TRUE(a.get_frame() == b.get_frame());
EXPECT_TRUE(a.get_track() == b.get_track());
EXPECT_FALSE(a.get_frame() != b.get_frame());
EXPECT_FALSE(a.get_track() != b.get_track());
// A different frame breaks frame equality while the track stays equal
const olive::TimelineCoordinate c(
olive::core::rational(6, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
EXPECT_FALSE(a.GetFrame() == c.GetFrame());
EXPECT_TRUE(a.GetFrame() != c.GetFrame());
EXPECT_TRUE(a.GetTrack() == c.GetTrack());
olive::core::Rational(6, 1),
olive::Track::Reference(olive::Track::k_video, 1));
EXPECT_FALSE(a.get_frame() == c.get_frame());
EXPECT_TRUE(a.get_frame() != c.get_frame());
EXPECT_TRUE(a.get_track() == c.get_track());
// A different track type or index breaks track equality while the frame
// stays equal
const olive::TimelineCoordinate d(
olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kAudio, 1));
olive::core::Rational(5, 1),
olive::Track::Reference(olive::Track::k_audio, 1));
const olive::TimelineCoordinate e(
olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kVideo, 2));
EXPECT_TRUE(a.GetTrack() != d.GetTrack());
EXPECT_FALSE(a.GetTrack() == d.GetTrack());
EXPECT_TRUE(a.GetTrack() != e.GetTrack());
EXPECT_TRUE(a.GetFrame() == d.GetFrame());
EXPECT_TRUE(a.GetFrame() == e.GetFrame());
olive::core::Rational(5, 1),
olive::Track::Reference(olive::Track::k_video, 2));
EXPECT_TRUE(a.get_track() != d.get_track());
EXPECT_FALSE(a.get_track() == d.get_track());
EXPECT_TRUE(a.get_track() != e.get_track());
EXPECT_TRUE(a.get_frame() == d.get_frame());
EXPECT_TRUE(a.get_frame() == e.get_frame());
// Mutating a copy breaks equality with the original
olive::TimelineCoordinate mutated = a;
mutated.SetFrame(olive::core::rational(7, 1));
EXPECT_TRUE(mutated.GetFrame() != a.GetFrame());
mutated.SetFrame(olive::core::rational(5, 1));
mutated.SetTrack(olive::Track::Reference(olive::Track::kSubtitle, 0));
EXPECT_TRUE(mutated.GetTrack() != a.GetTrack());
mutated.set_frame(olive::core::Rational(7, 1));
EXPECT_TRUE(mutated.get_frame() != a.get_frame());
mutated.set_frame(olive::core::Rational(5, 1));
mutated.set_track(olive::Track::Reference(olive::Track::k_subtitle, 0));
EXPECT_TRUE(mutated.get_track() != a.get_track());
}