Skip to content

Commit

Permalink
feat(pressure): Make pressure monitor message more brief (#424)
Browse files Browse the repository at this point in the history
* feat(pressure): Make pressure monitor message more brief

This allows users to more quickly identify the important numbers.

Resolve #423

* Fix tests
  • Loading branch information
AndyTWF committed Feb 10, 2022
1 parent ed2b5e5 commit 058be53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/plugin/metar/PressureChangeMessage.cpp
Expand Up @@ -21,8 +21,8 @@ namespace UKControllerPlugin::Metar {

auto PressureChangeMessage::MessageString() const -> std::string
{
return "Pressure change at " + airfield + ". QNH was " + this->QnhBefore() + ", now " + this->QnhAfter() +
". QFE was " + this->QfeBefore() + ", now " + this->QfeAfter() + ".";
return airfield + " QNH(QFE) now " + this->QnhAfter() + "(" + this->QfeAfter() + "), was " + this->QnhBefore() +
"(" + this->QfeBefore() + ").";
}

auto PressureChangeMessage::MessageShowHandler() const -> bool
Expand Down
8 changes: 2 additions & 6 deletions test/plugin/metar/PressureChangeMessageTest.cpp
Expand Up @@ -66,15 +66,11 @@ namespace UKControllerPluginTest::Metar {

TEST_F(PressureChangeMessageTest, ItHasAMessageHectopascals)
{
EXPECT_EQ(
"Pressure change at EGKK. QNH was 1013, now 1014. QFE was 1011, now 1012.",
messageHectopascals.MessageString());
EXPECT_EQ("EGKK QNH(QFE) now 1014(1012), was 1013(1011).", messageHectopascals.MessageString());
}

TEST_F(PressureChangeMessageTest, ItHasAMessageInHg)
{
EXPECT_EQ(
"Pressure change at EGLL. QNH was 29.92, now 29.94. QFE was 29.84, now 29.86.",
messageInhg.MessageString());
EXPECT_EQ("EGLL QNH(QFE) now 29.94(29.86), was 29.92(29.84).", messageInhg.MessageString());
}
} // namespace UKControllerPluginTest::Metar
4 changes: 1 addition & 3 deletions test/plugin/metar/PressureMonitorTest.cpp
Expand Up @@ -108,9 +108,7 @@ namespace UKControllerPluginTest::Metar {
TEST_F(PressureMonitorTest, ItSendsUpdateMessageOnNewQnh)
{
EXPECT_CALL(
this->mockPlugin,
ChatAreaMessage(
_, _, "Pressure change at EGKK. QNH was 1011, now 1012. QFE was 1012, now 1013.", _, _, _, _, _))
this->mockPlugin, ChatAreaMessage(_, _, "EGKK QNH(QFE) now 1012(1013), was 1011(1012).", _, _, _, _, _))
.Times(1);

this->monitor.SetNotficationsEnabled(true);
Expand Down

0 comments on commit 058be53

Please sign in to comment.