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:
@@ -2,8 +2,11 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTimer>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
@@ -12,6 +15,7 @@
|
||||
#include "node/project/footage/footage.h"
|
||||
#include "render/job/footagejob.h"
|
||||
#include "task/proxy/proxy.h"
|
||||
#include "task/taskmanager.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -217,39 +221,93 @@ TEST(ProxyManager, FootageClearRemovesProxyMetadata)
|
||||
|
||||
TEST(ProxyManager, EmitsProxyFinishedState)
|
||||
{
|
||||
// Drives a real proxy job through ProxyManager so that ProxyFinished is
|
||||
// emitted by the manager's own task completion path
|
||||
const QString ffmpeg = olive::ProxyManager::FindFFmpegExecutable(
|
||||
ProxyConfigValue("FFmpegPath").toString());
|
||||
if (ffmpeg.isEmpty()) {
|
||||
GTEST_SKIP() << "ffmpeg executable not available";
|
||||
}
|
||||
|
||||
const QString source =
|
||||
QDir(QStringLiteral(OAK_TEST_SOURCE_DIR))
|
||||
.filePath(QStringLiteral("tests/demo.mp4"));
|
||||
ASSERT_TRUE(QFileInfo::exists(source));
|
||||
|
||||
const bool created_task_manager =
|
||||
(olive::TaskManager::instance() == nullptr);
|
||||
if (created_task_manager) {
|
||||
olive::TaskManager::CreateInstance();
|
||||
}
|
||||
olive::ProxyManager::CreateInstance();
|
||||
|
||||
QTemporaryDir cache;
|
||||
ASSERT_TRUE(cache.isValid());
|
||||
|
||||
// A small, fast preset keeps the encode of the 17 second demo clip quick
|
||||
olive::ProxyManager::ProxyParams params;
|
||||
params.width = 320;
|
||||
params.height = 180;
|
||||
params.preset = QStringLiteral("ultrafast");
|
||||
params.include_audio = true;
|
||||
|
||||
const QString expected_proxy = olive::ProxyManager::GetProxyFilename(
|
||||
cache.path(), source, 0, params);
|
||||
|
||||
bool received = false;
|
||||
QString received_source;
|
||||
int received_stream = -1;
|
||||
QString received_proxy;
|
||||
olive::ProxyManager::ProxyState received_state =
|
||||
olive::ProxyManager::kProxyMissing;
|
||||
bool ready_received = false;
|
||||
QEventLoop loop;
|
||||
QObject::connect(
|
||||
olive::ProxyManager::instance(), &olive::ProxyManager::ProxyFinished,
|
||||
&loop,
|
||||
[&received, &received_source, &received_stream, &received_proxy,
|
||||
&received_state](const QString &source_filename, int stream_index,
|
||||
const QString &proxy_filename,
|
||||
olive::ProxyManager::ProxyState state) {
|
||||
&received_state, &loop](const QString &source_filename,
|
||||
int stream_index, const QString &proxy_filename,
|
||||
olive::ProxyManager::ProxyState state) {
|
||||
received = true;
|
||||
received_source = source_filename;
|
||||
received_stream = stream_index;
|
||||
received_proxy = proxy_filename;
|
||||
received_state = state;
|
||||
loop.quit();
|
||||
});
|
||||
QObject::connect(olive::ProxyManager::instance(),
|
||||
&olive::ProxyManager::ProxyReady, &loop,
|
||||
[&ready_received](const QString &, int, const QString &) {
|
||||
ready_received = true;
|
||||
});
|
||||
// Generous timeout; failure to finish in time fails the test below
|
||||
QTimer::singleShot(120000, &loop, &QEventLoop::quit);
|
||||
|
||||
emit olive::ProxyManager::instance()
|
||||
-> ProxyFinished(QStringLiteral("/media/source.mov"), 0,
|
||||
QStringLiteral("/cache/proxy/example.mp4"),
|
||||
olive::ProxyManager::kProxyFailed);
|
||||
const olive::ProxyManager::Proxy proxy =
|
||||
olive::ProxyManager::instance()->GetOrStartProxy(cache.path(), source, 0,
|
||||
params);
|
||||
ASSERT_EQ(proxy.state, olive::ProxyManager::kProxyGenerating);
|
||||
ASSERT_NE(proxy.task, nullptr);
|
||||
|
||||
EXPECT_TRUE(received);
|
||||
EXPECT_EQ(received_source, QStringLiteral("/media/source.mov"));
|
||||
loop.exec();
|
||||
|
||||
ASSERT_TRUE(received) << "Timed out waiting for proxy generation";
|
||||
EXPECT_TRUE(ready_received);
|
||||
EXPECT_EQ(received_source, source);
|
||||
EXPECT_EQ(received_stream, 0);
|
||||
EXPECT_EQ(received_proxy, QStringLiteral("/cache/proxy/example.mp4"));
|
||||
EXPECT_EQ(received_state, olive::ProxyManager::kProxyFailed);
|
||||
EXPECT_EQ(received_proxy, expected_proxy);
|
||||
EXPECT_EQ(received_state, olive::ProxyManager::kProxyReady);
|
||||
|
||||
// The manager moved the completed proxy into its final location
|
||||
EXPECT_TRUE(QFileInfo::exists(expected_proxy));
|
||||
EXPECT_EQ(olive::ProxyManager::GetProxyState(expected_proxy),
|
||||
olive::ProxyManager::kProxyReady);
|
||||
|
||||
olive::ProxyManager::DestroyInstance();
|
||||
if (created_task_manager) {
|
||||
olive::TaskManager::DestroyInstance();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ProxyManager, WorkingProxyFilenamePrependsExtension)
|
||||
|
||||
Reference in New Issue
Block a user