fix: fixed log and tests issue

This commit is contained in:
QxQ 2020-10-13 18:04:14 +08:00
parent 264110fefd
commit 94d701ce91
5 changed files with 33 additions and 5 deletions

View File

@ -1 +1 @@
5997 6000

View File

@ -13,7 +13,7 @@
#endif #endif
#define NEWLINE "\r\n" #define NEWLINE "\r\n"
#define ___LOG_EXPAND(___x) , QPair(#___x, [&] { return ___x; }()) #define ___LOG_EXPAND(___x) , QPair(std::string(#___x), [&] { return ___x; }())
#define A(...) FOREACH_CALL_FUNC(___LOG_EXPAND, __VA_ARGS__) #define A(...) FOREACH_CALL_FUNC(___LOG_EXPAND, __VA_ARGS__)
#ifdef QT_DEBUG #ifdef QT_DEBUG

View File

@ -177,7 +177,11 @@ namespace Qv2ray::base::config
{ {
config_version = QV2RAY_CONFIG_VERSION; config_version = QV2RAY_CONFIG_VERSION;
} }
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
Q_DISABLE_COPY(Qv2rayConfigObject);
#else
Q_DISABLE_COPY_MOVE(Qv2rayConfigObject); Q_DISABLE_COPY_MOVE(Qv2rayConfigObject);
#endif
JSONSTRUCT_REGISTER_NOCOPYMOVE(Qv2rayConfigObject, // JSONSTRUCT_REGISTER_NOCOPYMOVE(Qv2rayConfigObject, //
F(config_version, autoStartId, lastConnectedId, autoStartBehavior, logLevel), // F(config_version, autoStartId, lastConnectedId, autoStartBehavior, logLevel), //
F(uiConfig, advancedConfig, pluginConfig, updateConfig, kernelConfig, networkConfig), // F(uiConfig, advancedConfig, pluginConfig, updateConfig, kernelConfig, networkConfig), //

View File

@ -21,8 +21,6 @@ namespace Qv2ray::base
/// Exit existing Qv2ray instance /// Exit existing Qv2ray instance
bool exitQv2ray; bool exitQv2ray;
///
}; };
} // namespace Qv2ray::base } // namespace Qv2ray::base

View File

@ -3,9 +3,35 @@
#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN
#include "catch.hpp" #include "catch.hpp"
int fakeArgc = 0;
char *fakeArgv[]{};
class QvTestApplication
: public QCoreApplication
, public Qv2rayApplicationManager
{
public:
explicit QvTestApplication() : QCoreApplication(fakeArgc, fakeArgv), Qv2rayApplicationManager(){};
virtual Qv2raySetupStatus Initialize() override
{
return {};
};
virtual Qv2rayExitCode RunQv2ray() override
{
return {};
};
virtual void MessageBoxWarn(QWidget *, const QString &, const QString &, MessageOpt) override{};
virtual void MessageBoxInfo(QWidget *, const QString &, const QString &, MessageOpt) override{};
virtual MessageOpt MessageBoxAsk(QWidget *, const QString &, const QString &, const QList<MessageOpt> &) override
{
return {};
};
virtual void OpenURL(const QString &) override{};
};
SCENARIO("Test RealPing get proxy address", "[RealPing]") SCENARIO("Test RealPing get proxy address", "[RealPing]")
{ {
QvTestApplication app;
GIVEN("A realping object") GIVEN("A realping object")
{ {
auto loop = uvw::Loop::create(); auto loop = uvw::Loop::create();