proxy: add dedicated Proxy dialog and preferences fields
- New ProxyDialog (Tools > Proxy Settings..., plus 'Proxy Settings...' in the project panel and timeline Proxy submenus) unifying global proxy settings, per-footage custom presets, generation and deletion in one place instead of three scattered entry points; this also fixes the Tools menu action opening the wrong preferences tab - Preferences Disk tab gains an 'include audio in proxies' checkbox and an ffmpeg executable path field (blank = auto-detect) - Add ProxyDialog smoke tests
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "dialog/proxy/proxydialog.h"
|
||||
#include "node/project/footage/footage.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
QVariant ProxyDialogConfigValue(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.ProxyWidth(),
|
||||
ProxyDialogConfigValue("ProxyWidth").value<int>());
|
||||
EXPECT_EQ(dialog.ProxyHeight(),
|
||||
ProxyDialogConfigValue("ProxyHeight").value<int>());
|
||||
EXPECT_EQ(dialog.ProxyCRF(),
|
||||
ProxyDialogConfigValue("ProxyCRF").value<int>());
|
||||
EXPECT_EQ(dialog.ProxyPreset(),
|
||||
ProxyDialogConfigValue("ProxyPreset").toString());
|
||||
EXPECT_EQ(dialog.ProxyIncludeAudio(),
|
||||
ProxyDialogConfigValue("ProxyIncludeAudio").toBool());
|
||||
EXPECT_EQ(dialog.FFmpegPath(),
|
||||
ProxyDialogConfigValue("FFmpegPath").toString());
|
||||
}
|
||||
|
||||
TEST(ProxyDialog, ConstructsWithFootageList)
|
||||
{
|
||||
olive::Footage footage;
|
||||
const QVector<olive::Footage *> items = { &footage };
|
||||
|
||||
olive::ProxyDialog dialog(nullptr, items);
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
TEST(ProxyDialog, AcceptSavesGlobalSettingsToConfig)
|
||||
{
|
||||
const int old_width = ProxyDialogConfigValue("ProxyWidth").value<int>();
|
||||
const bool old_include_audio =
|
||||
ProxyDialogConfigValue("ProxyIncludeAudio").toBool();
|
||||
const QString old_ffmpeg_path =
|
||||
ProxyDialogConfigValue("FFmpegPath").toString();
|
||||
|
||||
{
|
||||
olive::ProxyDialog dialog(nullptr);
|
||||
dialog.SetProxyWidth(640);
|
||||
dialog.SetProxyIncludeAudio(!old_include_audio);
|
||||
dialog.SetFFmpegPath(QStringLiteral("/tmp/oak-test-ffmpeg"));
|
||||
dialog.accept();
|
||||
}
|
||||
|
||||
EXPECT_EQ(ProxyDialogConfigValue("ProxyWidth").value<int>(), 640);
|
||||
EXPECT_EQ(ProxyDialogConfigValue("ProxyIncludeAudio").toBool(),
|
||||
!old_include_audio);
|
||||
EXPECT_EQ(ProxyDialogConfigValue("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;
|
||||
}
|
||||
Reference in New Issue
Block a user