Adapt to enable testing and add more tests
Some checks are pending
debian-build / build (push) Waiting to run
Push to master / Check Formatting 🔍 (push) Waiting to run
Push to master / Build Project 🧱 (push) Waiting to run
Push to master / Create Release 🛫 (push) Blocked by required conditions

This commit is contained in:
WarmUpTill
2026-03-10 21:34:03 +01:00
committed by WarmUpTill
parent be8744f0d0
commit 7a0e08b0d8
20 changed files with 1346 additions and 799 deletions

View File

@@ -8,9 +8,6 @@ namespace advss {
class Macro;
class MacroSegment;
/*******************************************************************************
* Advanced Scene Switcher window
*******************************************************************************/
class MacroEdit : public QWidget {
Q_OBJECT

View File

@@ -51,6 +51,7 @@ void MacroSelection::HideSelectedMacro()
return;
}
#ifndef UNIT_TEST
const auto m = ssWindow->ui->macros->GetCurrentMacro();
if (!m) {
return;
@@ -61,6 +62,7 @@ void MacroSelection::HideSelectedMacro()
}
qobject_cast<QListView *>(view())->setRowHidden(idx, true);
#endif // !UNIT_TEST
}
void MacroSelection::HideGroups()

View File

@@ -1141,9 +1141,11 @@ void Macro::ClearHotkeys() const
void setHotkeyDescriptionHelper(const char *formatModuleText,
const std::string name, const obs_hotkey_id id)
{
#ifndef UNIT_TEST
QString format{obs_module_text(formatModuleText)};
QString hotkeyDesc = format.arg(QString::fromStdString(name));
obs_hotkey_set_description(id, hotkeyDesc.toStdString().c_str());
#endif // !UNIT_TEST
}
void Macro::SetHotkeysDesc() const

View File

@@ -1,12 +1,5 @@
#pragma once
#ifdef UNIT_TEST
#define EXPORT
#define ADVSS_EXPORT
#else
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
@@ -19,5 +12,3 @@
#else
#define ADVSS_EXPORT Q_DECL_IMPORT
#endif
#endif // UNIT_TEST

View File

@@ -1,7 +1,5 @@
#pragma once
#ifndef UNIT_TEST
#include <util/base.h>
#endif
namespace advss {
@@ -9,6 +7,7 @@ namespace advss {
#define blog(level, msg, ...)
#define vblog(level, msg, ...)
#define ablog(level, msg, ...)
#define mblog(level, msg, ...)
#else
// Print log with "[adv-ss] " prefix

View File

@@ -37,8 +37,8 @@ void CenterSplitterPosition(QSplitter *splitter)
void SetSplitterPositionByFraction(QSplitter *splitter, double fraction)
{
int value1 = (double)QWIDGETSIZE_MAX * fraction;
int value2 = (double)QWIDGETSIZE_MAX * (1.0 - fraction);
int value1 = (int)((double)QWIDGETSIZE_MAX * fraction);
int value2 = (int)((double)QWIDGETSIZE_MAX * (1.0 - fraction));
splitter->setSizes(QList<int>() << value1 << value2);
}

View File

@@ -2,8 +2,22 @@
namespace advss {
#ifdef UNIT_TEST
std::mutex *GetSwitcherMutex()
{
static std::mutex m;
return &m;
}
std::unique_lock<std::mutex> *GetSwitcherLoopLock()
{
static std::mutex m;
static std::unique_lock<std::mutex> lock(m);
return &lock;
}
#else
std::mutex *GetSwitcherMutex();
std::unique_lock<std::mutex> *GetSwitcherLoopLock();
#endif
std::mutex *GetMutex()
{

View File

@@ -2,7 +2,6 @@
#include "export-symbol-helper.hpp"
#include <functional>
#include <memory>
#include <mutex>
namespace advss {

View File

@@ -81,13 +81,13 @@ void GenericVariableSpinbox::DisableVariableSelection()
void GenericVariableSpinbox::setMinimum(double value)
{
_fixedValueInt->setMinimum(value);
_fixedValueInt->setMinimum((int)value);
_fixedValueDouble->setMinimum(value);
}
void GenericVariableSpinbox::setMaximum(double value)
{
_fixedValueInt->setMaximum(value);
_fixedValueInt->setMaximum((int)value);
_fixedValueDouble->setMaximum(value);
}