mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 00:05:41 -05:00
Adapt to enable testing and add more tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace advss {
|
||||
|
||||
Reference in New Issue
Block a user