cli/worker/tests: facade-only linkage and updated test suites

oak-cli and oak-render-worker use the C ABI exclusively (0 olive::
symbols). Google Test suites updated for the migrated APIs, new engine
facade test coverage, CLI transcode verification.
This commit is contained in:
2026-07-26 22:43:32 +08:00
parent 0aa5879f35
commit 5b68bbeec8
26 changed files with 184 additions and 932 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
+7 -5
View File
@@ -8,6 +8,7 @@
#include <QStandardPaths>
#include "codec/encoder.h"
#include "oakengine/encoding.h"
#include "dialog/export/codec/h264section.h"
#include "dialog/export/codec/imagesection.h"
#include "dialog/export/exportadvancedvideodialog.h"
@@ -18,6 +19,7 @@
#include "dialog/export/exportvideotab.h"
#include "node/color/colormanager/colormanager.h"
#include "node/project.h"
#include "widget/manageddisplay/colorprocessorhandle.h"
namespace
{
@@ -195,7 +197,7 @@ TEST(DialogExportVideoTab, SetFormatPopulatesCodecs)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ExportVideoTab tab(project.color_manager());
olive::ExportVideoTab tab(oak_color_manager(project.color_manager()));
const QList<olive::ExportCodec::Codec> codecs =
olive::ExportFormat::get_video_codecs(olive::ExportFormat::k_format_matroska);
@@ -214,7 +216,7 @@ TEST(DialogExportVideoTab, CodecSelectsMatchingSection)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ExportVideoTab tab(project.color_manager());
olive::ExportVideoTab tab(oak_color_manager(project.color_manager()));
tab.set_format(olive::ExportFormat::k_format_matroska);
// First Matroska codec is H.264, which has a dedicated section
@@ -233,7 +235,7 @@ TEST(DialogExportVideoTab, ImageSequenceCheckboxRoundTrips)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ExportVideoTab tab(project.color_manager());
olive::ExportVideoTab tab(oak_color_manager(project.color_manager()));
tab.set_format(olive::ExportFormat::k_format_png);
tab.video_codec_changed();
@@ -249,7 +251,7 @@ TEST(DialogExportVideoTab, MaintainAspectTogglesScalingMethod)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ExportVideoTab tab(project.color_manager());
olive::ExportVideoTab tab(oak_color_manager(project.color_manager()));
tab.maintain_aspect_checkbox()->setChecked(true);
EXPECT_FALSE(tab.scaling_method_combobox()->isEnabled());
@@ -313,7 +315,7 @@ TEST(DialogExportSavePreset, AcceptWritesPresetFile)
{
StandardPathsTestModeGuard test_mode;
olive::EncodingParams params;
OakEngineEncodingParams *params = oakengine_encoding_params_create();
olive::ExportSavePresetDialog dialog(params);
+7 -6
View File
@@ -23,6 +23,7 @@
#include "dialog/actionsearch/actionsearch.h"
#include "dialog/autorecovery/autorecoverydialog.h"
#include "dialog/color/colordialog.h"
#include "widget/manageddisplay/colorprocessorhandle.h"
#include "dialog/configbase/configdialogbase.h"
#include "dialog/diskcache/diskcachedialog.h"
#include "dialog/preferences/keysequenceeditor.h"
@@ -43,7 +44,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
@@ -75,7 +76,7 @@ public:
return validate_result;
}
virtual void accept(olive::MultiUndoCommand *) override
virtual void accept(void *) override
{
++accept_count;
}
@@ -502,10 +503,10 @@ TEST(DialogTask, WrapsAndOwnsTask)
auto *task = new DummyTask();
QPointer<olive::Task> task_guard(task);
auto *dialog = new olive::TaskDialog(task, QStringLiteral("Title"));
auto *dialog = new olive::TaskDialog(
reinterpret_cast<OakEngineTask*>(task), QStringLiteral("Title"));
EXPECT_EQ(dialog->get_task(), task);
EXPECT_EQ(task->parent(), dialog);
EXPECT_EQ(dialog->get_task(), reinterpret_cast<OakEngineTask*>(task));
// The dialog takes ownership of the task
delete dialog;
@@ -520,7 +521,7 @@ TEST(DialogColor, SelectedColorRoundTrips)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ColorDialog dialog(project.color_manager(),
olive::ColorDialog dialog(oak_color_manager(project.color_manager()),
olive::Color(1.0f, 0.0f, 0.0f, 1.0f));
olive::ManagedColor selected = dialog.get_selected_color();
+1 -1
View File
@@ -119,7 +119,7 @@ protected:
{
if (!olive::Core::instance()) {
// Leaked intentionally: Core is process-wide (matches footage_test)
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
// Footage::Value() resolves Project::cache_path(), which goes through
+19 -26
View File
@@ -343,7 +343,7 @@ protected:
if (!olive::Core::instance()) {
// Leaked intentionally: Core is process-wide and DiskManager
// touches it (matches render_diskcache_test).
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
// Footage::Value() resolves Project::cache_path(), which goes through
@@ -439,7 +439,10 @@ TEST_F(FootageTest, DataRolesForInvalidFootage)
EXPECT_EQ(footage.data(olive::Node::tooltip).toString(),
QStringLiteral("Invalid"));
EXPECT_TRUE(footage.data(olive::Node::icon).canConvert<QIcon>());
// B1: engine icon sites return icon name strings (mapped to QIcon in the
// app layer via icon::from_name); invalid footage gets "error".
EXPECT_EQ(footage.data(olive::Node::icon).toString(),
QStringLiteral("error"));
// With no existing file behind the footage, the time roles fall through
// to the base class and stay invalid
@@ -477,14 +480,8 @@ TEST_F(FootageTest, TooltipDescribesEnabledStreams)
TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
{
// The icon globals must be loaded for the returned icons to be
// distinguishable (null icons all share the same cache key)
olive::icon::load_all(QStringLiteral(":/style/olive-dark"));
ASSERT_FALSE(olive::icon::video.isNull());
ASSERT_FALSE(olive::icon::audio.isNull());
ASSERT_FALSE(olive::icon::image.isNull());
ASSERT_FALSE(olive::icon::subtitles.isNull());
ASSERT_FALSE(olive::icon::error.isNull());
// B1: engine icon sites return icon name strings ("video", "audio",
// "image", "subtitles", "error"); the QIcon mapping lives in the app layer.
// Footage::data(ICON) only inspects streams once the footage has been
// probed (total_stream_count_ is set by Reprobe), so each variant is
@@ -507,8 +504,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
// Invalid footage gets the error icon
TestableFootage invalid;
EXPECT_EQ(invalid.data(olive::Node::icon).value<QIcon>().cacheKey(),
olive::icon::error.cacheKey());
EXPECT_EQ(invalid.data(olive::Node::icon).toString(),
QStringLiteral("error"));
// Real video streams take priority over audio
olive::FootageDescription video_audio(QStringLiteral("fakedecoder"));
@@ -517,10 +514,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
video_audio.set_stream_count(2);
TestableFootage *footage = probe(QStringLiteral("video-audio.mkv"), video_audio);
ASSERT_NE(footage, nullptr);
const QIcon video_icon = footage->data(olive::Node::icon).value<QIcon>();
EXPECT_EQ(video_icon.cacheKey(), olive::icon::video.cacheKey());
EXPECT_NE(video_icon.cacheKey(), olive::icon::audio.cacheKey());
EXPECT_NE(video_icon.cacheKey(), olive::icon::error.cacheKey());
EXPECT_EQ(footage->data(olive::Node::icon).toString(),
QStringLiteral("video"));
// Audio still takes priority over a still image stream
olive::VideoParams still_stream = make_video_stream(0);
@@ -532,10 +527,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
TestableFootage *still_and_audio =
probe(QStringLiteral("still-audio.mkv"), still_audio);
ASSERT_NE(still_and_audio, nullptr);
const QIcon still_audio_icon =
still_and_audio->data(olive::Node::icon).value<QIcon>();
EXPECT_EQ(still_audio_icon.cacheKey(), olive::icon::audio.cacheKey());
EXPECT_NE(still_audio_icon.cacheKey(), olive::icon::image.cacheKey());
EXPECT_EQ(still_and_audio->data(olive::Node::icon).toString(),
QStringLiteral("audio"));
// A still image without audio hits the image branch
olive::FootageDescription stills(QStringLiteral("fakedecoder"));
@@ -543,8 +536,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
stills.set_stream_count(1);
TestableFootage *still_only = probe(QStringLiteral("still.mkv"), stills);
ASSERT_NE(still_only, nullptr);
EXPECT_EQ(still_only->data(olive::Node::icon).value<QIcon>().cacheKey(),
olive::icon::image.cacheKey());
EXPECT_EQ(still_only->data(olive::Node::icon).toString(),
QStringLiteral("image"));
// Audio-only footage
olive::FootageDescription audio(QStringLiteral("fakedecoder"));
@@ -552,8 +545,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
audio.set_stream_count(1);
TestableFootage *audio_only = probe(QStringLiteral("audio.mkv"), audio);
ASSERT_NE(audio_only, nullptr);
EXPECT_EQ(audio_only->data(olive::Node::icon).value<QIcon>().cacheKey(),
olive::icon::audio.cacheKey());
EXPECT_EQ(audio_only->data(olive::Node::icon).toString(),
QStringLiteral("audio"));
// Subtitle-only footage
olive::FootageDescription subs(QStringLiteral("fakedecoder"));
@@ -561,8 +554,8 @@ TEST_F(FootageTest, IconReflectsPrioritizedStreamType)
subs.set_stream_count(1);
TestableFootage *subs_only = probe(QStringLiteral("subs.mkv"), subs);
ASSERT_NE(subs_only, nullptr);
EXPECT_EQ(subs_only->data(olive::Node::icon).value<QIcon>().cacheKey(),
olive::icon::subtitles.cacheKey());
EXPECT_EQ(subs_only->data(olive::Node::icon).toString(),
QStringLiteral("subtitles"));
}
TEST_F(FootageTest, ProxyChangesMarkProjectModifiedAndEmitSignal)
+74 -64
View File
@@ -21,10 +21,12 @@
#include "render/rendermanager.h"
#include "task/task.h"
#include "task/taskmanager.h"
#include "oakengine/task.h"
#include "engineeventbridge.h"
#include "widget/menu/menushared.h"
#include "window/mainwindow/mainstatusbar.h"
#include "window/mainwindow/mainwindow.h"
#include "node/project/serializer/mainwindowlayoutinfo.h"
#include "node/project/serializer/serializedlayoutinfo.h"
using namespace olive;
@@ -47,7 +49,7 @@ protected:
} // namespace
TEST(MainWindowLayoutInfo, AccessorsStoreAndRetrieve)
TEST(SerializedLayoutInfo, AccessorsStoreAndRetrieve)
{
Project project;
project.initialize();
@@ -58,48 +60,49 @@ TEST(MainWindowLayoutInfo, AccessorsStoreAndRetrieve)
auto *viewer = new ViewerOutput();
viewer->setParent(&project);
MainWindowLayoutInfo info;
EXPECT_TRUE(info.open_folders().empty());
EXPECT_TRUE(info.open_sequences().empty());
EXPECT_TRUE(info.open_viewers().empty());
EXPECT_TRUE(info.panel_data().empty());
EXPECT_TRUE(info.state().isEmpty());
SerializedLayoutInfo info;
EXPECT_TRUE(info.open_folders.empty());
EXPECT_TRUE(info.open_sequences.empty());
EXPECT_TRUE(info.open_viewers.empty());
EXPECT_TRUE(info.panel_data.empty());
EXPECT_TRUE(info.state.isEmpty());
info.add_folder(folder);
info.add_sequence(sequence);
info.add_viewer(viewer);
info.open_folders.push_back(folder);
info.open_sequences.push_back(sequence);
info.open_viewers.push_back(viewer);
ASSERT_EQ(info.open_folders().size(), 1);
EXPECT_EQ(info.open_folders().front(), folder);
ASSERT_EQ(info.open_sequences().size(), 1);
EXPECT_EQ(info.open_sequences().front(), sequence);
ASSERT_EQ(info.open_viewers().size(), 1);
EXPECT_EQ(info.open_viewers().front(), viewer);
ASSERT_EQ(info.open_folders.size(), 1);
EXPECT_EQ(info.open_folders.front(), folder);
ASSERT_EQ(info.open_sequences.size(), 1);
EXPECT_EQ(info.open_sequences.front(), sequence);
ASSERT_EQ(info.open_viewers.size(), 1);
EXPECT_EQ(info.open_viewers.front(), viewer);
PanelWidget::Info data;
data[QStringLiteral("key")] = QStringLiteral("value");
info.set_panel_data(QStringLiteral("panel_a"), data);
ASSERT_EQ(info.panel_data().size(), 1);
EXPECT_EQ(info.panel_data()
info.panel_data[QStringLiteral("panel_a")] = data;
ASSERT_EQ(info.panel_data.size(), 1);
EXPECT_EQ(info.panel_data
.at(QStringLiteral("panel_a"))
.at(QStringLiteral("key")),
QStringLiteral("value"));
// move_panel_data renames the entry
info.move_panel_data(QStringLiteral("panel_a"),
QStringLiteral("panel_b"));
EXPECT_EQ(info.panel_data().count(QStringLiteral("panel_a")), 0);
ASSERT_EQ(info.panel_data().count(QStringLiteral("panel_b")), 1);
EXPECT_EQ(info.panel_data()
// renaming the entry moves the data
info.panel_data[QStringLiteral("panel_b")] =
info.panel_data.at(QStringLiteral("panel_a"));
info.panel_data.erase(QStringLiteral("panel_a"));
EXPECT_EQ(info.panel_data.count(QStringLiteral("panel_a")), 0);
ASSERT_EQ(info.panel_data.count(QStringLiteral("panel_b")), 1);
EXPECT_EQ(info.panel_data
.at(QStringLiteral("panel_b"))
.at(QStringLiteral("key")),
QStringLiteral("value"));
info.set_state(QByteArray("layout-state"));
EXPECT_EQ(info.state(), QByteArray("layout-state"));
info.state = QByteArray("layout-state");
EXPECT_EQ(info.state, QByteArray("layout-state"));
}
TEST(MainWindowLayoutInfo, XmlRoundTripPreservesEverything)
TEST(SerializedLayoutInfo, XmlRoundTripPreservesEverything)
{
Project project;
project.initialize();
@@ -110,14 +113,14 @@ TEST(MainWindowLayoutInfo, XmlRoundTripPreservesEverything)
auto *viewer = new ViewerOutput();
viewer->setParent(&project);
MainWindowLayoutInfo info;
info.add_folder(folder);
info.add_sequence(sequence);
info.add_viewer(viewer);
SerializedLayoutInfo info;
info.open_folders.push_back(folder);
info.open_sequences.push_back(sequence);
info.open_viewers.push_back(viewer);
PanelWidget::Info data;
data[QStringLiteral("splitter")] = QStringLiteral("AAA=");
info.set_panel_data(QStringLiteral("TimelinePanel"), data);
info.set_state(QByteArray("binary\x01\x02state", 12));
info.panel_data[QStringLiteral("TimelinePanel")] = data;
info.state = QByteArray("binary\x01\x02state", 12);
QString xml;
QXmlStreamWriter writer(&xml);
@@ -136,32 +139,32 @@ TEST(MainWindowLayoutInfo, XmlRoundTripPreservesEverything)
ASSERT_TRUE(reader.readNextStartElement());
ASSERT_EQ(reader.name(), QStringLiteral("layout"));
MainWindowLayoutInfo loaded = MainWindowLayoutInfo::from_xml(&reader, node_map);
SerializedLayoutInfo loaded = SerializedLayoutInfo::from_xml(&reader, node_map);
ASSERT_EQ(loaded.open_folders().size(), 1);
EXPECT_EQ(loaded.open_folders().front(), folder);
ASSERT_EQ(loaded.open_sequences().size(), 1);
EXPECT_EQ(loaded.open_sequences().front(), sequence);
ASSERT_EQ(loaded.open_folders.size(), 1);
EXPECT_EQ(loaded.open_folders.front(), folder);
ASSERT_EQ(loaded.open_sequences.size(), 1);
EXPECT_EQ(loaded.open_sequences.front(), sequence);
// Open viewers must survive the round trip too
ASSERT_EQ(loaded.open_viewers().size(), 1);
EXPECT_EQ(loaded.open_viewers().front(), viewer);
ASSERT_EQ(loaded.open_viewers.size(), 1);
EXPECT_EQ(loaded.open_viewers.front(), viewer);
EXPECT_EQ(loaded.state(), info.state());
EXPECT_EQ(loaded.state, info.state);
ASSERT_EQ(loaded.panel_data().count(QStringLiteral("TimelinePanel")), 1);
EXPECT_EQ(loaded.panel_data()
ASSERT_EQ(loaded.panel_data.count(QStringLiteral("TimelinePanel")), 1);
EXPECT_EQ(loaded.panel_data
.at(QStringLiteral("TimelinePanel"))
.at(QStringLiteral("splitter")),
QStringLiteral("AAA="));
// No unknown nodes leak into the viewers list: it must contain exactly the
// viewer that was added, not a duplicate of the sequences list
EXPECT_NE(loaded.open_viewers().front(),
EXPECT_NE(loaded.open_viewers.front(),
static_cast<ViewerOutput *>(sequence));
}
TEST(MainWindowLayoutInfo, FromXmlSkipsUnknownElementsAndNodes)
TEST(SerializedLayoutInfo, FromXmlSkipsUnknownElementsAndNodes)
{
const QString xml = QStringLiteral(
"<layout version=\"1\">"
@@ -177,17 +180,17 @@ TEST(MainWindowLayoutInfo, FromXmlSkipsUnknownElementsAndNodes)
ASSERT_TRUE(reader.readNextStartElement());
ASSERT_EQ(reader.name(), QStringLiteral("layout"));
MainWindowLayoutInfo info = MainWindowLayoutInfo::from_xml(&reader, {});
SerializedLayoutInfo info = SerializedLayoutInfo::from_xml(&reader, {});
// Unknown pointers resolve to null but are still listed
ASSERT_EQ(info.open_folders().size(), 1);
EXPECT_EQ(info.open_folders().front(), nullptr);
ASSERT_EQ(info.open_sequences().size(), 1);
EXPECT_EQ(info.open_sequences().front(), nullptr);
ASSERT_EQ(info.open_viewers().size(), 1);
EXPECT_EQ(info.open_viewers().front(), nullptr);
EXPECT_EQ(info.state(), QByteArray("ABC"));
EXPECT_TRUE(info.panel_data().empty());
ASSERT_EQ(info.open_folders.size(), 1);
EXPECT_EQ(info.open_folders.front(), nullptr);
ASSERT_EQ(info.open_sequences.size(), 1);
EXPECT_EQ(info.open_sequences.front(), nullptr);
ASSERT_EQ(info.open_viewers.size(), 1);
EXPECT_EQ(info.open_viewers.front(), nullptr);
EXPECT_EQ(info.state, QByteArray("ABC"));
EXPECT_TRUE(info.panel_data.empty());
}
TEST(MainWindowStatusBar, ConstructionDefaults)
@@ -202,29 +205,36 @@ TEST(MainWindowStatusBar, ConstructionDefaults)
TEST(MainWindowStatusBar, ReflectsTaskManagerState)
{
TaskManager manager;
// The status bar now uses the global TaskManager singleton via the facade.
if (!TaskManager::instance()) {
TaskManager::create_instance();
}
EngineEventBridge bridge;
MainStatusBar bar;
bar.show();
auto *progress = bar.findChild<QProgressBar *>();
ASSERT_NE(progress, nullptr);
bar.connect_task_manager(&manager);
bar.connect_task_manager(&bridge);
auto *task = new DummyTask();
manager.add_task(task);
oakengine_task_manager_add(
reinterpret_cast<OakEngineTask *>(task));
// One running task shows its title and the progress bar
EXPECT_EQ(bar.currentMessage(), QStringLiteral("Status Test Task"));
EXPECT_TRUE(progress->isVisible());
// Progress signals are forwarded to the bar
// Progress signals are forwarded to the bar through the facade event bridge
emit task->progress_changed(0.5);
EXPECT_EQ(progress->value(), 50);
QTRY_COMPARE_WITH_TIMEOUT(progress->value(), 50, 1000);
// When the task list empties, the bar hides and the message clears
manager.cancel_task_and_wait(task);
QTRY_COMPARE_WITH_TIMEOUT(manager.get_task_count(), 0, 2000);
oakengine_task_manager_cancel(
reinterpret_cast<OakEngineTask *>(task));
// Wait for the deferred delete on the task (facade cancel removes it)
QTRY_COMPARE_WITH_TIMEOUT(oakengine_task_manager_count(), 0, 2000);
EXPECT_TRUE(bar.currentMessage().isEmpty());
EXPECT_FALSE(progress->isVisible());
EXPECT_EQ(progress->value(), 0);
@@ -300,7 +310,7 @@ TEST(MainWindow, ConstructsOffscreenWithPanelsAndMenus)
AudioManager::create_instance();
}
if (!Core::instance()) {
new Core(Core::CoreParams()); // intentionally leaked
new Core(); // intentionally leaked
}
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
+5 -4
View File
@@ -17,6 +17,7 @@
#include "node/node.h"
#include "node/project.h"
#include "node/project/folder/folder.h"
#include "oakengine/node.h"
namespace
{
@@ -774,9 +775,9 @@ TEST_F(NodeCoreTest, KeyframeAddAndRemovalEmitSignals)
int added = 0;
int removed = 0;
QObject::connect(node, &olive::Node::keyframe_added,
[&added](olive::NodeKeyframe *) { ++added; });
[&added](OakEngineKeyframe *) { ++added; });
QObject::connect(node, &olive::Node::keyframe_removed,
[&removed](olive::NodeKeyframe *) { ++removed; });
[&removed](OakEngineKeyframe *) { ++removed; });
QVector<olive::TimeRange> changed_ranges;
QObject::connect(node, &olive::Node::value_changed,
[&changed_ranges](const olive::NodeInput &,
@@ -854,9 +855,9 @@ TEST_F(NodeCoreTest, KeyframeTimeChangeResortsTrackAndEmits)
olive::NodeKeyframe *last_changed = nullptr;
QObject::connect(node, &olive::Node::keyframe_time_changed,
[&time_changed,
&last_changed](olive::NodeKeyframe *key) {
&last_changed](OakEngineKeyframe *key) {
++time_changed;
last_changed = key;
last_changed = reinterpret_cast<olive::NodeKeyframe *>(key);
});
// Moving the first keyframe past the second resorts the track
+1 -1
View File
@@ -113,7 +113,7 @@ olive::TexturePtr get_output_texture(const olive::NodeValueTable &table)
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
+1 -1
View File
@@ -147,7 +147,7 @@ protected:
// singleton, which itself touches Core (same pattern as
// project_factory_test)
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
+9 -9
View File
@@ -63,7 +63,7 @@ public:
ColorManager::set_up_default_config();
if (!Core::instance()) {
new Core(Core::CoreParams()); // intentionally leaked
new Core(); // intentionally leaked
}
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
@@ -401,7 +401,7 @@ TEST_F(PanelTest, CurvePanelSetNodes)
// A single node appears as one top-level item listing its keyframable
// inputs (MathNode has three: the base "enabled" input and parameters
// A and B)
panel.set_node(math);
panel.set_node(reinterpret_cast<OakEngineNode *>(math));
ASSERT_EQ(tree->topLevelItemCount(), 1);
EXPECT_EQ(tree->topLevelItem(0)->text(0), math->name());
EXPECT_EQ(tree->topLevelItem(0)->childCount(), 3);
@@ -447,12 +447,12 @@ TEST_F(PanelTest, ParamPanelForwardsViewSignals)
ParamPanel panel;
QSignalSpy focused_spy(&panel, &ParamPanel::focused_node_changed);
emit panel.get_param_view()->focused_node_changed(math);
emit panel.get_param_view()->focused_node_changed(reinterpret_cast<OakEngineNode *>(math));
ASSERT_EQ(focused_spy.count(), 1);
EXPECT_EQ(focused_spy.first().first().value<Node *>(), math);
EXPECT_EQ(focused_spy.first().first().value<OakEngineNode *>(), reinterpret_cast<OakEngineNode *>(math));
QSignalSpy selected_spy(&panel, &ParamPanel::selected_nodes_changed);
emit panel.get_param_view()->selected_nodes_changed({ { math, nullptr } });
emit panel.get_param_view()->selected_nodes_changed({ { reinterpret_cast<OakEngineNode *>(math), nullptr } });
EXPECT_EQ(selected_spy.count(), 1);
QSignalSpy text_spy(&panel, &ParamPanel::request_viewer_to_start_editing_text);
@@ -620,7 +620,7 @@ TEST_F(PanelTest, FootageViewerPanelConstruction)
panel.connect_viewer_node(viewer);
ASSERT_EQ(panel.get_selected_footage().size(), 1);
EXPECT_EQ(panel.get_selected_footage().first(), viewer);
EXPECT_EQ(panel.get_selected_footage().first(), reinterpret_cast<OakEngineNode *>(viewer));
panel.disconnect_viewer_node();
EXPECT_TRUE(panel.get_selected_footage().isEmpty());
@@ -656,15 +656,15 @@ TEST_F(PanelTest, NodePanelForwardsViewSignals)
panel.set_contexts({ project.root() });
QSignalSpy selected_spy(&panel, &NodePanel::nodes_selected);
emit panel.get_node_widget()->view()->nodes_selected({ math });
emit panel.get_node_widget()->view()->nodes_selected({ reinterpret_cast<OakEngineNode *>(math) });
ASSERT_EQ(selected_spy.count(), 1);
QSignalSpy deselected_spy(&panel, &NodePanel::nodes_deselected);
emit panel.get_node_widget()->view()->nodes_deselected({ math });
emit panel.get_node_widget()->view()->nodes_deselected({ reinterpret_cast<OakEngineNode *>(math) });
EXPECT_EQ(deselected_spy.count(), 1);
QSignalSpy selection_spy(&panel, &NodePanel::node_selection_changed);
emit panel.get_node_widget()->view()->node_selection_changed({ math });
emit panel.get_node_widget()->view()->node_selection_changed({ reinterpret_cast<OakEngineNode *>(math) });
EXPECT_EQ(selection_spy.count(), 1);
}
+1 -1
View File
@@ -54,7 +54,7 @@ void collect_leaf_actions(QMenu *menu, QList<QAction *> *leaves)
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
+1 -1
View File
@@ -71,7 +71,7 @@ protected:
// Leaked intentionally: Core is process-wide and DiskCacheFolder
// eviction calls Core::instance()->WarnCacheFull() (matches
// viewer_display_repro_test).
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
olive::DiskManager::create_instance();
+1 -1
View File
@@ -41,7 +41,7 @@
#include "node/globals.h"
#include "node/project.h"
#include "render/job/acceleratedjob.h"
#include "render/managedcolor.h"
#include "widget/manageddisplay/colorprocessorhandle.h"
#include "render/renderjobtracker.h"
#include "render/rendermanager.h"
#include "render/renderprocessor.h"
+1 -1
View File
@@ -75,7 +75,7 @@ protected:
if (!olive::Core::instance()) {
// Leaked intentionally: Core is process-wide (matches
// render_diskcache_test)
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
olive::DiskManager::create_instance();
+2 -2
View File
@@ -466,7 +466,7 @@ protected:
if (!olive::Core::instance()) {
// Leaked intentionally: matches render_diskcache_test, Core is
// process-wide and eviction paths call Core::WarnCacheFull().
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
olive::DiskManager::create_instance();
@@ -658,7 +658,7 @@ protected:
}
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
olive::DiskManager::create_instance();
+1 -1
View File
@@ -90,7 +90,7 @@ protected:
{
if (!olive::Core::instance()) {
// Leaked intentionally: Core is process-wide (matches footage_probe_test)
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
olive::ColorManager::set_up_default_config();
+16 -13
View File
@@ -40,7 +40,7 @@ protected:
{
if (!olive::Core::instance()) {
// Leaked intentionally: Core is process-wide (matches footage_probe_test)
new olive::Core(olive::Core::CoreParams());
new olive::Core();
}
created_disk_manager_ = (olive::DiskManager::instance() == nullptr);
@@ -109,9 +109,10 @@ TEST_F(TaskProjectImportTest, ImportOfUnprobeableFileCollectsInvalidList)
EXPECT_DOUBLE_EQ(last_progress, 1.0);
// The undo command exists but contains no children since nothing was added
ASSERT_NE(task.get_command(), nullptr);
EXPECT_EQ(task.get_command()->child_count(), 0);
delete task.get_command();
olive::MultiUndoCommand *cmd = task.take_command();
ASSERT_NE(cmd, nullptr);
EXPECT_EQ(cmd->child_count(), 0);
delete cmd;
}
TEST_F(TaskProjectImportTest, ImportOfImageFileAddsFootageThroughUndoCommand)
@@ -135,18 +136,19 @@ TEST_F(TaskProjectImportTest, ImportOfImageFileAddsFootageThroughUndoCommand)
// Nothing is in the folder until the command is redone
EXPECT_TRUE(project_->root()->children().isEmpty());
ASSERT_NE(task.get_command(), nullptr);
task.get_command()->redo_now();
olive::MultiUndoCommand *cmd = task.take_command();
ASSERT_NE(cmd, nullptr);
cmd->redo_now();
ASSERT_EQ(project_->root()->children().size(), 1);
EXPECT_EQ(project_->root()->children().first(),
static_cast<olive::Node *>(footage));
EXPECT_TRUE(project_->nodes().contains(footage));
task.get_command()->undo_now();
cmd->undo_now();
EXPECT_TRUE(project_->root()->children().isEmpty());
delete task.get_command();
delete cmd;
}
TEST_F(TaskProjectImportTest, ImportOfDirectoryCreatesFolderHierarchy)
@@ -171,8 +173,9 @@ TEST_F(TaskProjectImportTest, ImportOfDirectoryCreatesFolderHierarchy)
EXPECT_FALSE(task.has_invalid_files());
EXPECT_EQ(task.get_imported_footage().size(), 2);
ASSERT_NE(task.get_command(), nullptr);
task.get_command()->redo_now();
olive::MultiUndoCommand *cmd = task.take_command();
ASSERT_NE(cmd, nullptr);
cmd->redo_now();
// Importing a directory creates a folder named after it under the target
const QVector<olive::Node *> &root_children = project_->root()->children();
@@ -191,10 +194,10 @@ TEST_F(TaskProjectImportTest, ImportOfDirectoryCreatesFolderHierarchy)
ASSERT_EQ(sub_folders.size(), 1);
EXPECT_EQ(sub_folders.first()->get_label(), QStringLiteral("sub"));
task.get_command()->undo_now();
cmd->undo_now();
EXPECT_TRUE(project_->root()->children().isEmpty());
delete task.get_command();
delete cmd;
}
TEST_F(TaskProjectImportTest, CancelledBeforeRunReturnsFalseAndDropsCommand)
@@ -206,7 +209,7 @@ TEST_F(TaskProjectImportTest, CancelledBeforeRunReturnsFalseAndDropsCommand)
task.Cancel();
EXPECT_FALSE(task.start());
EXPECT_EQ(task.get_command(), nullptr);
EXPECT_EQ(task.take_command(), nullptr);
EXPECT_TRUE(task.get_imported_footage().isEmpty());
EXPECT_FALSE(task.has_invalid_files());
EXPECT_TRUE(project_->root()->children().isEmpty());
+1 -1
View File
@@ -152,7 +152,7 @@ protected:
}
if (!Core::instance()) {
new Core(Core::CoreParams());
new Core();
}
AudioManager::create_instance();
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
+6 -5
View File
@@ -35,6 +35,7 @@
#include "widget/filefield/filefield.h"
#include "widget/focusablelineedit/focusablelineedit.h"
#include "widget/handmovableview/handmovableview.h"
#include "widget/manageddisplay/colorprocessorhandle.h"
#include "widget/menu/menu.h"
#include "widget/nodevaluetree/nodevaluetree.h"
#include "widget/path/pathwidget.h"
@@ -52,7 +53,7 @@ namespace
void ensure_core()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
}
@@ -641,7 +642,7 @@ TEST(WidgetColorButton, SetColorRoundTrips)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ColorButton btn(project.color_manager());
olive::ColorButton btn(oak_color_manager(project.color_manager()));
EXPECT_FLOAT_EQ(btn.get_color().red(), 1.0f);
EXPECT_FLOAT_EQ(btn.get_color().green(), 1.0f);
EXPECT_FLOAT_EQ(btn.get_color().blue(), 1.0f);
@@ -716,7 +717,7 @@ TEST(WidgetColorSwatchChooser, ClickingSwatchEmitsItsColor)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ColorSwatchChooser chooser(project.color_manager());
olive::ColorSwatchChooser chooser(oak_color_manager(project.color_manager()));
const auto buttons = chooser.findChildren<olive::ColorButton *>();
EXPECT_EQ(buttons.size(), 32);
@@ -746,7 +747,7 @@ TEST(WidgetColorSpaceChooser, InputRoundTripsAndEmits)
ASSERT_GE(spaces.size(), 2);
// Input-only mode, as used by the export dialog
olive::ColorSpaceChooser chooser(project.color_manager(), true, false);
olive::ColorSpaceChooser chooser(oak_color_manager(project.color_manager()), true, false);
EXPECT_FALSE(chooser.input().isEmpty());
QSignalSpy spy(&chooser,
@@ -773,7 +774,7 @@ TEST(WidgetColorSpaceChooser, FullModePopulatesDisplayFields)
olive::ColorManager::set_up_default_config();
olive::Project project;
olive::ColorSpaceChooser chooser(project.color_manager());
olive::ColorSpaceChooser chooser(oak_color_manager(project.color_manager()));
EXPECT_FALSE(chooser.input().isEmpty());
EXPECT_FALSE(chooser.output().display().isEmpty());
EXPECT_FALSE(chooser.output().view().isEmpty());
+9 -9
View File
@@ -45,7 +45,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
@@ -253,8 +253,8 @@ TEST_F(WidgetPanelsTest, NodeTreeCheckboxesToggleEnableStateAndEmit)
int node_emissions = 0;
QObject::connect(&view, &NodeTreeView::node_enable_changed,
[&node_signal_node, &node_signal_enabled,
&node_emissions](Node *n, bool e) {
node_signal_node = n;
&node_emissions](OakEngineNode *n, bool e) {
node_signal_node = reinterpret_cast<Node *>(n);
node_signal_enabled = e;
++node_emissions;
});
@@ -431,7 +431,7 @@ TEST(TaskView, TaskLifecycleUpdatesItems)
TaskView view(nullptr);
DummyTask task;
view.add_task(&task);
view.add_task(reinterpret_cast<OakEngineTask*>(&task));
auto *item = view.findChild<TaskViewItem *>();
ASSERT_NE(item, nullptr);
@@ -453,16 +453,16 @@ TEST(TaskView, TaskLifecycleUpdatesItems)
EXPECT_EQ(bar->value(), 50);
// The cancel button relays the task through TaskCancelled
Task *cancelled = nullptr;
OakEngineTask *cancelled = nullptr;
QObject::connect(&view, &TaskView::task_cancelled,
[&cancelled](Task *t) { cancelled = t; });
[&cancelled](OakEngineTask *t) { cancelled = t; });
auto *cancel_button = item->findChild<QPushButton *>();
ASSERT_NE(cancel_button, nullptr);
cancel_button->click();
EXPECT_EQ(cancelled, &task);
EXPECT_EQ(cancelled, reinterpret_cast<OakEngineTask*>(&task));
// Failure swaps in the error label
view.task_failed(&task);
view.task_failed(reinterpret_cast<OakEngineTask*>(&task));
bool found_error = false;
foreach (QLabel *label, item->findChildren<QLabel *>()) {
if (label->text().contains(QStringLiteral("boom"))) {
@@ -473,7 +473,7 @@ TEST(TaskView, TaskLifecycleUpdatesItems)
EXPECT_TRUE(found_error);
// Removal deletes the item once deferred deletions are processed
view.remove_task(&task);
view.remove_task(reinterpret_cast<OakEngineTask*>(&task));
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
EXPECT_EQ(view.findChild<TaskViewItem *>(), nullptr);
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();
@@ -26,7 +26,7 @@ namespace
void ensure_app_singletons()
{
if (!olive::Core::instance()) {
new olive::Core(olive::Core::CoreParams()); // intentionally leaked
new olive::Core(); // intentionally leaked
}
if (!olive::DiskManager::instance()) {
olive::DiskManager::create_instance();