mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #787, fixed unit test
* flag update for non cached scenarios was missing * some minor adjustments of test readers
This commit is contained in:
@@ -201,6 +201,7 @@ namespace BlackCore
|
||||
static QStringList arguments();
|
||||
|
||||
//! Process all events for some time
|
||||
//! \remark unlike QCoreApplication::processEvents this will spend at least the given time in the function, using QThread::msleep
|
||||
static void processEventsFor(int milliseconds);
|
||||
|
||||
//! Clear the caches
|
||||
|
||||
@@ -103,14 +103,28 @@ namespace BlackCore
|
||||
cachedEntities |= currentEntity; // read from cache
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// cache ignored
|
||||
if (rm.testFlag(CDbFlags::DbReading))
|
||||
{
|
||||
dbEntities |= currentEntity;
|
||||
}
|
||||
}
|
||||
currentEntity = CEntityFlags::iterateDbEntities(allEntities);
|
||||
}
|
||||
|
||||
// signals for the cached entities
|
||||
this->emitReadSignalPerSingleCachedEntity(cachedEntities, true);
|
||||
if (cachedEntities != CEntityFlags::NoEntity)
|
||||
{
|
||||
this->emitReadSignalPerSingleCachedEntity(cachedEntities, true);
|
||||
}
|
||||
|
||||
// Real read from DB
|
||||
this->startReadFromBackendInBackgroundThread(dbEntities, CDbFlags::DbReading, newerThan);
|
||||
if (dbEntities != CEntityFlags::NoEntity)
|
||||
{
|
||||
this->startReadFromBackendInBackgroundThread(dbEntities, CDbFlags::DbReading, newerThan);
|
||||
}
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CDatabaseReader::triggerLoadingDirectlyFromDb(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
||||
|
||||
@@ -69,8 +69,7 @@ namespace BlackCoreTest
|
||||
// I have to run my "own event loop"
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
CApplication::processEventsFor(500);
|
||||
QTest::qWait(10); // process events completes if there are no events. So I need to make sure we wait properly for a response
|
||||
CApplication::processEventsFor(500); // process events and sleep
|
||||
if (this->m_icaoReader->getAircraftIcaoCodesCount() > 0 && this->m_icaoReader->getAirlineIcaoCodesCount() > 0)
|
||||
{
|
||||
break;
|
||||
@@ -101,11 +100,7 @@ namespace BlackCoreTest
|
||||
for (int i = 0; i < 120; i++)
|
||||
{
|
||||
CApplication::processEventsFor(500);
|
||||
QTest::qWait(10); // process events completes if there are no events. So I need to make sure we wait properly for a response
|
||||
if (this->m_modelReader->getModelsCount() > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (this->m_modelReader->getModelsCount() > 0) { break; }
|
||||
}
|
||||
|
||||
const QString m1("No models " + url.getFullUrl());
|
||||
@@ -131,8 +126,7 @@ namespace BlackCoreTest
|
||||
for (int i = 0; i < 120; ++i)
|
||||
{
|
||||
CApplication::processEventsFor(500);
|
||||
QTest::qWait(10); // process events completes if there are no events. So I need to make sure we wait properly for a response
|
||||
if (this->m_airportReader->getAirports().size() > 0) break;
|
||||
if (this->m_airportReader->getAirports().size() > 0) { break; }
|
||||
}
|
||||
|
||||
QVERIFY2(this->m_airportReader->getAirports().size() > 0, "No airports");
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace BlackCoreTest
|
||||
void readAirportData();
|
||||
|
||||
private:
|
||||
BlackCore::Db::CAirportDataReader *m_airportReader = nullptr;
|
||||
BlackCore::Db::CIcaoDataReader *m_icaoReader = nullptr;
|
||||
BlackCore::Db::CModelDataReader *m_modelReader = nullptr;
|
||||
BlackCore::Db::CAirportDataReader *m_airportReader = nullptr;
|
||||
BlackCore::Db::CIcaoDataReader *m_icaoReader = nullptr;
|
||||
BlackCore::Db::CModelDataReader *m_modelReader = nullptr;
|
||||
|
||||
//! Test if server is available
|
||||
static bool pingServer(const BlackMisc::Network::CUrl &url);
|
||||
|
||||
Reference in New Issue
Block a user