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:
@@ -12,7 +12,7 @@ namespace
|
||||
// Collects qDebug/qWarning/qCritical output for inspection
|
||||
QStringList g_captured_messages;
|
||||
|
||||
void CaptureMessageHandler(QtMsgType, const QMessageLogContext &,
|
||||
void capture_message_handler(QtMsgType, const QMessageLogContext &,
|
||||
const QString &msg)
|
||||
{
|
||||
g_captured_messages.append(msg);
|
||||
@@ -22,19 +22,19 @@ void CaptureMessageHandler(QtMsgType, const QMessageLogContext &,
|
||||
|
||||
TEST(CommonFileFunctions, EnsureFilenameExtension)
|
||||
{
|
||||
EXPECT_EQ(olive::FileFunctions::EnsureFilenameExtension(
|
||||
EXPECT_EQ(olive::FileFunctions::ensure_filename_extension(
|
||||
QStringLiteral("project"), QStringLiteral("ove")),
|
||||
QStringLiteral("project.ove"));
|
||||
EXPECT_EQ(olive::FileFunctions::EnsureFilenameExtension(
|
||||
EXPECT_EQ(olive::FileFunctions::ensure_filename_extension(
|
||||
QStringLiteral("project.ove"), QStringLiteral("ove")),
|
||||
QStringLiteral("project.ove"));
|
||||
EXPECT_EQ(olive::FileFunctions::EnsureFilenameExtension(
|
||||
EXPECT_EQ(olive::FileFunctions::ensure_filename_extension(
|
||||
QStringLiteral("PROJECT"), QStringLiteral("ove")),
|
||||
QStringLiteral("PROJECT.ove"));
|
||||
EXPECT_TRUE(olive::FileFunctions::EnsureFilenameExtension(
|
||||
EXPECT_TRUE(olive::FileFunctions::ensure_filename_extension(
|
||||
QString(), QStringLiteral("ove"))
|
||||
.isEmpty());
|
||||
EXPECT_EQ(olive::FileFunctions::EnsureFilenameExtension(
|
||||
EXPECT_EQ(olive::FileFunctions::ensure_filename_extension(
|
||||
QStringLiteral("project"), QString()),
|
||||
QStringLiteral("project"));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ TEST(CommonFileFunctions, GetSafeTemporaryFilename)
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
|
||||
QString base = dir.filePath(QStringLiteral("test.ove"));
|
||||
QString first = olive::FileFunctions::GetSafeTemporaryFilename(base);
|
||||
QString first = olive::FileFunctions::get_safe_temporary_filename(base);
|
||||
EXPECT_FALSE(QFileInfo::exists(first));
|
||||
EXPECT_TRUE(first.contains(QStringLiteral(".tmp0.")));
|
||||
|
||||
@@ -53,7 +53,7 @@ TEST(CommonFileFunctions, GetSafeTemporaryFilename)
|
||||
f.open(QIODevice::WriteOnly);
|
||||
f.close();
|
||||
|
||||
QString second = olive::FileFunctions::GetSafeTemporaryFilename(base);
|
||||
QString second = olive::FileFunctions::get_safe_temporary_filename(base);
|
||||
EXPECT_NE(first, second);
|
||||
EXPECT_TRUE(second.contains(QStringLiteral(".tmp1.")));
|
||||
}
|
||||
@@ -64,10 +64,10 @@ TEST(CommonFileFunctions, DirectoryIsValid)
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
|
||||
EXPECT_TRUE(
|
||||
olive::FileFunctions::DirectoryIsValid(QDir(dir.path()), false));
|
||||
olive::FileFunctions::directory_is_valid(QDir(dir.path()), false));
|
||||
|
||||
QDir nonexistent(dir.filePath(QStringLiteral("subdir/nested")));
|
||||
EXPECT_TRUE(olive::FileFunctions::DirectoryIsValid(nonexistent, true));
|
||||
EXPECT_TRUE(olive::FileFunctions::directory_is_valid(nonexistent, true));
|
||||
EXPECT_TRUE(nonexistent.exists());
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ TEST(CommonFileFunctions, RenameFileAllowOverwrite)
|
||||
t.write("existing");
|
||||
t.close();
|
||||
|
||||
EXPECT_TRUE(olive::FileFunctions::RenameFileAllowOverwrite(from, to));
|
||||
EXPECT_TRUE(olive::FileFunctions::rename_file_allow_overwrite(from, to));
|
||||
EXPECT_FALSE(QFileInfo::exists(from));
|
||||
QFile result(to);
|
||||
result.open(QIODevice::ReadOnly);
|
||||
@@ -108,7 +108,7 @@ TEST(CommonFileFunctions, CanCopyDirectoryWithoutOverwriting)
|
||||
f.open(QIODevice::WriteOnly);
|
||||
f.close();
|
||||
|
||||
EXPECT_TRUE(olive::FileFunctions::CanCopyDirectoryWithoutOverwriting(
|
||||
EXPECT_TRUE(olive::FileFunctions::can_copy_directory_without_overwriting(
|
||||
src.path(), dst.path()));
|
||||
|
||||
QString dst_file = QDir(dst.path()).filePath(QStringLiteral("file.txt"));
|
||||
@@ -116,7 +116,7 @@ TEST(CommonFileFunctions, CanCopyDirectoryWithoutOverwriting)
|
||||
g.open(QIODevice::WriteOnly);
|
||||
g.close();
|
||||
|
||||
EXPECT_FALSE(olive::FileFunctions::CanCopyDirectoryWithoutOverwriting(
|
||||
EXPECT_FALSE(olive::FileFunctions::can_copy_directory_without_overwriting(
|
||||
src.path(), dst.path()));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ TEST(CommonFileFunctions, CopyDirectory)
|
||||
f.close();
|
||||
|
||||
QString dst_dir = QDir(dst.path()).filePath(QStringLiteral("copied"));
|
||||
olive::FileFunctions::CopyDirectory(src.path(), dst_dir, false);
|
||||
olive::FileFunctions::copy_directory(src.path(), dst_dir, false);
|
||||
|
||||
QFile result(QDir(dst_dir).filePath(QStringLiteral("file.txt")));
|
||||
EXPECT_TRUE(result.open(QIODevice::ReadOnly));
|
||||
@@ -148,9 +148,9 @@ TEST(CommonFileFunctions, ReadFileAsString)
|
||||
f.write("hello world");
|
||||
f.close();
|
||||
|
||||
EXPECT_EQ(olive::FileFunctions::ReadFileAsString(f.fileName()),
|
||||
EXPECT_EQ(olive::FileFunctions::read_file_as_string(f.fileName()),
|
||||
QStringLiteral("hello world"));
|
||||
EXPECT_TRUE(olive::FileFunctions::ReadFileAsString(
|
||||
EXPECT_TRUE(olive::FileFunctions::read_file_as_string(
|
||||
QStringLiteral("/nonexistent/path"))
|
||||
.isEmpty());
|
||||
}
|
||||
@@ -161,33 +161,33 @@ TEST(CommonFileFunctions, GetUniqueFileIdentifier)
|
||||
ASSERT_TRUE(f.open());
|
||||
f.close();
|
||||
|
||||
QString id1 = olive::FileFunctions::GetUniqueFileIdentifier(f.fileName());
|
||||
QString id2 = olive::FileFunctions::GetUniqueFileIdentifier(f.fileName());
|
||||
QString id1 = olive::FileFunctions::get_unique_file_identifier(f.fileName());
|
||||
QString id2 = olive::FileFunctions::get_unique_file_identifier(f.fileName());
|
||||
EXPECT_FALSE(id1.isEmpty());
|
||||
EXPECT_EQ(id1, id2);
|
||||
|
||||
EXPECT_TRUE(olive::FileFunctions::GetUniqueFileIdentifier(
|
||||
EXPECT_TRUE(olive::FileFunctions::get_unique_file_identifier(
|
||||
QStringLiteral("/nonexistent"))
|
||||
.isEmpty());
|
||||
}
|
||||
|
||||
TEST(CommonFileFunctions, GetConfigurationLocation)
|
||||
{
|
||||
QString loc = olive::FileFunctions::GetConfigurationLocation();
|
||||
QString loc = olive::FileFunctions::get_configuration_location();
|
||||
EXPECT_FALSE(loc.isEmpty());
|
||||
EXPECT_TRUE(QDir(loc).exists());
|
||||
}
|
||||
|
||||
TEST(CommonFileFunctions, GetTempFilePath)
|
||||
{
|
||||
QString temp = olive::FileFunctions::GetTempFilePath();
|
||||
QString temp = olive::FileFunctions::get_temp_file_path();
|
||||
EXPECT_FALSE(temp.isEmpty());
|
||||
EXPECT_TRUE(QDir(temp).exists());
|
||||
}
|
||||
|
||||
TEST(CommonFileFunctions, GetAutoRecoveryRoot)
|
||||
{
|
||||
QString root = olive::FileFunctions::GetAutoRecoveryRoot();
|
||||
QString root = olive::FileFunctions::get_auto_recovery_root();
|
||||
EXPECT_FALSE(root.isEmpty());
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ TEST(CommonFileFunctions, DirectoryIsValidExisting)
|
||||
QTemporaryDir dir;
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
EXPECT_TRUE(
|
||||
olive::FileFunctions::DirectoryIsValid(QDir(dir.path()), false));
|
||||
olive::FileFunctions::directory_is_valid(QDir(dir.path()), false));
|
||||
}
|
||||
|
||||
TEST(CommonFileFunctions, CopyDirectoryWithOverwrite)
|
||||
@@ -218,7 +218,7 @@ TEST(CommonFileFunctions, CopyDirectoryWithOverwrite)
|
||||
g.write("old content");
|
||||
g.close();
|
||||
|
||||
olive::FileFunctions::CopyDirectory(src.path(), dst.path(), true);
|
||||
olive::FileFunctions::copy_directory(src.path(), dst.path(), true);
|
||||
|
||||
QFile result(dst_file);
|
||||
result.open(QIODevice::ReadOnly);
|
||||
@@ -233,8 +233,8 @@ TEST(CommonFileFunctions, CopyDirectorySourceMissing)
|
||||
// A missing source must log a critical error naming the source and
|
||||
// leave the destination untouched
|
||||
g_captured_messages.clear();
|
||||
QtMessageHandler old = qInstallMessageHandler(CaptureMessageHandler);
|
||||
olive::FileFunctions::CopyDirectory(QStringLiteral("/nonexistent/path"),
|
||||
QtMessageHandler old = qInstallMessageHandler(capture_message_handler);
|
||||
olive::FileFunctions::copy_directory(QStringLiteral("/nonexistent/path"),
|
||||
dst.path(), false);
|
||||
qInstallMessageHandler(old);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user