From 767abfa514f12dd0277df985ced72386d9ddff84 2017-12-19 14:05:08 From: Alexandre Leroux Date: 2017-12-19 14:05:08 Subject: [PATCH] Some fixes - Improves log display - Fixes problem of range not set in UTC - Fixes problem for range of VariableState not correctly set at variable creation --- diff --git a/core/include/Data/SqpRange.h b/core/include/Data/SqpRange.h index 9fb5cc3..d51fc0f 100644 --- a/core/include/Data/SqpRange.h +++ b/core/include/Data/SqpRange.h @@ -18,8 +18,8 @@ struct SqpRange { static SqpRange fromDateTime(const QDate &startDate, const QTime &startTime, const QDate &endDate, const QTime &endTime) { - return {DateUtils::secondsSinceEpoch(QDateTime{startDate, startTime}), - DateUtils::secondsSinceEpoch(QDateTime{endDate, endTime})}; + return {DateUtils::secondsSinceEpoch(QDateTime{startDate, startTime, Qt::UTC}), + DateUtils::secondsSinceEpoch(QDateTime{endDate, endTime, Qt::UTC})}; } /// Start time (UTC) diff --git a/plugins/amda/tests/FuzzingDefs.cpp b/plugins/amda/tests/FuzzingDefs.cpp index 71f6c4d..6f75773 100644 --- a/plugins/amda/tests/FuzzingDefs.cpp +++ b/plugins/amda/tests/FuzzingDefs.cpp @@ -3,6 +3,7 @@ const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component"); const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables"); const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations"); +const QString INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange"); const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange"); const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); const QString PROVIDER_PROPERTY = QStringLiteral("provider"); diff --git a/plugins/amda/tests/FuzzingDefs.h b/plugins/amda/tests/FuzzingDefs.h index 4a68cbd..0a3208f 100644 --- a/plugins/amda/tests/FuzzingDefs.h +++ b/plugins/amda/tests/FuzzingDefs.h @@ -30,6 +30,10 @@ extern const QString NB_MAX_VARIABLES_PROPERTY; /// Set of operations available for the test extern const QString AVAILABLE_OPERATIONS_PROPERTY; + +/// Range with which the timecontroller is initialized +extern const QString INITIAL_RANGE_PROPERTY; + /// Max range that an operation can reach extern const QString MAX_RANGE_PROPERTY; diff --git a/plugins/amda/tests/FuzzingOperations.cpp b/plugins/amda/tests/FuzzingOperations.cpp index 6991c0f..6d0a6b6 100644 --- a/plugins/amda/tests/FuzzingOperations.cpp +++ b/plugins/amda/tests/FuzzingOperations.cpp @@ -34,11 +34,14 @@ struct CreateOperation : public IFuzzingOperation { = properties.value(PROVIDER_PROPERTY).value >(); auto variableName = QString{"Var_%1"}.arg(QUuid::createUuid().toString()); - qCInfo(LOG_FuzzingOperations()) + qCInfo(LOG_FuzzingOperations()).noquote() << "Creating variable" << variableName << "(metadata:" << variableMetadata << ")"; auto newVariable = variableController.createVariable(variableName, variableMetadata, variableProvider); + + // Updates variable's state + variableState.m_Range = properties.value(INITIAL_RANGE_PROPERTY).value(); std::swap(variableState.m_Variable, newVariable); } }; @@ -105,7 +108,7 @@ struct MoveOperation : public IFuzzingOperation { // Moves variable to its new range auto newVariableRange = SqpRange{m_RangeStartMoveFun(variableRange.m_TStart, delta), m_RangeEndMoveFun(variableRange.m_TEnd, delta)}; - qCInfo(LOG_FuzzingOperations()) + qCInfo(LOG_FuzzingOperations()).noquote() << "Performing" << m_Label << "on" << variable->name() << "(from" << variableRange << "to" << newVariableRange << ")..."; variableController.onRequestDataLoading({variable}, newVariableRange, false); diff --git a/plugins/amda/tests/TestAmdaFuzzing.cpp b/plugins/amda/tests/TestAmdaFuzzing.cpp index 6ff7cc6..ac4776f 100644 --- a/plugins/amda/tests/TestAmdaFuzzing.cpp +++ b/plugins/amda/tests/TestAmdaFuzzing.cpp @@ -113,8 +113,8 @@ public: void execute() { - qCInfo(LOG_TestAmdaFuzzing()) << "Running" << nbMaxOperations() << "operations on" - << nbMaxVariables() << "variable(s)..."; + qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Running" << nbMaxOperations() << "operations on" + << nbMaxVariables() << "variable(s)..."; auto canExecute = true; for (auto i = 0; i < nbMaxOperations() && canExecute; ++i) { @@ -139,12 +139,12 @@ public: } else { - qCInfo(LOG_TestAmdaFuzzing()) + qCInfo(LOG_TestAmdaFuzzing()).noquote() << "No more operations are available, the execution of the test will stop..."; } } - qCInfo(LOG_TestAmdaFuzzing()) << "Execution of the test completed."; + qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Execution of the test completed."; } private: @@ -242,8 +242,9 @@ void TestAmdaFuzzing::testFuzzing() // Sets initial range on time controller SqpRange initialRange{initialRangeStart, initialRangeEnd}; - qCInfo(LOG_TestAmdaFuzzing()) << "Setting initial range to" << initialRange << "..."; + qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Setting initial range to" << initialRange << "..."; timeController.onTimeToUpdate(initialRange); + properties.insert(INITIAL_RANGE_PROPERTY, QVariant::fromValue(initialRange)); FuzzingTest test{variableController, properties}; test.execute();