style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
+130
-130
@@ -48,8 +48,8 @@ TEST(ViewerSmokeTimer, DefaultConstruction)
|
||||
ViewerPlaybackTimer timer;
|
||||
|
||||
// After Start() is called, the timer must return valid timestamps
|
||||
timer.Start(0, 1, 1.0 / 24.0);
|
||||
EXPECT_GE(timer.GetTimestampNow(), 0);
|
||||
timer.start(0, 1, 1.0 / 24.0);
|
||||
EXPECT_GE(timer.get_timestamp_now(), 0);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeTimer, BasicTiming)
|
||||
@@ -57,15 +57,15 @@ TEST(ViewerSmokeTimer, BasicTiming)
|
||||
ViewerPlaybackTimer timer;
|
||||
|
||||
// Start at timestamp 0, 1x speed, 24fps (timebase = 1/24)
|
||||
timer.Start(0, 1, 1.0 / 24.0);
|
||||
timer.start(0, 1, 1.0 / 24.0);
|
||||
|
||||
// Immediately get timestamp (should be close to 0)
|
||||
int64_t ts = timer.GetTimestampNow();
|
||||
int64_t ts = timer.get_timestamp_now();
|
||||
EXPECT_GE(ts, 0);
|
||||
|
||||
// Wait a bit and check timestamp has increased
|
||||
QThread::msleep(50); // 50ms
|
||||
int64_t ts2 = timer.GetTimestampNow();
|
||||
int64_t ts2 = timer.get_timestamp_now();
|
||||
|
||||
// At 24fps, 50ms is more than one frame period (~41.7ms), so the
|
||||
// timestamp must have advanced by at least one frame
|
||||
@@ -77,11 +77,11 @@ TEST(ViewerSmokeTimer, PlaybackSpeedForward)
|
||||
ViewerPlaybackTimer timer;
|
||||
|
||||
// Start at timestamp 100, 2x speed, 30fps
|
||||
timer.Start(100, 2, 1.0 / 30.0);
|
||||
timer.start(100, 2, 1.0 / 30.0);
|
||||
|
||||
int64_t ts1 = timer.GetTimestampNow();
|
||||
int64_t ts1 = timer.get_timestamp_now();
|
||||
QThread::msleep(50);
|
||||
int64_t ts2 = timer.GetTimestampNow();
|
||||
int64_t ts2 = timer.get_timestamp_now();
|
||||
|
||||
// At 2x speed, time should advance twice as fast
|
||||
EXPECT_GT(ts2, ts1);
|
||||
@@ -92,11 +92,11 @@ TEST(ViewerSmokeTimer, PlaybackSpeedReverse)
|
||||
ViewerPlaybackTimer timer;
|
||||
|
||||
// Start at timestamp 1000, -1x speed (reverse), 24fps
|
||||
timer.Start(1000, -1, 1.0 / 24.0);
|
||||
timer.start(1000, -1, 1.0 / 24.0);
|
||||
|
||||
int64_t ts1 = timer.GetTimestampNow();
|
||||
int64_t ts1 = timer.get_timestamp_now();
|
||||
QThread::msleep(50);
|
||||
int64_t ts2 = timer.GetTimestampNow();
|
||||
int64_t ts2 = timer.get_timestamp_now();
|
||||
|
||||
// In reverse, timestamp should decrease
|
||||
EXPECT_LT(ts2, ts1);
|
||||
@@ -110,11 +110,11 @@ TEST(ViewerSmokeTimer, DifferentTimebases)
|
||||
for (double fps : { 24.0, 60.0 }) {
|
||||
ViewerPlaybackTimer timer;
|
||||
QElapsedTimer wall;
|
||||
timer.Start(0, 1, 1.0 / fps);
|
||||
timer.start(0, 1, 1.0 / fps);
|
||||
wall.start();
|
||||
QThread::msleep(100);
|
||||
|
||||
const int64_t ts = timer.GetTimestampNow();
|
||||
const int64_t ts = timer.get_timestamp_now();
|
||||
const int64_t expected =
|
||||
qFloor(static_cast<double>(wall.elapsed()) / (1000.0 / fps));
|
||||
EXPECT_NEAR(ts, expected, 1) << "fps=" << fps;
|
||||
@@ -123,11 +123,11 @@ TEST(ViewerSmokeTimer, DifferentTimebases)
|
||||
// With highly distinct timebases the faster one always produces more
|
||||
// frames in the same interval, even on heavily loaded machines
|
||||
ViewerPlaybackTimer slow, fast;
|
||||
slow.Start(0, 1, 1.0);
|
||||
fast.Start(0, 1, 1.0 / 240.0);
|
||||
slow.start(0, 1, 1.0);
|
||||
fast.start(0, 1, 1.0 / 240.0);
|
||||
QThread::msleep(100);
|
||||
|
||||
EXPECT_LT(slow.GetTimestampNow(), fast.GetTimestampNow());
|
||||
EXPECT_LT(slow.get_timestamp_now(), fast.get_timestamp_now());
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeTimer, ZeroSpeed)
|
||||
@@ -135,11 +135,11 @@ TEST(ViewerSmokeTimer, ZeroSpeed)
|
||||
ViewerPlaybackTimer timer;
|
||||
|
||||
// Start with 0 speed (paused)
|
||||
timer.Start(500, 0, 1.0 / 24.0);
|
||||
timer.start(500, 0, 1.0 / 24.0);
|
||||
|
||||
int64_t ts1 = timer.GetTimestampNow();
|
||||
int64_t ts1 = timer.get_timestamp_now();
|
||||
QThread::msleep(50);
|
||||
int64_t ts2 = timer.GetTimestampNow();
|
||||
int64_t ts2 = timer.get_timestamp_now();
|
||||
|
||||
// With 0 speed, timestamp should not change
|
||||
EXPECT_EQ(ts1, ts2);
|
||||
@@ -160,23 +160,23 @@ TEST(ViewerSmokeQueue, AppendForwardPlayback)
|
||||
ViewerQueue queue;
|
||||
|
||||
// Append frames for forward playback
|
||||
ViewerPlaybackFrame frame1{ rational(0), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ rational(1, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ rational(2, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame1{ Rational(0), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ Rational(1, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ Rational(2, 24), QVariant() };
|
||||
|
||||
queue.AppendTimewise(frame1, 1); // speed = 1 (forward)
|
||||
queue.AppendTimewise(frame2, 1);
|
||||
queue.AppendTimewise(frame3, 1);
|
||||
queue.append_timewise(frame1, 1); // speed = 1 (forward)
|
||||
queue.append_timewise(frame2, 1);
|
||||
queue.append_timewise(frame3, 1);
|
||||
|
||||
EXPECT_EQ(queue.size(), 3);
|
||||
|
||||
// Verify order (should be chronological for forward playback)
|
||||
auto it = queue.begin();
|
||||
EXPECT_EQ(it->timestamp, rational(0));
|
||||
EXPECT_EQ(it->timestamp, Rational(0));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(1, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(1, 24));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(2, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(2, 24));
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeQueue, AppendReversePlayback)
|
||||
@@ -184,23 +184,23 @@ TEST(ViewerSmokeQueue, AppendReversePlayback)
|
||||
ViewerQueue queue;
|
||||
|
||||
// Append frames for reverse playback
|
||||
ViewerPlaybackFrame frame1{ rational(2, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ rational(1, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ rational(0), QVariant() };
|
||||
ViewerPlaybackFrame frame1{ Rational(2, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ Rational(1, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ Rational(0), QVariant() };
|
||||
|
||||
queue.AppendTimewise(frame1, -1); // speed = -1 (reverse)
|
||||
queue.AppendTimewise(frame2, -1);
|
||||
queue.AppendTimewise(frame3, -1);
|
||||
queue.append_timewise(frame1, -1); // speed = -1 (reverse)
|
||||
queue.append_timewise(frame2, -1);
|
||||
queue.append_timewise(frame3, -1);
|
||||
|
||||
EXPECT_EQ(queue.size(), 3);
|
||||
|
||||
// Verify order (should be reverse chronological for reverse playback)
|
||||
auto it = queue.begin();
|
||||
EXPECT_EQ(it->timestamp, rational(2, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(2, 24));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(1, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(1, 24));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(0));
|
||||
EXPECT_EQ(it->timestamp, Rational(0));
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeQueue, InsertOutOfOrder)
|
||||
@@ -208,23 +208,23 @@ TEST(ViewerSmokeQueue, InsertOutOfOrder)
|
||||
ViewerQueue queue;
|
||||
|
||||
// Insert frames out of order for forward playback
|
||||
ViewerPlaybackFrame frame1{ rational(0), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ rational(2, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ rational(1, 24), QVariant() }; // Middle frame
|
||||
ViewerPlaybackFrame frame1{ Rational(0), QVariant() };
|
||||
ViewerPlaybackFrame frame2{ Rational(2, 24), QVariant() };
|
||||
ViewerPlaybackFrame frame3{ Rational(1, 24), QVariant() }; // Middle frame
|
||||
|
||||
queue.AppendTimewise(frame1, 1);
|
||||
queue.AppendTimewise(frame2, 1);
|
||||
queue.AppendTimewise(frame3, 1); // Should insert in middle
|
||||
queue.append_timewise(frame1, 1);
|
||||
queue.append_timewise(frame2, 1);
|
||||
queue.append_timewise(frame3, 1); // Should insert in middle
|
||||
|
||||
EXPECT_EQ(queue.size(), 3);
|
||||
|
||||
// Verify correct order
|
||||
auto it = queue.begin();
|
||||
EXPECT_EQ(it->timestamp, rational(0));
|
||||
EXPECT_EQ(it->timestamp, Rational(0));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(1, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(1, 24));
|
||||
++it;
|
||||
EXPECT_EQ(it->timestamp, rational(2, 24));
|
||||
EXPECT_EQ(it->timestamp, Rational(2, 24));
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeQueue, PurgeBefore)
|
||||
@@ -233,18 +233,18 @@ TEST(ViewerSmokeQueue, PurgeBefore)
|
||||
|
||||
// Add some frames
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ViewerPlaybackFrame frame{ rational(i, 24), QVariant() };
|
||||
queue.AppendTimewise(frame, 1);
|
||||
ViewerPlaybackFrame frame{ Rational(i, 24), QVariant() };
|
||||
queue.append_timewise(frame, 1);
|
||||
}
|
||||
|
||||
EXPECT_EQ(queue.size(), 10);
|
||||
|
||||
// Purge frames before 5/24
|
||||
queue.PurgeBefore(rational(5, 24), 1);
|
||||
queue.purge_before(Rational(5, 24), 1);
|
||||
|
||||
// Should have 5 frames remaining (5, 6, 7, 8, 9)
|
||||
EXPECT_EQ(queue.size(), 5);
|
||||
EXPECT_EQ(queue.front().timestamp, rational(5, 24));
|
||||
EXPECT_EQ(queue.front().timestamp, Rational(5, 24));
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeQueue, PurgeBeforeReverse)
|
||||
@@ -253,19 +253,19 @@ TEST(ViewerSmokeQueue, PurgeBeforeReverse)
|
||||
|
||||
// Add frames for reverse playback (newest first)
|
||||
for (int i = 9; i >= 0; i--) {
|
||||
ViewerPlaybackFrame frame{ rational(i, 24), QVariant() };
|
||||
queue.AppendTimewise(frame, -1);
|
||||
ViewerPlaybackFrame frame{ Rational(i, 24), QVariant() };
|
||||
queue.append_timewise(frame, -1);
|
||||
}
|
||||
|
||||
EXPECT_EQ(queue.size(), 10);
|
||||
|
||||
// In reverse playback, front() is the largest timestamp (9/24)
|
||||
// PurgeBefore with negative speed removes frames where front > time
|
||||
queue.PurgeBefore(rational(5, 24), -1);
|
||||
queue.purge_before(Rational(5, 24), -1);
|
||||
|
||||
// Should have frames 0-5 remaining (those <= 5/24)
|
||||
EXPECT_EQ(queue.size(), 6);
|
||||
EXPECT_EQ(queue.front().timestamp, rational(5, 24));
|
||||
EXPECT_EQ(queue.front().timestamp, Rational(5, 24));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -336,19 +336,19 @@ TEST(ViewerSmokeAudioCache, DefaultConstruction)
|
||||
AudioPlaybackCache cache;
|
||||
|
||||
// A fresh cache has invalid (unset) audio parameters and no validated ranges
|
||||
EXPECT_FALSE(cache.GetParameters().is_valid());
|
||||
EXPECT_TRUE(cache.GetValidatedRanges().isEmpty());
|
||||
EXPECT_FALSE(cache.get_parameters().is_valid());
|
||||
EXPECT_TRUE(cache.get_validated_ranges().isEmpty());
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeAudioCache, ParameterSetters)
|
||||
{
|
||||
AudioPlaybackCache cache;
|
||||
|
||||
AudioParams params(48000, kChannelLayoutStereo, SampleFormat::F32P);
|
||||
cache.SetParameters(params);
|
||||
AudioParams params(48000, k_channel_layout_stereo, SampleFormat::f32_p);
|
||||
cache.set_parameters(params);
|
||||
|
||||
// Parameters should be retrievable
|
||||
AudioParams retrieved = cache.GetParameters();
|
||||
AudioParams retrieved = cache.get_parameters();
|
||||
EXPECT_EQ(retrieved.sample_rate(), params.sample_rate());
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ TEST(ViewerSmokeAudioCache, ValidateWithRange)
|
||||
AudioPlaybackCache cache;
|
||||
|
||||
// Initially no validated ranges
|
||||
TimeRangeList validated = cache.GetValidatedRanges();
|
||||
TimeRangeList validated = cache.get_validated_ranges();
|
||||
EXPECT_TRUE(validated.isEmpty());
|
||||
}
|
||||
|
||||
@@ -371,35 +371,35 @@ class ViewerSmokeAutoCacherTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
ColorManager::SetUpDefaultConfig();
|
||||
ColorManager::set_up_default_config();
|
||||
|
||||
// Use the dummy render backend so PreviewAutoCacher can be exercised
|
||||
// without initializing OpenGL/Vulkan in the unit-test process.
|
||||
OLIVE_CONFIG("GraphicsBackend") = QStringLiteral("dummy");
|
||||
OAK_CONFIG("GraphicsBackend") = QStringLiteral("dummy");
|
||||
|
||||
DiskManager::CreateInstance();
|
||||
ConformManager::CreateInstance();
|
||||
RenderManager::CreateInstance();
|
||||
DiskManager::create_instance();
|
||||
ConformManager::create_instance();
|
||||
RenderManager::create_instance();
|
||||
|
||||
project_ = std::make_unique<Project>();
|
||||
project_->Initialize();
|
||||
project_->initialize();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
project_.reset();
|
||||
RenderManager::DestroyInstance();
|
||||
ConformManager::DestroyInstance();
|
||||
DiskManager::DestroyInstance();
|
||||
RenderManager::destroy_instance();
|
||||
ConformManager::destroy_instance();
|
||||
DiskManager::destroy_instance();
|
||||
}
|
||||
|
||||
ViewerOutput *CreateViewerWithValidParams()
|
||||
ViewerOutput *create_viewer_with_valid_params()
|
||||
{
|
||||
auto *viewer = new ViewerOutput();
|
||||
viewer->setParent(project_.get());
|
||||
viewer->SetVideoParams(
|
||||
VideoParams(64, 64, rational(1, 25), PixelFormat::U8,
|
||||
VideoParams::kRGBAChannelCount));
|
||||
viewer->set_video_params(
|
||||
VideoParams(64, 64, Rational(1, 25), PixelFormat::u8,
|
||||
VideoParams::k_rgba_channel_count));
|
||||
return viewer;
|
||||
}
|
||||
|
||||
@@ -411,74 +411,74 @@ TEST_F(ViewerSmokeAutoCacherTest, Construction)
|
||||
PreviewAutoCacher cacher;
|
||||
|
||||
// A freshly constructed cacher has no project and no custom range running
|
||||
EXPECT_FALSE(cacher.IsRenderingCustomRange());
|
||||
EXPECT_FALSE(cacher.is_rendering_custom_range());
|
||||
}
|
||||
|
||||
TEST_F(ViewerSmokeAutoCacherTest, PauseControls)
|
||||
{
|
||||
ViewerOutput *viewer = CreateViewerWithValidParams();
|
||||
ViewerOutput *viewer = create_viewer_with_valid_params();
|
||||
|
||||
PreviewAutoCacher cacher;
|
||||
cacher.SetProject(project_.get());
|
||||
cacher.set_project(project_.get());
|
||||
|
||||
// While renders are paused, a forced cache range must stay queued
|
||||
cacher.SetRendersPaused(true);
|
||||
cacher.ForceCacheRange(viewer, TimeRange(rational(0), rational(1, 25)));
|
||||
EXPECT_TRUE(cacher.IsRenderingCustomRange());
|
||||
cacher.set_renders_paused(true);
|
||||
cacher.force_cache_range(viewer, TimeRange(Rational(0), Rational(1, 25)));
|
||||
EXPECT_TRUE(cacher.is_rendering_custom_range());
|
||||
|
||||
// Unpausing must dispatch it; the dummy backend finishes each ticket
|
||||
// without a result, which exhausts the range immediately
|
||||
cacher.SetRendersPaused(false);
|
||||
EXPECT_FALSE(cacher.IsRenderingCustomRange());
|
||||
cacher.set_renders_paused(false);
|
||||
EXPECT_FALSE(cacher.is_rendering_custom_range());
|
||||
|
||||
// Deliver the queued RenderTicketWatcher::Finished emissions so the
|
||||
// completed watchers are reaped before teardown.
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
cacher.SetProject(nullptr);
|
||||
cacher.set_project(nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ViewerSmokeAutoCacherTest, CacheRequestSchedulesRenderWhenNotIgnored)
|
||||
{
|
||||
ViewerOutput *viewer = CreateViewerWithValidParams();
|
||||
ViewerOutput *viewer = create_viewer_with_valid_params();
|
||||
|
||||
PreviewAutoCacher cacher;
|
||||
cacher.SetProject(project_.get());
|
||||
cacher.set_project(project_.get());
|
||||
|
||||
QSignalSpy stop_spy(&cacher, &PreviewAutoCacher::StopCacheProxyTasks);
|
||||
QSignalSpy stop_spy(&cacher, &PreviewAutoCacher::stop_cache_proxy_tasks);
|
||||
|
||||
// A cache request on a connected node's cache must be picked up and
|
||||
// rendered, emitting StopCacheProxyTasks when the range is exhausted
|
||||
viewer->video_frame_cache()->Request(
|
||||
viewer, TimeRange(rational(0), rational(1, 25)));
|
||||
viewer->video_frame_cache()->request(
|
||||
viewer, TimeRange(Rational(0), Rational(1, 25)));
|
||||
EXPECT_GE(stop_spy.count(), 1);
|
||||
|
||||
// Deliver the queued RenderTicketWatcher::Finished emissions so the
|
||||
// completed watchers are reaped before teardown.
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
cacher.SetProject(nullptr);
|
||||
cacher.set_project(nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ViewerSmokeAutoCacherTest, SetIgnoreCacheRequests)
|
||||
{
|
||||
ViewerOutput *viewer = CreateViewerWithValidParams();
|
||||
ViewerOutput *viewer = create_viewer_with_valid_params();
|
||||
|
||||
PreviewAutoCacher cacher;
|
||||
// Must be set before SetProject(), which is when the cache connections
|
||||
// would be made
|
||||
cacher.SetIgnoreCacheRequests(true);
|
||||
cacher.SetProject(project_.get());
|
||||
cacher.set_ignore_cache_requests(true);
|
||||
cacher.set_project(project_.get());
|
||||
|
||||
QSignalSpy stop_spy(&cacher, &PreviewAutoCacher::StopCacheProxyTasks);
|
||||
QSignalSpy stop_spy(&cacher, &PreviewAutoCacher::stop_cache_proxy_tasks);
|
||||
|
||||
// With cache requests ignored, requesting a range must not queue any job
|
||||
viewer->video_frame_cache()->Request(
|
||||
viewer, TimeRange(rational(0), rational(1, 25)));
|
||||
viewer->video_frame_cache()->request(
|
||||
viewer, TimeRange(Rational(0), Rational(1, 25)));
|
||||
EXPECT_EQ(stop_spy.count(), 0);
|
||||
EXPECT_FALSE(cacher.IsRenderingCustomRange());
|
||||
EXPECT_FALSE(cacher.is_rendering_custom_range());
|
||||
|
||||
cacher.SetProject(nullptr);
|
||||
cacher.set_project(nullptr);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -487,50 +487,50 @@ TEST_F(ViewerSmokeAutoCacherTest, SetIgnoreCacheRequests)
|
||||
|
||||
TEST(ViewerSmokeRational, DefaultConstruction)
|
||||
{
|
||||
rational r;
|
||||
Rational r;
|
||||
EXPECT_EQ(r.numerator(), 0);
|
||||
EXPECT_EQ(r.denominator(), 1);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeRational, ValueConstruction)
|
||||
{
|
||||
rational r(24, 1);
|
||||
Rational r(24, 1);
|
||||
EXPECT_EQ(r.numerator(), 24);
|
||||
EXPECT_EQ(r.denominator(), 1);
|
||||
|
||||
rational r2(1, 24);
|
||||
Rational r2(1, 24);
|
||||
EXPECT_EQ(r2.numerator(), 1);
|
||||
EXPECT_EQ(r2.denominator(), 24);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeRational, ToDouble)
|
||||
{
|
||||
rational r(1, 2);
|
||||
EXPECT_DOUBLE_EQ(r.toDouble(), 0.5);
|
||||
Rational r(1, 2);
|
||||
EXPECT_DOUBLE_EQ(r.to_double(), 0.5);
|
||||
|
||||
rational r2(3, 4);
|
||||
EXPECT_DOUBLE_EQ(r2.toDouble(), 0.75);
|
||||
Rational r2(3, 4);
|
||||
EXPECT_DOUBLE_EQ(r2.to_double(), 0.75);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeRational, Arithmetic)
|
||||
{
|
||||
rational r1(1, 2);
|
||||
rational r2(1, 4);
|
||||
Rational r1(1, 2);
|
||||
Rational r2(1, 4);
|
||||
|
||||
rational sum = r1 + r2;
|
||||
Rational sum = r1 + r2;
|
||||
EXPECT_EQ(sum.numerator(), 3);
|
||||
EXPECT_EQ(sum.denominator(), 4);
|
||||
|
||||
rational diff = r1 - r2;
|
||||
Rational diff = r1 - r2;
|
||||
EXPECT_EQ(diff.numerator(), 1);
|
||||
EXPECT_EQ(diff.denominator(), 4);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeRational, Comparison)
|
||||
{
|
||||
rational r1(1, 2);
|
||||
rational r2(2, 4);
|
||||
rational r3(3, 4);
|
||||
Rational r1(1, 2);
|
||||
Rational r2(2, 4);
|
||||
Rational r3(3, 4);
|
||||
|
||||
EXPECT_TRUE(r1 == r2); // Equivalent fractions
|
||||
EXPECT_FALSE(r1 == r3);
|
||||
@@ -540,17 +540,17 @@ TEST(ViewerSmokeRational, Comparison)
|
||||
|
||||
TEST(ViewerSmokeRational, NullCheck)
|
||||
{
|
||||
rational r;
|
||||
Rational r;
|
||||
EXPECT_TRUE(r.isNull()); // 0/1 is considered null
|
||||
|
||||
rational r2(1, 2);
|
||||
Rational r2(1, 2);
|
||||
EXPECT_FALSE(r2.isNull());
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeRational, Flipped)
|
||||
{
|
||||
rational r(24, 1);
|
||||
rational flipped = r.flipped();
|
||||
Rational r(24, 1);
|
||||
Rational flipped = r.flipped();
|
||||
|
||||
EXPECT_EQ(flipped.numerator(), 1);
|
||||
EXPECT_EQ(flipped.denominator(), 24);
|
||||
@@ -566,7 +566,7 @@ TEST(ViewerSmokeThread, ConcurrentTimerAccess)
|
||||
const int num_iterations = 100;
|
||||
|
||||
ViewerPlaybackTimer timer;
|
||||
timer.Start(0, 1, 1.0 / 30.0);
|
||||
timer.start(0, 1, 1.0 / 30.0);
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
std::atomic<int> monotonic_violations{ 0 };
|
||||
@@ -577,7 +577,7 @@ TEST(ViewerSmokeThread, ConcurrentTimerAccess)
|
||||
threads.emplace_back([&timer, &monotonic_violations, num_iterations]() {
|
||||
int64_t previous = 0;
|
||||
for (int i = 0; i < num_iterations; ++i) {
|
||||
const int64_t ts = timer.GetTimestampNow();
|
||||
const int64_t ts = timer.get_timestamp_now();
|
||||
if (ts < previous) {
|
||||
monotonic_violations++;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ TEST(ViewerSmokeThread, ConcurrentTimerAccess)
|
||||
|
||||
EXPECT_EQ(monotonic_violations.load(), 0);
|
||||
// The threads ran long enough that the timer must have advanced at all
|
||||
EXPECT_GE(timer.GetTimestampNow(), 0);
|
||||
EXPECT_GE(timer.get_timestamp_now(), 0);
|
||||
}
|
||||
|
||||
TEST(ViewerSmokeThread, ConcurrentQueueAccess)
|
||||
@@ -609,9 +609,9 @@ TEST(ViewerSmokeThread, ConcurrentQueueAccess)
|
||||
[&queue, &append_count, t, num_frames_per_thread]() {
|
||||
for (int i = 0; i < num_frames_per_thread; ++i) {
|
||||
ViewerPlaybackFrame frame{
|
||||
rational(t * num_frames_per_thread + i, 24), QVariant()
|
||||
Rational(t * num_frames_per_thread + i, 24), QVariant()
|
||||
};
|
||||
queue.AppendTimewise(frame, 1);
|
||||
queue.append_timewise(frame, 1);
|
||||
append_count++;
|
||||
}
|
||||
});
|
||||
@@ -636,17 +636,17 @@ TEST(ViewerSmokeIntegration, PlaybackSequenceSimulation)
|
||||
ViewerQueue queue;
|
||||
|
||||
// Start playback at frame 0, 24fps; timestamps are expressed in frames
|
||||
timer.Start(0, 1, 1.0 / 24.0);
|
||||
timer.start(0, 1, 1.0 / 24.0);
|
||||
|
||||
// Queue some frames
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ViewerPlaybackFrame frame{ rational(i, 24), QVariant(i) };
|
||||
queue.AppendTimewise(frame, 1);
|
||||
ViewerPlaybackFrame frame{ Rational(i, 24), QVariant(i) };
|
||||
queue.append_timewise(frame, 1);
|
||||
}
|
||||
|
||||
// Get current timestamp (in frames) and convert it to a time in seconds
|
||||
const int64_t current_ts = timer.GetTimestampNow();
|
||||
const rational current_time(current_ts, 24);
|
||||
const int64_t current_ts = timer.get_timestamp_now();
|
||||
const Rational current_time(current_ts, 24);
|
||||
|
||||
// Find the first queued frame at or after the current playback time
|
||||
bool found = false;
|
||||
@@ -681,21 +681,21 @@ TEST(ViewerSmokeIntegration, ReversePlaybackScenario)
|
||||
ViewerQueue queue;
|
||||
|
||||
// Start reverse playback from frame 100
|
||||
timer.Start(100, -1, 1.0 / 24.0);
|
||||
timer.start(100, -1, 1.0 / 24.0);
|
||||
|
||||
// Queue frames in reverse order
|
||||
for (int i = 100; i >= 90; i--) {
|
||||
ViewerPlaybackFrame frame{ rational(i, 24), QVariant(i) };
|
||||
queue.AppendTimewise(frame, -1);
|
||||
ViewerPlaybackFrame frame{ Rational(i, 24), QVariant(i) };
|
||||
queue.append_timewise(frame, -1);
|
||||
}
|
||||
|
||||
// Get timestamps - should decrease
|
||||
int64_t ts1 = timer.GetTimestampNow();
|
||||
int64_t ts1 = timer.get_timestamp_now();
|
||||
QThread::msleep(50);
|
||||
int64_t ts2 = timer.GetTimestampNow();
|
||||
int64_t ts2 = timer.get_timestamp_now();
|
||||
|
||||
EXPECT_LT(ts2, ts1);
|
||||
EXPECT_EQ(queue.front().timestamp, rational(100, 24));
|
||||
EXPECT_EQ(queue.front().timestamp, Rational(100, 24));
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
Reference in New Issue
Block a user