Files
oak-editor/tests/gtest/timeline_coordinate_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

68 lines
2.0 KiB
C++

#include <gtest/gtest.h>
#include "timeline/timelinecoordinate.h"
TEST(TimelineCoordinate, DefaultAndSetters)
{
olive::TimelineCoordinate coord;
EXPECT_EQ(coord.GetTrack().type(), olive::Track::kNone);
EXPECT_EQ(coord.GetTrack().index(), 0);
const olive::core::rational frame(10, 1);
olive::Track::Reference ref(olive::Track::kVideo, 2);
coord.SetFrame(frame);
coord.SetTrack(ref);
EXPECT_EQ(coord.GetFrame(), frame);
EXPECT_EQ(coord.GetTrack(), ref);
}
TEST(TimelineCoordinate, Constructors)
{
const olive::core::rational frame(5, 1);
olive::Track::Reference ref(olive::Track::kAudio, 1);
olive::TimelineCoordinate with_ref(frame, ref);
EXPECT_EQ(with_ref.GetFrame(), frame);
EXPECT_EQ(with_ref.GetTrack(), ref);
olive::TimelineCoordinate with_type(frame, olive::Track::kSubtitle, 3);
EXPECT_EQ(with_type.GetFrame(), frame);
EXPECT_EQ(with_type.GetTrack().type(), olive::Track::kSubtitle);
EXPECT_EQ(with_type.GetTrack().index(), 3);
}
TEST(TimelineCoordinate, CopyAndAssignment)
{
const olive::core::rational frame(7, 1);
olive::Track::Reference ref(olive::Track::kVideo, 4);
olive::TimelineCoordinate original(frame, ref);
olive::TimelineCoordinate copy(original);
EXPECT_EQ(copy.GetFrame(), frame);
EXPECT_EQ(copy.GetTrack(), ref);
olive::TimelineCoordinate assigned;
assigned = original;
EXPECT_EQ(assigned.GetFrame(), frame);
EXPECT_EQ(assigned.GetTrack(), ref);
}
TEST(TimelineCoordinate, Equality)
{
olive::TimelineCoordinate a(olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
olive::TimelineCoordinate b(olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
olive::TimelineCoordinate c(olive::core::rational(6, 1),
olive::Track::Reference(olive::Track::kVideo, 1));
olive::TimelineCoordinate d(olive::core::rational(5, 1),
olive::Track::Reference(olive::Track::kAudio, 1));
EXPECT_EQ(a.GetFrame(), b.GetFrame());
EXPECT_EQ(a.GetTrack(), b.GetTrack());
EXPECT_NE(a.GetFrame(), c.GetFrame());
EXPECT_NE(a.GetTrack(), d.GetTrack());
}