Expand gtest coverage across recently changed modules

Adds ~60 new unit tests covering the modules touched in recent bug-fix
passes and UI refactors:

- RenderTicket: result/finish-count semantics, empty watcher defaults,
  ticket-reuse rejection
- Preferences tabs: behavior options migrated into General/Audio tabs,
  translation context helper, audio-tab initialization
- NodeView: context management, 'Show in Parameter Editor' action wiring
- PreviewAutoCacher: construction, pause toggles, single-frame render
  cancellation, force-cache range
- SeekableWidget/TimeBasedWidget: scroll, marker editing, context reset
- OCIOLutNode: empty/missing/unsupported LUT paths, string direction
  values, file-switching regression coverage
- ProxyManager: working filename, disabled state, empty proxy fields
- Frame/VideoParams/AudioParams/Timecode/ExportFormat/ExportCodec:
  additional edge-case and enumeration coverage

Also fixes the PreferencesAudioTab test crash by initializing
AudioManager in the offscreen test environment.

All tests pass: ctest --output-on-failure
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent b47887e127
commit b7ff687220
14 changed files with 1047 additions and 48 deletions
+72
View File
@@ -0,0 +1,72 @@
#include <gtest/gtest.h>
#include <QSignalSpy>
#include "node/generator/solid/solid.h"
#include "node/project.h"
#include "widget/nodeview/nodeview.h"
using namespace olive;
class NodeViewTest : public ::testing::Test {
protected:
void SetUp() override
{
ColorManager::SetUpDefaultConfig();
project_ = std::make_unique<Project>();
project_->Initialize();
}
std::unique_ptr<Project> project_;
};
TEST_F(NodeViewTest, ConstructionCreatesEmptyView)
{
NodeView view;
EXPECT_TRUE(view.GetContexts().isEmpty());
EXPECT_FALSE(view.IsGroupOverlay());
}
TEST_F(NodeViewTest, SetContextsUpdatesContextList)
{
auto *solid = new SolidGenerator();
solid->setParent(project_.get());
NodeView view;
view.SetContexts({ solid });
EXPECT_EQ(view.GetContexts().size(), 1);
EXPECT_EQ(view.GetContexts().first(), solid);
}
TEST_F(NodeViewTest, ShowSelectedNodeInParamEditorNoSelectionIsNoOp)
{
NodeView view;
QSignalSpy changed_with_ctx_spy(
&view, &NodeView::NodeSelectionChangedWithContexts);
foreach (QAction *action, view.actions()) {
if (action->property("id").toString() ==
QStringLiteral("shownodeparams")) {
action->trigger();
break;
}
}
EXPECT_EQ(changed_with_ctx_spy.count(), 0);
}
TEST_F(NodeViewTest, ClearGraphRemovesContexts)
{
auto *solid = new SolidGenerator();
solid->setParent(project_.get());
NodeView view;
view.SetContexts({ solid });
EXPECT_FALSE(view.GetContexts().isEmpty());
view.ClearGraph();
EXPECT_TRUE(view.GetContexts().isEmpty());
}