Expand Google Test coverage across core subsystems

Add and extend unit tests for:
- Task manager (failed tasks, progress signals, multiple tasks)
- Undo stack (multiple undo/redo, push-after-undo, clear, multi-command)
- Config defaults and graphics backend string conversion
- Node keyframe serialization and default state
- Node value string round-trips and table operations
- Node globals and project settings/serialization
- Timeline coordinate, workarea, and marker commands
- Color LUT processor and OCIO transform handling
- Common utilities (range, file functions, Qt helpers, XML utils)
- Render enums (loop mode, alpha association)
- Shader resource availability
- Module smoke tests for Tool and HumanStrings

All tests pass including RenderWorkerFootage GPU worker tests after
rebuilding the stale olive-render-worker binary.
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent b7ff687220
commit 748c53ac5c
20 changed files with 1075 additions and 11 deletions
+109
View File
@@ -0,0 +1,109 @@
#include <gtest/gtest.h>
#include "node/project.h"
TEST(NodeProject, DefaultsAfterConstruction)
{
olive::Project project;
EXPECT_EQ(project.filename(), QString());
EXPECT_EQ(project.name(), QStringLiteral("(untitled)"));
EXPECT_EQ(project.pretty_filename(), QStringLiteral("(untitled)"));
EXPECT_TRUE(project.is_new());
EXPECT_FALSE(project.is_modified());
EXPECT_TRUE(project.has_autorecovery_been_saved());
EXPECT_FALSE(project.GetUuid().isNull());
EXPECT_NE(project.color_manager(), nullptr);
EXPECT_EQ(project.root(), nullptr);
EXPECT_TRUE(project.nodes().isEmpty());
}
TEST(NodeProject, FilenameAndNameUpdate)
{
olive::Project project;
project.set_filename(QStringLiteral("/tmp/test_project.ove"));
EXPECT_EQ(project.filename(), QStringLiteral("/tmp/test_project.ove"));
EXPECT_EQ(project.name(), QStringLiteral("test_project"));
EXPECT_EQ(project.pretty_filename(), QStringLiteral("/tmp/test_project.ove"));
EXPECT_FALSE(project.is_new());
}
TEST(NodeProject, ModifiedState)
{
olive::Project project;
project.set_modified(true);
EXPECT_TRUE(project.is_modified());
EXPECT_FALSE(project.has_autorecovery_been_saved());
project.set_modified(false);
EXPECT_FALSE(project.is_modified());
EXPECT_TRUE(project.has_autorecovery_been_saved());
}
TEST(NodeProject, SettingsRoundTrip)
{
olive::Project project;
project.SetSetting(olive::Project::kCacheLocationSettingKey,
QString::number(olive::Project::kCacheStoreAlongsideProject));
EXPECT_EQ(project.GetCacheLocationSetting(),
olive::Project::kCacheStoreAlongsideProject);
project.SetCustomCachePath(QStringLiteral("/tmp/cache"));
EXPECT_EQ(project.GetCustomCachePath(), QStringLiteral("/tmp/cache"));
project.SetColorConfigFilename(QStringLiteral("config.ocio"));
EXPECT_EQ(project.GetColorConfigFilename(), QStringLiteral("config.ocio"));
project.SetDefaultInputColorSpace(QStringLiteral("ACEScg"));
EXPECT_EQ(project.GetDefaultInputColorSpace(), QStringLiteral("ACEScg"));
project.SetColorReferenceSpace(QStringLiteral("ACES - ACEScg"));
EXPECT_EQ(project.GetColorReferenceSpace(), QStringLiteral("ACES - ACEScg"));
}
TEST(NodeProject, InitializeCreatesRoot)
{
olive::Project project;
EXPECT_EQ(project.root(), nullptr);
project.Initialize();
EXPECT_NE(project.root(), nullptr);
EXPECT_EQ(project.root()->GetLabel(), QStringLiteral("Root"));
}
TEST(NodeProject, UuidCanBeRegenerated)
{
olive::Project project;
const QUuid original = project.GetUuid();
project.RegenerateUuid();
EXPECT_FALSE(project.GetUuid().isNull());
EXPECT_NE(project.GetUuid(), original);
}
TEST(NodeProject, GetProjectFromObject)
{
olive::Project project;
olive::ColorManager *cm = project.color_manager();
EXPECT_EQ(olive::Project::GetProjectFromObject(cm), &project);
}
TEST(NodeProject, SaveProducesXml)
{
olive::Project project;
project.Initialize();
QByteArray xml;
QXmlStreamWriter writer(&xml);
writer.writeStartDocument();
writer.writeStartElement(QStringLiteral("project"));
project.Save(&writer);
writer.writeEndElement();
writer.writeEndDocument();
EXPECT_FALSE(xml.isEmpty());
EXPECT_TRUE(xml.contains("uuid"));
}