mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 07:05:38 +08:00
Issue #22 Error when FL doesn't end in 0 or 5 should be warning
This commit is contained in:
@@ -342,8 +342,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
if (!CMathUtils::epsilonZero(fmod(flInt, 5)))
|
if (!CMathUtils::epsilonZero(fmod(flInt, 5)))
|
||||||
{
|
{
|
||||||
if (msgs) { msgs->push_back(CStatusMessage(this).validationError(u"FL needs to end with 0 or 5")); }
|
if (msgs) { msgs->push_back(CStatusMessage(this).validationWarning(u"FL should end with 0 or 5")); }
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ namespace BlackMiscTest
|
|||||||
CAltitude a;
|
CAltitude a;
|
||||||
a.parseFromFpAltitudeString("FL125");
|
a.parseFromFpAltitudeString("FL125");
|
||||||
QVERIFY2(a == CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL125");
|
QVERIFY2(a == CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL125");
|
||||||
|
a.parseFromFpAltitudeString("FL126");
|
||||||
|
QVERIFY2(a == CAltitude(12600, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL126");
|
||||||
a.parseFromFpAltitudeString("A122");
|
a.parseFromFpAltitudeString("A122");
|
||||||
QVERIFY2(a == CAltitude(12200, CAltitude::MeanSeaLevel, CLengthUnit::ft()), "Wrong altitude A122");
|
QVERIFY2(a == CAltitude(12200, CAltitude::MeanSeaLevel, CLengthUnit::ft()), "Wrong altitude A122");
|
||||||
a.parseFromFpAltitudeString("123ft");
|
a.parseFromFpAltitudeString("123ft");
|
||||||
@@ -87,8 +89,6 @@ namespace BlackMiscTest
|
|||||||
CAltitude faulty(a);
|
CAltitude faulty(a);
|
||||||
faulty.makeNegative();
|
faulty.makeNegative();
|
||||||
QVERIFY2(!faulty.isValidFpAltitude(), "Negative values not allowed");
|
QVERIFY2(!faulty.isValidFpAltitude(), "Negative values not allowed");
|
||||||
faulty.parseFromFpAltitudeString("FL111");
|
|
||||||
QVERIFY2(!faulty.isValidFpAltitude(), "FL should end with 0/5");
|
|
||||||
|
|
||||||
// as string
|
// as string
|
||||||
a = CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft());
|
a = CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft());
|
||||||
|
|||||||
Reference in New Issue
Block a user