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:
@@ -15,21 +15,21 @@ namespace
|
||||
class LutLibraryConfigGuard {
|
||||
public:
|
||||
LutLibraryConfigGuard()
|
||||
: previous_(olive::Config::Current()[QStringLiteral("LUTLibraryPaths")]
|
||||
: previous_(olive::Config::current()[QStringLiteral("LUTLibraryPaths")]
|
||||
.toString())
|
||||
{
|
||||
}
|
||||
|
||||
~LutLibraryConfigGuard()
|
||||
{
|
||||
olive::Config::Current()[QStringLiteral("LUTLibraryPaths")] = previous_;
|
||||
olive::Config::current()[QStringLiteral("LUTLibraryPaths")] = previous_;
|
||||
}
|
||||
|
||||
private:
|
||||
QString previous_;
|
||||
};
|
||||
|
||||
QString WriteFile(const QString &path)
|
||||
QString write_file(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
@@ -49,16 +49,16 @@ TEST(LutFileField, PopulatesComboFromLibrary)
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
|
||||
const QString cube =
|
||||
WriteFile(QDir(dir.path()).filePath(QStringLiteral("a.cube")));
|
||||
write_file(QDir(dir.path()).filePath(QStringLiteral("a.cube")));
|
||||
const QString three_dl =
|
||||
WriteFile(QDir(dir.path()).filePath(QStringLiteral("b.3dl")));
|
||||
write_file(QDir(dir.path()).filePath(QStringLiteral("b.3dl")));
|
||||
const QString other =
|
||||
WriteFile(QDir(dir.path()).filePath(QStringLiteral("c.txt")));
|
||||
write_file(QDir(dir.path()).filePath(QStringLiteral("c.txt")));
|
||||
ASSERT_FALSE(cube.isEmpty());
|
||||
ASSERT_FALSE(three_dl.isEmpty());
|
||||
ASSERT_FALSE(other.isEmpty());
|
||||
|
||||
olive::LUTLibrary::SetDirectories({ dir.path() });
|
||||
olive::LUTLibrary::set_directories({ dir.path() });
|
||||
|
||||
olive::LutFileField field;
|
||||
|
||||
@@ -78,30 +78,30 @@ TEST(LutFileField, SelectionFollowsFilenameAndEmitsOnPick)
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
|
||||
const QString cube =
|
||||
WriteFile(QDir(dir.path()).filePath(QStringLiteral("a.cube")));
|
||||
write_file(QDir(dir.path()).filePath(QStringLiteral("a.cube")));
|
||||
ASSERT_FALSE(cube.isEmpty());
|
||||
|
||||
olive::LUTLibrary::SetDirectories({ dir.path() });
|
||||
olive::LUTLibrary::set_directories({ dir.path() });
|
||||
|
||||
olive::LutFileField field;
|
||||
|
||||
// A path that is not in the library shows the "Other" entry
|
||||
field.SetFilename(QStringLiteral("/custom/elsewhere.cube"));
|
||||
field.set_filename(QStringLiteral("/custom/elsewhere.cube"));
|
||||
EXPECT_EQ(field.library_combo()->currentIndex(), 0);
|
||||
|
||||
// A library path selects its entry
|
||||
field.SetFilename(cube);
|
||||
field.set_filename(cube);
|
||||
EXPECT_GT(field.library_combo()->currentIndex(), 0);
|
||||
|
||||
// Picking a library entry updates the filename and emits the change
|
||||
// signal so the parameter bridge applies it like any other edit
|
||||
field.SetFilename(QString());
|
||||
QSignalSpy spy(&field, &olive::FileField::FilenameChanged);
|
||||
field.set_filename(QString());
|
||||
QSignalSpy spy(&field, &olive::FileField::filename_changed);
|
||||
const int index = field.library_combo()->findData(cube);
|
||||
ASSERT_GE(index, 1);
|
||||
emit field.library_combo()->activated(index);
|
||||
|
||||
EXPECT_EQ(field.GetFilename(), cube);
|
||||
EXPECT_EQ(field.get_filename(), cube);
|
||||
ASSERT_EQ(spy.count(), 1);
|
||||
EXPECT_EQ(spy.first().first().toString(), cube);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user