Files
oak-editor/tests/gtest/node_globals_test.cpp
T
Mike-Solar 748c53ac5c 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.
2026-07-13 10:19:30 +08:00

47 lines
1.5 KiB
C++

#include <gtest/gtest.h>
#include "node/globals.h"
#include "render/videoparams.h"
#include "render/loopmode.h"
TEST(NodeGlobals, DefaultConstruction)
{
olive::NodeGlobals globals;
EXPECT_EQ(globals.vparams().width(), 0);
EXPECT_EQ(globals.vparams().height(), 0);
EXPECT_EQ(globals.aparams().sample_rate(), 0);
}
TEST(NodeGlobals, ConstructedWithParams)
{
olive::VideoParams video_params(1920, 1080, olive::PixelFormat::F32, 4);
olive::AudioParams audio_params;
audio_params.set_sample_rate(48000);
audio_params.set_channel_layout(AV_CH_LAYOUT_STEREO);
olive::TimeRange time(olive::core::rational(1, 24), olive::core::rational(2, 24));
olive::NodeGlobals globals(video_params, audio_params, time, olive::LoopMode::kLoopModeLoop);
EXPECT_EQ(globals.vparams().width(), 1920);
EXPECT_EQ(globals.vparams().height(), 1080);
EXPECT_EQ(globals.aparams().sample_rate(), 48000);
EXPECT_EQ(globals.loop_mode(), olive::LoopMode::kLoopModeLoop);
EXPECT_EQ(globals.time().in(), olive::core::rational(1, 24));
EXPECT_EQ(globals.time().out(), olive::core::rational(2, 24));
}
TEST(NodeGlobals, RationalConstructorExpandsToFrame)
{
olive::VideoParams video_params(1280, 720, olive::PixelFormat::F32, 4);
video_params.set_frame_rate(24);
olive::AudioParams audio_params;
audio_params.set_sample_rate(44100);
olive::NodeGlobals globals(video_params, audio_params,
olive::core::rational(0, 1),
olive::LoopMode::kLoopModeClamp);
EXPECT_EQ(globals.time().in(), olive::core::rational(0, 1));
EXPECT_EQ(globals.time().out(), olive::core::rational(1, 24));
}