mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#2310 Add isProjectFileVersionEqualOrOlderThan to RimProject and use from summary plot
This commit is contained in:
parent
dbc1061a59
commit
96a900fe0f
@ -21,6 +21,7 @@
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaProjectFileVersionTools.h"
|
||||
#include "RiaVersionInfo.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -412,6 +413,15 @@ QString RimProject::projectFileVersionString() const
|
||||
return m_projectFileVersionString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimProject::isProjectFileVersionEqualOrOlderThan(const QString& otherProjectFileVersion) const
|
||||
{
|
||||
QString candidateProjectFileVersion = projectFileVersionString();
|
||||
|
||||
return RiaProjectFileVersionTools::isCandidateVersionNewerThanOther(candidateProjectFileVersion, otherProjectFileVersion);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
|
||||
void setScriptDirectories(const QString& scriptDirectories);
|
||||
QString projectFileVersionString() const;
|
||||
bool isProjectFileVersionEqualOrOlderThan(const QString& otherProjectFileVersion) const;
|
||||
void close();
|
||||
|
||||
void setProjectFileNameAndUpdateDependencies(const QString& fileName);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "RimAsciiDataCurve.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@ -1327,6 +1328,16 @@ void RimSummaryPlot::initAfterRead()
|
||||
{
|
||||
m_summaryCurveCollection->addCurve(curve);
|
||||
}
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj)
|
||||
{
|
||||
if (proj->isProjectFileVersionEqualOrOlderThan("2017.0.0"))
|
||||
{
|
||||
m_useAutoPlotTitle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1,66 +1,9 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RiaProjectFileVersionTools.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RiaProjectFileVersionTools, BasicUsage)
|
||||
{
|
||||
/*
|
||||
{
|
||||
QString projectFileVersionString = "2017.05.1";
|
||||
|
||||
int majorVersion = 2017;
|
||||
int minorVersion = 5;
|
||||
int patchNumber = 0;
|
||||
int developmentId = 0;
|
||||
|
||||
bool isNewer = RiaProjectFileVersionTools::isProjectFileVersionNewerThan(projectFileVersionString, majorVersion,
|
||||
minorVersion, patchNumber, developmentId);
|
||||
EXPECT_TRUE(isNewer);
|
||||
}
|
||||
|
||||
{
|
||||
QString projectFileVersionString = "2017.05.1.text.13";
|
||||
|
||||
{
|
||||
int majorVersion = 2017;
|
||||
int minorVersion = 5;
|
||||
int patchNumber = 1;
|
||||
int developmentId = 14;
|
||||
|
||||
bool isNewer = RiaProjectFileVersionTools::isProjectFileVersionNewerThan(projectFileVersionString, majorVersion,
|
||||
minorVersion, patchNumber,
|
||||
developmentId); EXPECT_FALSE(isNewer);
|
||||
}
|
||||
|
||||
{
|
||||
int majorVersion = 2017;
|
||||
int minorVersion = 5;
|
||||
int patchNumber = 1;
|
||||
int developmentId = 13;
|
||||
|
||||
bool isNewer = RiaProjectFileVersionTools::isProjectFileVersionNewerThan(projectFileVersionString, majorVersion,
|
||||
minorVersion, patchNumber,
|
||||
developmentId); EXPECT_TRUE(isNewer);
|
||||
}
|
||||
|
||||
{
|
||||
int majorVersion = 2017;
|
||||
int minorVersion = 5;
|
||||
int patchNumber = 1;
|
||||
int developmentId = 12;
|
||||
|
||||
bool isNewer = RiaProjectFileVersionTools::isProjectFileVersionNewerThan(projectFileVersionString, majorVersion,
|
||||
minorVersion, patchNumber,
|
||||
developmentId); EXPECT_TRUE(isNewer);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
TEST(RiaProjectFileVersionTools, DecodeProjectVersionString)
|
||||
{
|
||||
{
|
||||
@ -202,8 +145,7 @@ TEST(RiaProjectFileVersionTools, OrderKnownVersionStrings)
|
||||
|
||||
QStringList sortedVersionList = versionStrings;
|
||||
{
|
||||
qSort(sortedVersionList.begin(), sortedVersionList.end(),
|
||||
RiaProjectFileVersionTools::isCandidateVersionNewerThanOther);
|
||||
qSort(sortedVersionList.begin(), sortedVersionList.end(), RiaProjectFileVersionTools::isCandidateVersionNewerThanOther);
|
||||
}
|
||||
|
||||
for (const auto& s : sortedVersionList)
|
||||
|
Loading…
Reference in New Issue
Block a user