test: replace fake and duplicate tests with real assertions

Fake tests rewritten to assert real behavior:
- audio_smoke: conversion tests now actually Convert() samples and verify
  output; waveform length/summary assertions tightened to exact values
- plugin_format_conversion: RowBytes/U8ToU16/LoadImageFile now call real
  production code (VideoParams::GetBytesPerPixel, sws scaler, OIIO decode
  of tests/img.png with known pixel values)
- core_color: HSV round trip now verifies fromHsv(toHsv(c)) == c instead
  of comparing toHsv against its own accessors
- core_bezier/node_inputimmediate: expected values replaced with
  independently derived constants instead of re-running the code under test
- common_commandlineparser/common_debug/common_jobtime: capture
  stdout/stderr/qDebug and assert actual output content
- proxy_manager: ProxyFinished test now drives a real proxy job instead of
  emitting the signal itself; proxy_dialog/panel/proxy/preferences/timeruler
  tests assert real widget state
- viewer_smoke/preview_autocacher/render_misc: zero-assertion tests given
  observable-state assertions or removed where nothing is observable

Duplicates removed:
- plugin_smoke_test.cpp: 18 tests duplicated from plugin_paraminstance /
  plugin_support_* / plugin_renderer_readback (751 -> 180 lines)
- module_smoke HumanStrings tests covered precisely by ui_humanstrings_test
- render_misc duplicate kDefaultInterpolation constant check

Removed by policy (skip allowed, never disabled):
- all DISABLED_ prefixes: re-enabled as real offscreen tests or deleted
- ffmpeg_decoder_hw: hardcoded personal path replaced with
  OAK_TEST_HW_DECODE_FILE env var, GTEST_SKIP when unset

Also:
- config_test: restore Config defaults after run (cross-test pollution)
- render_worker_footage: drop /tmp debug-output scaffolding
- previewaudiodevice construction test asserts the real bugfix
This commit is contained in:
2026-07-19 13:58:31 +08:00
parent b0aa683499
commit cb1718a103
37 changed files with 1560 additions and 1038 deletions
+36 -5
View File
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>
#include <QFontMetrics>
#include <QLabel>
#include <QPushButton>
#include <QSignalSpy>
@@ -9,6 +10,7 @@
#include "node/output/viewer/viewer.h"
#include "olive/core/util/timecodefunctions.h"
#include "render/diskmanager.h"
#include "timeline/timelinemarker.h"
#include "widget/playbackcontrols/playbackcontrols.h"
#include "widget/slider/base/sliderbase.h"
#include "widget/slider/base/sliderlabel.h"
@@ -35,14 +37,33 @@ void EnsureAppSingletons()
TEST(TimeRuler, ConstructionWithAndWithoutDecorations)
{
EnsureAppSingletons();
// Text shown, cache status hidden
TimeRuler plain;
EXPECT_EQ(plain.GetMarkers(), nullptr);
EXPECT_EQ(plain.GetWorkArea(), nullptr);
// Text hidden, cache status shown
TimeRuler decorated(false, true);
// The height is fixed and derived from the enabled decorations: base
// text height plus marker height always, another text height when text
// is visible, and the cache indicator height when cache status is shown
const QFontMetrics fm = plain.fontMetrics();
const int marker_h = TimelineMarker::GetMarkerHeight(fm);
EXPECT_EQ(plain.minimumHeight(), 2 * fm.height() + marker_h);
EXPECT_EQ(plain.maximumHeight(), plain.minimumHeight());
EXPECT_EQ(decorated.minimumHeight(),
fm.height() + PlaybackCache::GetCacheIndicatorHeight() + marker_h);
EXPECT_EQ(decorated.maximumHeight(), decorated.minimumHeight());
// Centered text only affects painting, not geometry
decorated.SetCenteredText(true);
SUCCEED();
EXPECT_EQ(decorated.minimumHeight(),
fm.height() + PlaybackCache::GetCacheIndicatorHeight() + marker_h);
}
TEST(TimeRuler, TimebaseAndScaleDriveTimePixelConversion)
@@ -253,11 +274,21 @@ TEST_F(PlaybackControlsTest, SetEndTimeFormatsEndTimecodeLabel)
}
ASSERT_NE(end_label, nullptr);
// Pin the display mode so the expected strings don't depend on whatever
// the config happens to hold
const core::Timecode::Display saved_display =
Core::instance()->GetTimecodeDisplay();
Core::instance()->SetTimecodeDisplay(core::Timecode::kTimecodeNonDropFrame);
// 30 seconds at 30 fps is frame 900 = 30 seconds + 0 frames
controls.SetEndTime(rational(30));
const QString expected = QString::fromStdString(
core::Timecode::time_to_timecode(rational(30), rational(1, 30),
Core::instance()->GetTimecodeDisplay()));
EXPECT_EQ(end_label->text(), expected);
EXPECT_EQ(end_label->text(), QStringLiteral("00:00:30:00"));
// 1.5 seconds at 30 fps is frame 45 = 1 second + 15 frames
controls.SetEndTime(rational(3, 2));
EXPECT_EQ(end_label->text(), QStringLiteral("00:00:01:15"));
Core::instance()->SetTimecodeDisplay(saved_display);
}
TEST_F(PlaybackControlsTest, PlayPauseStackSwitchesVisibleButton)