Files
oak-editor/tests/gtest/proxy_dialog_test.cpp
T
Mike-Solar 66d761b4b7 R8: finish app/ pure C ABI migration (P3-P9) and make OTIO required
- 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
2026-07-31 22:46:52 +08:00

114 lines
3.7 KiB
C++

#include <gtest/gtest.h>
#include <QCheckBox>
#include <QPushButton>
#include <QTreeWidget>
#include "config/config.h"
#include "dialog/proxy/proxydialog.h"
#include "node/project/footage/footage.h"
#include "oakengine/node.h"
namespace
{
QVariant proxy_dialog_config_value(const char *key)
{
return olive::Config::current()[QString::fromUtf8(key)];
}
} // namespace
TEST(ProxyDialog, ConstructsInGlobalModeWithNullParent)
{
olive::ProxyDialog dialog(nullptr);
// The global settings editors must reflect the current config values
EXPECT_EQ(dialog.proxy_width(),
proxy_dialog_config_value("ProxyWidth").value<int>());
EXPECT_EQ(dialog.proxy_height(),
proxy_dialog_config_value("ProxyHeight").value<int>());
EXPECT_EQ(dialog.proxy_crf(),
proxy_dialog_config_value("ProxyCRF").value<int>());
EXPECT_EQ(dialog.proxy_preset(),
proxy_dialog_config_value("ProxyPreset").toString());
EXPECT_EQ(dialog.proxy_include_audio(),
proxy_dialog_config_value("ProxyIncludeAudio").toBool());
EXPECT_EQ(dialog.f_fmpeg_path(),
proxy_dialog_config_value("FFmpegPath").toString());
}
TEST(ProxyDialog, ConstructsWithFootageList)
{
olive::Footage footage(QStringLiteral("/tmp/oak-proxy-test.mov"));
const QVector<OakEngineNode *> items = {
reinterpret_cast<OakEngineNode *>(&footage)
};
olive::ProxyDialog dialog(nullptr, items);
EXPECT_EQ(dialog.windowTitle(), QStringLiteral("Proxy Settings"));
// Global mode has no footage tree at all
olive::ProxyDialog global_dialog(nullptr);
EXPECT_EQ(global_dialog.findChild<QTreeWidget *>(), nullptr);
// Footage mode shows one tree row per item with its proxy state
auto *tree = dialog.findChild<QTreeWidget *>();
ASSERT_NE(tree, nullptr);
ASSERT_EQ(tree->topLevelItemCount(), 1);
EXPECT_EQ(tree->topLevelItem(0)->text(0),
QStringLiteral("/tmp/oak-proxy-test.mov"));
EXPECT_EQ(tree->topLevelItem(0)->text(1), QStringLiteral("missing"));
// Fresh footage has no custom params, so the custom settings checkbox
// starts unchecked
QCheckBox *custom_checkbox = nullptr;
foreach (QCheckBox *box, dialog.findChildren<QCheckBox *>()) {
if (box->text() ==
QStringLiteral("Use custom settings for selected footage")) {
custom_checkbox = box;
break;
}
}
ASSERT_NE(custom_checkbox, nullptr);
EXPECT_FALSE(custom_checkbox->isChecked());
// Footage mode adds generate/delete actions next to Close
QStringList button_texts;
foreach (QPushButton *b, dialog.findChildren<QPushButton *>()) {
button_texts << b->text();
}
EXPECT_TRUE(button_texts.contains(QStringLiteral("Generate Proxies")));
EXPECT_TRUE(button_texts.contains(QStringLiteral("Delete Proxies")));
EXPECT_TRUE(button_texts.contains(QStringLiteral("Close")));
}
TEST(ProxyDialog, AcceptSavesGlobalSettingsToConfig)
{
const int old_width = proxy_dialog_config_value("ProxyWidth").value<int>();
const bool old_include_audio =
proxy_dialog_config_value("ProxyIncludeAudio").toBool();
const QString old_ffmpeg_path =
proxy_dialog_config_value("FFmpegPath").toString();
{
olive::ProxyDialog dialog(nullptr);
dialog.set_proxy_width(640);
dialog.set_proxy_include_audio(!old_include_audio);
dialog.set_f_fmpeg_path(QStringLiteral("/tmp/oak-test-ffmpeg"));
dialog.accept();
}
EXPECT_EQ(proxy_dialog_config_value("ProxyWidth").value<int>(), 640);
EXPECT_EQ(proxy_dialog_config_value("ProxyIncludeAudio").toBool(),
!old_include_audio);
EXPECT_EQ(proxy_dialog_config_value("FFmpegPath").toString(),
QStringLiteral("/tmp/oak-test-ffmpeg"));
// Restore previous config values so other tests are unaffected
olive::Config::current()[QStringLiteral("ProxyWidth")] = old_width;
olive::Config::current()[QStringLiteral("ProxyIncludeAudio")] =
old_include_audio;
olive::Config::current()[QStringLiteral("FFmpegPath")] = old_ffmpeg_path;
}