mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
refactor: Move FSD Test server information to test case
This commit is contained in:
@@ -245,8 +245,7 @@ namespace BlackCore::Data
|
|||||||
CServerList CGlobalSetup::getPredefinedServersPlusHardcodedServers() const
|
CServerList CGlobalSetup::getPredefinedServersPlusHardcodedServers() const
|
||||||
{
|
{
|
||||||
static const CServerList hardcoded(
|
static const CServerList hardcoded(
|
||||||
{ CServer::swiftFsdTestServer(),
|
{ CServer::fscFsdServer(),
|
||||||
CServer::fscFsdServer(),
|
|
||||||
CServer::esTowerView() });
|
CServer::esTowerView() });
|
||||||
CServerList testServers(m_predefinedServers);
|
CServerList testServers(m_predefinedServers);
|
||||||
testServers.addIfAddressNotExists(hardcoded);
|
testServers.addIfAddressNotExists(hardcoded);
|
||||||
|
|||||||
@@ -54,19 +54,6 @@ namespace BlackMisc::Network
|
|||||||
return QStringLiteral("%1 %2 %3:%4 %5 %6 accepting: %7 FSD: %8 con.since: %9").arg(m_name, m_description, m_address).arg(m_port).arg(m_user.toQString(i18n), m_ecosystem.getSystemString(), boolToYesNo(m_isAcceptingConnections), m_fsdSetup.toQString(i18n), this->isConnected() ? this->getFormattedUtcTimestampHms() : "not con.");
|
return QStringLiteral("%1 %2 %3:%4 %5 %6 accepting: %7 FSD: %8 con.since: %9").arg(m_name, m_description, m_address).arg(m_port).arg(m_user.toQString(i18n), m_ecosystem.getSystemString(), boolToYesNo(m_isAcceptingConnections), m_fsdSetup.toQString(i18n), this->isConnected() ? this->getFormattedUtcTimestampHms() : "not con.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const CServer &CServer::swiftFsdTestServer(bool withPw)
|
|
||||||
{
|
|
||||||
// CUser("guest", "Guest Client project", "", "guest")
|
|
||||||
// PW!!!!! => use CObfuscation::endocde to get the strings
|
|
||||||
static const CServer dvp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
|
||||||
CUser("OBF:AwJ6BweZqpmtmORL", "OBF:AwI/594lQTJGZnmSwB0=", "", "OBF:AwKi3JkHNAczBno="),
|
|
||||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
|
||||||
static const CServer dvnWithPw("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
|
||||||
CUser("OBF:AwJ6BweZqpmtmORL", "OBF:AwI/594lQTJGZnmSwB0=", "", ""),
|
|
||||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
|
||||||
return withPw ? dvp : dvnWithPw;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CServer &CServer::fscFsdServer()
|
const CServer &CServer::fscFsdServer()
|
||||||
{
|
{
|
||||||
static const CServer fsc = [] {
|
static const CServer fsc = [] {
|
||||||
|
|||||||
@@ -208,9 +208,6 @@ namespace BlackMisc::Network
|
|||||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! swift FSD test server
|
|
||||||
static const CServer &swiftFsdTestServer(bool withPw = false);
|
|
||||||
|
|
||||||
//! FSC server
|
//! FSC server
|
||||||
static const CServer &fscFsdServer();
|
static const CServer &fscFsdServer();
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackMisc::Network::Settings
|
|||||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||||
static const BlackMisc::Network::CServer &defaultValue()
|
static const BlackMisc::Network::CServer &defaultValue()
|
||||||
{
|
{
|
||||||
static const CServer dv = CServer::swiftFsdTestServer();
|
static const CServer dv;
|
||||||
return dv;
|
return dv;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
@@ -101,6 +102,8 @@ namespace BlackFsdTest
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CFSDClient *m_client = nullptr;
|
CFSDClient *m_client = nullptr;
|
||||||
|
|
||||||
|
const CServer &localTestServer();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CTestFSDClient::initTestCase()
|
void CTestFSDClient::initTestCase()
|
||||||
@@ -108,9 +111,17 @@ namespace BlackFsdTest
|
|||||||
BlackMisc::registerMetadata();
|
BlackMisc::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CServer &CTestFSDClient::localTestServer()
|
||||||
|
{
|
||||||
|
static const CServer dvp("Testserver", "Client project testserver", "localhost", 6809,
|
||||||
|
CUser("1234567", "Test User", "", "123456"),
|
||||||
|
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
|
return dvp;
|
||||||
|
}
|
||||||
|
|
||||||
void CTestFSDClient::init()
|
void CTestFSDClient::init()
|
||||||
{
|
{
|
||||||
const CServer server = CServer::swiftFsdTestServer(true);
|
const CServer server = localTestServer();
|
||||||
|
|
||||||
COwnAircraftProviderDummy::instance()->updateOwnCallsign("ABCD");
|
COwnAircraftProviderDummy::instance()->updateOwnCallsign("ABCD");
|
||||||
CLivery livery;
|
CLivery livery;
|
||||||
@@ -841,7 +852,7 @@ namespace BlackFsdTest
|
|||||||
|
|
||||||
// void CTestFSDClient::testConnection()
|
// void CTestFSDClient::testConnection()
|
||||||
// {
|
// {
|
||||||
// const CServer fsdServer = CServer::swiftFsdTestServer(true);
|
// const CServer fsdServer = localTestServer();
|
||||||
// if (!pingServer(fsdServer)) { QSKIP("Server not reachable."); }
|
// if (!pingServer(fsdServer)) { QSKIP("Server not reachable."); }
|
||||||
//
|
//
|
||||||
// QSignalSpy spy(m_client, &CFSDClient::connectionStatusChanged);
|
// QSignalSpy spy(m_client, &CFSDClient::connectionStatusChanged);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
@@ -308,7 +309,9 @@ namespace BlackMiscTest
|
|||||||
const CUser user2(user1);
|
const CUser user2(user1);
|
||||||
QVERIFY2(user1 == user2, "information shall be equal");
|
QVERIFY2(user1 == user2, "information shall be equal");
|
||||||
|
|
||||||
const CServer server1 = CServer::swiftFsdTestServer();
|
const CServer server1 = CServer("Testserver", "Client project testserver", "localhost", 6809,
|
||||||
|
CUser("111111", "My Name", "", "123"),
|
||||||
|
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
const CServer server2(server1);
|
const CServer server2(server1);
|
||||||
QVERIFY2(server1 == server2, "server shall be equal");
|
QVERIFY2(server1 == server2, "server shall be equal");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user