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:
@@ -3,6 +3,7 @@
|
||||
#include <QApplication>
|
||||
|
||||
#include "audio/audiomanager.h"
|
||||
#include "config/config.h"
|
||||
#include "dialog/preferences/tabs/preferencesbehaviortab.h"
|
||||
#include "dialog/preferences/tabs/preferencesgeneraltab.h"
|
||||
#include "dialog/preferences/tabs/preferencesaudiotab.h"
|
||||
@@ -41,32 +42,52 @@ TEST(PreferencesBehaviorTab, RenderingCategoryHasGraphicsBackendCombobox)
|
||||
EXPECT_FALSE(tab.findChildren<QCheckBox *>().isEmpty());
|
||||
}
|
||||
|
||||
TEST(PreferencesBehaviorTab, BehaviorPrefTrProvidesTranslations)
|
||||
TEST(PreferencesBehaviorTab, BehaviorPrefTrReturnsExactSourceStrings)
|
||||
{
|
||||
QStringList keys;
|
||||
keys << QStringLiteral("Enable hover focus")
|
||||
<< QStringLiteral("Select also selects all children in the graph")
|
||||
<< QStringLiteral("Double-clicking a node opens its properties")
|
||||
<< QStringLiteral("Auto-Seek to Beginning of Sequence")
|
||||
<< QStringLiteral("Scroll wheel zooms instead of scrolling")
|
||||
<< QStringLiteral("Enable audio scrubbing");
|
||||
|
||||
foreach (const QString &key, keys) {
|
||||
EXPECT_FALSE(
|
||||
PreferencesBehaviorTab::BehaviorPrefTr(key.toUtf8().constData())
|
||||
.isEmpty())
|
||||
<< key.toStdString();
|
||||
}
|
||||
// BehaviorPrefTr() provides the shared source strings used by the other
|
||||
// preference tabs; without a translator installed it returns the source
|
||||
// text unchanged. Pin the exact strings so accidental edits are caught
|
||||
// (they would silently change the translation keys and the cross-tab
|
||||
// lookups that rely on them).
|
||||
EXPECT_EQ(PreferencesBehaviorTab::BehaviorPrefTr("Behavior"),
|
||||
QStringLiteral("Behavior"));
|
||||
EXPECT_EQ(PreferencesBehaviorTab::BehaviorPrefTr("Enable hover focus"),
|
||||
QStringLiteral("Enable hover focus"));
|
||||
EXPECT_EQ(PreferencesBehaviorTab::BehaviorPrefTr("Enable slider ladder"),
|
||||
QStringLiteral("Enable slider ladder"));
|
||||
EXPECT_EQ(PreferencesBehaviorTab::BehaviorPrefTr(
|
||||
"Scrolling zooms by default"),
|
||||
QStringLiteral("Scrolling zooms by default"));
|
||||
EXPECT_EQ(PreferencesBehaviorTab::BehaviorPrefTr("Enable audio scrubbing"),
|
||||
QStringLiteral("Enable audio scrubbing"));
|
||||
}
|
||||
|
||||
TEST(PreferencesBehaviorTab, RenderingCategoryContainsDefaultBackend)
|
||||
{
|
||||
PreferencesBehaviorTab tab(PreferencesBehaviorTab::kCategoryRendering);
|
||||
QList<QComboBox *> boxes = tab.findChildren<QComboBox *>();
|
||||
ASSERT_FALSE(boxes.isEmpty());
|
||||
// Force the config back to the registered default so the selected entry
|
||||
// is deterministic regardless of test order
|
||||
const QVariant saved_backend =
|
||||
Config::Current()[QStringLiteral("GraphicsBackend")];
|
||||
Config::Current()[QStringLiteral("GraphicsBackend")] =
|
||||
QStringLiteral("opengl");
|
||||
|
||||
QComboBox *backend_box = boxes.first();
|
||||
EXPECT_GT(backend_box->count(), 0);
|
||||
{
|
||||
PreferencesBehaviorTab tab(PreferencesBehaviorTab::kCategoryRendering);
|
||||
QList<QComboBox *> boxes = tab.findChildren<QComboBox *>();
|
||||
ASSERT_FALSE(boxes.isEmpty());
|
||||
|
||||
QComboBox *backend_box = boxes.first();
|
||||
|
||||
// config.cpp registers "opengl" as the default GraphicsBackend
|
||||
const int opengl_index =
|
||||
backend_box->findData(QStringLiteral("opengl"));
|
||||
ASSERT_NE(opengl_index, -1);
|
||||
EXPECT_EQ(backend_box->itemText(opengl_index),
|
||||
QStringLiteral("OpenGL"));
|
||||
EXPECT_EQ(backend_box->currentIndex(), opengl_index);
|
||||
}
|
||||
|
||||
Config::Current()[QStringLiteral("GraphicsBackend")] = saved_backend;
|
||||
}
|
||||
|
||||
TEST(PreferencesGeneralTab, ContainsHoverFocusOption)
|
||||
@@ -120,15 +141,20 @@ TEST(PreferencesAudioTab, IncludesAudioScrubbingOption)
|
||||
|
||||
{
|
||||
PreferencesAudioTab tab;
|
||||
QList<QCheckBox *> boxes = tab.findChildren<QCheckBox *>();
|
||||
bool found = false;
|
||||
foreach (QCheckBox *box, boxes) {
|
||||
if (!box->text().isEmpty()) {
|
||||
found = true;
|
||||
|
||||
// Locate the scrubbing checkbox by its exact (untranslated) label
|
||||
QCheckBox *scrubbing = nullptr;
|
||||
foreach (QCheckBox *box, tab.findChildren<QCheckBox *>()) {
|
||||
if (box->text() == QStringLiteral("Enable audio scrubbing")) {
|
||||
scrubbing = box;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(found);
|
||||
ASSERT_NE(scrubbing, nullptr);
|
||||
|
||||
// Its initial state mirrors the AudioScrubbing config entry
|
||||
EXPECT_EQ(scrubbing->isChecked(),
|
||||
Config::Current()[QStringLiteral("AudioScrubbing")].toBool());
|
||||
}
|
||||
|
||||
AudioManager::DestroyInstance();
|
||||
|
||||
Reference in New Issue
Block a user