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
+229 -229
View File
@@ -60,7 +60,7 @@ class PanelEnvironment {
public:
PanelEnvironment()
{
ColorManager::SetUpDefaultConfig();
ColorManager::set_up_default_config();
if (!Core::instance()) {
new Core(Core::CoreParams()); // intentionally leaked
@@ -69,12 +69,12 @@ public:
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
if (!PanelManager::instance()) {
PanelManager::CreateInstance();
PanelManager::create_instance();
created_panel_manager_ = true;
}
if (!TaskManager::instance()) {
TaskManager::CreateInstance();
TaskManager::create_instance();
created_task_manager_ = true;
}
@@ -82,15 +82,15 @@ public:
// Another suite may have left an experimental backend in the
// config; RenderManager needs a real one to create its cacher
saved_backend_ =
Config::Current()[QStringLiteral("GraphicsBackend")];
Config::Current()[QStringLiteral("GraphicsBackend")] =
Config::current()[QStringLiteral("GraphicsBackend")];
Config::current()[QStringLiteral("GraphicsBackend")] =
QStringLiteral("opengl");
RenderManager::CreateInstance();
RenderManager::create_instance();
created_render_manager_ = true;
}
if (!DiskManager::instance()) {
DiskManager::CreateInstance();
DiskManager::create_instance();
created_disk_manager_ = true;
}
}
@@ -99,19 +99,19 @@ public:
{
// Panels must be gone before the manager that tracks them
if (created_panel_manager_) {
PanelManager::instance()->DeleteAllPanels();
PanelManager::DestroyInstance();
PanelManager::instance()->delete_all_panels();
PanelManager::destroy_instance();
}
if (created_task_manager_) {
TaskManager::DestroyInstance();
TaskManager::destroy_instance();
}
if (created_render_manager_) {
RenderManager::DestroyInstance();
Config::Current()[QStringLiteral("GraphicsBackend")] =
RenderManager::destroy_instance();
Config::current()[QStringLiteral("GraphicsBackend")] =
saved_backend_;
}
if (created_disk_manager_) {
DiskManager::DestroyInstance();
DiskManager::destroy_instance();
}
}
@@ -131,13 +131,13 @@ public:
{
}
using PanelWidget::SetSubtitle;
using PanelWidget::SetTitle;
using PanelWidget::set_subtitle;
using PanelWidget::set_title;
};
class TestTimeBasedPanel : public TimeBasedPanel {
public:
using TimeBasedPanel::SetTimeBasedWidget;
using TimeBasedPanel::set_time_based_widget;
using TimeBasedPanel::TimeBasedPanel;
};
@@ -145,11 +145,11 @@ class DummyTask : public Task {
public:
DummyTask()
{
SetTitle(QStringLiteral("Panel Test Task"));
set_title(QStringLiteral("Panel Test Task"));
}
protected:
virtual bool Run() override
virtual bool run() override
{
return true;
}
@@ -169,7 +169,7 @@ protected:
delete env_;
}
template <typename T> T *AddNode(Project *project)
template <typename T> T *add_node(Project *project)
{
auto *node = new T();
node->setParent(project);
@@ -184,14 +184,14 @@ TEST_F(PanelTest, PanelWidgetBaseTitleSubtitleFormatting)
TestPanel panel(QStringLiteral("BaseTestPanel"));
EXPECT_EQ(panel.objectName(), QStringLiteral("BaseTestPanel"));
panel.SetTitle(QStringLiteral("Title"));
panel.set_title(QStringLiteral("Title"));
EXPECT_EQ(panel.title(), QStringLiteral("Title"));
panel.SetSubtitle(QStringLiteral("Sub"));
panel.set_subtitle(QStringLiteral("Sub"));
EXPECT_EQ(panel.title(), QStringLiteral("Title: Sub"));
// Clearing the subtitle falls back to the bare title
panel.SetSubtitle(QString());
panel.set_subtitle(QString());
EXPECT_EQ(panel.title(), QStringLiteral("Title"));
}
@@ -203,13 +203,13 @@ TEST_F(PanelTest, PanelWidgetBaseRegistersWithPanelManager)
auto *panel = new TestPanel(QStringLiteral("RegisteredPanel"));
EXPECT_TRUE(manager->panels().contains(panel));
EXPECT_EQ(manager->panels().size(), panel_count_before + 1);
EXPECT_EQ(manager->GetPanelWithName(QStringLiteral("RegisteredPanel")),
EXPECT_EQ(manager->get_panel_with_name(QStringLiteral("RegisteredPanel")),
panel);
EXPECT_TRUE(manager->GetPanelsOfType<TestPanel>().contains(panel));
EXPECT_TRUE(manager->get_panels_of_type<TestPanel>().contains(panel));
delete panel;
EXPECT_FALSE(manager->panels().contains(panel));
EXPECT_EQ(manager->GetPanelWithName(QStringLiteral("RegisteredPanel")),
EXPECT_EQ(manager->get_panel_with_name(QStringLiteral("RegisteredPanel")),
nullptr);
}
@@ -225,8 +225,8 @@ TEST_F(PanelTest, PanelWidgetBaseCloseBehavior)
// With SetSignalInsteadOfClose the close is vetoed and CloseRequested is
// emitted instead
panel.SetSignalInsteadOfClose(true);
QSignalSpy spy(&panel, &PanelWidget::CloseRequested);
panel.set_signal_instead_of_close(true);
QSignalSpy spy(&panel, &PanelWidget::close_requested);
panel.show();
ASSERT_TRUE(panel.isVisible());
panel.close();
@@ -237,77 +237,77 @@ TEST_F(PanelTest, PanelWidgetBaseCloseBehavior)
TEST_F(PanelTest, PanelWidgetBaseDefaultActionsLeaveStateUnchanged)
{
TestPanel panel(QStringLiteral("NoOpTestPanel"));
panel.SetTitle(QStringLiteral("NoOp"));
panel.set_title(QStringLiteral("NoOp"));
panel.show();
ASSERT_TRUE(panel.isVisible());
// Default SaveData is empty and LoadData accepts anything
EXPECT_TRUE(panel.SaveData().empty());
panel.LoadData(PanelWidget::Info());
EXPECT_TRUE(panel.save_data().empty());
panel.load_data(PanelWidget::Info());
// None of the default actions may request a close
QSignalSpy close_spy(&panel, &PanelWidget::CloseRequested);
QSignalSpy close_spy(&panel, &PanelWidget::close_requested);
// All default actions are no-ops and must not crash
panel.ZoomIn();
panel.ZoomOut();
panel.GoToStart();
panel.PrevFrame();
panel.PlayPause();
panel.PlayInToOut();
panel.NextFrame();
panel.GoToEnd();
panel.SelectAll();
panel.DeselectAll();
panel.RippleToIn();
panel.RippleToOut();
panel.EditToIn();
panel.EditToOut();
panel.ShuttleLeft();
panel.ShuttleStop();
panel.ShuttleRight();
panel.GoToPrevCut();
panel.GoToNextCut();
panel.RenameSelected();
panel.DeleteSelected();
panel.RippleDelete();
panel.IncreaseTrackHeight();
panel.DecreaseTrackHeight();
panel.SetIn();
panel.SetOut();
panel.ResetIn();
panel.ResetOut();
panel.ClearInOut();
panel.SetMarker();
panel.ToggleLinks();
panel.CutSelected();
panel.CopySelected();
panel.Paste();
panel.PasteInsert();
panel.ToggleShowAll();
panel.GoToIn();
panel.GoToOut();
panel.DeleteInToOut();
panel.RippleDeleteInToOut();
panel.ToggleSelectedEnabled();
panel.Duplicate();
panel.SetColorLabel(1);
panel.NudgeLeft();
panel.NudgeRight();
panel.MoveInToPlayhead();
panel.MoveOutToPlayhead();
panel.zoom_in();
panel.zoom_out();
panel.go_to_start();
panel.prev_frame();
panel.play_pause();
panel.play_in_to_out();
panel.next_frame();
panel.go_to_end();
panel.select_all();
panel.deselect_all();
panel.ripple_to_in();
panel.ripple_to_out();
panel.edit_to_in();
panel.edit_to_out();
panel.shuttle_left();
panel.shuttle_stop();
panel.shuttle_right();
panel.go_to_prev_cut();
panel.go_to_next_cut();
panel.rename_selected();
panel.delete_selected();
panel.ripple_delete();
panel.increase_track_height();
panel.decrease_track_height();
panel.set_in();
panel.set_out();
panel.reset_in();
panel.reset_out();
panel.clear_in_out();
panel.set_marker();
panel.toggle_links();
panel.cut_selected();
panel.copy_selected();
panel.paste();
panel.paste_insert();
panel.toggle_show_all();
panel.go_to_in();
panel.go_to_out();
panel.delete_in_to_out();
panel.ripple_delete_in_to_out();
panel.toggle_selected_enabled();
panel.duplicate();
panel.set_color_label(1);
panel.nudge_left();
panel.nudge_right();
panel.move_in_to_playhead();
panel.move_out_to_playhead();
// The sweep must not have altered any observable panel state
EXPECT_EQ(panel.title(), QStringLiteral("NoOp"));
EXPECT_TRUE(panel.isVisible());
EXPECT_TRUE(panel.SaveData().empty());
EXPECT_TRUE(panel.save_data().empty());
EXPECT_EQ(close_spy.count(), 0);
}
TEST_F(PanelTest, PanelWidgetBaseBorderAndFocus)
{
TestPanel panel(QStringLiteral("BorderTestPanel"));
panel.SetBorderVisible(true);
panel.set_border_visible(true);
panel.show();
// The shown signal is wired to grab focus
@@ -315,7 +315,7 @@ TEST_F(PanelTest, PanelWidgetBaseBorderAndFocus)
emit panel.hidden();
// Focus history lookup by type works through PanelManager
EXPECT_EQ(PanelManager::instance()->MostRecentlyFocused<TestPanel>(),
EXPECT_EQ(PanelManager::instance()->most_recently_focused<TestPanel>(),
&panel);
}
@@ -332,7 +332,7 @@ TEST_F(PanelTest, PixelSamplerPanelConstruction)
// Feeding values through the slot updates the displayed components
Color red(1.0, 0.0, 0.0, 1.0);
Color green(0.0, 1.0, 0.0, 1.0);
panel.SetValues(red, green);
panel.set_values(red, green);
// First child is the display view, second the reference view
EXPECT_TRUE(samplers.at(0)->findChild<QLabel *>()->text().contains(
@@ -353,14 +353,14 @@ TEST_F(PanelTest, TaskManagerPanelReflectsTaskManager)
// The panel's TaskView is wired to the TaskManager singleton
auto *task = new DummyTask();
TaskManager::instance()->AddTask(task);
TaskManager::instance()->add_task(task);
auto *view = panel.findChild<TaskView *>();
ASSERT_NE(view, nullptr);
EXPECT_NE(view->findChild<TaskViewItem *>(), nullptr);
// TaskManager owns the task now; cancel it and let the removal propagate
TaskManager::instance()->CancelTaskAndWait(task);
TaskManager::instance()->cancel_task_and_wait(task);
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
}
@@ -370,28 +370,28 @@ TEST_F(PanelTest, CurvePanelConstructionAndScaling)
CurvePanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("CurvePanel"));
EXPECT_TRUE(panel.title().startsWith(QStringLiteral("Curve Editor")));
ASSERT_NE(panel.GetTimeBasedWidget(), nullptr);
ASSERT_NE(panel.get_time_based_widget(), nullptr);
auto *curve = static_cast<CurveWidget *>(panel.GetTimeBasedWidget());
auto *curve = static_cast<CurveWidget *>(panel.get_time_based_widget());
// Track height actions scale the curve view vertically
const double initial_scale = curve->GetVerticalScale();
panel.IncreaseTrackHeight();
EXPECT_DOUBLE_EQ(curve->GetVerticalScale(), initial_scale * 2);
panel.DecreaseTrackHeight();
EXPECT_DOUBLE_EQ(curve->GetVerticalScale(), initial_scale);
const double initial_scale = curve->get_vertical_scale();
panel.increase_track_height();
EXPECT_DOUBLE_EQ(curve->get_vertical_scale(), initial_scale * 2);
panel.decrease_track_height();
EXPECT_DOUBLE_EQ(curve->get_vertical_scale(), initial_scale);
// Selection actions on an empty view are harmless
panel.SelectAll();
panel.DeselectAll();
panel.DeleteSelected();
panel.select_all();
panel.deselect_all();
panel.delete_selected();
}
TEST_F(PanelTest, CurvePanelSetNodes)
{
Project project;
project.Initialize();
auto *math = AddNode<MathNode>(&project);
project.initialize();
auto *math = add_node<MathNode>(&project);
CurvePanel panel;
auto *tree = panel.findChild<NodeTreeView *>();
@@ -401,76 +401,76 @@ TEST_F(PanelTest, CurvePanelSetNodes)
// A single node appears as one top-level item listing its keyframable
// inputs (MathNode has three: the base "enabled" input and parameters
// A and B)
panel.SetNode(math);
panel.set_node(math);
ASSERT_EQ(tree->topLevelItemCount(), 1);
EXPECT_EQ(tree->topLevelItem(0)->text(0), math->Name());
EXPECT_EQ(tree->topLevelItem(0)->text(0), math->name());
EXPECT_EQ(tree->topLevelItem(0)->childCount(), 3);
// A null node clears the tree again
panel.SetNode(nullptr);
panel.set_node(nullptr);
EXPECT_EQ(tree->topLevelItemCount(), 0);
// Same through the multi-node slot
panel.SetNodes({ math });
panel.set_nodes({ math });
EXPECT_EQ(tree->topLevelItemCount(), 1);
panel.SetNodes({});
panel.set_nodes({});
EXPECT_EQ(tree->topLevelItemCount(), 0);
}
TEST_F(PanelTest, ParamPanelConstructionAndContexts)
{
Project project;
project.Initialize();
project.initialize();
ParamPanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("ParamPanel"));
EXPECT_EQ(panel.title(), QStringLiteral("Parameter Editor"));
ASSERT_NE(panel.GetParamView(), nullptr);
ASSERT_NE(panel.get_param_view(), nullptr);
EXPECT_TRUE(panel.GetContexts().isEmpty());
panel.SetContexts({ project.root() });
ASSERT_EQ(panel.GetContexts().size(), 1);
EXPECT_EQ(panel.GetContexts().first(), project.root());
EXPECT_TRUE(panel.get_contexts().isEmpty());
panel.set_contexts({ project.root() });
ASSERT_EQ(panel.get_contexts().size(), 1);
EXPECT_EQ(panel.get_contexts().first(), project.root());
// Selection slots on an empty selection are harmless
panel.SelectAll();
panel.DeselectAll();
panel.DeleteSelected();
panel.select_all();
panel.deselect_all();
panel.delete_selected();
}
TEST_F(PanelTest, ParamPanelForwardsViewSignals)
{
Project project;
project.Initialize();
auto *math = AddNode<MathNode>(&project);
project.initialize();
auto *math = add_node<MathNode>(&project);
ParamPanel panel;
QSignalSpy focused_spy(&panel, &ParamPanel::FocusedNodeChanged);
emit panel.GetParamView()->FocusedNodeChanged(math);
QSignalSpy focused_spy(&panel, &ParamPanel::focused_node_changed);
emit panel.get_param_view()->focused_node_changed(math);
ASSERT_EQ(focused_spy.count(), 1);
EXPECT_EQ(focused_spy.first().first().value<Node *>(), math);
QSignalSpy selected_spy(&panel, &ParamPanel::SelectedNodesChanged);
emit panel.GetParamView()->SelectedNodesChanged({ { math, nullptr } });
QSignalSpy selected_spy(&panel, &ParamPanel::selected_nodes_changed);
emit panel.get_param_view()->selected_nodes_changed({ { math, nullptr } });
EXPECT_EQ(selected_spy.count(), 1);
QSignalSpy text_spy(&panel, &ParamPanel::RequestViewerToStartEditingText);
emit panel.GetParamView()->RequestViewerToStartEditingText();
QSignalSpy text_spy(&panel, &ParamPanel::request_viewer_to_start_editing_text);
emit panel.get_param_view()->request_viewer_to_start_editing_text();
EXPECT_EQ(text_spy.count(), 1);
}
TEST_F(PanelTest, ProjectPanelTracksProject)
{
Project project;
project.Initialize();
project.initialize();
project.set_filename(QStringLiteral("/tmp/panel_test_project.ove"));
ProjectPanel panel(QStringLiteral("ProjectPanelTest"));
EXPECT_EQ(panel.objectName(), QStringLiteral("ProjectPanelTest"));
EXPECT_EQ(panel.project(), nullptr);
QSignalSpy name_spy(&panel, &ProjectPanel::ProjectNameChanged);
QSignalSpy name_spy(&panel, &ProjectPanel::project_name_changed);
panel.set_project(&project);
EXPECT_EQ(panel.project(), &project);
EXPECT_EQ(name_spy.count(), 1);
@@ -480,7 +480,7 @@ TEST_F(PanelTest, ProjectPanelTracksProject)
EXPECT_TRUE(panel.title().contains(project.name()));
// A child folder can become the shown root
auto *folder = AddNode<Folder>(&project);
auto *folder = add_node<Folder>(&project);
FolderAddChild(project.root(), folder).redo_now();
panel.set_root(folder);
EXPECT_EQ(panel.get_root(), folder);
@@ -489,83 +489,83 @@ TEST_F(PanelTest, ProjectPanelTracksProject)
TEST_F(PanelTest, ProjectPanelSelectsChildNodes)
{
Project project;
project.Initialize();
auto *math = AddNode<MathNode>(&project);
project.initialize();
auto *math = add_node<MathNode>(&project);
FolderAddChild(project.root(), math).redo_now();
ProjectPanel panel(QStringLiteral("ProjectPanelSelectTest"));
panel.set_project(&project);
QSignalSpy selection_spy(&panel, &ProjectPanel::SelectionChanged);
QSignalSpy selection_spy(&panel, &ProjectPanel::selection_changed);
ASSERT_TRUE(panel.SelectItem(math));
EXPECT_TRUE(panel.SelectedItems().contains(math));
ASSERT_TRUE(panel.select_item(math));
EXPECT_TRUE(panel.selected_items().contains(math));
EXPECT_GT(selection_spy.count(), 0);
}
TEST_F(PanelTest, TimeBasedPanelSignalsAndTimebase)
{
TestTimeBasedPanel panel(QStringLiteral("TimeBasedTestPanel"));
panel.SetTimeBasedWidget(new TimeBasedWidget(false, false, &panel));
panel.set_time_based_widget(new TimeBasedWidget(false, false, &panel));
QSignalSpy play_pause_spy(&panel, &TimeBasedPanel::PlayPauseRequested);
panel.PlayPause();
QSignalSpy play_pause_spy(&panel, &TimeBasedPanel::play_pause_requested);
panel.play_pause();
EXPECT_EQ(play_pause_spy.count(), 1);
QSignalSpy play_in_out_spy(&panel, &TimeBasedPanel::PlayInToOutRequested);
panel.PlayInToOut();
QSignalSpy play_in_out_spy(&panel, &TimeBasedPanel::play_in_to_out_requested);
panel.play_in_to_out();
EXPECT_EQ(play_in_out_spy.count(), 1);
QSignalSpy shuttle_left_spy(&panel, &TimeBasedPanel::ShuttleLeftRequested);
panel.ShuttleLeft();
QSignalSpy shuttle_left_spy(&panel, &TimeBasedPanel::shuttle_left_requested);
panel.shuttle_left();
EXPECT_EQ(shuttle_left_spy.count(), 1);
QSignalSpy shuttle_stop_spy(&panel, &TimeBasedPanel::ShuttleStopRequested);
panel.ShuttleStop();
QSignalSpy shuttle_stop_spy(&panel, &TimeBasedPanel::shuttle_stop_requested);
panel.shuttle_stop();
EXPECT_EQ(shuttle_stop_spy.count(), 1);
QSignalSpy shuttle_right_spy(&panel,
&TimeBasedPanel::ShuttleRightRequested);
panel.ShuttleRight();
&TimeBasedPanel::shuttle_right_requested);
panel.shuttle_right();
EXPECT_EQ(shuttle_right_spy.count(), 1);
panel.SetTimebase(rational(1, 30));
EXPECT_EQ(panel.timebase(), rational(1, 30));
panel.set_timebase(Rational(1, 30));
EXPECT_EQ(panel.timebase(), Rational(1, 30));
}
TEST_F(PanelTest, TimeBasedPanelConnectViewerUpdatesSubtitle)
{
Project project;
project.Initialize();
auto *viewer = AddNode<ViewerOutput>(&project);
viewer->SetLabel(QStringLiteral("My Viewer"));
project.initialize();
auto *viewer = add_node<ViewerOutput>(&project);
viewer->set_label(QStringLiteral("My Viewer"));
TestTimeBasedPanel panel(QStringLiteral("TimeBasedConnectPanel"));
panel.SetTimeBasedWidget(new TimeBasedWidget(false, false, &panel));
EXPECT_EQ(panel.GetConnectedViewer(), nullptr);
panel.set_time_based_widget(new TimeBasedWidget(false, false, &panel));
EXPECT_EQ(panel.get_connected_viewer(), nullptr);
panel.ConnectViewerNode(viewer);
EXPECT_EQ(panel.GetConnectedViewer(), viewer);
panel.connect_viewer_node(viewer);
EXPECT_EQ(panel.get_connected_viewer(), viewer);
EXPECT_TRUE(panel.title().contains(QStringLiteral("My Viewer")));
// Label changes on the viewer propagate to the panel title
viewer->SetLabel(QStringLiteral("Renamed Viewer"));
viewer->set_label(QStringLiteral("Renamed Viewer"));
EXPECT_TRUE(panel.title().contains(QStringLiteral("Renamed Viewer")));
panel.DisconnectViewerNode();
EXPECT_EQ(panel.GetConnectedViewer(), nullptr);
panel.disconnect_viewer_node();
EXPECT_EQ(panel.get_connected_viewer(), nullptr);
}
TEST_F(PanelTest, NodeTablePanelConstruction)
{
Project project;
project.Initialize();
auto *math = AddNode<MathNode>(&project);
project.initialize();
auto *math = add_node<MathNode>(&project);
NodeTablePanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("NodeTablePanel"));
EXPECT_EQ(panel.title(), QStringLiteral("Table View"));
ASSERT_NE(panel.GetTimeBasedWidget(), nullptr);
ASSERT_NE(panel.get_time_based_widget(), nullptr);
auto *view = panel.findChild<NodeTableView *>();
ASSERT_NE(view, nullptr);
@@ -574,12 +574,12 @@ TEST_F(PanelTest, NodeTablePanelConstruction)
EXPECT_EQ(view->topLevelItemCount(), 0);
// Selecting a node adds a top-level row labeled with the node
panel.SelectNodes({ math });
panel.select_nodes({ math });
ASSERT_EQ(view->topLevelItemCount(), 1);
EXPECT_EQ(view->topLevelItem(0)->text(0), math->GetLabelAndName());
EXPECT_EQ(view->topLevelItem(0)->text(0), math->get_label_and_name());
// Deselecting removes it again
panel.DeselectNodes({ math });
panel.deselect_nodes({ math });
EXPECT_EQ(view->topLevelItemCount(), 0);
}
@@ -588,8 +588,8 @@ TEST_F(PanelTest, MulticamPanelConstruction)
MulticamPanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("MultiCamPanel"));
EXPECT_TRUE(panel.title().startsWith(QStringLiteral("Multi-Cam")));
EXPECT_NE(panel.GetMulticamWidget(), nullptr);
EXPECT_EQ(panel.GetConnectedViewer(), nullptr);
EXPECT_NE(panel.get_multicam_widget(), nullptr);
EXPECT_EQ(panel.get_connected_viewer(), nullptr);
}
TEST_F(PanelTest, HistoryPanelReflectsUndoStack)
@@ -607,86 +607,86 @@ TEST_F(PanelTest, HistoryPanelReflectsUndoStack)
TEST_F(PanelTest, FootageViewerPanelConstruction)
{
Project project;
project.Initialize();
auto *viewer = AddNode<ViewerOutput>(&project);
project.initialize();
auto *viewer = add_node<ViewerOutput>(&project);
FootageViewerPanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("FootageViewerPanel"));
EXPECT_TRUE(panel.title().startsWith(QStringLiteral("Footage Viewer")));
EXPECT_NE(panel.GetFootageViewerWidget(), nullptr);
EXPECT_NE(panel.get_footage_viewer_widget(), nullptr);
// With nothing connected there is no selected footage
EXPECT_TRUE(panel.GetSelectedFootage().isEmpty());
EXPECT_TRUE(panel.get_selected_footage().isEmpty());
panel.ConnectViewerNode(viewer);
ASSERT_EQ(panel.GetSelectedFootage().size(), 1);
EXPECT_EQ(panel.GetSelectedFootage().first(), viewer);
panel.connect_viewer_node(viewer);
ASSERT_EQ(panel.get_selected_footage().size(), 1);
EXPECT_EQ(panel.get_selected_footage().first(), viewer);
panel.DisconnectViewerNode();
EXPECT_TRUE(panel.GetSelectedFootage().isEmpty());
panel.disconnect_viewer_node();
EXPECT_TRUE(panel.get_selected_footage().isEmpty());
}
TEST_F(PanelTest, NodePanelConstructionAndContexts)
{
Project project;
project.Initialize();
project.initialize();
NodePanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("NodePanel"));
EXPECT_EQ(panel.title(), QStringLiteral("Node Editor"));
EXPECT_NE(panel.GetNodeWidget(), nullptr);
EXPECT_NE(panel.get_node_widget(), nullptr);
EXPECT_TRUE(panel.GetContexts().isEmpty());
panel.SetContexts({ project.root() });
ASSERT_EQ(panel.GetContexts().size(), 1);
EXPECT_EQ(panel.GetContexts().first(), project.root());
EXPECT_TRUE(panel.get_contexts().isEmpty());
panel.set_contexts({ project.root() });
ASSERT_EQ(panel.get_contexts().size(), 1);
EXPECT_EQ(panel.get_contexts().first(), project.root());
// Node selection actions on an empty scene are harmless
panel.SelectAll();
panel.DeselectAll();
panel.select_all();
panel.deselect_all();
}
TEST_F(PanelTest, NodePanelForwardsViewSignals)
{
Project project;
project.Initialize();
auto *math = AddNode<MathNode>(&project);
project.initialize();
auto *math = add_node<MathNode>(&project);
NodePanel panel;
panel.SetContexts({ project.root() });
panel.set_contexts({ project.root() });
QSignalSpy selected_spy(&panel, &NodePanel::NodesSelected);
emit panel.GetNodeWidget()->view()->NodesSelected({ math });
QSignalSpy selected_spy(&panel, &NodePanel::nodes_selected);
emit panel.get_node_widget()->view()->nodes_selected({ math });
ASSERT_EQ(selected_spy.count(), 1);
QSignalSpy deselected_spy(&panel, &NodePanel::NodesDeselected);
emit panel.GetNodeWidget()->view()->NodesDeselected({ math });
QSignalSpy deselected_spy(&panel, &NodePanel::nodes_deselected);
emit panel.get_node_widget()->view()->nodes_deselected({ math });
EXPECT_EQ(deselected_spy.count(), 1);
QSignalSpy selection_spy(&panel, &NodePanel::NodeSelectionChanged);
emit panel.GetNodeWidget()->view()->NodeSelectionChanged({ math });
QSignalSpy selection_spy(&panel, &NodePanel::node_selection_changed);
emit panel.get_node_widget()->view()->node_selection_changed({ math });
EXPECT_EQ(selection_spy.count(), 1);
}
TEST_F(PanelTest, TimelinePanelConstructionAndSequence)
{
Project project;
project.Initialize();
auto *sequence = AddNode<Sequence>(&project);
project.initialize();
auto *sequence = add_node<Sequence>(&project);
TimelinePanel panel(QStringLiteral("TimelinePanelTest"));
EXPECT_EQ(panel.objectName(), QStringLiteral("TimelinePanelTest"));
EXPECT_NE(panel.timeline_widget(), nullptr);
EXPECT_EQ(panel.GetSequence(), nullptr);
EXPECT_EQ(panel.get_sequence(), nullptr);
panel.ConnectViewerNode(sequence);
EXPECT_EQ(panel.GetConnectedViewer(), sequence);
EXPECT_EQ(panel.GetSequence(), sequence);
panel.connect_viewer_node(sequence);
EXPECT_EQ(panel.get_connected_viewer(), sequence);
EXPECT_EQ(panel.get_sequence(), sequence);
// Selection actions on an empty sequence are harmless
panel.SelectAll();
panel.DeselectAll();
EXPECT_TRUE(panel.GetSelectedBlocks().isEmpty());
panel.select_all();
panel.deselect_all();
EXPECT_TRUE(panel.get_selected_blocks().isEmpty());
}
TEST_F(PanelTest, TimelinePanelSaveLoadDataRoundTrip)
@@ -706,7 +706,7 @@ TEST_F(PanelTest, TimelinePanelSaveLoadDataRoundTrip)
splitter->setSizes({ 200, 400, 100 });
const QList<int> saved_sizes = splitter->sizes();
PanelWidget::Info info = panel.SaveData();
PanelWidget::Info info = panel.save_data();
ASSERT_EQ(info.size(), 1);
EXPECT_TRUE(info.count(QStringLiteral("splitter")));
@@ -715,14 +715,14 @@ TEST_F(PanelTest, TimelinePanelSaveLoadDataRoundTrip)
ASSERT_NE(splitter->sizes(), saved_sizes);
// LoadData must restore the splitter layout captured by SaveData
panel.LoadData(info);
panel.load_data(info);
EXPECT_EQ(splitter->sizes(), saved_sizes);
EXPECT_EQ(panel.timeline_widget()->SaveSplitterState(),
EXPECT_EQ(panel.timeline_widget()->save_splitter_state(),
QByteArray::fromBase64(
info.at(QStringLiteral("splitter")).toUtf8()));
// Loading twice is idempotent
panel.LoadData(info);
panel.load_data(info);
EXPECT_EQ(splitter->sizes(), saved_sizes);
}
@@ -736,17 +736,17 @@ TEST_F(PanelTest, ToolPanelReflectsCoreToolState)
ASSERT_NE(toolbar, nullptr);
// The toolbar drives Core's active tool through the panel's connections
Core::instance()->SetTool(Tool::kPointer);
emit toolbar->ToolChanged(Tool::kHand);
EXPECT_EQ(Core::instance()->tool(), Tool::kHand);
Core::instance()->set_tool(Tool::k_pointer);
emit toolbar->tool_changed(Tool::k_hand);
EXPECT_EQ(Core::instance()->tool(), Tool::k_hand);
// ...and snapping state
emit toolbar->SnappingChanged(false);
emit toolbar->snapping_changed(false);
EXPECT_FALSE(Core::instance()->snapping());
emit toolbar->SnappingChanged(true);
emit toolbar->snapping_changed(true);
EXPECT_TRUE(Core::instance()->snapping());
Core::instance()->SetTool(Tool::kPointer);
Core::instance()->set_tool(Tool::k_pointer);
}
TEST_F(PanelTest, ViewerPanelConstruction)
@@ -754,8 +754,8 @@ TEST_F(PanelTest, ViewerPanelConstruction)
ViewerPanel panel(QStringLiteral("ViewerPanelTest"));
EXPECT_EQ(panel.objectName(), QStringLiteral("ViewerPanelTest"));
EXPECT_TRUE(panel.title().startsWith(QStringLiteral("Viewer")));
EXPECT_NE(panel.GetViewerWidget(), nullptr);
EXPECT_EQ(panel.GetConnectedViewer(), nullptr);
EXPECT_NE(panel.get_viewer_widget(), nullptr);
EXPECT_EQ(panel.get_connected_viewer(), nullptr);
}
TEST_F(PanelTest, SequenceViewerPanelConstruction)
@@ -763,7 +763,7 @@ TEST_F(PanelTest, SequenceViewerPanelConstruction)
SequenceViewerPanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("SequenceViewerPanel"));
EXPECT_TRUE(panel.title().startsWith(QStringLiteral("Sequence Viewer")));
EXPECT_NE(panel.GetViewerWidget(), nullptr);
EXPECT_NE(panel.get_viewer_widget(), nullptr);
}
TEST_F(PanelTest, ViewerPanelConnectTimeBasedPanel)
@@ -773,17 +773,17 @@ TEST_F(PanelTest, ViewerPanelConnectTimeBasedPanel)
// Routing playback commands from a timebased panel to the viewer must not
// crash, even with nothing connected to the viewer
viewer_panel.ConnectTimeBasedPanel(&curve_panel);
viewer_panel.connect_time_based_panel(&curve_panel);
QSignalSpy spy(&curve_panel, &TimeBasedPanel::PlayPauseRequested);
curve_panel.PlayPause();
QSignalSpy spy(&curve_panel, &TimeBasedPanel::play_pause_requested);
curve_panel.play_pause();
EXPECT_EQ(spy.count(), 1);
curve_panel.ShuttleLeft();
curve_panel.ShuttleStop();
curve_panel.ShuttleRight();
curve_panel.shuttle_left();
curve_panel.shuttle_stop();
curve_panel.shuttle_right();
viewer_panel.DisconnectTimeBasedPanel(&curve_panel);
viewer_panel.disconnect_time_based_panel(&curve_panel);
}
TEST_F(PanelTest, ScopePanelConstructionAndTypeSwitching)
@@ -791,26 +791,26 @@ TEST_F(PanelTest, ScopePanelConstructionAndTypeSwitching)
ScopePanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("ScopePanel"));
EXPECT_EQ(panel.title(), QStringLiteral("Scopes"));
EXPECT_EQ(panel.GetConnectedViewerPanel(), nullptr);
EXPECT_EQ(panel.get_connected_viewer_panel(), nullptr);
// Every scope type has a human readable name
for (int i = 0; i < ScopePanel::kTypeCount; i++) {
for (int i = 0; i < ScopePanel::k_type_count; i++) {
EXPECT_FALSE(
ScopePanel::TypeToName(static_cast<ScopePanel::Type>(i)).isEmpty());
ScopePanel::type_to_name(static_cast<ScopePanel::Type>(i)).isEmpty());
}
auto *combo = panel.findChild<QComboBox *>();
auto *stack = panel.findChild<QStackedWidget *>();
ASSERT_NE(combo, nullptr);
ASSERT_NE(stack, nullptr);
ASSERT_EQ(stack->count(), ScopePanel::kTypeCount);
ASSERT_EQ(stack->count(), ScopePanel::k_type_count);
// SetType switches the visible scope through the combo box
panel.SetType(ScopePanel::kTypeHistogram);
EXPECT_EQ(combo->currentIndex(), ScopePanel::kTypeHistogram);
panel.set_type(ScopePanel::k_type_histogram);
EXPECT_EQ(combo->currentIndex(), ScopePanel::k_type_histogram);
panel.SetType(ScopePanel::kTypeVectorscope);
EXPECT_EQ(combo->currentIndex(), ScopePanel::kTypeVectorscope);
panel.set_type(ScopePanel::k_type_vectorscope);
EXPECT_EQ(combo->currentIndex(), ScopePanel::k_type_vectorscope);
}
TEST_F(PanelTest, ScopePanelViewerConnection)
@@ -818,16 +818,16 @@ TEST_F(PanelTest, ScopePanelViewerConnection)
ScopePanel scope_panel;
ViewerPanel viewer_panel(QStringLiteral("ScopeSourcePanel"));
scope_panel.SetViewerPanel(&viewer_panel);
EXPECT_EQ(scope_panel.GetConnectedViewerPanel(), &viewer_panel);
scope_panel.set_viewer_panel(&viewer_panel);
EXPECT_EQ(scope_panel.get_connected_viewer_panel(), &viewer_panel);
// Setting the same panel again is a no-op
scope_panel.SetViewerPanel(&viewer_panel);
EXPECT_EQ(scope_panel.GetConnectedViewerPanel(), &viewer_panel);
scope_panel.set_viewer_panel(&viewer_panel);
EXPECT_EQ(scope_panel.get_connected_viewer_panel(), &viewer_panel);
// Disconnecting clears the reference buffer connection
scope_panel.SetViewerPanel(nullptr);
EXPECT_EQ(scope_panel.GetConnectedViewerPanel(), nullptr);
scope_panel.set_viewer_panel(nullptr);
EXPECT_EQ(scope_panel.get_connected_viewer_panel(), nullptr);
}
TEST_F(PanelTest, AudioMonitorPanelConstruction)
@@ -835,8 +835,8 @@ TEST_F(PanelTest, AudioMonitorPanelConstruction)
AudioMonitorPanel panel;
EXPECT_EQ(panel.objectName(), QStringLiteral("AudioMonitor"));
EXPECT_EQ(panel.title(), QStringLiteral("Audio Monitor"));
EXPECT_FALSE(panel.IsPlaying());
EXPECT_FALSE(panel.is_playing());
panel.SetParams(core::AudioParams(48000, core::kChannelLayoutStereo,
core::SampleFormat::F32P));
panel.set_params(core::AudioParams(48000, core::k_channel_layout_stereo,
core::SampleFormat::f32_p));
}