- app/ no longer includes engine C++ headers nor holds engine C++ types: engine access goes through the oakengine C ABI plus C++ wrappers (oakutil/oaknode.h, oakutil/oakvideo.h) and app-local mirror types (tooltypes, trackreferencehandle, timelinecommonapp, keyframetypes, subtitleapp, serializedlayoutinfoapp, nodevaluehandle, sliderdisplaytypeapp) - engine: new C ABI functions for block/track/clip/transition navigation and predicates, links, caches, waveform/playback, disk folder, sequence_track_list, node_free, footage_is_valid, block_get_track, get_brush; loadotio/saveotio ported to the current engine API - OTIO is now a required dependency: CI and CD build it on every platform, FindOpenTimelineIO fixed for OTIO 0.16/0.19 (the old deps include requirement silently disabled OTIO everywhere), runtime libraries are bundled into packages and copied next to macOS binaries (oak_copy_otio_runtime) - fix ProjectViewModel drag&drop mime read/write size mismatch (segfault) - unify color label naming (k_olive -> "Oak") in the app-side mirror - docs: OTIO required, FFmpeg minimum corrected to 6.0 (en/zh) - gtest suite: 1925 passed, 0 failed
101 lines
3.4 KiB
C++
101 lines
3.4 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include "timeline/timelinecoordinate.h"
|
|
|
|
TEST(TimelineCoordinate, DefaultAndSetters)
|
|
{
|
|
olive::TimelineCoordinate coord;
|
|
EXPECT_EQ(coord.get_track().type(), olive::TrackReference::k_none);
|
|
EXPECT_EQ(coord.get_track().index(), 0);
|
|
|
|
const olive::core::Rational frame(10, 1);
|
|
olive::TrackReference ref(olive::TrackReference::k_video, 2);
|
|
|
|
coord.set_frame(frame);
|
|
coord.set_track(ref);
|
|
|
|
EXPECT_EQ(coord.get_frame(), frame);
|
|
EXPECT_EQ(coord.get_track(), ref);
|
|
}
|
|
|
|
TEST(TimelineCoordinate, Constructors)
|
|
{
|
|
const olive::core::Rational frame(5, 1);
|
|
olive::TrackReference ref(olive::TrackReference::k_audio, 1);
|
|
|
|
olive::TimelineCoordinate with_ref(frame, ref);
|
|
EXPECT_EQ(with_ref.get_frame(), frame);
|
|
EXPECT_EQ(with_ref.get_track(), ref);
|
|
|
|
olive::TimelineCoordinate with_type(frame, olive::TrackReference::k_subtitle, 3);
|
|
EXPECT_EQ(with_type.get_frame(), frame);
|
|
EXPECT_EQ(with_type.get_track().type(), olive::TrackReference::k_subtitle);
|
|
EXPECT_EQ(with_type.get_track().index(), 3);
|
|
}
|
|
|
|
TEST(TimelineCoordinate, CopyAndAssignment)
|
|
{
|
|
const olive::core::Rational frame(7, 1);
|
|
olive::TrackReference ref(olive::TrackReference::k_video, 4);
|
|
|
|
olive::TimelineCoordinate original(frame, ref);
|
|
olive::TimelineCoordinate copy(original);
|
|
EXPECT_EQ(copy.get_frame(), frame);
|
|
EXPECT_EQ(copy.get_track(), ref);
|
|
|
|
olive::TimelineCoordinate assigned;
|
|
assigned = original;
|
|
EXPECT_EQ(assigned.get_frame(), frame);
|
|
EXPECT_EQ(assigned.get_track(), ref);
|
|
}
|
|
|
|
TEST(TimelineCoordinate, Equality)
|
|
{
|
|
// TimelineCoordinate provides no operator== of its own; equality is
|
|
// observable through the real operators of its components (Rational and
|
|
// Track::Reference)
|
|
const olive::TimelineCoordinate a(
|
|
olive::core::Rational(5, 1),
|
|
olive::TrackReference(olive::TrackReference::k_video, 1));
|
|
|
|
// Distinct objects with identical frame and track compare equal in both
|
|
// components
|
|
const olive::TimelineCoordinate b(
|
|
olive::core::Rational(5, 1),
|
|
olive::TrackReference(olive::TrackReference::k_video, 1));
|
|
EXPECT_TRUE(a.get_frame() == b.get_frame());
|
|
EXPECT_TRUE(a.get_track() == b.get_track());
|
|
EXPECT_FALSE(a.get_frame() != b.get_frame());
|
|
EXPECT_FALSE(a.get_track() != b.get_track());
|
|
|
|
// A different frame breaks frame equality while the track stays equal
|
|
const olive::TimelineCoordinate c(
|
|
olive::core::Rational(6, 1),
|
|
olive::TrackReference(olive::TrackReference::k_video, 1));
|
|
EXPECT_FALSE(a.get_frame() == c.get_frame());
|
|
EXPECT_TRUE(a.get_frame() != c.get_frame());
|
|
EXPECT_TRUE(a.get_track() == c.get_track());
|
|
|
|
// A different track type or index breaks track equality while the frame
|
|
// stays equal
|
|
const olive::TimelineCoordinate d(
|
|
olive::core::Rational(5, 1),
|
|
olive::TrackReference(olive::TrackReference::k_audio, 1));
|
|
const olive::TimelineCoordinate e(
|
|
olive::core::Rational(5, 1),
|
|
olive::TrackReference(olive::TrackReference::k_video, 2));
|
|
EXPECT_TRUE(a.get_track() != d.get_track());
|
|
EXPECT_FALSE(a.get_track() == d.get_track());
|
|
EXPECT_TRUE(a.get_track() != e.get_track());
|
|
EXPECT_TRUE(a.get_frame() == d.get_frame());
|
|
EXPECT_TRUE(a.get_frame() == e.get_frame());
|
|
|
|
// Mutating a copy breaks equality with the original
|
|
olive::TimelineCoordinate mutated = a;
|
|
mutated.set_frame(olive::core::Rational(7, 1));
|
|
EXPECT_TRUE(mutated.get_frame() != a.get_frame());
|
|
mutated.set_frame(olive::core::Rational(5, 1));
|
|
mutated.set_track(olive::TrackReference(olive::TrackReference::k_subtitle, 0));
|
|
EXPECT_TRUE(mutated.get_track() != a.get_track());
|
|
}
|